rev:手持功能代码优化
This commit is contained in:
@@ -57,6 +57,6 @@ public interface DeviceExtraMapper extends CommonMapper<DeviceExtra> {
|
||||
* @param extra_code
|
||||
* @return
|
||||
*/
|
||||
@Select("select * from lzhl_two_acs.acs_device_extra where device_id=#{device_id} and extra_code=#{extra_code} order by create_time desc")
|
||||
@Select("select * from acs_device_extra where device_id=#{device_id} and extra_code=#{extra_code} order by create_time desc")
|
||||
DeviceExtra findByDeviceId(@Param("device_id") String device_id, @Param("extra_code") String extra_code);
|
||||
}
|
||||
|
||||
@@ -88,6 +88,11 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
|
||||
public int lastMove = 0;
|
||||
public int lastAction = 0;
|
||||
public int lastError = 0;
|
||||
int to_command = 0;
|
||||
int last_to_command = 0;
|
||||
|
||||
int to_error = 0;
|
||||
int last_to_error = 0;
|
||||
|
||||
Boolean isonline = true;
|
||||
|
||||
@@ -117,6 +122,8 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
|
||||
action = this.itemProtocol.getItem_action();
|
||||
error = this.itemProtocol.getItem_error();
|
||||
iserror = this.itemProtocol.isError;
|
||||
to_command = this.itemProtocol.getItem_to_command();
|
||||
to_error = this.itemProtocol.getItem_error();
|
||||
|
||||
if (mode != lastMode) {
|
||||
requireSucess = false;
|
||||
@@ -134,7 +141,7 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
|
||||
} else if (error != 0) {
|
||||
this.setIserror(true);
|
||||
message = "universal_message3";
|
||||
}else {
|
||||
} else {
|
||||
this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
message = "";
|
||||
@@ -175,11 +182,12 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
|
||||
}
|
||||
|
||||
|
||||
|
||||
lastMode = mode;
|
||||
lastMove = move;
|
||||
lastAction = action;
|
||||
lastError = error;
|
||||
last_to_error = to_error;
|
||||
last_to_command = to_command;
|
||||
|
||||
}
|
||||
|
||||
@@ -203,20 +211,20 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
|
||||
if (ObjectUtil.isEmpty(response)) {
|
||||
message = "two_message18";
|
||||
} else {
|
||||
if (response.getCode()== CommonFinalParam.STATUS_OPEN) {
|
||||
if (mode==4){
|
||||
this.writing("to_command","4");
|
||||
}else if (mode==5){
|
||||
this.writing("to_command","5");
|
||||
}else if (mode==9){
|
||||
this.writing("to_command","9");
|
||||
if (response.getCode() == CommonFinalParam.STATUS_OPEN) {
|
||||
if (mode == 4) {
|
||||
this.writing("to_command", "4");
|
||||
} else if (mode == 5) {
|
||||
this.writing("to_command", "5");
|
||||
} else if (mode == 9) {
|
||||
this.writing("to_command", "9");
|
||||
}
|
||||
message = "two_message19";
|
||||
requireSucess = true;
|
||||
} else {
|
||||
requireSucess = false;
|
||||
message = "two_message20" + response.getMessage();
|
||||
this.writing("to_command","99");
|
||||
this.writing("to_command", "99");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,8 +232,6 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void writing(String param, String value) {
|
||||
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
@@ -277,14 +283,12 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
|
||||
requireSucess = "1";
|
||||
}
|
||||
jo.put("requireSucess", requireSucess);
|
||||
if (this.getAction() == 1) {
|
||||
action = "取货中";
|
||||
if (this.getAction() == 0) {
|
||||
action = "不允许取放";
|
||||
} else if (this.getAction() == 1) {
|
||||
action = "允许取放";
|
||||
} else if (this.getAction() == 2) {
|
||||
action = "取货完成";
|
||||
} else if (this.getAction() == 3) {
|
||||
action = "放货中";
|
||||
} else if (this.getAction() == 4) {
|
||||
action = "放货完成";
|
||||
action = "允许离开";
|
||||
}
|
||||
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
|
||||
@@ -20,6 +20,7 @@ public class ItemProtocol {
|
||||
|
||||
|
||||
public static String item_to_command = "to_command";
|
||||
public static String item_to_error = "to_error";
|
||||
|
||||
|
||||
private GreenFoilMachineButtonDriver driver;
|
||||
@@ -42,6 +43,9 @@ public class ItemProtocol {
|
||||
};
|
||||
public int getItem_error(){
|
||||
return this.getOpcIntegerValue(item_error);
|
||||
}
|
||||
public int getItem_to_command(){
|
||||
return this.getOpcIntegerValue(item_to_error);
|
||||
} ;
|
||||
|
||||
Boolean isonline;
|
||||
@@ -89,6 +93,7 @@ public class ItemProtocol {
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "下发命令", "DB6.W0"));
|
||||
list.add(new ItemDto(item_to_error, "下发故障代码", "DB6.W1"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,9 @@ public class TaskScreenServiceImpl extends CommonServiceImpl<TaskScreenMapper, D
|
||||
DeviceDto deviceDto = deviceService.findByCode(deviceCode);
|
||||
String deviceId = deviceDto.getDevice_id();
|
||||
DeviceExtra deviceExtra = deviceExtraMapper.findByDeviceId(deviceId, "link_device_code");
|
||||
if (ObjectUtil.isEmpty(deviceExtra)){
|
||||
throw new BadRequestException("未配置关联设备!");
|
||||
}
|
||||
String extraValue = deviceExtra.getExtra_value();
|
||||
List<String> extraDeviceCodes = getExtraDeviceCodes(extraValue);
|
||||
if (CollUtil.isEmpty(extraDeviceCodes) || extraDeviceCodes.size() < 0) {
|
||||
|
||||
@@ -54,19 +54,13 @@ public class B2HandServiceImpl implements B2HandService {
|
||||
String task_type = dto.getTask_type();
|
||||
|
||||
if (StrUtil.isEmpty(start_device_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", "起点1不能为空");
|
||||
errArr.add(json);
|
||||
throw new BadRequestException("起点1不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(next_device_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", "终点1不能为空");
|
||||
errArr.add(json);
|
||||
throw new BadRequestException("终点1不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(task_type)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", "任务类型不能为空");
|
||||
errArr.add(json);
|
||||
throw new BadRequestException("任务类型不能为空");
|
||||
}
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
@@ -85,11 +79,8 @@ public class B2HandServiceImpl implements B2HandService {
|
||||
jo.put("next_device_code", next_device_code);
|
||||
jo.put("start_point_code", start_device_code);
|
||||
jo.put("next_point_code", next_device_code);
|
||||
jo.put("start_device_code2", start_device_code2);
|
||||
jo.put("next_device_code2", next_device_code2);
|
||||
jo.put("start_point_code2", start_device_code2);
|
||||
jo.put("next_point_code2", next_device_code2);
|
||||
jo.put("task_type", task_type);
|
||||
jo.put("route_plan_code","normal");
|
||||
jo.put("agv_system_type", "2");
|
||||
jo.put("priority", "1");
|
||||
|
||||
@@ -101,6 +92,7 @@ public class B2HandServiceImpl implements B2HandService {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", e.getMessage());
|
||||
errArr.add(json);
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
JSONArray data = new JSONArray();
|
||||
JSONObject resultJson = new JSONObject();
|
||||
@@ -119,7 +111,7 @@ public class B2HandServiceImpl implements B2HandService {
|
||||
JSONArray data = new JSONArray();
|
||||
//查询所有生箔区的设备
|
||||
List<Device> list = deviceService.lambdaQuery()
|
||||
.eq(Device::getRegion, "2")
|
||||
.eq(Device::getRegion, "1")
|
||||
.list();
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
throw new BadRequestException("未查到该区域的设备!");
|
||||
@@ -158,15 +150,12 @@ public class B2HandServiceImpl implements B2HandService {
|
||||
String device_code = dto.getDevice_code();
|
||||
String option = dto.getOption();
|
||||
if (StrUtil.isEmpty(device_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", "设备号不能为空");
|
||||
errArr.add(json);
|
||||
throw new BadRequestException("设备号不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(option)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", "操作不能为空");
|
||||
errArr.add(json);
|
||||
throw new BadRequestException("操作不能为空");
|
||||
}
|
||||
//满轴位允许进入,空轴位允许离开
|
||||
if (device_code.contains("M")&&(!"1".equals(option))){
|
||||
throw new BadRequestException("该设备为满轴位,不能进行该操作");
|
||||
}
|
||||
@@ -175,6 +164,11 @@ public class B2HandServiceImpl implements B2HandService {
|
||||
}
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)){
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", "设备不存在!");
|
||||
errArr.add(json);
|
||||
}
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option));
|
||||
JSONArray data = new JSONArray();
|
||||
|
||||
@@ -115,19 +115,13 @@ public class HandServiceImpl implements HandService {
|
||||
String task_type = dto.getTask_type();
|
||||
|
||||
if (StrUtil.isEmpty(start_device_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", "起点不能为空");
|
||||
errArr.add(json);
|
||||
throw new BadRequestException("起点不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(next_device_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", "终点不能为空");
|
||||
errArr.add(json);
|
||||
throw new BadRequestException("终点不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(task_type)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("message", "任务类型不能为空");
|
||||
errArr.add(json);
|
||||
throw new BadRequestException("任务类型不能为空");
|
||||
}
|
||||
|
||||
String start_device_code2 = "";
|
||||
|
||||
@@ -153,7 +153,7 @@ export default {
|
||||
const timer = setInterval(() => {
|
||||
this.settime()// 你所加载数据的方法
|
||||
this.getMessage()
|
||||
}, 10000)
|
||||
}, 1000)
|
||||
// 销毁定时器
|
||||
this.$once('hook:beforeDestroy', () => {
|
||||
clearInterval(timer)
|
||||
@@ -175,14 +175,6 @@ export default {
|
||||
methods: {
|
||||
changeDevice(val) {
|
||||
this.device = val
|
||||
deviceCrud.getLedMessage(this.device).then(data => {
|
||||
this.form = data
|
||||
})
|
||||
// todo: 定时器
|
||||
this.timer = setInterval(() => { // 定时刷新设备的状态信息
|
||||
console.log('定时器启动')
|
||||
this.initStatus()
|
||||
}, 10000)
|
||||
},
|
||||
getMessage() {
|
||||
deviceCrud.getLedMessage(this.device).then(data => {
|
||||
|
||||
Reference in New Issue
Block a user