opt: 异常日志,流量限制,创建任务优化

This commit is contained in:
yanps
2024-02-28 16:35:50 +08:00
parent c010166c28
commit ae3b25f35a
13 changed files with 154 additions and 96 deletions

View File

@@ -71,7 +71,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
@Autowired @Autowired
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
@Autowired @Autowired
private LimitRegionalService limitRegionalService=SpringContextHolder.getBean(LimitRegionalService.class); private LimitRegionalService limitRegionalService = SpringContextHolder.getBean(LimitRegionalService.class);
@Autowired @Autowired
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
@@ -177,51 +177,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
y_position = this.itemProtocol.getY_position(); y_position = this.itemProtocol.getY_position();
iserror = this.itemProtocol.device_status; iserror = this.itemProtocol.device_status;
if (to_onset != last_to_onset) { if(mode != last_mode){
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_onset" + last_to_onset + "->" + to_onset);
}
if (to_command != last_to_command) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command" + last_to_command + "->" + to_command);
}
if (to_target != last_to_target) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_target" + last_to_target + "->" + to_target);
}
if (to_task != last_to_task) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task" + last_to_task + "->" + to_task);
}
if (mode != last_mode) {
requireSucess = false; requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
if (move != last_move) {
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
}
if (action != last_action) {
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + "->" + action);
}
if (error != last_error) {
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
}
if (walk_y != last_walk_y) {
logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(walk_y));
logServer.deviceExecuteLog(this.device_code, "", "", "信号walk_y" + last_walk_y + "->" + walk_y);
}
if (task != last_task) {
logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + "->" + task);
}
if (x_position != last_x_position) {
logServer.deviceItemValue(this.device_code, "x_position", String.valueOf(x_position));
logServer.deviceExecuteLog(this.device_code, "", "", "信号x_position" + last_x_position + "->" + x_position);
}
if (y_position != last_y_position) {
logServer.deviceItemValue(this.device_code, "y_position", String.valueOf(y_position));
logServer.deviceExecuteLog(this.device_code, "", "", "信号y_position" + last_y_position + "->" + y_position);
} }
update_instruction_status(); update_instruction_status();
} catch (Exception var17) { } catch (Exception var17) {
@@ -356,32 +316,32 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver; OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver;
if(startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ if (startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) startdevice.getDeviceDriver(); ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) startdevice.getDeviceDriver();
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
if(ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1){ if (ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->烘箱检测站点-普通检测站点:" + ovenInspectSiteDeviceDriver.getDevicecode() + notCreateInstMessage = "手动创建指令未下发电气信号原因->烘箱检测站点-普通检测站点:" + ovenInspectSiteDeviceDriver.getDevicecode() +
"无货,无法下发指令或"+standardInspectSiteDeviceDriver.getDevicecode()+ "有货,无法下发指令!" +"!指令号:" + instruction.getInstruction_code(); "无货,无法下发指令或" + standardInspectSiteDeviceDriver.getDevicecode() + "有货,无法下发指令!" + "!指令号:" + instruction.getInstruction_code();
return false; return false;
} }
//判断经过的烘箱是否关门 //判断经过的烘箱是否关门
boolean hongxiangCloseDoor = this.hongxiangCloseDoor(start_device_code, next_device_code); boolean hongxiangCloseDoor = this.hongxiangCloseDoor(start_device_code, next_device_code);
if(!hongxiangCloseDoor){ if (!hongxiangCloseDoor) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + start_device_code + ",放货位:" + next_device_code + ",存在关联的同一列烘箱设备未关门!指令号:" + instruction.getInstruction_code(); notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + start_device_code + ",放货位:" + next_device_code + ",存在关联的同一列烘箱设备未关门!指令号:" + instruction.getInstruction_code();
return false; return false;
} }
} }
if(nextdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ if (nextdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver(); standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if(ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1){ if (ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->烘箱检测站点-普通检测站点:" + ovenInspectSiteDeviceDriver.getDevicecode() + notCreateInstMessage = "手动创建指令未下发电气信号原因->烘箱检测站点-普通检测站点:" + ovenInspectSiteDeviceDriver.getDevicecode() +
"无货,无法下发指令或"+standardInspectSiteDeviceDriver.getDevicecode()+ "有货,无法下发指令!" +"!指令号:" + instruction.getInstruction_code(); "无货,无法下发指令或" + standardInspectSiteDeviceDriver.getDevicecode() + "有货,无法下发指令!" + "!指令号:" + instruction.getInstruction_code();
return false; return false;
} }
//判断经过的烘箱是否关门 //判断经过的烘箱是否关门
boolean hongxiangCloseDoor = this.hongxiangCloseDoor( next_device_code, start_device_code); boolean hongxiangCloseDoor = this.hongxiangCloseDoor(next_device_code, start_device_code);
if(!hongxiangCloseDoor){ if (!hongxiangCloseDoor) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + start_device_code + ",放货位:" + next_device_code + ",存在关联的同一列烘箱设备未关门!指令号:" + instruction.getInstruction_code(); notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + start_device_code + ",放货位:" + next_device_code + ",存在关联的同一列烘箱设备未关门!指令号:" + instruction.getInstruction_code();
return false; return false;
} }
@@ -435,9 +395,14 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} }
String start_addr = startDevice.getExtraValue().get("address").toString(); String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString(); String next_addr = nextDevice.getExtraValue().get("address").toString();
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:" String msg = "当前设备:" + device_code + ",下发指令:"
+ instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code() + instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code()
+ ",指令终点:" + instruction.getNext_device_code()); + ",指令终点:" + instruction.getNext_device_code();
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(msg)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
List list = new ArrayList<>(); List list = new ArrayList<>();
Map map = new HashMap(); Map map = new HashMap();
map.put("to_onset", start_addr); map.put("to_onset", start_addr);
@@ -482,32 +447,32 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver; OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver;
if(startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ if (startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) startdevice.getDeviceDriver(); ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) startdevice.getDeviceDriver();
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
if(ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1){ if (ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->烘箱检测站点-普通检测站点:" + ovenInspectSiteDeviceDriver.getDevicecode() + notCreateInstMessage = "手动创建指令未下发电气信号原因->烘箱检测站点-普通检测站点:" + ovenInspectSiteDeviceDriver.getDevicecode() +
"无货,无法下发指令或"+standardInspectSiteDeviceDriver.getDevicecode()+ "有货,无法下发指令!" +"!任务号:" + task.getTask_code(); "无货,无法下发指令或" + standardInspectSiteDeviceDriver.getDevicecode() + "有货,无法下发指令!" + "!任务号:" + task.getTask_code();
return false; return false;
} }
//判断经过的烘箱是否关门 //判断经过的烘箱是否关门
boolean hongxiangCloseDoor = this.hongxiangCloseDoor(task.getStart_device_code(), task.getNext_device_code()); boolean hongxiangCloseDoor = this.hongxiangCloseDoor(task.getStart_device_code(), task.getNext_device_code());
if(!hongxiangCloseDoor){ if (!hongxiangCloseDoor) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + task.getStart_device_code() + ",放货位:" + task.getNext_device_code() + ",存在关联的同一列烘箱设备未关门!任务号:" + task.getTask_code(); notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + task.getStart_device_code() + ",放货位:" + task.getNext_device_code() + ",存在关联的同一列烘箱设备未关门!任务号:" + task.getTask_code();
return false; return false;
} }
} }
if(nextdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ if (nextdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver(); standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if(ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1){ if (ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->烘箱检测站点-普通检测站点:" + ovenInspectSiteDeviceDriver.getDevicecode() + notCreateInstMessage = "手动创建指令未下发电气信号原因->烘箱检测站点-普通检测站点:" + ovenInspectSiteDeviceDriver.getDevicecode() +
"无货,无法下发指令或"+standardInspectSiteDeviceDriver.getDevicecode()+ "有货,无法下发指令!" +"!任务号:" + task.getTask_code(); "无货,无法下发指令或" + standardInspectSiteDeviceDriver.getDevicecode() + "有货,无法下发指令!" + "!任务号:" + task.getTask_code();
return false; return false;
} }
//判断经过的烘箱是否关门 //判断经过的烘箱是否关门
boolean hongxiangCloseDoor = this.hongxiangCloseDoor(task.getStart_device_code(), task.getNext_device_code()); boolean hongxiangCloseDoor = this.hongxiangCloseDoor(task.getStart_device_code(), task.getNext_device_code());
if(!hongxiangCloseDoor){ if (!hongxiangCloseDoor) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + task.getStart_device_code() + ",放货位:" + task.getNext_device_code() + ",存在关联的同一列烘箱设备未关门!任务号:" + task.getTask_code(); notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + task.getStart_device_code() + ",放货位:" + task.getNext_device_code() + ",存在关联的同一列烘箱设备未关门!任务号:" + task.getTask_code();
return false; return false;
} }
@@ -616,6 +581,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} }
String start_addr = startDevice.getExtraValue().get("address").toString(); String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString(); String next_addr = nextDevice.getExtraValue().get("address").toString();
if(ObjectUtil.isEmpty(start_addr) || ObjectUtil.isEmpty(next_addr)){
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "或设备:" + nextDevice.getDevice_code() + "地址值!");
}
String msg = "当前设备:" + device_code + ",下发指令:" String msg = "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code() + instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code(); + ",指令终点:" + instdto.getNext_device_code();
@@ -627,16 +595,16 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
List list = new ArrayList<>(); List list = new ArrayList<>();
Map map = new HashMap(); Map map = new HashMap();
map.put("code", "to_onset"); map.put("code", "to_onset");
map.put("value",StrUtil.isNotBlank(start_addr)? start_addr : "0"); map.put("value", StrUtil.isNotBlank(start_addr) ? start_addr : "0");
Map map1 = new HashMap(); Map map1 = new HashMap();
map1.put("code", "to_target"); map1.put("code", "to_target");
map1.put("value",StrUtil.isNotBlank(next_addr)? next_addr : "0"); map1.put("value", StrUtil.isNotBlank(next_addr) ? next_addr : "0");
Map map2 = new HashMap(); Map map2 = new HashMap();
map2.put("code", "to_task"); map2.put("code", "to_task");
map2.put("value",instdto.getInstruction_code()); map2.put("value", instdto.getInstruction_code());
Map map3 = new HashMap(); Map map3 = new HashMap();
map3.put("code", "to_command"); map3.put("code", "to_command");
map3.put("value","1"); map3.put("value", "1");
list.add(map); list.add(map);
list.add(map1); list.add(map1);
list.add(map2); list.add(map2);
@@ -667,7 +635,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
/** /**
* 判断经过的烘箱是否关门 * 判断经过的烘箱是否关门
*/ */
private boolean hongxiangCloseDoor(String start_device_code,String next_device_code) { private boolean hongxiangCloseDoor(String start_device_code, String next_device_code) {
boolean flag = true; boolean flag = true;
List<String> ovenDeviceCodeList = null; List<String> ovenDeviceCodeList = null;
Device startDevice = deviceAppService.findDeviceByCode(start_device_code); Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
@@ -682,14 +650,14 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
ovenDeviceCodeList = ovenInspectSiteDeviceDriver.getExtraDeviceCodes("link_device_code"); ovenDeviceCodeList = ovenInspectSiteDeviceDriver.getExtraDeviceCodes("link_device_code");
} }
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
if(CollUtil.isNotEmpty(ovenDeviceCodeList)){ if (CollUtil.isNotEmpty(ovenDeviceCodeList)) {
for (String s : ovenDeviceCodeList) { for (String s : ovenDeviceCodeList) {
Device device = deviceAppService.findDeviceByCode(s); Device device = deviceAppService.findDeviceByCode(s);
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver(); hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
//判断关联设备是否开门 //判断关联设备是否开门
if (hongXiangConveyorDeviceDriver.getDoor() == 1) { if (hongXiangConveyorDeviceDriver.getDoor() == 1) {
notCreateInstMessage = "关联设备->" + device + "烘箱门未关闭!"; notCreateInstMessage = "关联设备->" + device + "烘箱门未关闭!";
flag = false; flag = false;
break; break;
} }
@@ -701,6 +669,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
/** /**
* 判断取货位或放货位为烘箱设备时关联的同一列烘箱设备是否有开门 * 判断取货位或放货位为烘箱设备时关联的同一列烘箱设备是否有开门
*
* @param start_device_code * @param start_device_code
* @param next_device_code * @param next_device_code
* @return * @return
@@ -1087,7 +1056,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} else if (this.getAction() == 4) { } else if (this.getAction() == 4) {
action = "放货完成"; action = "放货完成";
} }
if(error == 0 && iserror){ if (error == 0 && iserror) {
this.setMessage(LangProcess.msg("universal_message4")); this.setMessage(LangProcess.msg("universal_message4"));
} }
jo.put("device_name", this.getDevice().getDevice_name()); jo.put("device_name", this.getDevice().getDevice_name());
@@ -1195,4 +1164,51 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
return null; return null;
} }
/*if (to_onset != last_to_onset) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_onset" + last_to_onset + "->" + to_onset);
}
if (to_command != last_to_command) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command" + last_to_command + "->" + to_command);
}
if (to_target != last_to_target) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_target" + last_to_target + "->" + to_target);
}
if (to_task != last_to_task) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task" + last_to_task + "->" + to_task);
}
if (mode != last_mode) {
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
if (move != last_move) {
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
}
if (action != last_action) {
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + "->" + action);
}
if (error != last_error) {
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
}
if (walk_y != last_walk_y) {
logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(walk_y));
logServer.deviceExecuteLog(this.device_code, "", "", "信号walk_y" + last_walk_y + "->" + walk_y);
}
if (task != last_task) {
logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + "->" + task);
}
if (x_position != last_x_position) {
logServer.deviceItemValue(this.device_code, "x_position", String.valueOf(x_position));
logServer.deviceExecuteLog(this.device_code, "", "", "信号x_position" + last_x_position + "->" + x_position);
}
if (y_position != last_y_position) {
logServer.deviceItemValue(this.device_code, "y_position", String.valueOf(y_position));
logServer.deviceExecuteLog(this.device_code, "", "", "信号y_position" + last_y_position + "->" + y_position);
}*/
} }

View File

@@ -540,6 +540,9 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
} }
if(this.itemProtocol.getIsError() && error == 0){ if(this.itemProtocol.getIsError() && error == 0){
this.setMessage(LangProcess.msg("universal_message4")); this.setMessage(LangProcess.msg("universal_message4"));
iserror = true;
}else if(error == 0) {
iserror = false;
} }
jo.put("device_name", this.getDevice().getDevice_name()); jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode); jo.put("mode", mode);

