diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java index 4ee62576e..269e7a94b 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java @@ -75,36 +75,42 @@ public class QueryAGVStatus { String carNo = json.getString("vehicle"); String instructionCode = json.getString("id"); if ("RUNNING".equals(state) || "CREATED".equals(state) || "TOBEDISPATCHED".equals(state) || "WAITING".equals(state)) { - instruction.setInstruction_status("1"); - instruction.setCarno(carNo); - TaskDto task = new TaskDto(); - instructionService.update(instruction); - task.setCarno(carNo); - task.setTask_id(instruction.getTask_id()); - instructionService.update(instruction); - taskService.update(task); - if (StrUtil.isNotEmpty(instructionCode)){ - Device carCode = deviceAppService.findDeviceByCode(instructionCode); - XgAgvCarDeviceDriver xgAgvCarDeviceDriver; - if (null != carCode) { - if (carCode.getDeviceDriver() instanceof XgAgvCarDeviceDriver) { - xgAgvCarDeviceDriver = (XgAgvCarDeviceDriver) carCode.getDeviceDriver(); - xgAgvCarDeviceDriver.setTaskType(AgvActionTypeEnum.getStatus(instruction.getAgv_action_type())); + if (!"1".equals(instruction.getInstruction_status())) { + instruction.setInstruction_status("1"); + instruction.setCarno(carNo); + TaskDto task = new TaskDto(); + instructionService.update(instruction); + task.setCarno(carNo); + task.setTask_id(instruction.getTask_id()); + instructionService.update(instruction); + taskService.update(task); + if (StrUtil.isNotEmpty(instructionCode)) { + Device carCode = deviceAppService.findDeviceByCode(instructionCode); + XgAgvCarDeviceDriver xgAgvCarDeviceDriver; + if (null != carCode) { + if (carCode.getDeviceDriver() instanceof XgAgvCarDeviceDriver) { + xgAgvCarDeviceDriver = (XgAgvCarDeviceDriver) carCode.getDeviceDriver(); + xgAgvCarDeviceDriver.setTaskType(AgvActionTypeEnum.getStatus(instruction.getAgv_action_type())); + } } } - } + } } else if ("FINISHED".equals(state)) { - instruction.setInstruction_status("2"); - try { - instructionService.finish(instruction); - } catch (Exception e) { - log.error("执行完成,但无法更新状态,可能由于参数错误导致的异常"); - e.printStackTrace(); + if (!"2".equals(instruction.getInstruction_status())) { + instruction.setInstruction_status("2"); + try { + instructionService.finish(instruction); + } catch (Exception e) { + log.error("执行完成,但无法更新状态,可能由于参数错误导致的异常"); + e.printStackTrace(); + } } } else if ("STOPPED".equals(state) || "FAILED".equals(state) || "Error".equals(state)) { - instruction.setInstruction_status("1"); - instructionService.update(instruction); + if (!"1".equals(instruction.getInstruction_status())) { + instruction.setInstruction_status("1"); + instructionService.update(instruction); + } } } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java index 738856700..a1d6165b4 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java @@ -743,7 +743,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { Instruction instructionDto = instructionService.findByCodeFromCache(inst_code); if (ObjectUtil.isEmpty(instructionDto)) { LuceneLogDto logDto = LuceneLogDto.builder() - .content("请求失败,未找到指令!" ) + .content("请求失败,未找到指令!" + inst_code) .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java index 29120de8c..a90eb82d0 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java @@ -76,7 +76,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); - LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl"); + LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl"); //当前指令 @@ -192,56 +192,64 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i } if (move != 0 && task > 0) { - if (null!=inst) { + if (null != inst) { inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); } update_instruction_status(); } - } catch (Exception var17) { - var17.printStackTrace(); - logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); - } - - - if (move != last_move && move==0 && last_move==1) { - requireSucess = false; - clearWrite(); - } - - if (mode == 0) { - this.setIsonline(false); - message = "脱机"; - - //有报警 - } else { - this.setIsonline(true); - this.setIserror(false); - if (error != 0) { - this.setIserror(true); - message = "有警报"; + if (move != last_move && move == 0 && last_move == 1) { + requireSucess = false; + clearWrite(); } - Instruction instruction = null; - List toInstructions; + if (mode == 0) { + this.setIsonline(false); + message = "脱机"; - switch (mode) { - case 1: - log.debug("设备运转模式:等待工作"); - break; - case 2: - break; - case 25: - if ( StrUtil.isEmpty(material_barcode)) { - message = "子卷码为空"; - }else { - //二楼到一楼输送线申请行架任务 - if (move == 1 && !requireSucess) { - applyManipulatorTask(); + //有报警 + } else { + this.setIsonline(true); + this.setIserror(false); + if (error != 0) { + this.setIserror(true); + message = "有警报"; + }else { + this.setIserror(false); + } + + Instruction instruction = null; + List toInstructions; + + switch (mode) { + case 1: + log.debug("设备运转模式:等待工作"); + break; + case 2: + break; + case 25: + if (StrUtil.isEmpty(material_barcode)) { + message = "子卷码为空"; + } else { + //二楼到一楼输送线申请行架任务 + if (move == 1 && !requireSucess) { + applyManipulatorTask(); + } } - } - break; + break; + } } + } catch (Exception var17) { + this.iserror = true; + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(this.device_code+ "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + var17.printStackTrace(); } + + last_mode = mode; last_move = move; last_error = error; @@ -259,21 +267,21 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i private void clearWrite() { List list = new ArrayList<>(); Map map = new HashMap<>(); - map.put("code","to_target"); - map.put("value","0"); + map.put("code", "to_target"); + map.put("value", "0"); list.add(map); Map map2 = new HashMap<>(); - map2.put("code","to_task"); - map2.put("value","0"); + map2.put("code", "to_task"); + map2.put("value", "0"); list.add(map2); Map map4 = new HashMap<>(); - map4.put("code","to_container_type"); - map4.put("value","0"); + map4.put("code", "to_container_type"); + map4.put("value", "0"); list.add(map4); this.writing(list); - message=null; - vehicle_code=null; + message = null; + vehicle_code = null; inst_message = null; } @@ -578,7 +586,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() , inst.getInstruction_code())) { this.writing(list); - LuceneLogDto logDto = LuceneLogDto.builder() + LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content(device_code + inst.getInstruction_code() + "再次下发电气信号") .build(); @@ -652,7 +660,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i map.put("error", ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(this.getError()))); map.put("requireSucess", requireSucess); map.put("driver_type", "siemens_conveyor"); - map.put("message",message); + map.put("message", message); map.put("inst_message", this.inst_message); map.put("last_inst_message", this.last_inst_message); map.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/ItemProtocol.java index 76da017eb..60bd2433b 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/ItemProtocol.java @@ -139,7 +139,7 @@ public class ItemProtocol { setIsonline(true); return value; } - return 0; + return value; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java index 41b3f3266..9b8ae0da5 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java @@ -243,6 +243,15 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记:" + requireSucess); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode); } + if (mode == -99){ + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("PLC断连需重启程序") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + throw new BadRequestException("PLC断连需重启程序"); + } if (move != last_move && move == 0 && last_move == 1) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ItemProtocol.java index ff6736587..89f5cd649 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ItemProtocol.java @@ -178,7 +178,7 @@ public class ItemProtocol { setIsonline(true); return value; } - return 0; + return -99; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java index 2ad4ca2c3..cda1ff206 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java @@ -285,6 +285,12 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl } }else { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(device_code) + .content("木箱开盖报错,接口返回:" + response) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); message = "木箱开盖报错,返回参数:" + jo; this.iserror = true; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java index 932dfc816..84e41c216 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java @@ -182,16 +182,14 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice if (mode == 0) { this.setIsonline(false); - message = "未联机"; //有报警 } else if (error != 0) { this.setIserror(true); - message = "有报警"; + message = "universal_message3"; //无报警 } else { this.setIsonline(true); this.setIserror(false); - message = ""; Instruction instruction = null; List toInstructions; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index f9247b2f5..78bdc2b7d 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -1688,7 +1688,14 @@ public class TaskServiceImpl extends CommonServiceImpl impleme JSONArray ja = new JSONArray(); ja.add(feed_jo); //TODO 有需要根据上位系统反馈的信息再做进一步处理 - acstowmsService.feedTaskStatus(ja); + CompletableFuture.runAsync(() -> { + acstowmsService.feedTaskStatus(ja); + // 异步更新任务状态 + try { + } catch (Exception e) { + e.printStackTrace(); + } + }); } } diff --git a/acs2/nladmin-ui/src/views/acs/device/customPolicy/task/index.vue b/acs2/nladmin-ui/src/views/acs/device/customPolicy/task/index.vue index 06257468d..9481f84ee 100644 --- a/acs2/nladmin-ui/src/views/acs/device/customPolicy/task/index.vue +++ b/acs2/nladmin-ui/src/views/acs/device/customPolicy/task/index.vue @@ -23,7 +23,24 @@
- + + + + - + - - - +