View File

@@ -159,6 +159,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
task = this.itemProtocol.getTask(); task = this.itemProtocol.getTask();
x_position = this.itemProtocol.getX_position(); x_position = this.itemProtocol.getX_position();
y_position = this.itemProtocol.getY_position(); y_position = this.itemProtocol.getY_position();
heartbeat = this.itemProtocol.getHeartbeat();
if (mode != last_mode) { if (mode != last_mode) {
requireSucess = false; requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode)); logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));

View File

@@ -40,7 +40,6 @@ public class DeviceErrorLogController {
*/ */
@GetMapping @GetMapping
@Log("查询设备报警记录") @Log("查询设备报警记录")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){ public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
return new ResponseEntity<>(acsDeviceErrorLogService.queryAll(whereJson,page),HttpStatus.OK); return new ResponseEntity<>(acsDeviceErrorLogService.queryAll(whereJson,page),HttpStatus.OK);
} }
@@ -52,7 +51,6 @@ public class DeviceErrorLogController {
*/ */
@PostMapping @PostMapping
@Log("新增设备报警记录") @Log("新增设备报警记录")
public ResponseEntity<Object> create(@Validated @RequestBody DeviceErrorLogDto dto){ public ResponseEntity<Object> create(@Validated @RequestBody DeviceErrorLogDto dto){
acsDeviceErrorLogService.create(dto); acsDeviceErrorLogService.create(dto);
return new ResponseEntity<>(HttpStatus.CREATED); return new ResponseEntity<>(HttpStatus.CREATED);
@@ -65,7 +63,6 @@ public class DeviceErrorLogController {
*/ */
@PutMapping @PutMapping
@Log("修改设备报警记录") @Log("修改设备报警记录")
public ResponseEntity<Object> update(@Validated @RequestBody DeviceErrorLogDto dto){ public ResponseEntity<Object> update(@Validated @RequestBody DeviceErrorLogDto dto){
acsDeviceErrorLogService.update(dto); acsDeviceErrorLogService.update(dto);
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return new ResponseEntity<>(HttpStatus.NO_CONTENT);
@@ -77,7 +74,6 @@ public class DeviceErrorLogController {
* @return * @return
*/ */
@Log("删除设备报警记录") @Log("删除设备报警记录")
@DeleteMapping @DeleteMapping
public ResponseEntity<Object> delete(@RequestBody String[] ids) { public ResponseEntity<Object> delete(@RequestBody String[] ids) {
acsDeviceErrorLogService.deleteAll(ids); acsDeviceErrorLogService.deleteAll(ids);
@@ -91,7 +87,6 @@ public class DeviceErrorLogController {
* @throws IOException * @throws IOException
*/ */
@Log("导出设备报警记录") @Log("导出设备报警记录")
@GetMapping(value = "/download") @GetMapping(value = "/download")
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException { public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
acsDeviceErrorLogService.download(acsDeviceErrorLogService.queryAll(whereJson), response); acsDeviceErrorLogService.download(acsDeviceErrorLogService.queryAll(whereJson), response);

View File

@@ -526,7 +526,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
dto = foramte(dto); dto = foramte(dto);
String task_code = dto.getTask_code(); String task_code = dto.getTask_code();
TaskDto task = taskService.findByCodeFromCache(task_code); TaskDto task = taskService.findByCodeFromCache(task_code);
if(regional(dto.getStart_device_code(), dto.getNext_device_code())){
throw new BadRequestException(LangProcess.msg("error_regional_max"));
}
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now(); String now = DateUtil.now();
if (StrUtil.isEmpty(dto.getRoute_plan_code())) { if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
@@ -1731,6 +1733,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
int count = 0; int count = 0;
boolean startRegionalExit = true; boolean startRegionalExit = true;
boolean nextRegionalExit = true; boolean nextRegionalExit = true;
if(StrUtil.isEmpty(startRegion) || StrUtil.isEmpty(nextRegion)){
return true;
}
//控制指令生成 //控制指令生成
LimitRegionalDto limitRegionalDtos = limitRegionalService.selectByReging(startRegion, nextRegion); LimitRegionalDto limitRegionalDtos = limitRegionalService.selectByReging(startRegion, nextRegion);
if (ObjectUtil.isNotEmpty(limitRegionalDtos)) { if (ObjectUtil.isNotEmpty(limitRegionalDtos)) {

View File

@@ -2,6 +2,7 @@ package org.nl.acs.limit_regional.server.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
@@ -21,7 +22,9 @@ import org.nl.acs.limit_regional.server.mapper.LimitRegionalMapper;
import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.utils.ConvertUtil; import org.nl.acs.utils.ConvertUtil;
import org.nl.acs.utils.PageUtil; import org.nl.acs.utils.PageUtil;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils; import org.nl.common.utils.SecurityUtils;
import org.nl.config.language.LangProcess;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -45,7 +48,7 @@ public class LimitRegionalServiceImpl extends CommonServiceImpl<LimitRegionalMap
@Autowired @Autowired
private DeviceAppService deviceAppService; private DeviceAppService deviceAppService;
private List<LimitRegional> dataList; public List<LimitRegional> dataList;
@Override @Override
@@ -82,7 +85,7 @@ public class LimitRegionalServiceImpl extends CommonServiceImpl<LimitRegionalMap
@Override @Override
public void add(JSONObject json) { public void add(JSONObject json) {
LimitRegional limitRegional = new LimitRegional(); LimitRegional limitRegional = new LimitRegional();
limitRegional.setId(String.valueOf(RandomUtil.randomInt(8))); limitRegional.setId(RandomUtil.randomNumbers(8));
limitRegional.setStart_regional(json.getString("start_regional")); limitRegional.setStart_regional(json.getString("start_regional"));
limitRegional.setNext_regional(json.getString("next_regional")); limitRegional.setNext_regional(json.getString("next_regional"));
limitRegional.setStart_exclude_device(json.getString("startExcludeDevice")); limitRegional.setStart_exclude_device(json.getString("startExcludeDevice"));
@@ -91,12 +94,14 @@ public class LimitRegionalServiceImpl extends CommonServiceImpl<LimitRegionalMap
String regex = "\\d+"; String regex = "\\d+";
boolean isNumeric = max_num.matches(regex); boolean isNumeric = max_num.matches(regex);
if(!isNumeric){ if(!isNumeric){
throw new RuntimeException("最大数请输入纯数字"); throw new BadRequestException("请输入纯数字");
} }
limitRegional.setIs_active("1");
limitRegional.setMax_num(max_num); limitRegional.setMax_num(max_num);
limitRegional.setCreate_by("auto"); limitRegional.setCreate_by("auto");
limitRegional.setCreate_time(DateUtil.now()); limitRegional.setCreate_time(DateUtil.now());
limitRegionalMapper.insert(limitRegional); limitRegionalMapper.insert(limitRegional);
dataList.add(limitRegional);
} }
@@ -106,13 +111,25 @@ public class LimitRegionalServiceImpl extends CommonServiceImpl<LimitRegionalMap
return; return;
} }
for (String id : ids) { for (String id : ids) {
LimitRegional limitRegional = limitRegionalMapper.selectById(id);
if(ObjectUtil.isNull(limitRegional)){
throw new BadRequestException("这个对象不存在");
}
limitRegionalMapper.deleteById(id); limitRegionalMapper.deleteById(id);
} }
dataList.removeIf(limitRegional -> CollUtil.contains(Arrays.asList(ids), limitRegional.getId()));
} }
@Override @Override
public void update(JSONObject json) { public void update(JSONObject json) {
if(StrUtil.isEmpty(json.getString("id"))){
throw new BadRequestException(LangProcess.msg("error_checkNull", "流量限制id"));
}
LimitRegional id = limitRegionalMapper.selectById(json.getString("id"));
if(ObjectUtil.isNull(id)){
throw new BadRequestException(LangProcess.msg("error_isNull", "流量限制id="+json.getString("id")));
}
LimitRegional limitRegional = new LimitRegional(); LimitRegional limitRegional = new LimitRegional();
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
limitRegional.setId(json.getString("id")); limitRegional.setId(json.getString("id"));
@@ -124,19 +141,30 @@ public class LimitRegionalServiceImpl extends CommonServiceImpl<LimitRegionalMap
String regex = "\\d+"; String regex = "\\d+";
boolean isNumeric = max_num.matches(regex); boolean isNumeric = max_num.matches(regex);
if(!isNumeric){ if(!isNumeric){
throw new RuntimeException("最大数请输入纯数字"); throw new RuntimeException("请输入纯数字");
} }
limitRegional.setMax_num(max_num); limitRegional.setMax_num(max_num);
limitRegional.setUpdate_by(currentUsername); limitRegional.setUpdate_by(currentUsername);
limitRegional.setUpdate_time(DateUtil.now()); limitRegional.setUpdate_time(DateUtil.now());
limitRegionalMapper.updateById(limitRegional); limitRegionalMapper.updateById(limitRegional);
dataList.forEach(limitRegional1 -> {
if (limitRegional.getId().equals(limitRegional1.getId())) {
limitRegional1.setStart_regional(limitRegional.getStart_regional());
limitRegional1.setNext_regional(limitRegional.getNext_regional());
limitRegional1.setStart_exclude_device(limitRegional.getStart_exclude_device());
limitRegional1.setNext_exclude_device(limitRegional.getNext_exclude_device());
limitRegional1.setMax_num(limitRegional.getMax_num());
limitRegional1.setUpdate_by(limitRegional.getUpdate_by());
limitRegional1.setUpdate_time(limitRegional.getUpdate_time());
}
});
} }
@Override @Override
public void updateStatusById(Map whereJson) { public void updateStatusById(Map whereJson) {
String id = whereJson.get("id").toString(); String id = whereJson.get("id").toString();
if(StrUtil.isEmpty(id)){ if(StrUtil.isEmpty(id)){
return; throw new BadRequestException("id为空");
} }
LimitRegional limitRegional = new LimitRegional(); LimitRegional limitRegional = new LimitRegional();
limitRegional.setId(id); limitRegional.setId(id);
@@ -144,6 +172,12 @@ public class LimitRegionalServiceImpl extends CommonServiceImpl<LimitRegionalMap
limitRegional.setUpdate_by(SecurityUtils.getCurrentUsername()); limitRegional.setUpdate_by(SecurityUtils.getCurrentUsername());
limitRegional.setUpdate_time(DateUtil.now()); limitRegional.setUpdate_time(DateUtil.now());
limitRegionalMapper.updateById(limitRegional); limitRegionalMapper.updateById(limitRegional);
dataList.forEach(limitRegional1 -> {if (limitRegional.getId().equals(limitRegional1.getId())) {
limitRegional1.setIs_active(limitRegional.getIs_active());
limitRegional1.setUpdate_by(limitRegional.getUpdate_by());
limitRegional1.setUpdate_time(limitRegional.getUpdate_time());
}
});
} }
@Override @Override

View File

@@ -290,6 +290,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
} }
private void runNew() { private void runNew() {
Async20Access accessor = null; Async20Access accessor = null;

View File

@@ -138,14 +138,14 @@ public class LogAspect {
@AfterThrowing(pointcut = "logPointcut()", throwing = "e") /*@AfterThrowing(pointcut = "logPointcut()", throwing = "e")
public void logAfterThrowing(JoinPoint joinPoint, Throwable e) { public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
SysLog log = new SysLog("ERROR",System.currentTimeMillis() - currentTime.get()); SysLog log = new SysLog("ERROR",System.currentTimeMillis() - currentTime.get());
currentTime.remove(); currentTime.remove();
log.setException_detail(ThrowableUtil.getStackTrace(e).getBytes()); log.setException_detail(ThrowableUtil.getStackTrace(e).getBytes());
HttpServletRequest request = RequestHolder.getHttpServletRequest(); HttpServletRequest request = RequestHolder.getHttpServletRequest();
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint)joinPoint, log); logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint)joinPoint, log);
} }*/
public String getUsername() { public String getUsername() {
try { try {

View File

@@ -30,15 +30,12 @@ public class SysLogController {
@Autowired @Autowired
private ISysLogService logService; private ISysLogService logService;
@GetMapping @GetMapping
//@SaCheckPermission("@el.check()")
public ResponseEntity<Object> query(@RequestParam Map criteria, PageQuery pageable){ public ResponseEntity<Object> query(@RequestParam Map criteria, PageQuery pageable){
criteria.put("log_type","INFO"); criteria.put("log_type","INFO");
return new ResponseEntity<>(TableDataInfo.build(logService.queryAll(criteria,pageable)), HttpStatus.OK); return new ResponseEntity<>(TableDataInfo.build(logService.queryAll(criteria,pageable)), HttpStatus.OK);
} }
@GetMapping(value = "/user") @GetMapping(value = "/user")
//
public ResponseEntity<Object> queryUserLog(@RequestParam Map criteria, PageQuery pageable){ public ResponseEntity<Object> queryUserLog(@RequestParam Map criteria, PageQuery pageable){
criteria.put("log_type","INFO"); criteria.put("log_type","INFO");
criteria.put("username", SecurityUtils.getCurrentUsername()); criteria.put("username", SecurityUtils.getCurrentUsername());
@@ -46,7 +43,6 @@ public class SysLogController {
} }
@GetMapping(value = "/error") @GetMapping(value = "/error")
// @SaCheckPermission("@el.check()") // @SaCheckPermission("@el.check()")
public ResponseEntity<Object> queryErrorLog(@RequestParam Map criteria, PageQuery pageable){ public ResponseEntity<Object> queryErrorLog(@RequestParam Map criteria, PageQuery pageable){
criteria.put("log_type","ERROR"); criteria.put("log_type","ERROR");
@@ -54,7 +50,6 @@ public class SysLogController {
} }
@GetMapping(value = "/error/{id}") @GetMapping(value = "/error/{id}")
// @SaCheckPermission("@el.check()") // @SaCheckPermission("@el.check()")
public ResponseEntity<Object> queryErrorLogs(@PathVariable String id){ public ResponseEntity<Object> queryErrorLogs(@PathVariable String id){
return new ResponseEntity<>(logService.findByErrDetail(id), HttpStatus.OK); return new ResponseEntity<>(logService.findByErrDetail(id), HttpStatus.OK);
@@ -62,7 +57,6 @@ public class SysLogController {
@DeleteMapping(value = "/del/error") @DeleteMapping(value = "/del/error")
@Log("删除所有ERROR日志") @Log("删除所有ERROR日志")
// @SaCheckPermission("@el.check()") // @SaCheckPermission("@el.check()")
public ResponseEntity<Object> delAllErrorLog(){ public ResponseEntity<Object> delAllErrorLog(){
logService.delAllByError(); logService.delAllByError();
@@ -71,7 +65,6 @@ public class SysLogController {
@DeleteMapping(value = "/del/info") @DeleteMapping(value = "/del/info")
@Log("删除所有INFO日志") @Log("删除所有INFO日志")
// @SaCheckPermission("@el.check()") // @SaCheckPermission("@el.check()")
public ResponseEntity<Object> delAllInfoLog(){ public ResponseEntity<Object> delAllInfoLog(){
logService.delAllByInfo(); logService.delAllByInfo();

View File

@@ -135,7 +135,7 @@ export default {
props: { props: {
parentForm: { parentForm: {
type: Object, type: Object,
required: true require: true
} }
}, },
cruds() { cruds() {

View File

@@ -286,7 +286,7 @@ export default {
this.$refs.child1.setForm(clickObj) this.$refs.child1.setForm(clickObj)
} else if (clickObj.data.driver_type === 'standard_stacker') { } else if (clickObj.data.driver_type === 'standard_stacker') {
this.dialogFormVisible4 = true this.dialogFormVisible4 = true
}else { } else {
this.dialogFormVisible = true this.dialogFormVisible = true
} }
} }

View File

@@ -759,7 +759,11 @@ export default {
this.dialogVisible = false this.dialogVisible = false
}, },
saveBtn() { saveBtn() {
// 禁用按钮
this.isDisabled = true
crudTask.add(this.form).then(res => { crudTask.add(this.form).then(res => {
// 请求完成后启用按钮
this.isDisabled = false
this.crud.toQuery() this.crud.toQuery()
this.formDia = false this.formDia = false
this.isDisabled = true this.isDisabled = true
@@ -767,6 +771,10 @@ export default {
this.extension = [{ this.extension = [{
name: '', name: '',
value: '' }] value: '' }]
// 设置定时器,等待一定时间后再次允许请求
setTimeout(() => {
this.isDisabled = false // 可根据具体需求进行调整
}, 1000) // 5000 毫秒,即 5 秒钟
}, },
openDialog() { openDialog() {
this.dialogVisible = true this.dialogVisible = true

View File

@@ -186,7 +186,7 @@
</el-form-item> </el-form-item>
<el-form-item :label="$t('monitor.click.job_command')" prop="toCommand" label-width="120px"> <el-form-item :label="$t('monitor.click.job_command')" prop="toCommand" label-width="120px">
<el-radio-group v-model="form.toCommand"> <el-radio-group v-model="form.toCommand">
<el-radio-button :label="7" >{{ $t('monitor.click.recall') }}</el-radio-button> <el-radio-button :label="7">{{ $t('monitor.click.recall') }}</el-radio-button>
<el-radio-button :label="8">{{ $t('monitor.click.scram') }}</el-radio-button> <el-radio-button :label="8">{{ $t('monitor.click.scram') }}</el-radio-button>
<el-radio-button :label="5">{{ $t('monitor.click.police_clearance') }}</el-radio-button> <el-radio-button :label="5">{{ $t('monitor.click.police_clearance') }}</el-radio-button>
</el-radio-group> </el-radio-group>
@@ -200,7 +200,7 @@
<el-form-item :label="$t('monitor.click.stop_task')" prop="stopReceiveTask" label-width="120px"> <el-form-item :label="$t('monitor.click.stop_task')" prop="stopReceiveTask" label-width="120px">
<el-switch v-model="form.stopReceiveTask" /> <el-switch v-model="form.stopReceiveTask" />
</el-form-item> </el-form-item>
<el-form-item :label="$t('monitor.click.requireSucess')" prop="applySucess" label-width="120px"> <el-form-item :label="$t('monitor.click.requireSucess')" prop="applySucess" label-width="120px">
<el-radio-group v-model="form.requireSucess"> <el-radio-group v-model="form.requireSucess">
<el-radio-button :label="0"> {{ $t('auto.common.false') }}</el-radio-button> <el-radio-button :label="0"> {{ $t('auto.common.false') }}</el-radio-button>
<el-radio-button :label="1">{{ $t('auto.common.true') }}</el-radio-button> <el-radio-button :label="1">{{ $t('auto.common.true') }}</el-radio-button>
@@ -232,6 +232,7 @@ export default {
name: 'MonitorDevice', name: 'MonitorDevice',
data() { data() {
return { return {
// stageParam: 'stage_code', // 舞台参数
stageParam: 'age', // 舞台参数 stageParam: 'age', // 舞台参数
dialogDeviceMsgVisible: false, // 显示设备信息的dialog dialogDeviceMsgVisible: false, // 显示设备信息的dialog
device_code: null, device_code: null,
@@ -760,6 +761,7 @@ body {
::v-deep.el-radio-button{ ::v-deep.el-radio-button{
margin-right: 15px; margin-right: 15px;
border-radius:4px; border-radius:4px;
}
.el-radio-button__inner { .el-radio-button__inner {
width: 90px; width: 90px;
height: 30px; height: 30px;
@@ -773,5 +775,5 @@ body {
border-color: blue; border-color: blue;
box-shadow: -1px 0 0 0 blue; box-shadow: -1px 0 0 0 blue;
} }
}
</style> </style>