diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/indoor_manipulator/IndoorManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/indoor_manipulator/IndoorManipulatorDeviceDriver.java index 9c9b1ce2d..ad89dd0c2 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/indoor_manipulator/IndoorManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/indoor_manipulator/IndoorManipulatorDeviceDriver.java @@ -251,6 +251,10 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple inst = null; message = null; } + if(mode == 2 && requireSucess){ + this.setRequireSucess(false); + logServer.deviceExecuteLog(this.device_code, "", "", "再次信号复位requireSuccess:" + requireSucess); + } logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode)); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode); } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java index 7ddac7db0..d9ac003bc 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -440,9 +440,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + start_device_code + ",放货位:" + next_device_code + ",存在关联的同一列烘箱设备未关门!指令号:" + instruction.getInstruction_code(); return false; } - instruction.setInstruction_status("1"); - instruction.setUpdate_time(DateUtil.now()); - instructionService.update(instruction); Device startDevice = deviceAppService.findDeviceByCode(start_device_code); Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { @@ -454,7 +451,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i String start_addr = startDevice.getExtraValue().get("address").toString(); String next_addr = nextDevice.getExtraValue().get("address").toString(); logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:" - + instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code() + + instruction.getInstruction_code() + "任务号="+ taskDto.getTask_code() + ",指令起点:" + instruction.getStart_device_code() + ",指令终点:" + instruction.getNext_device_code()); this.writing("to_onset", start_addr); this.writing("to_target", next_addr); @@ -622,10 +619,15 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); } + Instruction byInsructionCode = instructionService.findByInsructionCode(instdto.getInstruction_code()); + if(ObjectUtil.isEmpty(byInsructionCode)){ + logServer.deviceExecuteLog(this.getDevice_code(), "", "", "未找到指令号: "+instdto.getInstruction_code()); + return false; + } String start_addr = startDevice.getExtraValue().get("address").toString(); String next_addr = nextDevice.getExtraValue().get("address").toString(); logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:" - + instdto.getInstruction_code() +";指令号: "+ CodeUtil.getNewCode("INSTRUCT_NO") + ",指令起点:" + instdto.getStart_device_code() + + instdto.getInstruction_code()+ "任务号: "+ task.getTask_code() + ",指令起点:" + instdto.getStart_device_code() + ",指令终点:" + instdto.getNext_device_code()); this.writing("to_onset", start_addr); this.writing("to_target", next_addr); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index 34740dbfd..5f82b1174 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -279,7 +279,15 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { map.put("point_code", point_code); } if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) { + // 将字符串时间解析为日期对象 + Date date = DateUtil.parse(create_time.replace("Z", " UTC"), "yyyy-MM-dd'T'HH:mm:ss.SSS Z"); + // 将日期对象加上8小时 + /*Date newDate = DateUtil.offsetHour(date, 8);*/ + // 将新日期对象格式化为字符串时间 + create_time = DateUtil.formatDateTime(date); map.put("create_time", create_time); + Date date1 = DateUtil.parse(end_time.replace("Z", " UTC"), "yyyy-MM-dd'T'HH:mm:ss.SSS Z"); + end_time = DateUtil.formatDateTime(date1); map.put("end_time", end_time); } JSONObject jsonObject1 = diff --git a/acs2/nladmin-system/logPath_IS_UNDEFINED/ACS请求LMS/2024-03-15.0.log b/acs2/nladmin-system/logPath_IS_UNDEFINED/ACS请求LMS/2024-03-15.0.log new file mode 100644 index 000000000..e69de29bb diff --git a/acs2/nladmin-system/logPath_IS_UNDEFINED/ACS请求LMS/2024-03-18.0.log b/acs2/nladmin-system/logPath_IS_UNDEFINED/ACS请求LMS/2024-03-18.0.log new file mode 100644 index 000000000..e69de29bb diff --git a/acs2/nladmin-system/logPath_IS_UNDEFINED/ACS请求LMS/2024-03-20.0.log b/acs2/nladmin-system/logPath_IS_UNDEFINED/ACS请求LMS/2024-03-20.0.log new file mode 100644 index 000000000..e69de29bb diff --git a/acs2/nladmin-system/logPath_IS_UNDEFINED/LMS下发ACS/2024-03-15.0.log b/acs2/nladmin-system/logPath_IS_UNDEFINED/LMS下发ACS/2024-03-15.0.log new file mode 100644 index 000000000..e69de29bb diff --git a/acs2/nladmin-system/logPath_IS_UNDEFINED/LMS下发ACS/2024-03-18.0.log b/acs2/nladmin-system/logPath_IS_UNDEFINED/LMS下发ACS/2024-03-18.0.log new file mode 100644 index 000000000..e69de29bb diff --git a/acs2/nladmin-system/logPath_IS_UNDEFINED/LMS下发ACS/2024-03-20.0.log b/acs2/nladmin-system/logPath_IS_UNDEFINED/LMS下发ACS/2024-03-20.0.log new file mode 100644 index 000000000..e69de29bb diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/AcsConfig.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/AcsConfig.java index 536cdf88e..0f64f17f5 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/AcsConfig.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/AcsConfig.java @@ -53,6 +53,10 @@ public interface AcsConfig { * 二楼2区AGV系统端口 */ String AGVPORT22 = "agvport22"; + /** + * acsIP地址 + */ + String ACSIP = "acsIP"; /** * 指定AGV系统 */ diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/rest/XianGongAgvController.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/rest/XianGongAgvController.java index 2bccb2f2b..063da5b90 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/rest/XianGongAgvController.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/rest/XianGongAgvController.java @@ -1,6 +1,7 @@ package org.nl.acs.agv.rest; import com.alibaba.fastjson.JSONObject; +import groovy.lang.Lazy; import org.nl.acs.agv.server.XianGongAgvService; import org.nl.common.logging.annotation.Log; import org.springframework.beans.factory.annotation.Autowired; @@ -17,7 +18,7 @@ import org.springframework.web.bind.annotation.RequestBody; @Controller public class XianGongAgvController { - + @Lazy @Autowired private XianGongAgvService xianGongAgentService; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java index 5d89569a3..59f633ce6 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java @@ -80,55 +80,191 @@ public class NDCAgvServiceImpl implements NDCAgvService { log.info("sendAgvInstToNDC 指令下发NDC:" + "inst_code:" + inst.getInstruction_code() + ",agv_system_type:" + agv_system_type + ",agv_inst_type:" + inst.getAgv_inst_type() + ",priority:" + inst.getPriority() + ",startAddress:" + inst.getStart_point_code() + ",nextAddress:" + inst.getNext_point_code()); - if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { - String instcode = inst.getInstruction_code(); - int type = Integer.parseInt(inst.getInstruction_type()); - int priority = Integer.parseInt(inst.getPriority()) + 128; - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); - int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code()); - int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code()); - byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode)); - byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode)); - byte typehigh = (byte) IntToHexHigh(type); - byte typelow = (byte) IntToHexLow(type); - byte qhdhigh = (byte) IntToHexHigh(startAddress); - byte qhdlow = (byte) IntToHexLow(startAddress); - byte fhdhigh = (byte) IntToHexHigh(nextAddress); - byte fhdlow = (byte) IntToHexLow(nextAddress); - byte prioritylow = (byte) IntToHexLow(priority); - String str = "十进制下发:"; - String str1 = "十六进制下发:"; - str += "ikey:" + (Integer.parseInt(instcode)); - str1 += "ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF); - str += "/type:" + (type); - str1 += "/type:" + hexToString(typehigh & 0xFF) + hexToString(typelow & 0xFF); - str += "/qhd:" + (startAddress); - str1 += "/qhd:" + hexToString(qhdhigh & 0xFF) + hexToString(qhdlow & 0xFF); - str += "/fhd:" + (nextAddress); - str1 += "/fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF); - str += "/priority:" + (priority); - str1 += "/priority:" + hexToString(prioritylow & 0xFF); - System.out.println(str); - System.out.println(str1); - byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, - (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X12, - (byte) 0X00, (byte) 0X01, - (byte) 0X00, (byte) 0X71, - (byte) 0X00, (byte) 0X0E, - (byte) 0X01, prioritylow, - (byte) 0X00, (byte) 0X01, - (byte) ikeyhigh, (byte) ikeylow, - (byte) ikeyhigh, (byte) ikeylow, - (byte) typehigh, (byte) typelow, - (byte) qhdhigh, (byte) qhdlow, - (byte) fhdhigh, (byte) fhdlow - }; - log.info("下发AGV作业指令--{}", str1); -// OneNDCSocketConnectionAutoRun.write(b); - TwoNDCSocketConnectionAutoRun.write(b); - System.out.println("下发agv指令数据:" + Bytes2HexString(b)); + if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { + if (!StrUtil.equals(agv_system_type, "1")) { + String instcode = inst.getInstruction_code(); + int type = Integer.parseInt(inst.getAgv_inst_type()); + int priority = Integer.parseInt(inst.getPriority()) + 128; + DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); + DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); + int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code()); + int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code()); + int startAddress2 = deviceService.queryAddressBydeviceCode(inst.getStart_point_code2()); + int nextAddress2 = deviceService.queryAddressBydeviceCode(inst.getNext_point_code2()); + byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode)); + byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode)); + byte typehigh = (byte) IntToHexHigh(type); + byte typelow = (byte) IntToHexLow(type); + byte qhdhigh = (byte) IntToHexHigh(startAddress); + byte qhdlow = (byte) IntToHexLow(startAddress); + byte qhdhigh2 = (byte) IntToHexHigh(startAddress2); + byte qhdlow2 = (byte) IntToHexLow(startAddress2); + byte fhdhigh = (byte) IntToHexHigh(nextAddress); + byte fhdlow = (byte) IntToHexLow(nextAddress); + byte fhdhigh2 = (byte) IntToHexHigh(nextAddress2); + byte fhdlow2 = (byte) IntToHexLow(nextAddress2); + byte prioritylow = (byte) IntToHexLow(priority); + + String str = "十进制下发:"; + String str1 = "十六进制下发:"; + str += "任务号 ikey:" + (Integer.parseInt(instcode)); + str1 += "任务号 ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF); + + str += "指令类型 /type:" + (type); + str1 += "指令类型 /type:" + hexToString(typehigh & 0xFF) + hexToString(typelow & 0xFF); + + str += "取货点 /qhd:" + (startAddress); + str1 += "取货点 /qhd:" + hexToString(qhdhigh & 0xFF) + hexToString(qhdlow & 0xFF); + str += "放货点 /fhd:" + (nextAddress); + str1 += "放货点 /fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF); + + str += "取货点2 /qhd2:" + (startAddress2); + str1 += "取货点2 /qhd2:" + hexToString(qhdhigh2 & 0xFF) + hexToString(qhdlow2 & 0xFF); + str += "放货点2 /fhd2:" + (nextAddress2); + str1 += "放货点2 /fhd2:" + hexToString(fhdhigh2 & 0xFF) + hexToString(fhdlow2 & 0xFF); + + str += "优先级 /priority:" + (priority); + str1 += "优先级 /priority:" + hexToString(prioritylow & 0xFF); + + byte[] b = new byte[]{}; + if (type == 1) { + b = new byte[]{(byte) 0X87, (byte) 0XCD, + (byte) 0X00, (byte) 0X08, + (byte) 0X00, (byte) 0X16, + (byte) 0X00, (byte) 0X01, + (byte) 0X00, (byte) 0X71, + (byte) 0X00, (byte) 0X12, + (byte) 0X01, prioritylow, + (byte) 0X00, (byte) 0X01, + (byte) ikeyhigh, (byte) ikeylow, + (byte) ikeyhigh, (byte) ikeylow, + (byte) typehigh, (byte) typelow, + (byte) qhdhigh, (byte) qhdlow, + (byte) qhdhigh2, (byte) qhdlow2, + (byte) fhdhigh, (byte) fhdlow, + (byte) fhdhigh2, (byte) fhdlow2 + }; + } else if (type == 2) { + b = new byte[]{(byte) 0X87, (byte) 0XCD, + (byte) 0X00, (byte) 0X08, + (byte) 0X00, (byte) 0X16, + (byte) 0X00, (byte) 0X01, + (byte) 0X00, (byte) 0X71, + (byte) 0X00, (byte) 0X12, + (byte) 0X01, prioritylow, + (byte) 0X00, (byte) 0X01, + (byte) ikeyhigh, (byte) ikeylow, + (byte) ikeyhigh, (byte) ikeylow, + (byte) typehigh, (byte) typelow, + (byte) qhdhigh, (byte) qhdlow, + (byte) 0X00, (byte) 0X00, + (byte) fhdhigh, (byte) fhdlow, + (byte) 0X00, (byte) 0X00 + }; + } else if (type == 3) { + b = new byte[]{(byte) 0X87, (byte) 0XCD, + (byte) 0X00, (byte) 0X08, + (byte) 0X00, (byte) 0X16, + (byte) 0X00, (byte) 0X01, + (byte) 0X00, (byte) 0X71, + (byte) 0X00, (byte) 0X12, + (byte) 0X01, prioritylow, + (byte) 0X00, (byte) 0X01, + (byte) ikeyhigh, (byte) ikeylow, + (byte) ikeyhigh, (byte) ikeylow, + (byte) typehigh, (byte) typelow, + (byte) qhdhigh, (byte) qhdlow, + (byte) qhdhigh2, (byte) qhdlow2, + (byte) fhdhigh, (byte) fhdlow, + (byte) fhdhigh2, (byte) fhdlow2 + }; + } + log.info("下发AGV作业指令 --{}", str1); + log.info("下发AGV作业指令--{}", str); + log.info("下发agv指令数据--{}", Bytes2HexString(b)); + + if (StrUtil.equals(agv_system_type, "2")) { + TwoNDCSocketConnectionAutoRun.write(b); + } + } else { + + String instcode = inst.getInstruction_code(); + int startHeight = Integer.parseInt(StrUtil.isEmpty(inst.getStart_height()) ? "0" : inst.getStart_height()); + int nextHeight = Integer.parseInt(StrUtil.isEmpty(inst.getNext_height()) ? "0" : inst.getNext_height()); + //默认取货放货高度都为0 + //int type = Integer.parseInt(inst.getInstruction_type()); + int type = 4; + if (startHeight != 0 && nextHeight != 0) { + //取货放货高度都不为0 + type = 1; + } else if (startHeight != 0 && nextHeight == 0) { + //取货高度不为0 放货高度为0 + type = 2; + } else if (startHeight == 0 && nextHeight != 0) { + //取货高度为0 放货高度不为0 + type = 3; + } + int priority = Integer.parseInt(inst.getPriority()) + 128; + DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); + DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); + int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code()); + int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code()); + + byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode)); + byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode)); + byte typehigh = (byte) IntToHexHigh(type); + byte typelow = (byte) IntToHexLow(type); + byte qhdhigh = (byte) IntToHexHigh(startAddress); + byte qhdlow = (byte) IntToHexLow(startAddress); + byte fhdhigh = (byte) IntToHexHigh(nextAddress); + byte fhdlow = (byte) IntToHexLow(nextAddress); + byte prioritylow = (byte) IntToHexLow(priority); + + byte shhigh = (byte) IntToHexHigh(startHeight); + byte shlow = (byte) IntToHexLow(startHeight); + + byte nhhigh = (byte) IntToHexHigh(nextHeight); + byte nhlow = (byte) IntToHexLow(nextHeight); + + String str = "十进制下发:"; + String str1 = "十六进制下发:"; + str += "ikey:" + (Integer.parseInt(instcode)); + str1 += "ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF); + + str += "/type:" + (type); + str1 += "/type:" + hexToString(typehigh & 0xFF) + hexToString(typelow & 0xFF); + + str += "/qhd:" + (startAddress); + str1 += "/qhd:" + hexToString(qhdhigh & 0xFF) + hexToString(qhdlow & 0xFF); + str += "/fhd:" + (nextAddress); + str1 += "/fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF); + + str += "/priority:" + (priority); + str1 += "/priority:" + hexToString(prioritylow & 0xFF); + + System.out.println(str); + System.out.println(str1); + byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, + (byte) 0X00, (byte) 0X08, + (byte) 0X00, (byte) 0X16, + (byte) 0X00, (byte) 0X01, + (byte) 0X00, (byte) 0X71, + (byte) 0X00, (byte) 0X12, + (byte) 0X01, prioritylow, + (byte) 0X00, (byte) 0X01, + (byte) ikeyhigh, (byte) ikeylow, + (byte) ikeyhigh, (byte) ikeylow, + (byte) typehigh, (byte) typelow, + (byte) qhdhigh, (byte) qhdlow, + (byte) fhdhigh, (byte) fhdlow, + (byte) shhigh, (byte) shlow, + (byte) nhhigh, (byte) nhlow + }; + log.info("下发AGV作业指令 --{}", str1); + log.info("下发AGV作业指令--{}", str); + log.info("下发agv指令数据--{}", Bytes2HexString(b)); + OneNDCSocketConnectionAutoRun.write(b); + } } } 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 c976366f0..cf557d4ba 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 @@ -47,6 +47,7 @@ import java.util.Map; public class XianGongAgvServiceImpl implements XianGongAgvService { private final DeviceAppService deviceAppService; private final ISysParamService paramService; + @Autowired private final AcsToWmsService acsToWmsService; @Autowired @@ -115,7 +116,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } - + @Override public HttpResponse markComplete(String code) throws Exception { @@ -141,7 +142,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } - + @Override public HttpResponse queryXZAgvDeviceStatus() { @@ -202,7 +203,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } - + @Override public HttpResponse queryXZAgvInstStatus(String instCode) { @@ -225,7 +226,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } } - + @Override public HttpResponse deleteXZAgvInst(String instCode) { if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { @@ -245,7 +246,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } } - + @Override public HttpResponse sendOrderSequencesToXZ(Instruction inst) throws Exception { com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject(); @@ -356,6 +357,38 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { jo.put("script_args", script_args); ja.add(jo); } + JSONObject jo3 = new JSONObject(); + //动作块id + jo3.put("blockId", IdUtil.simpleUUID()); + //目的地名称 + jo3.put("location", pointCode + "INGET"); + jo3.put("id", pointCode + "INGET"); + //执行脚本 + jo3.put("operation", "expand"); + //通信脚本,动作前后与现场设备交互的场景 + jo3.put("script_name", "Fork-expand.py"); + JSONObject script_args = new JSONObject(); + script_args.put("expandWidth", 0.2); + script_args.put("operation", "expand"); + jo3.put("script_args", script_args); + ja.add(jo3); + + JSONObject jo4 = new JSONObject(); + //动作块id + jo4.put("blockId", IdUtil.simpleUUID()); + //目的地名称 + jo4.put("location", pointCode + "INGET"); + jo4.put("id", pointCode + "INGET"); + //执行脚本 + jo4.put("operation", "stretch"); + //通信脚本,动作前后与现场设备交互的场景 + jo4.put("script_name", "Fork-expand.py"); + JSONObject script_args1 = new JSONObject(); + script_args1.put("expandWidth", 0.2); + script_args1.put("operation", "stretch"); + jo4.put("script_args", script_args1); + ja.add(jo4); + //将货物顶起来,机器识别提升高度 JSONObject jo1 = new JSONObject(); jo1.put("blockId", IdUtil.simpleUUID()); @@ -466,7 +499,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } } - + @Override public HttpResponse addOrderSequences(Instruction inst) throws Exception { JSONObject orderjo = createOrederData(inst, CommonFinalParam.ONE); @@ -493,7 +526,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } } - + @Override public String sendOrderSequencesParam(Instruction inst) throws Exception { JSONObject jo = new JSONObject(); @@ -511,7 +544,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { return jo.toString(); } - + @Override public JSONObject createOrederData(Instruction inst, String inst_type) { String inst_code = inst.getInstruction_code(); @@ -648,7 +681,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { return destinationOrder; } - + @Override public String queryDoorStatus(String device) { log.info("AGV查询自动门状态,参数:{}", device); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java index 4af089dc2..068c6efed 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java @@ -30,7 +30,6 @@ import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; import java.util.Date; -import java.util.List; import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString; @@ -87,7 +86,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); try { - System.out.println("2楼1区域AGV系统链接开始"); + log.info("2楼1区域AGV系统链接开始"); ip = paramService.findByCode(AcsConfig.AGVURL).getValue(); port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue()); // byte[] b = new byte[1024]; @@ -118,7 +117,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { } int[] arr = new int[count]; - StringBuffer bs = new StringBuffer(); + StringBuffer bs = new StringBuffer(); for (int i = 0; i < count; i++) { int temp = b[i]; @@ -233,13 +232,14 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); try { - standardAutodoorDeviceDriver.writing("to_command", 1); + standardAutodoorDeviceDriver.writing("to_open", "1"); + standardAutodoorDeviceDriver.writing("to_close", "0"); } catch (Exception e) { log.info("下发电气信号失败:" + e.getMessage()); e.printStackTrace(); } - if (standardAutodoorDeviceDriver.getAction() == 1 && standardAutodoorDeviceDriver.getTo_command() == 1) { - log.info("下发开门信号值为:{}", standardAutodoorDeviceDriver.getTo_command()); + if (standardAutodoorDeviceDriver.getOpen() == 1 && standardAutodoorDeviceDriver.getToOpen() == 1 ) { + log.info("下发开门信号值为:{},下发关门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose()); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } } @@ -256,7 +256,8 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); try { - standardAutodoorDeviceDriver.writing("to_command", 2); + standardAutodoorDeviceDriver.writing("to_close", "1"); + standardAutodoorDeviceDriver.writing("to_open", "0"); } catch (Exception e) { log.info("下发电气信号失败:" + e.getMessage()); e.printStackTrace(); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/common/base/CommonFinalParam.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/common/base/CommonFinalParam.java index 68ca91154..ba3609b60 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/common/base/CommonFinalParam.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/common/base/CommonFinalParam.java @@ -16,6 +16,7 @@ public class CommonFinalParam { private final String BARRE = "-"; private final String POINT = "."; + public static final String ZERO = "0"; public static final String ONE = "1"; public static final String TWO = "2"; @@ -51,6 +52,20 @@ public class CommonFinalParam { public static final int ACTION_TWO = 2; public static final int ACTION_THREE = 3; + /** + * 申请任务type类型 + */ + public static final String TYPE_ONE = "1"; + public static final String TYPE_TWO = "2"; + public static final String TYPE_THREE = "3"; + public static final String TYPE_FOUR = "4"; + public static final String TYPE_FIVE = "5"; + public static final String TYPE_SIX = "6"; + public static final String TYPE_SEVEN = "7"; + + + + /** * 切割点符号 */ diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java index 608756d70..2a705dfa9 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java @@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.map.ListOrderedMap; import org.apache.commons.lang.LocaleUtils; import org.nl.acs.auto.initial.ApplicationAutoInitial; @@ -28,6 +29,10 @@ import org.nl.acs.device.domain.DeviceRunpoint; import org.nl.acs.device.service.mapper.DeviceRunpointMapper; import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver; import org.nl.acs.device_driver.one_conveyor.scanner_weight_conveyor.ConveyorWithScannerWeightDeviceDriver; +import org.nl.acs.device_driver.one_manipulator.box_package_manipulator.BoxPackageManipulatorDeviceDriver; +import org.nl.acs.device_driver.one_manipulator.box_storage_manipulator.BoxStorageManipulatorDeviceDriver; +import org.nl.acs.device_driver.one_manipulator.return_good_manipulator.ReturnGoodManipulatorDeviceDriver; +import org.nl.acs.device_driver.one_manipulator.trapped_manipulator.TrappedManipulatorManipulatorDeviceDriver; import org.nl.acs.device_driver.one_manipulator.volume_two_manipulator.VolumeTwoManipulatorManipulatorDeviceDriver; import org.nl.acs.device_driver.stacker.standard_stacker.StandardStackerDeviceDriver; import org.nl.acs.device_driver.two_conveyor.oven_manipulator.OvenGantryManipulatorDeviceDriver; @@ -1030,6 +1035,18 @@ public class DeviceServiceImpl extends CommonServiceImpl i }else if (device.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { BeltConveyorDeviceDriver beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) device.getDeviceDriver(); beltConveyorDeviceDriver.setDeviceStatus(form); + }else if (device.getDeviceDriver() instanceof BoxPackageManipulatorDeviceDriver) { + BoxPackageManipulatorDeviceDriver boxPackageManipulatorDeviceDriver = (BoxPackageManipulatorDeviceDriver) device.getDeviceDriver(); + boxPackageManipulatorDeviceDriver.setDeviceStatus(form); + }else if (device.getDeviceDriver() instanceof BoxStorageManipulatorDeviceDriver) { + BoxStorageManipulatorDeviceDriver boxStorageManipulatorDeviceDriver = (BoxStorageManipulatorDeviceDriver) device.getDeviceDriver(); + boxStorageManipulatorDeviceDriver.setDeviceStatus(form); + }else if (device.getDeviceDriver() instanceof ReturnGoodManipulatorDeviceDriver) { + ReturnGoodManipulatorDeviceDriver returnGoodManipulatorDeviceDriver = (ReturnGoodManipulatorDeviceDriver) device.getDeviceDriver(); + returnGoodManipulatorDeviceDriver.setDeviceStatus(form); + }else if (device.getDeviceDriver() instanceof TrappedManipulatorManipulatorDeviceDriver) { + TrappedManipulatorManipulatorDeviceDriver trappedManipulatorManipulatorDeviceDriver = (TrappedManipulatorManipulatorDeviceDriver) device.getDeviceDriver(); + trappedManipulatorManipulatorDeviceDriver.setDeviceStatus(form); } } @@ -1228,13 +1245,15 @@ public class DeviceServiceImpl extends CommonServiceImpl i JSONArray w_arry = new JSONArray(); List writeableItemDtos = opcDeviceDriverDefination.getWriteableItemDtos(); List writeableItemJsons = new ArrayList<>(); - for (int i = 0; i < writeableItemDtos.size(); i++) { - ItemDto itemDto = writeableItemDtos.get(i); - JSONObject writeableItemJson = new JSONObject(); - writeableItemJson.put("code", itemDto.getCode()); - writeableItemJson.put("name", itemDto.getName()); - //writeableItemJson.put("db",itemDto.getDb()); - writeableItemJsons.add(writeableItemJson); + if (CollectionUtils.isNotEmpty(writeableItemDtos)) { + for (int i = 0; i < writeableItemDtos.size(); i++) { + ItemDto itemDto = writeableItemDtos.get(i); + JSONObject writeableItemJson = new JSONObject(); + writeableItemJson.put("code", itemDto.getCode()); + writeableItemJson.put("name", itemDto.getName()); + //writeableItemJson.put("db",itemDto.getDb()); + writeableItemJsons.add(writeableItemJson); + } } for (int i = 0; i < ws.size(); i++) { String extra_code = ws.getJSONObject(i).getString("extra_code"); @@ -1260,14 +1279,16 @@ public class DeviceServiceImpl extends CommonServiceImpl i jsonObject.put("name", wJson.getString("name")); warry.add(jsonObject); } - for (int i = 0; i < writeableItemDtos.size(); i++) { - ItemDto itemDto = writeableItemDtos.get(i); - JSONObject writeableItemJson = new JSONObject(); - writeableItemJson.put("code", itemDto.getCode()); - writeableItemJson.put("name", itemDto.getName()); - if (!warry.contains(writeableItemJson)) { - writeableItemJson.put("db", itemDto.getDb()); - w_arry.add(writeableItemJson); + if (CollectionUtils.isNotEmpty(writeableItemDtos)) { + for (int i = 0; i < writeableItemDtos.size(); i++) { + ItemDto itemDto = writeableItemDtos.get(i); + JSONObject writeableItemJson = new JSONObject(); + writeableItemJson.put("code", itemDto.getCode()); + writeableItemJson.put("name", itemDto.getName()); + if (!warry.contains(writeableItemJson)) { + writeableItemJson.put("db", itemDto.getDb()); + w_arry.add(writeableItemJson); + } } } if (!r_arry.isEmpty()) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java index f1ffe5a51..848bfedf6 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java @@ -230,7 +230,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } catch (Exception e) { e.printStackTrace(); } - if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) { + if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 + && standardInspectSiteDeviceDriver.getError() == 0)) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } else { message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/ItemProtocol.java index 719a56825..ba8e72069 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.autodoor.standard_autodoor; +import cn.hutool.core.util.StrUtil; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; @@ -8,13 +9,10 @@ import java.util.List; @Slf4j public class ItemProtocol { - public static String item_heartbeat = "heartbeat"; - public static String item_mode = "mode"; - public static String item_state = "state"; - public static String item_action = "action"; - public static String item_error = "error"; - public static String item_to_command = "to_command"; - public static String item_to_state = "to_state"; + public static String item_open = "open"; + public static String item_close = "close"; + public static String item_to_open = "to_open"; + public static String item_to_close = "to_close"; private StandardAutodoorDeviceDriver driver; @@ -23,35 +21,27 @@ public class ItemProtocol { this.driver = driver; } - public int getHeartbeat() { - return this.getOpcIntegerValue(item_heartbeat); + public int getOpen() { + return this.getOpcIntegerValue(item_open); } - public int getMode() { - return this.getOpcIntegerValue(item_mode); + public int getClose() { + return this.getOpcIntegerValue(item_close); } - public int getAction() { - return this.getOpcIntegerValue(item_action); + + public int getToOpen() { + return this.getOpcIntegerValue(item_to_open); } - public int getError() { - return this.getOpcIntegerValue(item_error); + public int getToClose() { + return this.getOpcIntegerValue(item_to_close); } - public int getToCommand() { - return this.getOpcIntegerValue(item_to_command); - } - - public int getToState() { - return this.getOpcIntegerValue(item_to_state); - } - - public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); if (value == null) { -// log.error("读取错误!"); + // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); } else { return value; } @@ -59,22 +49,34 @@ public class ItemProtocol { } + public String getOpcStringValue(String protocol) { + String value = this.driver.getStringValue(protocol); + if (StrUtil.isEmpty(value)) { + + } else { + return value; + } + return "0"; + } + public static List getReadableItemDtos() { ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0")); - list.add(new ItemDto(item_mode, "工作模式", "DB600.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_state, "工作状态", "DB600.B2")); - list.add(new ItemDto(item_action, "动作信号", "DB600.B3")); - list.add(new ItemDto(item_error, "报警信号", "DB600.B4")); + list.add(new ItemDto(item_open, "开到位", "10001")); + list.add(new ItemDto(item_close, "关到位", "10002")); return list; } public static List getWriteableItemDtos() { ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2", Boolean.valueOf(true))); - list.add(new ItemDto(item_to_state, "下发状态", "DB601.W3", Boolean.valueOf(true))); + list.add(new ItemDto(item_to_open, "下发开门", "00001" )); + list.add(new ItemDto(item_to_close, "下发关门", "00002")); return list; } + + @Override + public String toString() { + return ""; + } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDefination.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDefination.java index c37bb0cff..77ae81092 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDefination.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDefination.java @@ -2,12 +2,11 @@ package org.nl.acs.device_driver.autodoor.standard_autodoor; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; import org.nl.acs.device.domain.Device; +import org.nl.acs.device.enums.DeviceType; import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; -import org.nl.acs.device.enums.DeviceType; import org.springframework.stereotype.Service; -import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -31,6 +30,7 @@ public class StandardAutodoorDefination implements OpcDeviceDriverDefination { return "标准版-自动门"; } + @Override public DeviceDriver getDriverInstance(Device device) { return (new StandardAutodoorDeviceDriver()).setDevice(device).setDriverDefination(this); @@ -49,18 +49,10 @@ public class StandardAutodoorDefination implements OpcDeviceDriverDefination { return types; } + @Override public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - List list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB600.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB600.B1", true)); - list.add(new ItemDto(ItemProtocol.item_action, "动作信号", "DB600.B2")); - list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB600.B4")); - return list; + return ItemProtocol.getReadableItemDtos(); } @Override diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDeviceDriver.java index d86e60da9..ae7073f28 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDeviceDriver.java @@ -4,98 +4,41 @@ import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.device.domain.Device; -import org.nl.acs.ext.wms.data.one.feedBackTaskStatus.FeedBackTaskStatusRequest; -import org.nl.acs.ext.wms.service.AcsToWmsService; -import org.nl.acs.utils.ReadUtil; -import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.route.service.RouteLineService; -import org.nl.acs.task.service.TaskService; +import org.nl.acs.log.service.DeviceExecuteLogService; +import org.nl.acs.monitor.DeviceStageMonitor; +import org.nl.acs.utils.ReadUtil; import org.nl.config.SpringContextHolder; import org.openscada.opc.lib.da.Server; -import java.util.Date; import java.util.HashMap; import java.util.Map; + /** * 自动门驱动 */ @Slf4j @Data @RequiredArgsConstructor -public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver { +public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, DeviceStageMonitor { protected ItemProtocol itemProtocol = new ItemProtocol(this); + DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); + int open = 0; + int close = 0; - DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl"); + int last_open = 0; + int last_close = 0; - RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl"); - - TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl"); - - AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); - String container; - String container_type_desc; - String last_container_type_desc; - String last_container; - //放货准备锁 - String putReadyLock = null; - //有货标记 - protected boolean has_goods_tag = false; - String devicecode; - int mode = 0; - int action = 0; - int error = 0; - Boolean iserror = false; - - int move = 0; - int task = 0; - int state = 0; - int last_state = 0; - int last_action = 0; - int last_mode = 0; - int last_error = 0; - int last_move = 0; - int last_task = 0; - - boolean hasVehicle = false; - boolean isReady = false; - protected int instruction_num = 0; - protected int instruction_num_truth = 0; - protected boolean hasGoods = false; - boolean isFold = false; - private String assemble_check_tag; - private Boolean sampleMode0; - private Boolean sampleMode3; - private Integer sampleError; - private Boolean sampleOnline; - protected String displayMessage = null; - public int display_message_time_out = 30000; - public Date display_message_time; - protected String current_stage_instruction_message; - protected String last_stage_instruction_message; - Integer heartbeat_tag; - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - - int to_command = 0; - int last_to_command = 0; - - - - private int instruction_require_time_out; - boolean requireSucess = false; - - private int instruction_finished_time_out; - - int branchProtocol = 0; + int toOpen = 0; + int last_toOpen = 0; + int toClose = 0; + int last_toClose = 0; + String device_code = null; @Override public Device getDevice() { @@ -107,55 +50,48 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem public void execute() { String message = null; - String device_code = this.getDevice().getDevice_code(); - mode = this.itemProtocol.getMode(); - action = this.itemProtocol.getAction(); - error = this.itemProtocol.getError(); - to_command = this.itemProtocol.getToCommand(); - if (mode != last_mode) { + device_code = this.getDevice().getDevice_code(); + open = this.itemProtocol.getOpen(); + close = this.itemProtocol.getClose(); + toOpen = this.itemProtocol.getToOpen(); + toClose = this.itemProtocol.getToClose(); + if (open != last_open) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号open:" + last_open + "->" + open); } - if (action != last_action) { + if (close != last_close) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号close:" + last_close + "->" + close); + if(close ==1 ){ + this.writing("to_close","0"); + } } - if (error != last_error) { - } - if (state != last_state) { - //固化室状态变更后通知lms更新固化室状态 - FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest(); - request.setState(String.valueOf(state)); - request.setDevice_code(this.devicecode); - request.setType(CommonFinalParam.ONE); - acsToWmsService.notify(request); - } - last_action = action; - last_mode = mode; - last_error = error; - last_state = state; - last_to_command = to_command; - //message = StringFormatUtl.format("设备报警:{}", new Object[]{}); - -// String manual_create_task = this.getDevice().getExtraValue().get("manual_create_task").toString(); + if (toClose != last_toClose) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号toClose:" + last_toClose + "->" + toClose); + } + if (toOpen != last_toOpen) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号toOpen:" + last_toOpen + "->" + toOpen); + } + last_open = open; + last_close = close; + last_toClose = toClose; + last_toOpen = toOpen; } - public synchronized String getStatus() { - JSONObject jo = new JSONObject(); - if (action == 1) { - jo.put("name", this.getDevice().getDevice_code()); - jo.put("status", "OPEN"); + public void writing(String param, String value) { + String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + param; + Map itemMap = new HashMap(); + itemMap.put(to_param, Integer.parseInt(value)); - } else if (action == 2) { - jo.put("name", this.getDevice().getDevice_code()); - jo.put("status", "CLOSE"); - - } else { - jo.put("name", this.getDevice().getDevice_code()); - jo.put("status", "ERROR"); + try { + this.checkcontrol(itemMap); + } catch (Exception e) { + e.printStackTrace(); } - return jo.toString(); + logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value); } - public void writing(String param, int command) { String to_command = String.format("%s.%s.%s.%s", this.getDevice().getOpc_server_code(), this.getDevice().getOpc_plc_code(), this.getDevice().getDevice_code(), param); @@ -165,19 +101,37 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem itemMap.put(to_command, command); ReadUtil.write(itemMap, server); log.info("下发PLC信号:{},{}", to_command, command); - System.out.println("设备:" + devicecode + ",下发PLC信号:" + to_command + ",value:" + command); + System.out.println("设备:" + this.device_code + ",下发PLC信号:" + to_command + ",value:" + command); } - public synchronized void OpenOrClose(String type) { - - //开门 - if (CommonFinalParam.ONE.equals(type)) { - writing(ItemProtocol.item_to_command, 1); - } else { - writing(ItemProtocol.item_to_command, 2); + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String open = ""; + String close = ""; + if (this.getOpen() == 0) { + open = "未知"; + } else if (this.getOpen() == 1) { + open = "开到位"; } + if (this.getClose() == 0) { + open = "未知"; + } else if (this.getClose() == 1) { + open = "关到位"; + } + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("open", open); + jo.put("close", close); + jo.put("isOnline", true); + + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { } + } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/box_manipulator_site/BoxManipulatorSiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/box_manipulator_site/BoxManipulatorSiteDeviceDriver.java index aa355dcb8..a2e21c0bf 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/box_manipulator_site/BoxManipulatorSiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/box_manipulator_site/BoxManipulatorSiteDeviceDriver.java @@ -274,19 +274,19 @@ public class BoxManipulatorSiteDeviceDriver extends AbstractOpcDeviceDriver impl //if (!requireSucess) { String remark = "";; if (mode != 2) { - remark = remark + "universal_remark2"; + remark = "universal_remark2"; } if (move != 0) { - remark = remark + "universal_remark3"; + remark = "universal_remark3"; } if (task != 0) { - remark = remark + "universal_remark4"; + remark = "universal_remark4"; if (ObjectUtil.isNotEmpty(this.inst)) { this.inst = null; } } if (requireSucess) { - remark = remark + "universal_remark5"; + remark = "universal_remark5"; } this.setNotCreateTaskMessage(remark); //} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java index 2e4f0e196..c5bca803d 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java @@ -236,7 +236,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements if (mode != last_mode) { - requireSucess = false; } @@ -272,7 +271,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements break; case 2: //申请任务 - if (move == 1 && !requireSucess) { + if (move == 1 && !requireSucess && task==0) { instruction_require(); } break; @@ -291,12 +290,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements applyAgvTask(); } break; - case 6: - //二楼到一楼输送线申请行架任务 - if (move == 1 && !requireSucess) { - applyManipulatorTask(); - } - break; + default: break; @@ -320,34 +314,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements } - private void applyManipulatorTask() { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return; - } else { - JSONObject param = new JSONObject(); - param.put("device_code", device_code); - param.put("material_barcode", material_barcode); - logServer.deviceExecuteLog(this.device_code, "", "", "二楼到一楼输送线申请行架任务,参数:" + param); - String response = acsToWmsService.applyTowToOne(param); - JSONObject jo = JSON.parseObject(response); - if (response == null || jo.getInteger("status") == 200) { - LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code(device_code) - .content("二楼到一楼输送线申请行架任务,参数,接口返回:" + jo) - .build(); - luceneExecuteLogService.deviceExecuteLog(logDto2); - this.requireSucess = true; - } else { - LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code(device_code) - .content("二楼到一楼输送线申请行架任务,返回参数:" + jo.getString("body")) - .build(); - luceneExecuteLogService.deviceExecuteLog(logDto2); - } - } - } + public void writing(int command) { @@ -490,7 +457,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements } List list = new ArrayList(); writeData(next_addr, list, inst); - led_message = getLedMessage(inst); +// led_message = getLedMessage(inst); requireSucess = true; return true; } else { @@ -499,7 +466,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements if (ObjectUtil.isNull(taskdto)) { return false; } - if (ObjectUtil.isNotNull(taskdto) && TaskTypeEnum.Conveyor_Task.getIndex().equals(taskdto.getTask_type())) { + if (ObjectUtil.isNotNull(taskdto)) { //判断指令的起点和当前的设备号相同 if (!taskdto.getStart_device_code().equals(device_code)) { return false; @@ -565,7 +532,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements String next_addr = nextdevice.getExtraValue().get("address").toString(); List list = new ArrayList(); writeData(next_addr, list, instdto); - led_message = getLedMessage(instdto); +// led_message = getLedMessage(instdto); requireSucess = true; return true; } @@ -589,7 +556,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements list.add(map2); Map map3 = new HashMap(); map3.put("code", "to_container_type"); - map3.put("value", "1"); + map3.put("value", inst.getVehicle_type()); list.add(map3); Map map4 = new HashMap(); map4.put("code", "to_container_no"); @@ -703,23 +670,24 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements return jo; } - /** - * 获取任务信息 - */ - public JSONObject getLedMessage(Instruction instdto) { - JSONObject json = new JSONObject(); - json.put("task_code", instdto.getTask_code()); - json.put("inst_code", instdto.getInstruction_code()); - json.put("start_device_code", instdto.getStart_device_code()); - json.put("next_device_code", instdto.getNext_device_code()); - json.put("material_type", instdto.getMaterial()); - json.put("quantity", instdto.getQuantity()); - json.put("vehicle_code", instdto.getVehicle_code()); - json.put("instruction_status", instdto.getInstruction_status()); - json.put("entry_time", instdto.getCreate_time()); - json.put("ip", localhost); - return json; - } +// /** +// * 获取任务信息 +// */ +// public JSONObject getLedMessage(Instruction instdto) { +// JSONObject json = new JSONObject(); +// json.put("task_code", instdto.getTask_code()); +// json.put("inst_code", instdto.getInstruction_code()); +// json.put("start_device_code", instdto.getStart_device_code()); +// json.put("next_device_code", instdto.getNext_device_code()); +// json.put("material_type", instdto.getMaterial()); +// json.put("quantity", instdto.getQuantity()); +// json.put("vehicle_code", instdto.getVehicle_code()); +// json.put("instruction_status", instdto.getInstruction_status()); +// json.put("entry_time", instdto.getCreate_time()); +// String acsIp = paramService.findByCode(AcsConfig.ACSIP).getValue(); +// json.put("ip", acsIp); +// return json; +// } /** diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/ItemProtocol.java index 29b39a622..9077fd383 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/ItemProtocol.java @@ -11,7 +11,7 @@ import java.util.List; @Slf4j @Data -public class ItemProtocol { +public class ItemProtocol { /** * 心跳 diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/led/led_screen/LedScreenDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/led/led_screen/LedScreenDeviceDriver.java index be389c2bd..6f9df8f70 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/led/led_screen/LedScreenDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/led/led_screen/LedScreenDeviceDriver.java @@ -20,6 +20,7 @@ import org.nl.acs.monitor.DeviceStageMonitor; public class LedScreenDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { @Override public void execute() { + //todo:判断当前对接位有货变没货后十五秒清屏 } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/BlankManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/BlankManipulatorDeviceDriver.java index 07dee0f30..f3b26ae2b 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/BlankManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/BlankManipulatorDeviceDriver.java @@ -268,13 +268,13 @@ // remark = remark + "光电信号(move)为有货状态,"; // } // if (task != 0) { -// remark = remark + "universal_remark4"; +// remark = "universal_remark4"; // if (ObjectUtil.isNotEmpty(this.inst)) { // this.inst = null; // } // } // if (requireSucess) { -// remark = remark + "universal_remark5"; +// remark = "universal_remark5"; // } // this.setNotCreateTaskMessage(remark); // //} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/DryManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/DryManipulatorDeviceDriver.java index 011d11919..d18463010 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/DryManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/DryManipulatorDeviceDriver.java @@ -267,13 +267,13 @@ // remark = remark + "光电信号(move)为有货状态,"; // } // if (task != 0) { -// remark = remark + "universal_remark4"; +// remark = "universal_remark4"; // if (ObjectUtil.isNotEmpty(this.inst)) { // this.inst = null; // } // } // if (requireSucess) { -// remark = remark + "universal_remark5"; +// remark = "universal_remark5"; // } // this.setNotCreateTaskMessage(remark); // //} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/OvenGantryManipulatorDeviceDriver.java index 4443518e9..1adf84f54 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -273,13 +273,13 @@ // remark = remark + "光电信号(move)为有货状态,"; // } // if (task != 0) { -// remark = remark + "universal_remark4"; +// remark = "universal_remark4"; // if (ObjectUtil.isNotEmpty(this.inst)) { // this.inst = null; // } // } // if (requireSucess) { -// remark = remark + "universal_remark5"; +// remark = "universal_remark5"; // } // this.setNotCreateTaskMessage(remark); // //} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDefination.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDefination.java index b6d85f0f3..9824fc6ca 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDefination.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDefination.java @@ -11,7 +11,7 @@ import java.util.LinkedList; import java.util.List; /** - * 一楼木箱出入库站点 + * 子卷下卷输送线工位(二楼下一楼区域) * */ @Service @@ -23,12 +23,12 @@ public class BoxStorageOutConveyorDefination implements OpcDeviceDriverDefinatio @Override public String getDriverName() { - return "一楼木箱出入库标准站点"; + return "子卷下卷输送线工位(二楼下一楼区域)"; } @Override public String getDriverDescription() { - return "一楼木箱出入库标准站点"; + return "子卷下卷输送线工位(二楼下一楼区域)"; } @Override 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 abbec24ea..93ce55e46 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 @@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; @@ -37,6 +38,8 @@ import org.nl.acs.task.service.dto.TaskDto; import org.nl.common.utils.SecurityUtils; import org.nl.config.SpringContextHolder; import org.nl.config.language.LangProcess; +import org.nl.config.lucene.service.LuceneExecuteLogService; +import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.config.thread.ThreadPoolExecutorUtil; import org.openscada.opc.lib.da.Server; @@ -74,6 +77,10 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class); DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); + + LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl"); + + //当前指令 Instruction inst = null; @@ -114,6 +121,10 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i int to_height = 0; int last_to_height = 0; + //子卷条码 + String material_barcode = null; + String last_material_barcode = null; + int phase = 0; int index = 0; Boolean isonline = true; @@ -174,6 +185,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i to_target = this.itemProtocol.getTo_target(); to_task = this.itemProtocol.getTo_task(); heartbeat = this.itemProtocol.getHeartbeat(); + material_barcode = this.itemProtocol.getMaterialBarcode(); if (mode != last_mode) { JSONObject param = new JSONObject(); param.put("device_code", this.device_code); @@ -221,6 +233,12 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i instruction_require(); } break; + case 4: + //二楼到一楼输送线申请行架任务 + if (move == 1 && !requireSucess) { + applyManipulatorTask(); + } + break; } } last_mode = mode; @@ -313,6 +331,35 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i } } + private void applyManipulatorTask() { + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; + } else { + JSONObject param = new JSONObject(); + param.put("device_code", device_code); + param.put("material_barcode", material_barcode); + logServer.deviceExecuteLog(this.device_code, "", "", "二楼到一楼输送线申请行架任务,参数:" + param); + String response = acsToWmsService.applyTowToOne(param); + JSONObject jo = JSON.parseObject(response); + if (response == null || jo.getInteger("status") == 200) { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(device_code) + .content("二楼到一楼输送线申请行架任务,参数,接口返回:" + jo) + .build(); + luceneExecuteLogService.deviceExecuteLog(logDto2); + this.requireSucess = true; + } else { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(device_code) + .content("二楼到一楼输送线申请行架任务,返回参数:" + jo.getString("body")) + .build(); + luceneExecuteLogService.deviceExecuteLog(logDto2); + } + } + } + /** * 请求指令 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 0c3193f9a..432f2ba4c 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 @@ -65,6 +65,11 @@ public class ItemProtocol { */ public static String item_to_task = "to_task"; + /** + * 子卷条码 + */ + public static String item_material_barcode = "material_barcode"; + private BoxStorageOutConveyorDeviceDriver driver; @@ -82,6 +87,10 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_heartbeat); } + public String getMaterialBarcode() { + return this.getOpcStringValue(item_material_barcode); + } + public int getMode() { return this.getOpcIntegerValue(item_mode); } @@ -134,6 +143,16 @@ public class ItemProtocol { } + public String getOpcStringValue(String protocol) { + String value = this.driver.getStringValue(protocol); + if (StrUtil.isBlank(value)) { + + } else { + return value; + } + return "0"; + } + public static List getReadableItemDtos() { @@ -146,6 +165,7 @@ public class ItemProtocol { list.add(new ItemDto(item_error, "报警信号", "DB600.B6")); list.add(new ItemDto(item_container_type, "托盘类型", "DB101.B7")); list.add(new ItemDto(item_task, "任务号", "DB600.D10")); + list.add(new ItemDto(item_material_barcode, "子卷条码", "DB601.STRING1.50")); return list; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java index 2d45376f9..a2411a907 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java @@ -271,14 +271,14 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr this.require_apply_strangulation_time = date; // String vehicle_code = ""; // -// if (StrUtil.isEmpty(vehicle_code)) { -// message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message11"); -// return; -// } - + Instruction inst = instructionService.findByCodeFromCache(String.valueOf(task)); + if (StrUtil.isEmpty(inst.getVehicle_code())) { + message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message11"); + return; + } JSONObject param = new JSONObject(); param.put("device_code", device_code); - param.put("vehicle_code", material_barcode); + param.put("vehicle_code", inst.getVehicle_code()); param.put("type", AcsToLmsApplyTaskTypeEnum.LABEL_BIND.getType()); String response = acsToWmsService.deviceApplyTwo(param); JSONObject jo = JSON.parseObject(response); @@ -289,7 +289,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr .build(); luceneExecuteLogService.deviceExecuteLog(logDto2); // Map datas = applyLabelingAndBindingResponse.getData(); - packagePLCData(jo.getString("body")); + packagePLCData(jo.getString("data")); requireSucess = true; } else { LuceneLogDto logDto2 = LuceneLogDto.builder() diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java index 6b9d6f562..49de8247c 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java @@ -242,10 +242,10 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements //if (!requireSucess) { String remark = "";; if (mode != 2) { - remark = remark + "universal_remark2"; + remark = "universal_remark2"; } if (move != 0) { - remark = remark + "universal_remark3"; + remark = "universal_remark3"; } if (task != 0) { remark = remark + LangProcess.msg("universal_remark4"); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator_cache/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/manipulator_cache/ItemProtocol.java similarity index 85% rename from acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator_cache/ItemProtocol.java rename to acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/manipulator_cache/ItemProtocol.java index 71b485ae6..bcf594ec4 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator_cache/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/manipulator_cache/ItemProtocol.java @@ -1,4 +1,4 @@ -package org.nl.acs.device_driver.manipulator_cache; +package org.nl.acs.device_driver.one_conveyor.manipulator_cache; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -18,6 +18,8 @@ public class ItemProtocol { //动作信号 public static String item_action = "action"; + public static String item_to_command = "to_command"; + private ManipulatorCacheDeviceDriver driver; public ItemProtocol(ManipulatorCacheDeviceDriver driver) { @@ -49,6 +51,7 @@ public class ItemProtocol { public static List getReadableItemDtos() { ArrayList list = new ArrayList<>(); + list.add(new ItemDto(item_to_command, "作业命令", "DB200.W2", Boolean.valueOf(true))); list.add(new ItemDto(item_mode, "工作模式", "DB1.B1")); list.add(new ItemDto(item_action, "动作信号", "DB1.B3")); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator_cache/ManipulatorCacheDefination.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/manipulator_cache/ManipulatorCacheDefination.java similarity index 67% rename from acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator_cache/ManipulatorCacheDefination.java rename to acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/manipulator_cache/ManipulatorCacheDefination.java index 8f4788020..781f7f6c1 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator_cache/ManipulatorCacheDefination.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/manipulator_cache/ManipulatorCacheDefination.java @@ -1,49 +1,62 @@ -package org.nl.acs.device_driver.manipulator_cache; - -import org.nl.acs.device.domain.Device; -import org.nl.acs.device.enums.DeviceType; -import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.DeviceDriverDefination; -import org.springframework.stereotype.Service; - -import java.util.LinkedList; -import java.util.List; - -/** - * 扫码器 - */ -@Service -public class ManipulatorCacheDefination implements DeviceDriverDefination { - @Override - public String getDriverCode() { - return "manipulator_cache"; - } - - @Override - public String getDriverName() { - return "行架对接缓存位"; - } - - @Override - public String getDriverDescription() { - return "行架对接缓存位"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new ManipulatorCacheDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return ManipulatorCacheDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.conveyor); - return types; - } -} +package org.nl.acs.device_driver.one_conveyor.manipulator_cache; + +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; +import org.nl.acs.device.domain.Device; +import org.nl.acs.device.enums.DeviceType; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.DeviceDriverDefination; +import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; +import org.springframework.stereotype.Service; + +import java.util.LinkedList; +import java.util.List; + +/** + * 行架对接缓存位 + */ +@Service +public class ManipulatorCacheDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "manipulator_cache"; + } + + @Override + public String getDriverName() { + return "行架对接缓存位"; + } + + @Override + public String getDriverDescription() { + return "行架对接缓存位"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new ManipulatorCacheDeviceDriver()).setDevice(device).setDriverDefination(this); + + } + + @Override + public List getReadableItemDtos() { + return ItemProtocol.getReadableItemDtos(); + } + + @Override + public List getWriteableItemDtos() { + return null; + } + + + @Override + public Class getDeviceDriverType() { + return ManipulatorCacheDeviceDriver.class; + } + + @Override + public List getFitDeviceTypes() { + List types = new LinkedList(); + types.add(DeviceType.conveyor); + return types; + } +} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator_cache/ManipulatorCacheDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/manipulator_cache/ManipulatorCacheDeviceDriver.java similarity index 89% rename from acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator_cache/ManipulatorCacheDeviceDriver.java rename to acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/manipulator_cache/ManipulatorCacheDeviceDriver.java index b3a81d76d..9fcc854c4 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator_cache/ManipulatorCacheDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/manipulator_cache/ManipulatorCacheDeviceDriver.java @@ -1,113 +1,111 @@ -package org.nl.acs.device_driver.manipulator_cache; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSONObject; -import lombok.Data; -import lombok.extern.slf4j.Slf4j; - -import org.nl.acs.device.domain.Device; - -import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.FeedLmsRealFailed; -import org.nl.acs.device_driver.RouteableDeviceDriver; -import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; -import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -import org.nl.acs.instruction.domain.Instruction; -import org.nl.acs.monitor.DeviceStageMonitor; -import org.nl.config.language.LangProcess; -import org.nl.config.thread.ThreadPoolExecutorUtil; -import org.openscada.opc.lib.da.Server; - -import java.util.*; -import java.util.concurrent.ThreadPoolExecutor; - -/** - * 标准版扫码器 - */ -@Slf4j -@Data -public class ManipulatorCacheDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { - private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); - protected ItemProtocol itemProtocol = new ItemProtocol(this); - - //当前指令 - Instruction inst = null; - - private String error_type = "ssx_error_type"; - - //工作模式 - int mode = 0; - int last_mode = 0; - - //任务号 - int action = 0; - int last_action = 0; - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute() { - action = this.itemProtocol.getAction(); - mode = this.itemProtocol.getMode(); - } - - - - - public boolean exe_business() { - return true; - } - - - - - - public void executing(Server server, Map itemMap) { - this.control(itemMap); - } - - public void writing(int command) { - Map itemMap = new HashMap(); - this.control(itemMap); - } - - - @Override - public JSONObject getDeviceStatusName() { - JSONObject jo = new JSONObject(); - String mode = ""; - String move = ""; - if (this.getMode() == 0) { - mode = LangProcess.msg("universal_off-line"); - } else if (this.getMode() == 1) { - mode = LangProcess.msg("universal_stand-alone"); - } else if (this.getMode() == 2) { - mode = LangProcess.msg("universal_standby"); - } else if (this.getMode() == 3) { - mode = LangProcess.msg("universal_operation"); - } - jo.put("device_name", this.getDevice().getDevice_name()); - jo.put("mode", mode); - jo.put("action", action); - - return jo; - } - - @Override - public void setDeviceStatus(JSONObject data) { - - } - - - @Override - public JSONObject feedLmsRealFailedInfo() { - return null; - } -} +package org.nl.acs.device_driver.one_conveyor.manipulator_cache; + +import com.alibaba.fastjson.JSONObject; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; + +import org.nl.acs.device.domain.Device; + +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.FeedLmsRealFailed; +import org.nl.acs.device_driver.RouteableDeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.instruction.domain.Instruction; +import org.nl.acs.monitor.DeviceStageMonitor; +import org.nl.config.language.LangProcess; +import org.nl.config.thread.ThreadPoolExecutorUtil; +import org.openscada.opc.lib.da.Server; + +import java.util.*; +import java.util.concurrent.ThreadPoolExecutor; + +/** + * 行架对接缓存位 + */ +@Slf4j +@Data +public class ManipulatorCacheDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { + private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); + protected ItemProtocol itemProtocol = new ItemProtocol(this); + + //当前指令 + Instruction inst = null; + + private String error_type = "ssx_error_type"; + + //工作模式 + int mode = 0; + int last_mode = 0; + + //任务号 + int action = 0; + int last_action = 0; + + + + @Override + public Device getDevice() { + return this.device; + } + + + @Override + public void execute() { + action = this.itemProtocol.getAction(); + mode = this.itemProtocol.getMode(); + } + + + + + public boolean exe_business() { + return true; + } + + + + + + public void executing(Server server, Map itemMap) { + this.control(itemMap); + } + + public void writing(int command) { + Map itemMap = new HashMap(); + this.control(itemMap); + } + + + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String mode = ""; + String move = ""; + if (this.getMode() == 0) { + mode = LangProcess.msg("universal_off-line"); + } else if (this.getMode() == 1) { + mode = LangProcess.msg("universal_stand-alone"); + } else if (this.getMode() == 2) { + mode = LangProcess.msg("universal_standby"); + } else if (this.getMode() == 3) { + mode = LangProcess.msg("universal_operation"); + } + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("mode", mode); + jo.put("action", action); + + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + + } + + + @Override + public JSONObject feedLmsRealFailedInfo() { + return null; + } +} 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 aced999f3..cf482826e 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 @@ -12,6 +12,7 @@ import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; +import org.nl.acs.AcsConfig; import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.device.domain.Device; import org.nl.acs.device.service.DeviceExtraService; @@ -21,6 +22,7 @@ import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.device_driver.led.led_screen.LedScreenDeviceDriver; import org.nl.acs.enums.StorageTypeEnum; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.history.ErrorUtil; @@ -40,11 +42,14 @@ import org.nl.acs.task.enums.TaskStatusEnum; import org.nl.acs.task.enums.TaskTypeEnum; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; +import org.nl.acs.taskscreen.service.TaskScreenService; +import org.nl.common.exception.BadRequestException; import org.nl.common.utils.SecurityUtils; import org.nl.config.SpringContextHolder; import org.nl.config.language.LangProcess; import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.config.lucene.service.dto.LuceneLogDto; +import org.nl.system.service.param.ISysParamService; import org.springframework.beans.factory.annotation.Autowired; import java.util.*; @@ -76,6 +81,10 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); + + ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); + + TaskScreenService taskScreenService = SpringContextHolder.getBean(TaskScreenService.class); //工作模式 int mode = 0; int last_mode = 0; @@ -131,6 +140,10 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv String material_barcode = null; String last_material_barcode = null; + String hand_barcode = null; + + String hand_material_barcode = null; + //数量 int qty = 0; int last_qty = 0; @@ -165,6 +178,10 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv //当前指令 Instruction inst = null; + /** + * led点阵屏信息 + */ + JSONObject led_message = null; //0 无任务执行 1更新指令状态 2下发电气信号 3允许取货 允许放货 5放货完成 int now_steps_type = 0; @@ -217,6 +234,29 @@ 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(move !=last_move){ + if (ObjectUtil.isNotEmpty(inst)){ + if (move==0){ + Thread.sleep(10000); + led_message = clearMessage(); + List deviceCodes = this.getExtraDeviceCodes("link_device_code"); + String device = null; + if (ObjectUtil.isNotEmpty(deviceCodes)) { + for (String deviceCode : deviceCodes) { + Device linkDevice = deviceAppService.findDeviceByCode(deviceCode); + if (ObjectUtil.isEmpty(linkDevice)) { + throw new BadRequestException("设备:" + device_code + "关联设备->" + deviceCode + "为空!"); + } + if (linkDevice.getDeviceDriver() instanceof LedScreenDeviceDriver){ + device = deviceCode; + } + } + } + taskScreenService.getLedMessage(device); + } + } + requireSucess = false; + } if (move != 0 && task > 0) { update_instruction_status(); @@ -264,10 +304,10 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv //if (!requireSucess) { String remark = "";; if (mode != 2) { - remark = remark + "universal_remark2"; + remark = "universal_remark2"; } if (move != 0) { - remark = remark + "universal_remark3"; + remark = "universal_remark3"; } if (task != 0) { remark = remark + LangProcess.msg("universal_remark4"); @@ -449,6 +489,12 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv Integer start = 0; String start_device_code = pathlist.get(start); String next_device_code = pathlist.get(start+1); + //判断有无出入库任务是相同路线 + TaskDto dto = taskserver.findByCodeAndExcute(taskdto.getNext_device_code(), taskdto.getStart_device_code()); + if (ObjectUtil.isNotEmpty(dto)){ + requireSucess = false; + return false; + } packageInstrcutData(instdto, taskdto, taskid, taskcode, vehiclecode, priority,start_device_code,next_device_code); }else { @@ -483,6 +529,21 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv map3.put("value", "1"); list.add(map3); this.writing(list); + led_message = getLedMessage(instdto); + List deviceCodes = this.getExtraDeviceCodes("link_device_code"); + String device = null; + if (ObjectUtil.isNotEmpty(deviceCodes)) { + for (String deviceCode : deviceCodes) { + Device linkDevice = deviceAppService.findDeviceByCode(deviceCode); + if (ObjectUtil.isEmpty(linkDevice)) { + throw new BadRequestException("设备:" + device_code + "关联设备->" + deviceCode + "为空!"); + } + if (linkDevice.getDeviceDriver() instanceof LedScreenDeviceDriver){ + device = deviceCode; + } + } + } + taskScreenService.getLedMessage(device); requireSucess = true; while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() , instdto.getInstruction_code())) { @@ -503,6 +564,43 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv } } + /** + * 获取任务信息 + */ + public JSONObject getLedMessage(Instruction instdto) { + JSONObject json = new JSONObject(); + json.put("task_code", instdto.getTask_code()); + json.put("inst_code", instdto.getInstruction_code()); + json.put("start_device_code", instdto.getStart_device_code()); + json.put("next_device_code", instdto.getNext_device_code()); + json.put("material_type", instdto.getMaterial()); + json.put("quantity", instdto.getQuantity()); + json.put("vehicle_code", instdto.getVehicle_code()); + json.put("instruction_status", instdto.getInstruction_status()); + json.put("entry_time", instdto.getCreate_time()); + String acsIp = paramService.findByCode(AcsConfig.ACSIP).getValue(); + json.put("ip", acsIp); + return json; + } + + /** + * 清空任务信息任务信息 + */ + public JSONObject clearMessage() { + JSONObject json = new JSONObject(); + json.put("task_code", ""); + json.put("inst_code", ""); + json.put("start_device_code", ""); + json.put("next_device_code", ""); + json.put("material_type", ""); + json.put("quantity", ""); + json.put("vehicle_code", ""); + json.put("instruction_status", ""); + json.put("entry_time", ""); + json.put("ip", ""); + return json; + } + private void packageInstrcutData(Instruction instdto, TaskDto taskdto, String taskid, String taskcode, String vehiclecode, String priority,String startCode, String endCode) { instdto.setInstruction_id(IdUtil.simpleUUID()); instdto.setRoute_plan_code(taskdto.getRoute_plan_code()); @@ -597,6 +695,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv jo.put("device_name", this.getDevice().getDevice_name()); jo.put("mode", mode); + jo.put("hand_barcode", hand_barcode); jo.put("move", move); jo.put("action", action); jo.put("task", task); @@ -607,7 +706,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv jo.put("notCreateTaskMessage", notCreateTaskMessage); jo.put("notCreateInstMessage", notCreateInstMessage); jo.put("feedMessage", LangProcess.msg(feedMessage)); - jo.put("driver_type", "siemens_conveyor"); + jo.put("driver_type", "conveyor_with_scanner_weight"); jo.put("is_click", true); return jo; } @@ -620,6 +719,10 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv } else if (StrUtil.equals(requestSucess, "1")) { this.requireSucess = true; } + String hand_barcode = data.getString("hand_barcode"); + this.setHand_barcode(hand_barcode); + String hand_material_barcode = data.getString("hand_material_barcode"); + this.setHand_material_barcode(hand_material_barcode); } @Override diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java index f78323db8..92cc3f01a 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java @@ -1,7 +1,6 @@ package org.nl.acs.device_driver.one_manipulator.box_package_manipulator; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; @@ -20,8 +19,8 @@ import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -import org.nl.acs.device_driver.manipulator_cache.ManipulatorCacheDeviceDriver; import org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor.BoxSubvolumesConveyorDeviceDriver; +import org.nl.acs.device_driver.one_conveyor.manipulator_cache.ManipulatorCacheDeviceDriver; import org.nl.acs.history.ErrorUtil; import org.nl.acs.history.service.DeviceErrorLogService; import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; @@ -80,11 +79,11 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i int task = 0; int last_task = 0; // x坐标 - float x_position = 0; - float last_x_position = 0; + float x = 0.0f; + float last_x = 0.0f; // y坐标 - float y_position = 0; - float last_y_position = 0; + float y = 0.0f; + float last_y = 0.0f; int heartbeat = 0; int last_heartbeat = 0; @@ -114,7 +113,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i Boolean isonline = true; int hasGoods = 0; - String message = null; + String message = ""; Boolean iserror = false; private Date instruction_update_time = new Date(); private int instruction_update_time_out = 1000; @@ -150,6 +149,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i List putDeviceCodeList = null; + @Override public Device getDevice() { return this.device; @@ -171,8 +171,8 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i to_target = this.itemProtocol.getTo_target(); to_task = this.itemProtocol.getTo_task(); to_onset = this.itemProtocol.getTo_onset(); - x_position = this.itemProtocol.getX_position(); - y_position = this.itemProtocol.getY_position(); + x = this.itemProtocol.getX(); + y = this.itemProtocol.getY(); to_seq = this.itemProtocol.getTo_seq(); to_max_no = this.itemProtocol.getTo_max_no(); to_direction = this.itemProtocol.getTo_direction(); @@ -220,19 +220,19 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } else { String remark = "";; if (mode != 2) { - remark = remark + "universal_remark2"; + remark = "universal_remark2"; } if (move != 0) { - remark = remark + "universal_remark3"; + remark = "universal_remark3"; } if (task != 0) { - remark = remark + "universal_remark4"; + remark = "universal_remark4"; if (ObjectUtil.isNotEmpty(this.inst)) { this.inst = null; } } if (requireSucess) { - remark = remark + "universal_remark5"; + remark = "universal_remark5"; } this.setNotCreateTaskMessage(remark); } @@ -249,8 +249,6 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i last_to_command = to_command; last_to_target = to_target; last_to_onset = to_onset; - last_x_position = x_position; - last_y_position = y_position; last_to_seq = to_seq; last_to_last = to_last; last_to_direction = to_direction; @@ -296,16 +294,16 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i }else { feedMessage = "universal_feedMessage5"; if (mode != 3) { - feedMessage = feedMessage + "universal_feedMessage1"; + feedMessage = "universal_feedMessage1"; } if (action != 8) { - feedMessage = feedMessage + "universal_feedMessage2"; + feedMessage = "universal_feedMessage2"; } if (move != 0) { - feedMessage = feedMessage + "universal_feedMessage3"; + feedMessage = "universal_feedMessage3"; } if (task == 0) { - feedMessage = feedMessage + "universal_feedMessage4"; + feedMessage = "universal_feedMessage4"; } } } @@ -392,10 +390,10 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); } - SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; - if (nextDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { - siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) nextDevice.getDeviceDriver(); - if (siemensConveyorDeviceDriver.getMove() != 1) { + BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver; + if (nextDevice.getDeviceDriver() instanceof BoxSubvolumesConveyorDeviceDriver) { + boxSubvolumesConveyorDeviceDriver = (BoxSubvolumesConveyorDeviceDriver) nextDevice.getDeviceDriver(); + if (boxSubvolumesConveyorDeviceDriver.getMove() != 1) { notCreateInstMessage = "universal_notCreateInstMessage2"; return false; } @@ -404,7 +402,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i ManipulatorCacheDeviceDriver manipulatorCacheDeviceDriver; if (startDevice.getDeviceDriver() instanceof ManipulatorCacheDeviceDriver) { manipulatorCacheDeviceDriver = (ManipulatorCacheDeviceDriver) startDevice.getDeviceDriver(); - if (manipulatorCacheDeviceDriver.getMode() != 2 && manipulatorCacheDeviceDriver.getMode() !=1) { + if (manipulatorCacheDeviceDriver.getMode() != 2 && manipulatorCacheDeviceDriver.getAction() !=1) { notCreateInstMessage = "universal_notCreateInstMessage3"; return false; } @@ -473,19 +471,14 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i map4.put("value", task); list.add(map4); if (ObjectUtil.isNotEmpty(interactionJsonDTO)) { - if (ObjectUtil.isNotEmpty(interactionJsonDTO.getSeq())) { - map5.put("code", "to_seq"); - map5.put("value", interactionJsonDTO.getSeq()); - list.add(map5); - } if (ObjectUtil.isNotEmpty(interactionJsonDTO.getLastOne())) { map6.put("code", "to_last_one"); map6.put("value", interactionJsonDTO.getLastOne()); list.add(map6); } - if (ObjectUtil.isNotEmpty(interactionJsonDTO.getDirection())) { - map7.put("code", "to_direction"); - map7.put("value", interactionJsonDTO.getDirection()); + if (ObjectUtil.isNotEmpty(interactionJsonDTO.getBoxNo())) { + map7.put("code", "to_box_no"); + map7.put("value", interactionJsonDTO.getBoxNo()); list.add(map7); } if (ObjectUtil.isNotEmpty(interactionJsonDTO.getMaxNo())) { @@ -495,8 +488,8 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } if (ObjectUtil.isNotEmpty(interactionJsonDTO.getBarcode())) { - map8.put("code", "to_barcode"); - map8.put("value", interactionJsonDTO.getBarcode()); + map9.put("code", "to_barcode"); + map9.put("value", interactionJsonDTO.getBarcode()); list.add(map9); } } @@ -613,10 +606,10 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i jo.put("notCreateTaskMessage", notCreateTaskMessage); jo.put("notCreateInstMessage", notCreateInstMessage); jo.put("feedMessage", LangProcess.msg(feedMessage)); - jo.put("driver_type", "siemens_conveyor"); + jo.put("driver_type", "box_package_manipulator"); jo.put("is_click", true); - jo.put("x", x_position); - jo.put("y", y_position); + jo.put("x", x); + jo.put("y", y); return jo; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/InteractionJsonDTO.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/InteractionJsonDTO.java index a7695163f..2e45f015c 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/InteractionJsonDTO.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/InteractionJsonDTO.java @@ -9,14 +9,12 @@ public class InteractionJsonDTO { *木箱最大数量 */ private String maxNo; + /** - *子卷摆放方向 + *木箱最大数量 */ - private String direction; - /** - *下发木箱工位顺序 - */ - private String seq; + private String boxNo; + /** *是否最后子卷 diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/ItemProtocol.java index 41cfd2387..9f26e9490 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/ItemProtocol.java @@ -43,11 +43,11 @@ public class ItemProtocol { /** * x轴坐标 */ - public static String item_x_position = "x_position"; + public static String item_x = "x"; /** * y轴坐标 */ - public static String item_y_position = "y_position"; + public static String item_y= "y"; /** @@ -96,6 +96,10 @@ public class ItemProtocol { * 下发是否最后子卷 */ public static String item_to_last_one = "to_last_one"; + /** + *下发木箱条码 + */ + public static String item_to_barcode = "to_barcode"; private BoxPackageManipulatorDeviceDriver driver; @@ -148,12 +152,12 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_to_target); } - public float getX_position() { - return this.getOpcFloatValue(item_x_position); + public float getX() { + return this.getOpcFloatValue(item_x); } - public float getY_position() { - return this.getOpcFloatValue(item_y_position); + public float getY() { + return this.getOpcFloatValue(item_y); } public int getTo_seq(){ @@ -186,6 +190,10 @@ public class ItemProtocol { } + public String getTo_barcode() { + return this.getOpcStringValue(item_to_barcode); + } + public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); if (StrUtil.isEmpty(value)) { @@ -218,8 +226,8 @@ public class ItemProtocol { list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4")); list.add(new ItemDto(item_error, "报警信号", "DB1.B5")); list.add(new ItemDto(item_task, "任务号", "DB1.D6")); - list.add(new ItemDto(item_x_position, "x坐标", "DB1.REAL10")); - list.add(new ItemDto(item_y_position, "y坐标", "DB1.REAL14")); + list.add(new ItemDto(item_x, "x坐标", "DB1.REAL10")); + list.add(new ItemDto(item_y, "y坐标", "DB1.REAL14")); list.add(new ItemDto(item_position, "木箱位置", "DB1.REAL16")); list.add(new ItemDto(item_number, "木箱数量", "DB1.REAL18")); return list; @@ -235,6 +243,8 @@ public class ItemProtocol { list.add(new ItemDto(item_to_direction, "子卷摆放方向", "DB2.D10")); list.add(new ItemDto(item_to_seq, "下发木箱工位顺序", "DB2.W12")); list.add(new ItemDto(item_to_last_one, "下发是否最后子卷", "DB2.W14")); + list.add(new ItemDto(item_to_barcode, "下发木箱条码", "DB601.STRING1.50")); + return list; } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java index 1ee2a9e81..cfeaad9c6 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java @@ -17,6 +17,7 @@ import org.nl.acs.device.service.impl.DeviceExtraServiceImpl; import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; +import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver; import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; @@ -192,19 +193,19 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } else { String remark = "";; if (mode != 2) { - remark = remark + "universal_remark2"; + remark = "universal_remark2"; } if (move != 0) { - remark = remark + "universal_remark3"; + remark = "universal_remark3"; } if (task != 0) { - remark = remark + "universal_remark4"; + remark = "universal_remark4"; if (ObjectUtil.isNotEmpty(this.inst)) { this.inst = null; } } if (requireSucess) { - remark = remark + "universal_remark5"; + remark = "universal_remark5"; } this.setNotCreateTaskMessage(remark); } @@ -253,16 +254,16 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } else { feedMessage = "universal_feedMessage5"; if (mode != 3) { - feedMessage = feedMessage + "universal_feedMessage1"; + feedMessage = "universal_feedMessage1"; } if (action != 8) { - feedMessage = feedMessage + "universal_feedMessage2"; + feedMessage = "universal_feedMessage2"; } if (move != 0) { - feedMessage = feedMessage + "universal_feedMessage3"; + feedMessage = "universal_feedMessage3"; } if (task == 0) { - feedMessage = feedMessage + "universal_feedMessage4"; + feedMessage = "universal_feedMessage4"; } } } @@ -350,10 +351,11 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i notCreateInstMessage = "universal_notCreateInstMessage1"; throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); } - SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; - if (nextDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { - siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) nextDevice.getDeviceDriver(); - if (siemensConveyorDeviceDriver.getMove() != 1) { + //存在托盘才可以申请任务 + BeltConveyorDeviceDriver beltConveyorDeviceDriver; + if (nextDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { + beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) nextDevice.getDeviceDriver(); + if (beltConveyorDeviceDriver.getMove() != 1) { notCreateInstMessage = "universal_notCreateInstMessage2"; return false; } @@ -425,7 +427,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i list.add(map4); if (ObjectUtil.isNotEmpty(interactionJsonDTO)) { if (ObjectUtil.isNotEmpty(interactionJsonDTO.getWeight())) { - map5.put("code", "to_weight"); + map5.put("code", "to_width"); map5.put("value", interactionJsonDTO.getWeight()); list.add(map5); } @@ -559,7 +561,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i jo.put("notCreateTaskMessage", notCreateTaskMessage); jo.put("notCreateInstMessage", notCreateInstMessage); jo.put("feedMessage", LangProcess.msg(feedMessage)); - jo.put("driver_type", "siemens_conveyor"); + jo.put("driver_type", "box_storage_manipulator"); jo.put("is_click", true); return jo; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/ItemProtocol.java index 796dee308..8f3d8a53b 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/ItemProtocol.java @@ -42,6 +42,18 @@ public class ItemProtocol { public static String item_walk_y = "walk_y"; + + /** + * 行走列 + */ + public static String item_x = "x"; + + /** + * 行走层号 + */ + public static String item_y = "y"; + + /** * 下发命令 */ @@ -68,7 +80,7 @@ public class ItemProtocol { /** *木箱宽度 */ - public static String item_to_weight = "to_weight"; + public static String item_to_width = "to_width"; /** *木箱高度 */ @@ -86,6 +98,16 @@ public class ItemProtocol { private BoxStorageManipulatorDeviceDriver driver; + + + public float getX() { + return this.getOpcFloatValue(item_x); + } + + public float getY() { + return this.getOpcFloatValue(item_y); + } + public ItemProtocol(BoxStorageManipulatorDeviceDriver driver){ this.driver=driver; } @@ -161,6 +183,18 @@ public class ItemProtocol { return 0; } + public float getOpcFloatValue(String protocol) { + Float value = this.driver.getDoubleValue(protocol); + if (value == null) { + // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); if (StrUtil.isBlank(value)) { @@ -180,6 +214,8 @@ public class ItemProtocol { list.add(new ItemDto(item_error, "报警信号", "DB1.B5")); list.add(new ItemDto(item_task, "任务号", "DB1.D6")); list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4")); + list.add(new ItemDto(item_x, "行走列号", "DB101.B10")); + list.add(new ItemDto(item_y, "行走层号", "DB101.B11")); return list; } @@ -190,7 +226,7 @@ public class ItemProtocol { list.add(new ItemDto(item_to_task, "下发任务号", "DB2.D6")); list.add(new ItemDto(item_to_onset, "下发起始站", "DB2.W2")); list.add(new ItemDto(item_to_length, "木箱长度", "DB601.W14")); - list.add(new ItemDto(item_to_weight, "木箱宽度", "DB601.W16")); + list.add(new ItemDto(item_to_width, "木箱宽度", "DB601.W16")); list.add(new ItemDto(item_to_height, "木箱高度", "DB601.W18")); list.add(new ItemDto(item_to_barcode, "下发木箱条码", "DB601.STRING1.50")); list.add(new ItemDto(item_to_layer, "下发木箱层数", "DB601.W22")); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ItemProtocol.java index fd72628f2..9ee088013 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ItemProtocol.java @@ -85,6 +85,26 @@ public class ItemProtocol { private ReturnGoodManipulatorDeviceDriver driver; + + /** + * 行走列 + */ + public static String item_x = "x"; + + /** + * 行走层号 + */ + public static String item_y = "y"; + + + public float getX() { + return this.getOpcFloatValue(item_x); + } + + public float getY() { + return this.getOpcFloatValue(item_y); + } + public ItemProtocol(ReturnGoodManipulatorDeviceDriver driver){ this.driver=driver; } @@ -143,6 +163,19 @@ public class ItemProtocol { Boolean isonline; + + public float getOpcFloatValue(String protocol) { + Float value = this.driver.getDoubleValue(protocol); + if (value == null) { + // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); if (value == null) { @@ -163,6 +196,8 @@ public class ItemProtocol { list.add(new ItemDto(item_error, "报警信号", "DB1.B5")); list.add(new ItemDto(item_task, "任务号", "DB1.D6")); list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4")); + list.add(new ItemDto(item_x, "行走列号", "DB101.B10")); + list.add(new ItemDto(item_y, "行走层号", "DB101.B11")); return list; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java index 3cfcb0df2..5c413a60e 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java @@ -18,6 +18,7 @@ import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.box_manipulator_site.BoxManipulatorSiteDeviceDriver; +import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver; import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; @@ -202,19 +203,19 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } else { String remark = "";; if (mode != 2) { - remark = remark + "universal_remark2"; + remark = "universal_remark2"; } if (move != 0) { - remark = remark + "universal_remark3"; + remark = "universal_remark3"; } if (task != 0) { - remark = remark + "universal_remark4"; + remark = "universal_remark4"; if (ObjectUtil.isNotEmpty(this.inst)) { this.inst = null; } } if (requireSucess) { - remark = remark + "universal_remark5"; + remark = "universal_remark5"; } this.setNotCreateTaskMessage(remark); } @@ -273,16 +274,16 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } else { feedMessage = "universal_feedMessage5"; if (mode != 3) { - feedMessage = feedMessage + "universal_feedMessage1"; + feedMessage = "universal_feedMessage1"; } if (action != 8) { - feedMessage = feedMessage + "universal_feedMessage2"; + feedMessage = "universal_feedMessage2"; } if (move != 0) { - feedMessage = feedMessage + "universal_feedMessage3"; + feedMessage = "universal_feedMessage3"; } if (task == 0) { - feedMessage = feedMessage + "universal_feedMessage4"; + feedMessage = "universal_feedMessage4"; } } } @@ -373,15 +374,15 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); } - SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; - if (nextDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { - siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) nextDevice.getDeviceDriver(); - if (siemensConveyorDeviceDriver.getMove() != 1) { + //存在托盘才可以申请任务 + BeltConveyorDeviceDriver beltConveyorDeviceDriver; + if (nextDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { + beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) nextDevice.getDeviceDriver(); + if (beltConveyorDeviceDriver.getMove() != 1) { notCreateInstMessage = "universal_notCreateInstMessage2"; return false; } } - String taskid = taskDto.getTask_id(); String taskcode = taskDto.getTask_code(); String start_point_code = taskDto.getStart_point_code(); @@ -450,7 +451,7 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i list.add(map5); } if (ObjectUtil.isNotEmpty(interactionJsonDTO.getLength())) { - map6.put("code", "to_length"); + map6.put("code", "to_lenght"); map6.put("value", interactionJsonDTO.getLength()); list.add(map6); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/ItemProtocol.java index 63e94d08f..a128f1334 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/ItemProtocol.java @@ -36,6 +36,21 @@ public class ItemProtocol { */ public static String item_error = "error"; + /** + * 行走列 + */ + public static String item_walk_y = "walk_y"; + + /** + * 行走列 + */ + public static String item_x = "x"; + + /** + * 行走层号 + */ + public static String item_y = "y"; + /** * 下发托盘类型 @@ -69,7 +84,7 @@ public class ItemProtocol { /** *木箱宽度 */ - public static String item_to_weight = "to_weight"; + public static String item_to_width = "to_width"; /** *木箱高度 */ @@ -92,6 +107,18 @@ public class ItemProtocol { private TrappedManipulatorManipulatorDeviceDriver driver; + public float getX() { + return this.getOpcFloatValue(item_x); + } + + public float getY() { + return this.getOpcFloatValue(item_y); + } + public int getWalk_y() { + return this.getOpcIntegerValue(item_walk_y); + } + + public ItemProtocol(TrappedManipulatorManipulatorDeviceDriver driver){ this.driver=driver; } @@ -158,6 +185,19 @@ public class ItemProtocol { return 0; } + public float getOpcFloatValue(String protocol) { + Float value = this.driver.getDoubleValue(protocol); + if (value == null) { + // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } + public static List getReadableItemDtos() { ArrayList list = new ArrayList<>(); list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0")); @@ -166,6 +206,8 @@ public class ItemProtocol { list.add(new ItemDto(item_action, "动作信号", "DB1.B3")); list.add(new ItemDto(item_error, "报警信号", "DB1.B5")); list.add(new ItemDto(item_task, "任务号", "DB1.D6")); + list.add(new ItemDto(item_x, "行走列号", "DB101.B10")); + list.add(new ItemDto(item_y, "行走层号", "DB101.B11")); return list; } @@ -177,7 +219,7 @@ public class ItemProtocol { list.add(new ItemDto(item_to_onset, "下发起始站", "DB2.W2")); list.add(new ItemDto(item_to_container_type, "下发托盘类型", "DB102.B8")); list.add(new ItemDto(item_to_length, "木箱长度", "DB601.W10")); - list.add(new ItemDto(item_to_weight, "木箱宽度", "DB601.W12")); + list.add(new ItemDto(item_to_width, "木箱宽度", "DB601.W12")); list.add(new ItemDto(item_to_height, "木箱高度", "DB601.W14")); list.add(new ItemDto(item_to_template, "堆叠模板", "DB601.W16")); list.add(new ItemDto(item_to_is_binding, "下发是否捆轧", "DB601.D10")); 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 a555ccbd6..ce6240336 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 @@ -18,6 +18,7 @@ import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.box_manipulator_site.BoxManipulatorSiteDeviceDriver; +import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver; import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; @@ -206,13 +207,13 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice remark = remark + "光电信号(move)为有货状态,"; } if (task != 0) { - remark = remark + "universal_remark4"; + remark = "universal_remark4"; if (ObjectUtil.isNotEmpty(this.inst)) { this.inst = null; } } if (requireSucess) { - remark = remark + "universal_remark5"; + remark = "universal_remark5"; } this.setNotCreateTaskMessage(remark); } @@ -272,16 +273,16 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice }else { feedMessage = "universal_feedMessage5"; if (mode != 3) { - feedMessage = feedMessage + "universal_feedMessage1"; + feedMessage = "universal_feedMessage1"; } if (action != 8) { - feedMessage = feedMessage + "universal_feedMessage2"; + feedMessage = "universal_feedMessage2"; } if (move != 0) { - feedMessage = feedMessage + "universal_feedMessage3"; + feedMessage = "universal_feedMessage3"; } if (task == 0) { - feedMessage = feedMessage + "universal_feedMessage4"; + feedMessage = "universal_feedMessage4"; } } } @@ -369,10 +370,10 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice } - SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; - if (startDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { - siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) startDevice.getDeviceDriver(); - if (siemensConveyorDeviceDriver.getMove() != 1) { + BeltConveyorDeviceDriver beltConveyorDeviceDriver; + if (startDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { + beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) startDevice.getDeviceDriver(); + if (beltConveyorDeviceDriver.getMove() != 1) { notCreateInstMessage = "universal_notCreateInstMessage2"; return false; } @@ -445,7 +446,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice list.add(map4); if (ObjectUtil.isNotEmpty(interactionJsonDTO)) { if (ObjectUtil.isNotEmpty(interactionJsonDTO.getWeight())) { - map5.put("code", "to_weight"); + map5.put("code", "to_width"); map5.put("value", interactionJsonDTO.getWeight()); list.add(map5); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/ItemProtocol.java index cf261edcf..ba1bafc0b 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/ItemProtocol.java @@ -138,12 +138,12 @@ public class ItemProtocol { public int getWalk_y() { return this.getOpcIntegerValue(item_walk_y); } - public Integer getItem_x() { - return this.getOpcIntegerValue(item_x); + public float getX() { + return this.getOpcFloatValue(item_x); } - public Integer getItem_y() { - return this.getOpcIntegerValue(item_y); + public float getY() { + return this.getOpcFloatValue(item_y); } @@ -180,6 +180,19 @@ public class ItemProtocol { return 0; } + public float getOpcFloatValue(String protocol) { + Float value = this.driver.getDoubleValue(protocol); + if (value == null) { + // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } + public static List getReadableItemDtos() { ArrayList list = new ArrayList<>(); list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0")); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java index ff4315ddc..3066521e8 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java @@ -16,10 +16,11 @@ import org.nl.acs.device.service.impl.DeviceExtraServiceImpl; import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; +import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver; import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -import org.nl.acs.device_driver.manipulator_cache.ManipulatorCacheDeviceDriver; +import org.nl.acs.device_driver.one_conveyor.manipulator_cache.ManipulatorCacheDeviceDriver; import org.nl.acs.device_driver.one_manipulator.trapped_manipulator.InteractionJsonDTO; import org.nl.acs.enums.VolumeTwoTypeEnum; import org.nl.acs.history.ErrorUtil; @@ -100,16 +101,12 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi int last_to_onset2 = 0; int to_type = 0; int last_to_type = 0; - /** - * 行走列 - */ - Integer x = null; - Integer last_x = null; - /** - * 行走层号 - */ - Integer y = 0; - Integer last_y = 0; + // x坐标 + float x = 0.0f; + float last_x = 0.0f; + // y坐标 + float y = 0.0f; + float last_y = 0.0f; int to_task = 0; int last_to_task = 0; @@ -168,8 +165,8 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi error = this.itemProtocol.getError(); task = this.itemProtocol.getTask(); heartbeat = this.itemProtocol.getHeartbeat(); - x = this.itemProtocol.getItem_x(); - y = this.itemProtocol.getItem_y(); + x = this.itemProtocol.getX(); + y = this.itemProtocol.getY(); to_command = this.itemProtocol.getTo_command(); to_target1 = this.itemProtocol.getTo_target1(); to_onset1 = this.itemProtocol.getTo_onset1(); @@ -221,19 +218,19 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi } else { String remark = ""; if (mode != 2) { - remark = remark + "universal_remark2"; + remark = "universal_remark2"; } if (move != 0) { - remark = remark + "universal_remark3"; + remark = "universal_remark3"; } if (task != 0) { - remark = remark + "universal_remark4"; + remark = "universal_remark4"; if (ObjectUtil.isNotEmpty(this.inst)) { this.inst = null; } } if (requireSucess) { - remark = remark + "universal_remark5"; + remark = "universal_remark5"; } this.setNotCreateTaskMessage(remark); } @@ -297,16 +294,16 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi } else { feedMessage = "universal_feedMessage5"; if (mode != 3) { - feedMessage = feedMessage + "universal_feedMessage1"; + feedMessage = "universal_feedMessage1"; } if (action != 8) { - feedMessage = feedMessage + "universal_feedMessage2"; + feedMessage = "universal_feedMessage2"; } if (move != 0) { - feedMessage = feedMessage + "universal_feedMessage3"; + feedMessage = "universal_feedMessage3"; } if (task == 0) { - feedMessage = feedMessage + "universal_feedMessage4"; + feedMessage = "universal_feedMessage4"; } } } @@ -337,8 +334,6 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi TaskDto taskDtoIns = taskDtoInstruction.get(0); if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDtoIns.getTask_type())) { Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDtoIns.getTask_code()); - String interactionJson = taskDtoIns.getInteraction_json(); - InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); String start_device_code = taskDtoIns.getStart_device_code(); String next_device_code = taskDtoIns.getNext_device_code(); Device startDevice = deviceAppService.findDeviceByCode(start_device_code); @@ -366,7 +361,7 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi } catch (Exception e) { logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:" + instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code() - + ",指令终点:" + instruction.getNext_device_code() + ",交互参数:" + interactionJsonDTO.toString() + ",指令执行失败:" + e.getMessage()); + + ",指令终点:" + instruction.getNext_device_code() + ",指令执行失败:" + e.getMessage()); } this.setRequireSucess(true); return true; @@ -390,20 +385,29 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi notCreateInstMessage = "universal_notCreateInstMessage1"; throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); } - SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; - if (startDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { - siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) startDevice.getDeviceDriver(); - if (siemensConveyorDeviceDriver.getMove() != 1) { + BeltConveyorDeviceDriver beltConveyorDeviceDriver; + if (startDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { + beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) startDevice.getDeviceDriver(); + if (beltConveyorDeviceDriver.getMove() != 1) { notCreateInstMessage = "universal_notCreateInstMessage2"; return false; } } - - ManipulatorCacheDeviceDriver manipulatorCacheDeviceDriver; + + ManipulatorCacheDeviceDriver manipulatorCacheDeviceDriverStar; if (startDevice.getDeviceDriver() instanceof ManipulatorCacheDeviceDriver) { - manipulatorCacheDeviceDriver = (ManipulatorCacheDeviceDriver) startDevice.getDeviceDriver(); - if (manipulatorCacheDeviceDriver.getMode() != 2 && manipulatorCacheDeviceDriver.getMode() !=1) { + manipulatorCacheDeviceDriverStar = (ManipulatorCacheDeviceDriver) startDevice.getDeviceDriver(); + if (manipulatorCacheDeviceDriverStar.getMode() != 2 && manipulatorCacheDeviceDriverStar.getMode() !=1) { + notCreateInstMessage = "universal_notCreateInstMessage3"; + return false; + } + } + + ManipulatorCacheDeviceDriver manipulatorCacheDeviceDriverEnd; + if (nextDevice.getDeviceDriver() instanceof ManipulatorCacheDeviceDriver) { + manipulatorCacheDeviceDriverEnd = (ManipulatorCacheDeviceDriver) nextDevice.getDeviceDriver(); + if (manipulatorCacheDeviceDriverEnd.getMode() != 2 && manipulatorCacheDeviceDriverEnd.getMode() !=1) { notCreateInstMessage = "universal_notCreateInstMessage3"; return false; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/RgvDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/RgvDeviceDriver.java index dee4f387f..131e769ad 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/RgvDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/RgvDeviceDriver.java @@ -172,43 +172,8 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr to_task = this.itemProtocol.getTo_task(); to_sub_volume_no = this.itemProtocol.getTo_sub_volume_no(); - if (to_sub_volume_no != last_to_sub_volume_no) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号to_sub_volume_no:" + last_to_sub_volume_no + "->" + to_sub_volume_no); - } - - 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); } @@ -235,18 +200,18 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr List toInstructions; //拔轴完成,RGV工位上有货申请行架任务 - - if (mode == 2 && move == 1 && !requireSucess) { + if (mode == 4 && move == 1 && !requireSucess) { applyTask(); } else { if (mode == 2) { //if (!requireSucess) { - String remark = "";; + String remark = ""; + ; if (mode != 2) { - remark = remark + "universal_remark2"; + remark = "universal_remark2"; } if (move != 0) { - remark = remark + "universal_remark3"; + remark = "universal_remark3"; } if (task != 0) { remark = remark + LangProcess.msg("universal_remark4"); @@ -286,17 +251,19 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr public synchronized void applyTask() { ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest(); ApplyManipulatorActionResponse applyManipulatorActionResponse; + String direction = (String) this.getDevice().getExtraValue().get("direction"); applyManipulatorActionRequest.setDevice_code(device_code); - applyManipulatorActionRequest.setLocation("1"); + applyManipulatorActionRequest.setDirection(direction);//rgv申请位置 + applyManipulatorActionRequest.setQzz_no(String.valueOf(barcode));//气涨轴编码 applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest); Map map = new LinkedHashMap<>(); if (applyManipulatorActionResponse.getCode() == 200) { - map.put("to_target",applyManipulatorActionResponse.getNext_point()); - if (StrUtil.isEmpty(left)){ - map.put("to_sub_volume_no", right); - } else { - map.put("to_sub_volume_no", left); - } + Map data = applyManipulatorActionResponse.getData(); + String point_code2 = data.get("point_code2");//目标站点 + String material_code = data.get("material_code");//子卷号 + map.put("to_target", point_code2); + map.put("to_sub_volume_no", material_code); + map.put("to_command", "1"); this.writing(map); logServer.deviceExecuteLog(this.device_code, "", "", "申请行架任务,返回参数:" + applyManipulatorActionResponse); message = "申请行架任务成功"; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/ItemProtocol.java index da8557f75..7b40ef7ee 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/ItemProtocol.java @@ -414,23 +414,23 @@ public class ItemProtocol { list.add(new ItemDto(item_heartbeat, "心跳", "DB101.BO")); list.add(new ItemDto(item_deviceCode, "堆垛机号", "DB101.B1")); list.add(new ItemDto(item_mode, "工作模式", "DB101.B2")); - list.add(new ItemDto(item_command, "作业状态", "DB101.B3")); - list.add(new ItemDto(item_task, "任务号", "DB101.D4")); - list.add(new ItemDto(item_error, "Y轴报警(载货台)", "DB101.B8")); - list.add(new ItemDto(item_z, "行走排号", "DB101.B9")); - list.add(new ItemDto(item_x, "行走列号", "DB101.B10")); - list.add(new ItemDto(item_y, "行走层号", "DB101.B11")); - list.add(new ItemDto(item_move, "行走开关信号", "DB101.B12")); - list.add(new ItemDto(item_cargoMove, "载货台开关信号", "DB101.B13")); - list.add(new ItemDto(item_action, "行走动作信号", "DB101.B14")); + list.add(new ItemDto(item_command, "作业状态", "DB101.B31")); + list.add(new ItemDto(item_task, "任务号", "DB101.D32")); + list.add(new ItemDto(item_error, "Y轴报警(载货台)", "DB101.B36")); + list.add(new ItemDto(item_z, "行走排号", "DB101.B38")); + list.add(new ItemDto(item_x, "行走列号", "DB101.B39")); + list.add(new ItemDto(item_y, "行走层号", "DB101.B40")); + list.add(new ItemDto(item_move, "行走开关信号", "DB101.B4")); + list.add(new ItemDto(item_cargoMove, "载货台开关信号", "DB101.B41")); + list.add(new ItemDto(item_action, "行走动作信号", "DB101.B5")); list.add(new ItemDto(item_distancex, "行走激光数值", "DB101.D16")); - list.add(new ItemDto(item_distancey, "起升激光数值", "DB101.D20")); - list.add(new ItemDto(item_cargoError, "载货台超限信号", "DB101.B24")); - list.add(new ItemDto(item_forkCargo, "货叉探货信号", "DB101.B25")); - list.add(new ItemDto(item_forkLocation, "货叉位置信号", "DB101.B26")); - list.add(new ItemDto(item_forkAction, "货叉动作信号", "DB101.B27")); - list.add(new ItemDto(item_special1, "特殊开关量1", "DB101.B28")); - list.add(new ItemDto(item_special2, "特殊开关量2", "DB101.B29")); + list.add(new ItemDto(item_distancey, "起升激光数值", "DB101.D44")); + list.add(new ItemDto(item_cargoError, "载货台超限信号", "DB101.B43")); + list.add(new ItemDto(item_forkCargo, "货叉探货信号", "DB101.B48")); + list.add(new ItemDto(item_forkLocation, "货叉位置信号", "DB101.B49")); + list.add(new ItemDto(item_forkAction, "货叉动作信号", "DB101.B50")); + list.add(new ItemDto(item_special1, "特殊开关量1", "DB101.B10")); + list.add(new ItemDto(item_special2, "特殊开关量2", "DB101.B11")); list.add(new ItemDto(item_trayCode, "托盘条码", "DB101.B30.20")); list.add(new ItemDto(item_storage_cache, "水箱和消防缓存位有无货", "DB101.B50")); list.add(new ItemDto(item_stacker_rpm, "速度(转/分钟)", "DB101.W52")); @@ -454,10 +454,10 @@ public class ItemProtocol { list.add(new ItemDto(item_to_device_code, "堆垛机号", "DB100.B1")); list.add(new ItemDto(item_to_command, "作业命令", "DB100.B2")); list.add(new ItemDto(item_to_type, "物料类型", "DB100.B3")); - list.add(new ItemDto(item_to_task, "任务号", "DB100.D4")); - list.add(new ItemDto(item_to_z, "作业排", "DB100.B8")); - list.add(new ItemDto(item_to_x, "作业列", "DB100.B9")); - list.add(new ItemDto(item_to_y, "作业层", "DB100.B10")); + list.add(new ItemDto(item_to_task, "任务号", "DB100.D10")); + list.add(new ItemDto(item_to_z, "作业排", "DB100.B6")); + list.add(new ItemDto(item_to_x, "作业列", "DB100.B7")); + list.add(new ItemDto(item_to_y, "作业层", "DB100.B8")); list.add(new ItemDto(item_to_trayCode, "托盘号", "DB100.B11.20")); return list; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java index d550f37a3..f38f85748 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java @@ -1,11 +1,8 @@ package org.nl.acs.device_driver.stacker.standard_stacker; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.date.DateTime; -import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import lombok.Data; @@ -14,7 +11,6 @@ import lombok.extern.slf4j.Slf4j; import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.device.domain.Device; import org.nl.acs.device.enums.DeviceType; -import org.nl.acs.device.enums.ErrorType; import org.nl.acs.device.service.DeviceExtraService; import org.nl.acs.device.service.impl.DeviceExtraServiceImpl; import org.nl.acs.device_driver.DeviceDriver; @@ -25,10 +21,7 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; -import org.nl.acs.history.ErrorUtil; -import org.nl.acs.history.domain.AcsDeviceErrorLog; import org.nl.acs.history.service.DeviceErrorLogService; -import org.nl.acs.history.service.dto.DeviceErrorLogDto; import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; @@ -36,12 +29,13 @@ import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppServiceImpl; +import org.nl.acs.opc.WcsConfig; import org.nl.acs.route.service.RouteLineService; import org.nl.acs.route.service.dto.RouteLineDto; import org.nl.acs.route.service.impl.RouteLineServiceImpl; -import org.nl.acs.task.domain.Task; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; +import org.nl.common.utils.RedisUtils; import org.nl.config.SpringContextHolder; import org.nl.config.language.LangProcess; import org.nl.config.lucene.service.LuceneExecuteLogService; @@ -76,7 +70,12 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); - LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl"); + LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl"); + + public static final String REDIS_MOVE_BOX = "MOVE:MOVE_TASK"; + + @Autowired + private RedisUtils redisUtils; /** * 禁止入库 @@ -285,6 +284,11 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme */ Instruction inst = null; + /** + * 入库异常错误限制 + */ + Integer count = 0; + @Override public Device getDevice() { @@ -318,6 +322,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme trayCode = this.itemProtocol.getItem_trayCode(); storage_cache = this.itemProtocol.getItem_storage_cache(); + if (!command.equals(last_command)){ + requireSucess=false; + } // 更新指令状态 @@ -347,6 +354,10 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); } + //不同任务限制清零 + if (!Objects.equals(task, last_task)){ + count = 0; + } if (mode != 3 || requireSucess) { message = "one_message7"; @@ -354,7 +365,11 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } else if (error != 0) { message = "universal_message3"; //指定库位满入 - if (error == 5) { + if (error == 5 && count< WcsConfig.stacker_error_in_count) { + //相同任务时限制加一 + if (Objects.equals(task, last_task)){ + count++; + } applyUpdatePointCode(StandarStirageErroEnum.FILL.getType()); } //空出 @@ -365,7 +380,11 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme //浅货位有货 if (error == 16) { //放货 - if (cargoMove == 1) { + if (cargoMove == 1 && count< WcsConfig.stacker_error_in_count) { + //相同任务时限制加一 + if (Objects.equals(task, last_task)){ + count++; + } applyUpdatePointCode(StandarStirageErroEnum.BLOCK_OUT.getType()); } else if (cargoMove == 0) { //取货 @@ -388,7 +407,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme case 2: message = "universal_completed"; Instruction instruction = checkInst(); - if (ObjectUtil.isEmpty(instruction)){ + if (ObjectUtil.isEmpty(instruction)) { message = "universal_message4"; break; } @@ -556,6 +575,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme /** * 申请更新点位 + * * @param type */ private void applyUpdatePointCode(String type) { @@ -565,29 +585,55 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme return; } else { Instruction instruction = instructionService.findByCode(String.valueOf(task)); - if (ObjectUtil.isNotEmpty(instruction)){ + if (ObjectUtil.isEmpty(instruction)) { message = "one_message9"; return; } JSONObject param = new JSONObject(); param.put("task_code", instruction.getTask_code()); + param.put("task_id", instruction.getTask_id()); param.put("type", type); String response = acsToWmsService.applyUpdatePointCode(param); JSONObject jo = JSON.parseObject(response); if (StrUtil.isNotEmpty(jo.getString("body")) || jo.getInteger("status") == 200) { - LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code(device_code) - .content("申请更新点位,参数,接口返回:" + jo) - .build(); - luceneExecuteLogService.deviceExecuteLog(logDto2); - JSONObject pointCodeJson = JSON.parseObject(jo.getString("body")); - String poinCode = pointCodeJson.getString("poin_code").toString(); - if (type.equals(StandarStirageErroEnum.BLOCK_OUT.getType()) || type.equals(StandarStirageErroEnum.VOIDANCE.getType())){ - updateData1(poinCode, instruction); - } - if (type.equals(StandarStirageErroEnum.BLOCK_IN.getType()) || type.equals(StandarStirageErroEnum.FILL.getType())){ - updateData2(poinCode, instruction); + try { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(device_code) + .content("申请更新点位,参数,接口返回:" + jo) + .build(); + luceneExecuteLogService.deviceExecuteLog(logDto2); + String poinCode = jo.getString("point_code"); + if (StrUtil.isNotEmpty(poinCode)) { + String[] split = poinCode.split("-"); + Device point = deviceAppService.findDeviceByCode(split[0]); + if (ObjectUtil.isEmpty(point)) { + message = "one_message18"; + } + if (type.equals(StandarStirageErroEnum.VOIDANCE.getType())) { + updateData1(poinCode, instruction, point, split); + List list = new ArrayList(); + pakageData(list, point, split); + } + if (type.equals(StandarStirageErroEnum.BLOCK_IN.getType()) || type.equals(StandarStirageErroEnum.FILL.getType())) { + updateData2(poinCode, instruction, point, split); + List list = new ArrayList(); + pakageData(list, point, split); + } + } + //取货潜货位阻挡做完移库任务 + if (type.equals(StandarStirageErroEnum.BLOCK_OUT.getType())) { + //获取出库指令更新其优先级和状态 + Instruction instruction1 = checkInst(); + instruction1.setPriority("2"); + instruction1.setInstruction_status("0"); + instructionService.update(instruction1); + + } + } catch (Exception e) { + this.requireSucess = true; + e.printStackTrace(); } + this.requireSucess = true; } else { LuceneLogDto logDto2 = LuceneLogDto.builder() @@ -599,44 +645,76 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } } - private void updateData2(String poinCode, Instruction instruction) { - Instruction instructionUpdate = new Instruction(); - instructionUpdate.setNext_point_code(poinCode); - String[] split = poinCode.split("-"); - Device endPoint = deviceAppService.findDeviceByCode(split[0]); - instructionUpdate.setTo_x(endPoint.getExtraValue().get("x").toString()); - instructionUpdate.setNext_device_code(split[0]); - instructionUpdate.setTo_y(split[1]); - instructionUpdate.setTo_z(split[2]); - instructionUpdate.setInstruction_code(String.valueOf(task)); - instructionService.updateByInstructionCode(instructionUpdate); - Task taskUpdate = new Task(); - taskUpdate.setTo_x(endPoint.getExtraValue().get("x").toString()); - taskUpdate.setNext_device_code(split[0]); - taskUpdate.setTo_y(split[1]); - taskUpdate.setTo_z(split[2]); - taskUpdate.setTask_code(instruction.getTask_code()); - taskserver.updateByTaskCode(taskUpdate); + private void pakageData(List list, Device point, String[] split) { + String x = point.getExtraValue().get("x").toString(); + String y = split[1]; + String z = split[2]; + HashMap map1 = new HashMap(); + map1.put("code", "to_x"); + map1.put("value", y); + list.add(map1); + HashMap map2 = new HashMap(); + map2.put("code", "to_y"); + map2.put("value", z); + list.add(map2); + HashMap map3 = new HashMap(); + map3.put("code", "to_z"); + map3.put("value", x); + list.add(map3); + if (ObjectUtil.isNotEmpty(list)) { + this.writing(list); + } } - private void updateData1(String poinCode, Instruction instruction) { - Instruction instructionUpdate = new Instruction(); + private void updateData2(String poinCode, Instruction instruction, Device point, String[] split) { + Instruction instructionUpdate = checkInst(); + TaskDto taskUpdate = new TaskDto(); + instructionUpdate.setNext_point_code(poinCode); + instructionUpdate.setNext_device_code(split[0]); + taskUpdate.setNext_point_code(poinCode); + taskUpdate.setNext_device_code(split[0]); + taskUpdate.setTask_id(instructionUpdate.getTask_id()); + pakageData2(instruction, instructionUpdate, point, split, taskUpdate); + instructionService.update(instructionUpdate); + taskserver.update(taskUpdate); + } + + private void updateData1(String poinCode, Instruction instruction, Device point, String[] split) { + Instruction instructionUpdate = checkInst(); + TaskDto taskUpdate = new TaskDto(); instructionUpdate.setStart_point_code(poinCode); - String[] split = poinCode.split("-"); - Device starPoint = deviceAppService.findDeviceByCode(split[0]); - instructionUpdate.setFrom_x(starPoint.getExtraValue().get("x").toString()); instructionUpdate.setStart_device_code(split[0]); + taskUpdate.setStart_point_code(poinCode); + taskUpdate.setStart_device_code(split[0]); + taskUpdate.setTask_id(instructionUpdate.getTask_id()); + pakageData1(instruction, instructionUpdate, point, split, taskUpdate); + //更新缓存数据库 + instructionService.update(instructionUpdate); + taskserver.update(taskUpdate); + } + + private void pakageData1(Instruction instruction, Instruction instructionUpdate, Device starPoint, String[] split, TaskDto taskUpdate) { + instructionUpdate.setFrom_x(starPoint.getExtraValue().get("x").toString()); instructionUpdate.setFrom_y(split[1]); instructionUpdate.setFrom_z(split[2]); instructionUpdate.setInstruction_code(String.valueOf(task)); - instructionService.updateByInstructionCode(instructionUpdate); - Task taskUpdate = new Task(); taskUpdate.setFrom_x(starPoint.getExtraValue().get("x").toString()); - taskUpdate.setStart_device_code(split[0]); taskUpdate.setFrom_y(split[1]); taskUpdate.setFrom_z(split[2]); taskUpdate.setTask_code(instruction.getTask_code()); - taskserver.updateByTaskCode(taskUpdate); + + } + + + private void pakageData2(Instruction instruction, Instruction instructionUpdate, Device starPoint, String[] split, TaskDto taskUpdate) { + instructionUpdate.setTo_x(starPoint.getExtraValue().get("x").toString()); + instructionUpdate.setTo_y(split[1]); + instructionUpdate.setTo_z(split[2]); + instructionUpdate.setInstruction_code(String.valueOf(task)); + taskUpdate.setTo_x(starPoint.getExtraValue().get("x").toString()); + taskUpdate.setTo_y(split[1]); + taskUpdate.setTo_z(split[2]); + taskUpdate.setTask_code(instruction.getTask_code()); } @@ -704,18 +782,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } } List list = new ArrayList(); - HashMap map1 = new HashMap(); - map1.put("code", "to_device_code"); - map1.put("value", this.getDevice().getAddress()); - list.add(map1); - HashMap map2 = new HashMap(); - map2.put("code", "to_command"); - map2.put("value", 1); - list.add(map2); - HashMap map3 = new HashMap(); - map3.put("code", "to_task"); - list.add(map3); - map3.put("value", inst.getInstruction_code()); + + pakageCommand(list, inst.getInstruction_code()); if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) { if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("z"))) { HashMap map4 = new HashMap(); @@ -737,26 +805,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } } if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name())) { - HashMap map4 = new HashMap(); - map4.put("code", "to_y"); - map4.put("value", inst.getFrom_z()); - list.add(map4); - if (inst.getFrom_x().length() > 1) { - String substring = inst.getFrom_x().substring(1); - HashMap map5 = new HashMap(); - map5.put("code", "to_z"); - map5.put("value", substring); - list.add(map5); - } else { - HashMap map6 = new HashMap(); - map6.put("code", "to_z"); - map6.put("value", inst.getFrom_x()); - list.add(map6); - } - HashMap map7 = new HashMap(); - map7.put("code", "to_x"); - map7.put("value", inst.getFrom_y()); - list.add(map7); + pakagePlc(inst, list); } if (ObjectUtil.isNotEmpty(list)) { this.writing(list); @@ -767,6 +816,44 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme return true; } + private void pakagePlc(Instruction inst, List list) { + HashMap map4 = new HashMap(); + map4.put("code", "to_y"); + map4.put("value", inst.getFrom_z()); + list.add(map4); + if (inst.getFrom_x().length() > 1) { + String substring = inst.getFrom_x().substring(1); + HashMap map5 = new HashMap(); + map5.put("code", "to_z"); + map5.put("value", substring); + list.add(map5); + } else { + HashMap map6 = new HashMap(); + map6.put("code", "to_z"); + map6.put("value", inst.getFrom_x()); + list.add(map6); + } + HashMap map7 = new HashMap(); + map7.put("code", "to_x"); + map7.put("value", inst.getFrom_y()); + list.add(map7); + } + + private void pakageCommand(List list, String inst) { + HashMap map1 = new HashMap(); + map1.put("code", "to_device_code"); + map1.put("value", this.getDevice().getAddress()); + list.add(map1); + HashMap map2 = new HashMap(); + map2.put("code", "to_command"); + map2.put("value", 1); + list.add(map2); + HashMap map3 = new HashMap(); + map3.put("code", "to_task"); + map3.put("value", inst); + list.add(map3); + } + /** * 将指令根据优先级和创建时间排序 * diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/blank_manipulator/BlankManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/blank_manipulator/BlankManipulatorDeviceDriver.java index 194c433ee..3808bf0be 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/blank_manipulator/BlankManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/blank_manipulator/BlankManipulatorDeviceDriver.java @@ -48,6 +48,11 @@ import org.springframework.beans.factory.annotation.Autowired; import java.util.*; +/** + * @author: TuQiang + * @Created: 2024/3/14 + */ + /** * 表处下料-行架机械手 */ @@ -74,30 +79,49 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); @Autowired LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); - //工作模式 + /** + * 工作模式 + */ int mode = 0; int last_mode = 0; - //光电信号 + /** + * 光电信号 + */ int move = 0; int last_move = 0; - //动作信号 + + /** + * 动作信号 + */ int action = 0; int last_action = 0; - //行走列 + + /** + * 行走列 + */ int walk_y = 0; int last_walk_y = 0; - //报警信号 + + /** + * 报警信号 + */ int error = 0; int last_error = 0; - //任务号 + /** + * 任务号 + */ int task = 0; int last_task = 0; - //重量 + /** + * 重量 + */ int weight = 0; int last_weight = 0; - //条码 + /** + * 条码 + */ int barcode = 0; int last_barcode = 0; @@ -119,26 +143,29 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem int hasGoods = 0; String message = null; Boolean iserror = false; - private Date instruction_update_time = new Date(); - private int instruction_update_time_out = 1000; - Integer heartbeat_tag; + private Date instructionUpdateTime = new Date(); + private int instructionUpdateTimeOut = 1000; private Date instruction_require_time = new Date(); - private int instruction_require_time_out = 3000; - //行架机械手申请任务成功标识 + /** + * 行架机械手申请任务成功标识 + */ boolean requireSucess = false; private int instruction_finished_time_out; int branchProtocol = 0; - private String error_type = "hxhj_error_type"; - //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 + /** + * 暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 + */ int flag; String device_code; - //当前指令 + /** + * 当前指令 + */ Instruction inst = null; String notCreateTaskMessage = ""; @@ -177,36 +204,26 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem 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 (mode == 3 && task > 0) { Date date = new Date(); - if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out); + if (date.getTime() - this.instructionUpdateTime.getTime() < (long) this.instructionUpdateTimeOut) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instructionUpdateTimeOut); } else { - this.instruction_update_time = date; - //更改指令状态 + this.instructionUpdateTime = date; + /** + * 更改指令状态 + */ if (task > 0) { Instruction inst = checkInst(); if (inst != null) { - if (StrUtil.equals(inst.getInstruction_status(), "0")) { + if (StrUtil.equals(inst.getInstruction_status(), CommonFinalParam.ZERO)) { inst.setInstruction_status(CommonFinalParam.ONE); inst.setExecute_device_code(this.device_code); instructionService.update(inst); @@ -216,12 +233,14 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem } } - //反馈重量 + /** + * 反馈重量 + */ if (mode == 3 && action == 5 && move == 1 && task > 0) { Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task)); if (ObjectUtil.isNotEmpty(inst2)) { - String task_code = inst2.getTask_code(); - TaskDto dto = taskserver.findByCode(task_code); + String taskCode = inst2.getTask_code(); + TaskDto dto = taskserver.findByCode(taskCode); JSONObject jo = new JSONObject(); jo.put("task_id", dto.getTask_id()); jo.put("task_code", dto.getTask_code()); @@ -261,7 +280,7 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem } else { feedMessage = "universal_feedMessage5"; if (mode != 3) { - feedMessage = feedMessage + "universal_feedMessage1"; + feedMessage = "universal_feedMessage1"; } if (action != 5) { feedMessage = feedMessage + "two_message4"; @@ -274,7 +293,9 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem } } - //任务完成 + /** + * 任务完成 + */ if (mode == 3 && action == 6 && move == 0 && task > 0) { Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task)); if (inst2 != null) { @@ -282,7 +303,7 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem try { requireSucess = true; message = "universal_message7"; - finish_instruction(inst2); + finishInstruction(inst2); Map map = new LinkedHashMap<>(); map.put("to_command", "6"); this.writing(map); @@ -320,7 +341,9 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem Instruction instruction = null; List toInstructions; - //行架机械手申请任务 + /** + * 行架机械手申请任务 + */ if (mode == 2 && move == 0 && task == 0 && !requireSucess) { boolean res = applyTask(); if (res) { @@ -370,10 +393,7 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem /** - * // * 申请任务 - * // * - * // * @param - * // + * 申请任务 */ public synchronized boolean applyTask() { Date date = new Date(); @@ -395,26 +415,26 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem taskDtos = this.sortTask(taskDtos); TaskDto taskDto = taskDtos.get(0); Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code()); - String start_device_code = instruction.getStart_device_code(); - String next_device_code = instruction.getNext_device_code(); + String startCode = instruction.getStart_device_code(); + String nextCode = instruction.getNext_device_code(); instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex()); instruction.setUpdate_time(DateUtil.now()); instructionService.update(instruction); - Device startDevice = deviceAppService.findDeviceByCode(start_device_code); - Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); + Device startDevice = deviceAppService.findDeviceByCode(startCode); + Device nextDevice = deviceAppService.findDeviceByCode(nextCode); if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code())); } if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) { throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code())); } - String start_addr = startDevice.getExtraValue().get("address").toString(); - String next_addr = nextDevice.getExtraValue().get("address").toString(); + String startAddr = startDevice.getExtraValue().get("address").toString(); + String nextAddr = nextDevice.getExtraValue().get("address").toString(); Map map = new LinkedHashMap<>(); map.put("to_command", CommonFinalParam.ONE); - map.put("to_onset", start_addr); + map.put("to_onset", startAddr); map.put("to_task", instruction.getInstruction_code()); - map.put("to_target", next_addr); + map.put("to_target", nextAddr); this.writing(map); this.setRequireSucess(true); return true; @@ -431,35 +451,35 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem } } if (!ObjectUtil.isEmpty(task)) { - String taskid = task.getTask_id(); - String taskcode = task.getTask_code(); - String vehiclecode = task.getVehicle_code(); + String taskId = task.getTask_id(); + String taskCode = task.getTask_code(); + String vehicleCode = task.getVehicle_code(); String priority = task.getPriority(); - String start_point_code = task.getStart_point_code(); - String start_device_code = task.getStart_device_code(); - String route_plan_code = task.getRoute_plan_code(); - String next_point_code = task.getNext_point_code(); - String next_device_code = task.getNext_device_code(); + String startPointCode = task.getStart_point_code(); + String startDeviceCode = task.getStart_device_code(); + String routePlanCode = task.getRoute_plan_code(); + String nextPointCode = task.getNext_point_code(); + String nextDeviceCode = task.getNext_device_code(); Instruction instdto = new Instruction(); instdto.setInstruction_id(IdUtil.simpleUUID()); - instdto.setRoute_plan_code(route_plan_code); + instdto.setRoute_plan_code(routePlanCode); instdto.setRemark(task.getRemark()); instdto.setMaterial(task.getMaterial()); instdto.setQuantity(task.getQuantity()); - instdto.setTask_id(taskid); - instdto.setTask_code(taskcode); - instdto.setVehicle_code(vehiclecode); + instdto.setTask_id(taskId); + instdto.setTask_code(taskCode); + instdto.setVehicle_code(vehicleCode); String now = DateUtil.now(); instdto.setCreate_time(now); instdto.setCreate_by(SecurityUtils.getCurrentNickName()); - instdto.setStart_device_code(start_device_code); - instdto.setNext_device_code(next_device_code); - instdto.setStart_point_code(start_point_code); - instdto.setNext_point_code(next_point_code); + instdto.setStart_device_code(startDeviceCode); + instdto.setNext_device_code(nextDeviceCode); + instdto.setStart_point_code(startPointCode); + instdto.setNext_point_code(nextPointCode); instdto.setPriority(priority); instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex()); - instdto.setExecute_device_code(start_point_code); + instdto.setExecute_device_code(startPointCode); try { instructionService.create(instdto); @@ -498,13 +518,13 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code())); } - String start_addr = startDevice.getExtraValue().get("address").toString(); - String next_addr = nextDevice.getExtraValue().get("address").toString(); + String startAddr = startDevice.getExtraValue().get("address").toString(); + String nextAddr = nextDevice.getExtraValue().get("address").toString(); Map map = new LinkedHashMap<>(); map.put("to_command", CommonFinalParam.ONE); - map.put("to_onset", start_addr); + map.put("to_onset", startAddr); map.put("to_task", instdto.getInstruction_code()); - map.put("to_target", next_addr); + map.put("to_target", nextAddr); this.writing(map); this.setRequireSucess(true); notCreateInstMessage = ""; @@ -517,7 +537,7 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem } - public synchronized boolean finish_instruction(Instruction inst) throws Exception { + public synchronized boolean finishInstruction(Instruction inst) throws Exception { instructionService.finish(inst); return true; } @@ -553,6 +573,11 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem } } + /** + * 任务排序 + * @param taskDtos + * @return + */ public List sortTask(List taskDtos) { Collections.sort(taskDtos, new Comparator() { @Override @@ -570,6 +595,10 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem return taskDtos; } + /** + * 获取监控设备信息 + * @return + */ @Override public JSONObject getDeviceStatusName() { JSONObject jo = new JSONObject(); @@ -631,9 +660,9 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem @Override public void setDeviceStatus(JSONObject data) { String requestSucess = data.getString("requireSucess"); - if (StrUtil.equals(requestSucess, "0")) { + if (StrUtil.equals(requestSucess, CommonFinalParam.ZERO)) { this.requireSucess = false; - } else if (StrUtil.equals(requestSucess, "1")) { + } else if (StrUtil.equals(requestSucess, CommonFinalParam.ONE)) { this.requireSucess = true; } } @@ -644,8 +673,6 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem jo.put("device_code", this.getDevice().getDevice_code()); jo.put("device_name", this.getDevice().getDevice_name()); jo.put("fault_code", String.valueOf(error)); - jo.put("fault_info", ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError()))); - jo.put("fault_type", error_type); return jo; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/blanking_button/BlankingButtonDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/blanking_button/BlankingButtonDriver.java index f43ee62c9..bd16c2c02 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/blanking_button/BlankingButtonDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/blanking_button/BlankingButtonDriver.java @@ -30,6 +30,7 @@ import org.nl.acs.task.service.TaskService; import org.nl.config.SpringContextHolder; import org.nl.config.language.LangProcess; import org.nl.config.lucene.service.LuceneExecuteLogService; +import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.system.service.param.ISysParamService; import org.springframework.beans.factory.annotation.Autowired; @@ -37,6 +38,10 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +/** + * @author : TuQiang + * @date : 2024/3/14 + */ /** * 下料按钮 @@ -75,12 +80,9 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); - private String error_type = "hx_error_type"; - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - private Date instruction_apply_time = new Date(); - private int instruction_require_time_out = 3000; + private Date instructionRequireTime = new Date(); + private int instructionRequireTimeOut = 3000; public int heartbeat = 0; public int mode = 0; @@ -88,18 +90,18 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev public int action = 0; public int error = 0; - public int last_heartbeat = 0; - public int last_mode = 0; - public int last_move = 0; - public int last_action = 0; - public int last_error = 0; + public int lastHeartbeat = 0; + public int lastMode = 0; + public int lastMove = 0; + public int lastAction = 0; + public int lastError = 0; Boolean isonline = true; Boolean iserror = false; - String device_code; + String deviceCode; String message = null; @@ -115,31 +117,16 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev @Override public void execute() { - device_code = this.getDeviceCode(); + deviceCode = this.getDeviceCode(); heartbeat = this.itemProtocol.getItem_heartbeat(); mode = this.itemProtocol.getItem_mode(); move = this.itemProtocol.getItem_move(); action = this.itemProtocol.getItem_action(); error = this.itemProtocol.getItem_error(); - if (mode != last_mode) { + if (mode != lastMode) { 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 (mode == 0) { this.setIsonline(false); @@ -192,10 +179,10 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev } - last_mode = mode; - last_move = move; - last_action = action; - last_error = error; + lastMode = mode; + lastMove = move; + lastAction = action; + lastError = error; } @@ -204,22 +191,22 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev */ public synchronized void applyTakeFullVolume() { Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() - < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + if (date.getTime() - this.instructionRequireTime.getTime() + < (long) this.instructionRequireTimeOut) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instructionRequireTimeOut); return; } else { - this.instruction_require_time = date; + this.instructionRequireTime = date; if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) { message = "two_message5"; BlankingButtonRequest blankingButtonRequest = new BlankingButtonRequest(); - blankingButtonRequest.setDevice_code(device_code); - blankingButtonRequest.setType("1"); + blankingButtonRequest.setDevice_code(deviceCode); + blankingButtonRequest.setType(CommonFinalParam.TYPE_ONE); BlankingButtonResponse response = acsToWmsService.applyBlankButtonTask(blankingButtonRequest); if (ObjectUtil.isEmpty(response)) { message = "two_message6"; } else { - if (response.getCode()== 200) { + if (response.getCode()== CommonFinalParam.STATUS_OPEN) { this.writing("to_command","9"); message = "two_message7"; requireSucess = true; @@ -238,22 +225,22 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev */ public synchronized void cancelTask() { Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() - < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + if (date.getTime() - this.instructionRequireTime.getTime() + < (long) this.instructionRequireTimeOut) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instructionRequireTimeOut); return; } else { - this.instruction_require_time = date; + this.instructionRequireTime = date; if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) { message = "two_message9"; BlankingButtonRequest blankingButtonRequest = new BlankingButtonRequest(); - blankingButtonRequest.setDevice_code(device_code); - blankingButtonRequest.setType("2"); + blankingButtonRequest.setDevice_code(deviceCode); + blankingButtonRequest.setType(CommonFinalParam.TYPE_SIX); BlankingButtonResponse response = acsToWmsService.applyBlankButtonTask(blankingButtonRequest); if (ObjectUtil.isEmpty(response)) { message = "two_message10"; } else { - if (response.getCode()== 200) { + if (response.getCode()== CommonFinalParam.STATUS_OPEN) { this.writing("to_command","10"); message = "two_message11"; requireSucess = true; @@ -272,22 +259,22 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev */ public synchronized void applyTakeEmptyShaft() { Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() - < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + if (date.getTime() - this.instructionRequireTime.getTime() + < (long) this.instructionRequireTimeOut) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instructionRequireTimeOut); return; } else { - this.instruction_require_time = date; + this.instructionRequireTime = date; if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) { message = "two_message13"; BlankingButtonRequest blankingButtonRequest = new BlankingButtonRequest(); - blankingButtonRequest.setDevice_code(device_code); - blankingButtonRequest.setType("2"); + blankingButtonRequest.setDevice_code(deviceCode); + blankingButtonRequest.setType(CommonFinalParam.TYPE_TWO); BlankingButtonResponse response = acsToWmsService.applyBlankButtonTask(blankingButtonRequest); if (ObjectUtil.isEmpty(response)) { message = "two_message14"; } else { - if (response.getCode()== 200) { + if (response.getCode()== CommonFinalParam.STATUS_OPEN) { this.writing("to_command","10"); message = "two_message15"; requireSucess = true; @@ -310,7 +297,7 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev itemMap.put(to_param, Integer.parseInt(value)); this.control(itemMap); - logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value); + logServer.deviceExecuteLog(deviceCode, "", "", "下发电气信号设备号:" + deviceCode + ",下发电气:" + to_param + ",下发电气值:" + value); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/green_foil_machine_button/GreenFoilMachineButtonDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/green_foil_machine_button/GreenFoilMachineButtonDriver.java index 904e44bee..9483af3e0 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/green_foil_machine_button/GreenFoilMachineButtonDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/green_foil_machine_button/GreenFoilMachineButtonDriver.java @@ -30,6 +30,8 @@ import org.nl.acs.route.service.RouteLineService; import org.nl.acs.task.service.TaskService; import org.nl.config.SpringContextHolder; import org.nl.config.language.LangProcess; +import org.nl.config.lucene.service.LuceneExecuteLogService; +import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.system.service.param.ISysParamService; import org.springframework.beans.factory.annotation.Autowired; @@ -69,12 +71,11 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); - private String error_type = "hx_error_type"; + @Autowired + LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - private Date instruction_apply_time = new Date(); - private int instruction_require_time_out = 3000; + private Date instructionRequireTime = new Date(); + private int instructionRequireTimeOut = 3000; public int heartbeat = 0; public int mode = 0; @@ -82,18 +83,18 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem public int action = 0; public int error = 0; - public int last_heartbeat = 0; - public int last_mode = 0; - public int last_move = 0; - public int last_action = 0; - public int last_error = 0; + public int lastHeartbeat = 0; + public int lastMode = 0; + public int lastMove = 0; + public int lastAction = 0; + public int lastError = 0; Boolean isonline = true; Boolean iserror = false; - String device_code; + String deviceCode; String message = null; @@ -109,7 +110,7 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem @Override public void execute() { - device_code = this.getDeviceCode(); + deviceCode = this.getDeviceCode(); heartbeat = this.itemProtocol.getItem_heartbeat(); mode = this.itemProtocol.getItem_mode(); move = this.itemProtocol.getItem_move(); @@ -117,22 +118,8 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem error = this.itemProtocol.getItem_error(); iserror = this.itemProtocol.isError; - if (mode != last_mode) { + if (mode != lastMode) { 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 (mode == 0) { @@ -151,9 +138,6 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem this.setIsonline(true); this.setIserror(false); message = ""; - Instruction instruction = null; - List toInstructions; - switch (mode) { case 2: log.debug("待机"); @@ -168,9 +152,7 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem } break; case 5: - /** - * 申请AGV取空放空的任务 - */ + //申请AGV取空放空的任务 if (!requireSucess) { applyAgvTask(mode); } @@ -194,10 +176,10 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem - last_mode = mode; - last_move = move; - last_action = action; - last_error = error; + lastMode = mode; + lastMove = move; + lastAction = action; + lastError = error; } @@ -206,22 +188,22 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem */ public synchronized void applyAgvTask(int mode) { Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() - < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + if (date.getTime() - this.instructionRequireTime.getTime() + < (long) this.instructionRequireTimeOut) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instructionRequireTimeOut); return; } else { - this.instruction_require_time = date; + this.instructionRequireTime = date; if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) { message = "two_message17"; ApplyGreenFoilButtonRequest applyGreenFoilButtonRequest = new ApplyGreenFoilButtonRequest(); - applyGreenFoilButtonRequest.setDevice_code(device_code); + applyGreenFoilButtonRequest.setDevice_code(deviceCode); applyGreenFoilButtonRequest.setType(String.valueOf(mode)); ApplyGreenFoilButtonResponse response = acsToWmsService.applyGreenFoilButtonTask(applyGreenFoilButtonRequest); if (ObjectUtil.isEmpty(response)) { message = "two_message18"; } else { - if (response.getCode()== 200) { + if (response.getCode()== CommonFinalParam.STATUS_OPEN) { if (mode==4){ this.writing("to_command","4"); }else if (mode==5){ @@ -253,7 +235,7 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem itemMap.put(to_param, Integer.parseInt(value)); this.control(itemMap); - logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value); + logServer.deviceExecuteLog(deviceCode, "", "", "下发电气信号设备号:" + deviceCode + ",下发电气:" + to_param + ",下发电气值:" + value); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/hongxiang_device/HongXiangConveyorDefination.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/hongxiang_device/HongXiangConveyorDefination.java index eece99cad..0615adcd8 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/hongxiang_device/HongXiangConveyorDefination.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/hongxiang_device/HongXiangConveyorDefination.java @@ -43,7 +43,7 @@ public class HongXiangConveyorDefination implements OpcDeviceDriverDefination { @Override public List getFitDeviceTypes() { List types = new LinkedList(); - types.add(DeviceType.station); + types.add(DeviceType.conveyor); return types; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/inflatable_shaft_library/InflatableShaftLibraryDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/inflatable_shaft_library/InflatableShaftLibraryDeviceDriver.java index 236900090..d06d18d70 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/inflatable_shaft_library/InflatableShaftLibraryDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/inflatable_shaft_library/InflatableShaftLibraryDeviceDriver.java @@ -54,35 +54,32 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver //心跳 public int heartbeat = 0; - public int last_heartbeat = 0; + public int lastHeartbeat = 0; //工作模式 int mode = 0; - int last_mode = 0; + int lastMode = 0; //光电信号 int move = 0; - int last_move = 0; + int lastMove = 0; //动作信号 int action = 0; - int last_action = 0; + int lastAction = 0; //报警信号 int error = 0; - int last_error = 0; + int lastError = 0; //数量 int qty = 0; - int last_qty = 0; + int lastQty = 0; //类型 int type = 0; - int last_type = 0; - - int to_command = 0; - int last_to_command = 0; + int lastType = 0; Boolean isonline = true; Boolean iserror = false; - String device_code; + String deviceCode; String message = null; @@ -97,7 +94,7 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver @Override public void execute() { - device_code = this.getDeviceCode(); + deviceCode = this.getDeviceCode(); heartbeat = this.itemProtocol.getItem_heartbeat(); mode = this.itemProtocol.getItem_mode(); move = this.itemProtocol.getItem_move(); @@ -108,40 +105,16 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver iserror = this.itemProtocol.isError; - if (mode != last_mode) { + if (mode != lastMode) { 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 (qty != last_qty) { - logServer.deviceItemValue(this.device_code, "weight", String.valueOf(qty)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号qty:" + last_qty + "->" + qty); - } - if (type != last_type) { - logServer.deviceItemValue(this.device_code, "weight", String.valueOf(type)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号type:" + last_type + "->" + type); } - - - last_mode = mode; - last_move = move; - last_action = action; - last_error = error; - last_qty = qty; - last_type = type; + lastMode = mode; + lastMove = move; + lastAction = action; + lastError = error; + lastQty = qty; + lastType = type; } @@ -154,7 +127,7 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver itemMap.put(to_param, Integer.parseInt(value)); this.control(itemMap); - logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value); + logServer.deviceExecuteLog(deviceCode, "", "", "下发电气信号设备号:" + deviceCode + ",下发电气:" + to_param + ",下发电气值:" + value); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java index 7a7e821fc..a0da6c362 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -79,6 +79,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i //工作模式 int mode = 0; int last_mode = 0; + //光电信号 int move = 0; int last_move = 0; @@ -226,13 +227,13 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i remark = remark + "光电信号(move)为有货状态,"; } if (task != 0) { - remark = remark + "universal_remark4"; + remark = "universal_remark4"; if (ObjectUtil.isNotEmpty(this.inst)) { this.inst = null; } } if (requireSucess) { - remark = remark + "universal_remark5"; + remark = "universal_remark5"; } this.setNotCreateTaskMessage(remark); //} @@ -406,15 +407,22 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i luceneExecuteLogService.deviceExecuteLog(logDto); List list = new ArrayList<>(); Map map = new HashMap(); - map.put("to_onset", start_addr); - map.put("to_target", next_addr); - map.put("to_task", instruction.getInstruction_code()); - map.put("to_command", "1"); - try { - this.writing(map); - } catch (Exception e) { - e.printStackTrace(); - } + map.put("code", "to_onset"); + map.put("value", StrUtil.isNotBlank(start_addr) ? start_addr : "0"); + Map map1 = new HashMap(); + map1.put("code", "to_target"); + map1.put("value", StrUtil.isNotBlank(next_addr) ? next_addr : "0"); + Map map2 = new HashMap(); + map2.put("code", "to_task"); + map2.put("value", instruction.getInstruction_code()); + Map map3 = new HashMap(); + map3.put("code", "to_command"); + map3.put("value", "1"); + list.add(map); + list.add(map1); + list.add(map2); + list.add(map3); + this.writing(list); if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver(); hongXiangConveyorDeviceDriver.writing("to_open_door", "1"); @@ -699,7 +707,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i if (linkDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) linkDevice.getDeviceDriver(); //判断关联设备是否开门 - if (hongXiangConveyorDeviceDriver.getDoor() == 1) { + if (hongXiangConveyorDeviceDriver.getDoor() == 1 || hongXiangConveyorDeviceDriver.getError1() != 0 + || hongXiangConveyorDeviceDriver.getError() != 0) { isClose = true; notCreateInstMessage = start_device_code + "关联设备->" + deviceCode + "烘箱门未关闭!"; break; @@ -724,7 +733,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i if (linkDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) linkDevice.getDeviceDriver(); //判断关联设备是否开门 - if (hongXiangConveyorDeviceDriver.getDoor() == 1) { + if (hongXiangConveyorDeviceDriver.getDoor() == 1 || hongXiangConveyorDeviceDriver.getError1() != 0 + || hongXiangConveyorDeviceDriver.getError() != 0) { isClose = true; notCreateInstMessage = next_device_code + "关联设备->" + deviceCode + "烘箱门未关闭!"; break; @@ -776,6 +786,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } else { this.instruction_update_time = date; + ArrayList list = new ArrayList(); Map map = new HashMap(); //更改任务状态 if (task > 0) { @@ -803,11 +814,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i int door = hongXiangConveyorDeviceDriver.getDoor(); int action = hongXiangConveyorDeviceDriver.getAction(); int error1 = hongXiangConveyorDeviceDriver.getError1(); + int error = hongXiangConveyorDeviceDriver.getError(); int move = hongXiangConveyorDeviceDriver.getMove(); - if (mode == 1 && door == 1 && action == 1 && error1 == 0 && move == 1) { + if (mode == 1 && door == 1 && action == 1 && error == 0 && error1 == 0 && move == 1) { if (this.getNow_steps_type() == 2) { - ArrayList list = new ArrayList(); - map.put("to_command", "2"); + map.put("code", "to_command"); + map.put("value", "2"); list.add(map); this.writing(list); this.setNow_steps_type(3); @@ -834,8 +846,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } } else { if (this.getNow_steps_type() == 2) { - ArrayList list = new ArrayList(); - map.put("to_command", "2"); + map.put("code", "to_command"); + map.put("value", "2"); list.add(map); this.writing(list); this.setNow_steps_type(3); @@ -873,8 +885,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i hongXiangConveyorDeviceDriver.writing(map); } if (this.getNow_steps_type() == 3) { - ArrayList list = new ArrayList(); - map.put("to_command", "3"); + map.put("code", "to_command"); + map.put("value", "3"); list.add(map); this.writing(list); this.setNow_steps_type(4); @@ -911,11 +923,14 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i int door = hongXiangConveyorDeviceDriver.getDoor(); int action = hongXiangConveyorDeviceDriver.getAction(); int error1 = hongXiangConveyorDeviceDriver.getError1(); + int error = hongXiangConveyorDeviceDriver.getError(); int move = hongXiangConveyorDeviceDriver.getMove(); - if (mode == 1 && door == 1 && action == 1 && error1 == 0 && move == 0) { + if (mode == 1 && door == 1 && action == 1 && error == 0 && error1 == 0 && move == 0) { if (this.getNow_steps_type() == 4) { - map.put("to_command", "4"); - this.writing(map); + map.put("code", "to_command"); + map.put("value", "4"); + list.add(map); + this.writing(list); this.setNow_steps_type(5); } else { feedMessage = "未反馈电气信号原因:当前步骤不为允许放货(now_steps_type!=4)"; @@ -942,8 +957,10 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } } else { if (this.getNow_steps_type() == 4) { - map.put("to_command", "4"); - this.writing(map); + map.put("code", "to_command"); + map.put("value", "4"); + list.add(map); + this.writing(list); this.setNow_steps_type(5); } } @@ -1012,8 +1029,10 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } } - map.put("to_command", "5"); - this.writing(map); + map.put("code", "to_command"); + map.put("value", "5"); + list.add(map); + this.writing(list); this.setNow_steps_type(6); this.setNow_steps_type(0); try { @@ -1072,9 +1091,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i move = LangProcess.msg("universal_yes"); } - String requireSucess = LangProcess.msg("mark"); + String requireSucess = "0"; if (this.requireSucess) { - requireSucess = LangProcess.msg("no_mark"); + requireSucess = "1"; } jo.put("requireSucess", requireSucess); if (this.getAction() == 1) { @@ -1098,7 +1117,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i jo.put("isOnline", this.getIsonline()); jo.put("error", ErrorUtil.getDictDetail("hxhj_error_type", String.valueOf(this.getError()))); jo.put("isError", this.getIserror()); - jo.put("message", LangProcess.msg(message)); + jo.put("message", message); jo.put("notCreateTaskMessage", notCreateTaskMessage); jo.put("notCreateInstMessage", notCreateInstMessage); jo.put("feedMessage", LangProcess.msg(feedMessage)); @@ -1151,6 +1170,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i itemMap.put(to_param, json.getString("value")); } } + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("下发电气信号:" + itemMap) + .build(); + luceneExecuteLogService.deviceExecuteLog(logDto); logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap); try { this.checkcontrol(itemMap); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/ItemProtocol.java index c62d95b89..ce16d7b59 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.two_conveyor.plug_pull_device_site; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -34,6 +35,8 @@ public class ItemProtocol { public static String item_weight2 = "weight2"; //纸管2规格 public static String item_material2 = "material2"; + //气涨轴尺寸 + public static String item_size = "size"; //下发命令 public static String item_to_command = "to_command"; @@ -43,14 +46,16 @@ public class ItemProtocol { public static String item_to_material2 = "to_material2"; //纸管数量 public static String item_to_qty = "to_qty"; - //气涨轴类型 + //气涨轴类型 标箔/锂电 1/2 public static String item_to_qzz_type = "to_qzz_type"; - //是否换轴 - public static String item_to_weight1 = "to_weight1"; - //尺寸 - public static String item_to_size = "to_size"; - //存储位置 - public static String item_to_weight2 = "to_weight2"; + //是否下发纸管号1 + public static String item_to_volumn1 = "to_volumn1"; + //纸管1尺寸 + public static String item_to_size1 = "to_size1"; + //纸管2尺寸 + public static String item_to_size2 = "to_size2"; + //是否下发纸管号2 + public static String item_to_volumn2 = "to_volumn2"; private PlugPullDeviceSiteDeviceDriver driver; @@ -82,26 +87,28 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_task); } - public int getBarcode(){ return this.getOpcIntegerValue(item_barcode);} + public String getBarcode(){ return this.getOpcStringValue(item_barcode);} public int getWeight1(){ return this.getOpcIntegerValue(item_weight1);} - public int getMaterial1(){ return this.getOpcIntegerValue(item_material1);} + public String getMaterial1(){ return this.getOpcStringValue(item_material1);} public int getWeight2(){ return this.getOpcIntegerValue(item_weight2);} - public int getMaterial2(){ return this.getOpcIntegerValue(item_material2);} + public int getSize(){ return this.getOpcIntegerValue(item_size);} + + public String getMaterial2(){ return this.getOpcStringValue(item_material2);} public int getTo_command() { return this.getOpcIntegerValue(item_to_command); } - public int getTo_material1() { - return this.getOpcIntegerValue(item_to_material1); + public String getTo_material1() { + return this.getOpcStringValue(item_to_material1); } - public int getTo_material2() { - return this.getOpcIntegerValue(item_to_material2); + public String getTo_material2() { + return this.getOpcStringValue(item_to_material2); } public int getTo_qty() { @@ -112,16 +119,20 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_to_qzz_type); } - public int getTo_weight2() { - return this.getOpcIntegerValue(item_to_weight2); + public String getTo_volumn1() { + return this.getOpcStringValue(item_to_volumn1); } - public int getTo_size() { - return this.getOpcIntegerValue(item_to_size); + public int getTo_size1() { + return this.getOpcIntegerValue(item_to_size1); } - public int getTo_weight1() { - return this.getOpcIntegerValue(item_to_weight1); + public int getTo_size2() { + return this.getOpcIntegerValue(item_to_size2); + } + + public String getTo_volumn2() { + return this.getOpcStringValue(item_to_volumn1); } Boolean isonline; @@ -144,6 +155,16 @@ public class ItemProtocol { } + public String getOpcStringValue(String protocol) { + String value = this.driver.getStringValue(protocol); + if (StrUtil.isBlank(value)) { + + } else { + return value; + } + return "0"; + } + public float getOpcFloatValue(String protocol) { Float value = this.driver.getDoubleValue(protocol); if (value == null) { @@ -163,26 +184,28 @@ public class ItemProtocol { list.add(new ItemDto(item_mode, "工作模式", "DB9.B1")); list.add(new ItemDto(item_move, "光电信号", "DB9.B2")); list.add(new ItemDto(item_action, "动作信号", "DB9.B3")); - list.add(new ItemDto(item_barcode, "气胀轴条码", "DB9.B4")); + list.add(new ItemDto(item_barcode, "气胀轴条码", "DB9.String224.60")); list.add(new ItemDto(item_weight1, "纸管1重量", "DB9.B5")); - list.add(new ItemDto(item_material1, "纸管1规格", "DB9.B6")); + list.add(new ItemDto(item_material1, "纸管1规格", "DB9.String278.60")); list.add(new ItemDto(item_weight2, "纸管2重量", "DB9.B7")); - list.add(new ItemDto(item_material2, "纸管2规格", "DB9.B8")); + list.add(new ItemDto(item_material2, "纸管2规格", "DB9.String332.60")); list.add(new ItemDto(item_error, "报警信号", "DB9.B9")); list.add(new ItemDto(item_task, "任务号", "DB9.D10")); + list.add(new ItemDto(item_size, "尺寸", "DB9.B11")); return list; } public static List getWriteableItemDtos() { ArrayList list = new ArrayList(); list.add(new ItemDto(item_to_command, "下发命令", "DB10.W0")); - list.add(new ItemDto(item_to_material1, "纸管1规格", "DB10.W2")); - list.add(new ItemDto(item_to_material2, "纸管2规格", "DB10.W4")); + list.add(new ItemDto(item_to_material1, "纸管1规格", "DB10.String602.60")); + list.add(new ItemDto(item_to_material2, "纸管2规格", "DB10.String656.60")); list.add(new ItemDto(item_to_qty, "纸管数量", "DB10.W6")); list.add(new ItemDto(item_to_qzz_type, "气胀轴类型", "DB10.W8")); - list.add(new ItemDto(item_to_weight1, "纸管1标准重量", "DB10.W10")); - list.add(new ItemDto(item_to_weight2, "纸管2标准重量", "DB10.W12")); - list.add(new ItemDto(item_to_size, "尺寸", "DB10.W14")); + list.add(new ItemDto(item_to_volumn1, "下发纸管号1", "DB10.String610.60")); + list.add(new ItemDto(item_to_volumn2, "下发纸管号2", "DB10.String612.60")); + list.add(new ItemDto(item_to_size1, "下发纸管1尺寸", "DB10.W10")); + list.add(new ItemDto(item_to_size2, "下发纸管2尺寸", "DB10.W12")); return list; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java index 331399228..56086f209 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java @@ -7,6 +7,7 @@ import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.acs.agv.server.AgvService; +import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.device.domain.Device; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.DeviceDriver; @@ -29,6 +30,8 @@ import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; import org.nl.config.language.LangProcess; import org.nl.config.language.LangProcess; +import org.nl.config.lucene.service.LuceneExecuteLogService; +import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.system.service.param.ISysParamService; import org.nl.config.SpringContextHolder; import org.springframework.beans.factory.annotation.Autowired; @@ -61,70 +64,79 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); @Autowired AgvService agvService = SpringContextHolder.getBean(AgvService.class); + @Autowired + LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - private Date instruction_apply_time = new Date(); - private int instruction_require_time_out = 3000; //工作模式 int mode = 0; - int last_mode = 0; + int lastMode = 0; //光电信号 int move = 0; - int last_move = 0; + int lastMove = 0; //动作信号 int action = 0; - int last_action = 0; + int lastAction = 0; //报警信号 int error = 0; - int last_error = 0; + int lastError = 0; //任务号 int task = 0; - int last_task = 0; + int lastTask = 0; + + //气涨轴尺寸 + int size = 0; + int lastSize = 0; int heartbeat = 0; - int last_heartbeat = 0; - int to_command = 0; - int last_to_command = 0; + int lastHeartbeat = 0; + int toCommand = 0; + int lastToCommand = 0; //气胀轴条码 - int barcode = 0; - int last_barcode = 0; + String barcode = null; + String lastBarcode = null; //纸管1重量 int weight1 = 0; - int last_weight1 = 0; + int lastWeight1 = 0; //纸管1规格 - int material1 = 0; - int last_material1 = 0; + String material1 = null; + String lastMaterial1 = null; //纸管2重量 int weight2 = 0; - int last_weight2 = 0; + int lastWeight2 = 0; //纸管2规格 - int material2 = 0; - int last_material2 = 0; + String material2 = null; + String lastMaterial2 = null; - int to_size = 0; - int last_to_size = 0; + //纸管1尺寸 + int toSize1 = 0; + int lastToSize1 = 0; - int to_material1 = 0; - int last_to_material1 = 0; + //纸管2尺寸 + int toSize2 = 0; + int lastToSize2 = 0; - int to_material2 = 0; - int last_to_material2 = 0; + String toMaterial1 = null; + String lastToMaterial1 = null; - int to_qty = 0; - int last_to_qty = 0; + String toMaterial2 = null; + String lastToMaterial2 = null; - int to_qzz_type = 0; - int last_to_qzz_type = 0; + int toQty = 0; + int lastToQty = 0; - int to_weight1 = 0; - int last_to_weight1 = 0; + int toQzzType = 0; + int lastToQzzType = 0; - int to_weight2 = 0; - int last_to_weight2 = 0; + //子卷号1 + String toVolumn1 = null; + String lastToVolumn1 = null; + + //子卷号2 + String toVolumn2 = null; + String lastToVolumn2 = null; Boolean isonline = true; @@ -138,7 +150,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl */ int flag; - String device_code; + String deviceCode; String message = null; @@ -154,8 +166,8 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl String feedMessage = ""; @Override - public void execute() { - device_code = this.getDeviceCode(); + public void execute() throws Exception { + deviceCode = this.getDeviceCode(); mode = this.itemProtocol.getMode(); move = this.itemProtocol.getMove(); action = this.itemProtocol.getAction(); @@ -166,98 +178,35 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl weight1 = this.itemProtocol.getWeight1(); material1 = this.itemProtocol.getMaterial1(); weight2 = this.itemProtocol.getWeight2(); + size = this.itemProtocol.getSize(); material2 = this.itemProtocol.getMaterial2(); - to_command = this.itemProtocol.getTo_command(); - to_material1 = this.itemProtocol.getTo_material1(); - to_material2 = this.itemProtocol.getTo_material2(); - to_qty = this.itemProtocol.getTo_qty(); - to_qzz_type = this.itemProtocol.getTo_qzz_type(); - to_weight1 = this.itemProtocol.getTo_weight1(); - to_weight2 = this.itemProtocol.getTo_weight2(); - to_size = this.itemProtocol.getTo_size(); + toCommand = this.itemProtocol.getTo_command(); + toMaterial1 = this.itemProtocol.getTo_material1(); + toMaterial2 = this.itemProtocol.getTo_material2(); + toQty = this.itemProtocol.getTo_qty(); + toQzzType = this.itemProtocol.getTo_qzz_type(); + toVolumn1 = this.itemProtocol.getTo_volumn1(); + toVolumn2 = this.itemProtocol.getTo_volumn2(); + toSize1 = this.itemProtocol.getTo_size1(); + toSize2 = this.itemProtocol.getTo_size2(); - if (mode != last_mode) { + if (mode != lastMode) { 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 (barcode != last_barcode) { - logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(barcode)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号barcode:" + last_barcode + "->" + barcode); - } - if (weight1 != last_weight1) { - logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(weight1)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号weight1:" + last_weight1 + "->" + weight1); - } - if (material1 != last_material1) { - logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(material1)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号material1:" + last_material1 + "->" + material1); - } - if (weight2 != last_weight2) { - logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(weight2)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号weight2:" + last_weight2 + "->" + weight2); - } - if (material2 != last_material2) { - logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(material2)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号material2:" + last_material2 + "->" + material2); - } - if (task != last_task) { - logServer.deviceItemValue(this.device_code, "task", String.valueOf(task)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task); - } - if (to_command != last_to_command) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command:" + last_to_command + "->" + to_command); - } - if (to_material1 != last_to_material1) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号to_material1:" + last_to_material1 + "->" + to_material1); - } - if (to_material2 != last_to_material2) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号to_material2:" + last_to_material2 + "->" + to_material2); - } - if (to_qty != last_to_qty) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号to_qty:" + last_to_qty + "->" + to_qty); - } - if (to_qzz_type != last_to_qzz_type) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号to_qzz_type:" + last_to_qzz_type + "->" + to_qzz_type); - } - if (to_weight1 != last_to_weight1) { - logServer.deviceExecuteLog(this.device_code, "", "", "to_weight1:" + last_to_weight1 + "->" + to_weight1); - } - if (to_weight2 != last_to_weight2) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号to_weight2:" + last_to_weight2 + "->" + to_weight2); - } - if (to_size != last_to_size) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号to_size:" + last_to_size + "->" + to_size); } if (mode == 0) { this.setIsonline(false); - message = "未联机"; + message = "universal_off-line"; //有报警 } else if (error != 0) { this.setIserror(true); - message = "有报警"; + message = "universal_message3"; //无报警 } else { this.setIsonline(true); this.setIserror(false); message = ""; - Instruction instruction = null; - List toInstructions; - //插拔轴机工位申请任务 switch (mode) { case 1: @@ -270,24 +219,9 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl log.info(LangProcess.msg("universal_operation")); break; case 4: - if (task > 0) { - Instruction inst = instructionService.findByCode(String.valueOf(task)); - TaskDto taskDto = taskserver.findByCode(inst.getTask_code()); - if (StrUtil.equals("1", taskDto.getIs_bushing())) { - if (move == 1 && !requireSucess) { - //申请套管 - apply_casing(mode); - } - } else { - Map map = new LinkedHashMap<>(); - map.put("to_size", taskDto.getSize()); - this.writing(map); - } - } else { - if (move == 1 && !requireSucess) { - //申请套管 - apply_casing(mode); - } + if (!requireSucess) { + //申请套管 + apply_casing(mode); } break; case 5: @@ -297,21 +231,21 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl } break; case 6: - if (!requireSucess && task > 0) { + if (!requireSucess) { //拔轴完成 pullShaftSucess(mode); } break; case 7: - if (!requireSucess && task > 0) { + if (!requireSucess) { //申请拔轴 applyPullShaft(mode); } break; case 8: - if (!requireSucess && task > 0) { + if (!requireSucess) { //缓存线已满,申请行架任务 - applyTask(); + applyTask(mode); } break; default: @@ -319,48 +253,67 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl break; } } - last_mode = mode; - last_move = move; - last_action = action; - last_error = error; - last_task = task; - last_heartbeat = heartbeat; - last_barcode = barcode; - last_weight1 = weight1; - last_weight2 = weight2; - last_material1 = material1; - last_material2 = material2; - last_to_command = to_command; - last_to_material1 = to_material1; - last_to_material2 = to_material2; - last_to_qty = to_qty; - last_to_qzz_type = to_qzz_type; - last_to_weight2 = to_weight2; - last_to_weight1 = to_weight1; - last_to_size = to_size; + lastMode = mode; + lastMove = move; + lastAction = action; + lastError = error; + lastTask = task; + lastHeartbeat = heartbeat; + lastBarcode = barcode; + lastWeight1 = weight1; + lastWeight2 = weight2; + lastSize = size; + lastMaterial1 = material1; + lastMaterial2 = material2; + lastToCommand = toCommand; + lastToMaterial1 = toMaterial1; + lastToMaterial2 = toMaterial2; + lastToQty = toQty; + lastToQzzType = toQzzType; + lastToVolumn2 = toVolumn2; + lastToVolumn1 = toVolumn1; + lastToSize2 = toSize2; + lastToSize1 = toSize1; } /** * 申请套管 */ - private synchronized void apply_casing(int mode) { + private synchronized void apply_casing(int mode) throws Exception { ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); ApplyPlugPullSitResponse applyPlugPullSitResponse; - Instruction inst; - if (task != 0) { - inst = instructionService.findByCode(String.valueOf(task)); - String task_code = inst.getTask_code(); - TaskDto dto = taskserver.findByCode(task_code); - String size = dto.getSize(); - applyPlugPullSiteRequest.setSize(size); - applyPlugPullSiteRequest.setTask_code(task_code); - } - applyPlugPullSiteRequest.setDevice_code(device_code); - applyPlugPullSiteRequest.setType("1"); + applyPlugPullSiteRequest.setDevice_code(deviceCode); + applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_ONE); + //气涨轴尺寸 + applyPlugPullSiteRequest.setSize(String.valueOf(size)); applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); - if (applyPlugPullSitResponse.getCode() == 200) { - this.writeSignal(mode); - logServer.deviceExecuteLog(this.device_code, "", "", "申请套管,返回参数:" + applyPlugPullSitResponse); + if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { + Map data = applyPlugPullSitResponse.getData(); + String left = data.get("left"); + String right = data.get("right"); + String number = data.get("number"); + String leftSize = data.get("left_size"); + String rightSize = data.get("right_size"); + Map map = new LinkedHashMap<>(); + //下发纸管信息 + //todo:纸管规格待定 + if (StrUtil.isNotEmpty(left)) { + map.put("to_volumn1", left); + } + if (StrUtil.isNotEmpty(right)) { + map.put("to_volumn2", right); + } + if (StrUtil.isNotEmpty(leftSize)){ + map.put("to_size1", leftSize); + } + if (StrUtil.isNotEmpty(rightSize)){ + map.put("to_size2", rightSize); + } + map.put("to_command", mode); + map.put("to_qty", number); + this.writing(map); + requireSucess = true; + logServer.deviceExecuteLog(this.deviceCode, "", "", "申请套管,返回参数:" + applyPlugPullSitResponse); message = "申请套管成功"; } else { message = applyPlugPullSitResponse.getMessage(); @@ -369,31 +322,27 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl this.writing(map); requireSucess = true; message = "申请套管失败"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse); + logServer.deviceExecuteLog(this.deviceCode, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse); } } /** * 套管完成 */ - private synchronized void bushingSucess(int mode) { + private synchronized void bushingSucess(int mode) throws Exception { ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); ApplyPlugPullSitResponse applyPlugPullSitResponse; - if (task != 0) { - Instruction inst1 = instructionService.findByCode(String.valueOf(task)); - String task_code1 = inst1.getTask_code(); - applyPlugPullSiteRequest.setTask_code(task_code1); - } - applyPlugPullSiteRequest.setDevice_code(device_code); + applyPlugPullSiteRequest.setDevice_code(deviceCode); + //上报规格和重量 applyPlugPullSiteRequest.setWeight1(String.valueOf(weight1)); applyPlugPullSiteRequest.setMaterial1(String.valueOf(material1)); applyPlugPullSiteRequest.setWeight2(String.valueOf(weight2)); applyPlugPullSiteRequest.setMaterial2(String.valueOf(material2)); - applyPlugPullSiteRequest.setType("2"); + applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_TWO); applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); - if (applyPlugPullSitResponse.getCode() == 200) { + if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { this.writeSignal(mode); - logServer.deviceExecuteLog(this.device_code, "", "", "反馈套管完成,返回参数:" + applyPlugPullSitResponse); + logServer.deviceExecuteLog(this.deviceCode, "", "", "反馈套管完成,返回参数:" + applyPlugPullSitResponse); message = "套管完成成功"; } else { message = applyPlugPullSitResponse.getMessage(); @@ -402,7 +351,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl this.writing(map); requireSucess = true; message = "申请套管失败"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse); + logServer.deviceExecuteLog(this.deviceCode, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse); } } @@ -410,23 +359,19 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl /** * 拔轴完成 */ - private synchronized void pullShaftSucess(int mode) { + private synchronized void pullShaftSucess(int mode) throws Exception { ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); ApplyPlugPullSitResponse applyPlugPullSitResponse; - Instruction inst1 = instructionService.findByCode(String.valueOf(task)); - String task_code1 = inst1.getTask_code(); - TaskDto taskDto = taskserver.findByCode(task_code1); - if (ObjectUtil.isNotEmpty(taskDto)){ - - } - applyPlugPullSiteRequest.setDevice_code(device_code); - applyPlugPullSiteRequest.setTask_code(task_code1); + applyPlugPullSiteRequest.setDevice_code(deviceCode); applyPlugPullSiteRequest.setBarcode(String.valueOf(barcode)); - applyPlugPullSiteRequest.setType("3"); + applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_THREE); applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); - if (applyPlugPullSitResponse.getCode() == 200) { - this.writeSignal(mode); - logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse); + if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { + Map map = new LinkedHashMap<>(); + map.put("to_command", mode); + this.writing(map); + requireSucess = true; + logServer.deviceExecuteLog(this.deviceCode, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse); message = "拔轴完成成功"; } else { message = applyPlugPullSitResponse.getMessage(); @@ -434,32 +379,33 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl map.put("to_command", 99); this.writing(map); requireSucess = true; - message = "申请拔轴失败"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse); + message = "拔轴完成失败"; + logServer.deviceExecuteLog(this.deviceCode, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse); } } /** * 申请拔轴 */ - private synchronized void applyPullShaft(int mode) { + private synchronized void applyPullShaft(int mode) throws Exception { ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); ApplyPlugPullSitResponse applyPlugPullSitResponse; - Instruction inst1 = instructionService.findByCode(String.valueOf(task)); - String task_code1 = inst1.getTask_code(); - TaskDto taskDto = taskserver.findByCode(task_code1); - if (ObjectUtil.isNotEmpty(taskDto)){ - - } - applyPlugPullSiteRequest.setDevice_code(device_code); - applyPlugPullSiteRequest.setTask_code(task_code1); + applyPlugPullSiteRequest.setDevice_code(deviceCode); applyPlugPullSiteRequest.setBarcode(String.valueOf(barcode)); - applyPlugPullSiteRequest.setType("4"); + applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FOUR); applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); - if (applyPlugPullSitResponse.getCode() == 200) { - this.writeSignal(mode); - logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse); - message = "拔轴完成成功"; + if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { + Map data = applyPlugPullSitResponse.getData(); + String leftSize = data.get("left_size"); + String rightSzie = data.get("right_szie"); + Map map = new LinkedHashMap<>(); + map.put("to_size1", leftSize); + map.put("to_size2", rightSzie); + map.put("to_command", mode); + this.writing(map); + requireSucess = true; + logServer.deviceExecuteLog(this.deviceCode, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse); + message = "申请拔轴成功"; } else { message = applyPlugPullSitResponse.getMessage(); Map map = new LinkedHashMap<>(); @@ -467,30 +413,32 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl this.writing(map); requireSucess = true; message = "申请拔轴失败"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse); + logServer.deviceExecuteLog(this.deviceCode, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse); } } /** * 缓存线已满,生成行架任务 */ - private synchronized void applyTask() { + private synchronized void applyTask(int mode) throws Exception { ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); ApplyPlugPullSitResponse applyPlugPullSitResponse; - Instruction inst1 = instructionService.findByCode(String.valueOf(task)); - String task_code1 = inst1.getTask_code(); - applyPlugPullSiteRequest.setDevice_code(device_code); - applyPlugPullSiteRequest.setTask_code(task_code1); - applyPlugPullSiteRequest.setType("5"); + applyPlugPullSiteRequest.setDevice_code(deviceCode); + applyPlugPullSiteRequest.setSize(String.valueOf(size)); + applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FIVE); applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); - if (applyPlugPullSitResponse.getCode() == 200) { - logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse); - message = "拔轴完成成功"; + if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { + Map map = new LinkedHashMap<>(); + map.put("to_command", mode); + this.writing(map); + logServer.deviceExecuteLog(this.deviceCode, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse); + message = "生成行架任务成功"; + requireSucess = true; } else { message = applyPlugPullSitResponse.getMessage(); requireSucess = true; message = "申请行架任务失败"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse); + logServer.deviceExecuteLog(this.deviceCode, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse); } } @@ -499,7 +447,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl * * @param mode */ - public void writeSignal(int mode) { + public void writeSignal(int mode) throws Exception { Map map = new LinkedHashMap<>(); map.put("to_command", mode); this.writing(map); @@ -525,11 +473,11 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl itemMap.put(to_param, json.getString("value")); } } - logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap); + logServer.deviceExecuteLog(deviceCode, "", "", "下发电气信号:" + itemMap); this.control(itemMap); } - public void writing(Map map) { + public void writing(Map map) throws Exception { DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); Map itemMap = new LinkedHashMap<>(); map.forEach((key, value) -> { @@ -538,7 +486,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl } }); if (ObjectUtil.isNotEmpty(itemMap)) { - this.control(itemMap); + this.checkcontrol(itemMap); logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap); } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/ItemProtocol.java index 1f0c5c3f5..41e61bbcc 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/ItemProtocol.java @@ -45,14 +45,6 @@ public class ItemProtocol { public static String item_to_sleeve = "to_sleeve"; //尺寸 public static String item_to_size = "to_size"; - //代数 - public static String item_to_version = "to_version"; - //子卷数量 - public static String item_to_qty = "to_qty"; - //子卷1长度 - public static String item_to_length1 = "to_length1"; - //子卷2长度 - public static String item_to_length2 = "to_length2"; public static String item_to_barcode = "to_barcode"; @@ -107,16 +99,9 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_to_size); } - public int getTo_version() { - return this.getOpcIntegerValue(item_to_version); - } - public int getTo_qty() { - return this.getOpcIntegerValue(item_to_qty); - } - - public int getTo_barcode() { - return this.getOpcIntegerValue(item_to_barcode); + public String getTo_barcode() { + return this.getOpcStringValue(item_to_barcode); } public int getTo_onset() { @@ -139,13 +124,7 @@ public class ItemProtocol { return this.getOpcFloatValue(item_y_position); } - public float getTo_length1() { - return this.getOpcFloatValue(item_to_length1); - } - public float getTo_length2() { - return this.getOpcFloatValue(item_to_length2); - } Boolean isonline; Boolean isError; @@ -190,6 +169,7 @@ public class ItemProtocol { } + public static List getReadableItemDtos() { ArrayList list = new ArrayList<>(); list.add(new ItemDto(item_heartbeat, "心跳", "DB11.B0")); @@ -209,15 +189,11 @@ public class ItemProtocol { list.add(new ItemDto(item_to_command, "下发命令", "DB12.W0")); list.add(new ItemDto(item_to_onset, "下发起始站", "DB12.W2")); list.add(new ItemDto(item_to_target, "下发目标站", "DB12.W4")); - list.add(new ItemDto(item_to_barcode, "下发气涨轴条码", "DB12.W4")); + list.add(new ItemDto(item_to_barcode, "下发气涨轴条码", "DB12.String602.60")); list.add(new ItemDto(item_to_task, "下发任务号", "DB12.D6")); list.add(new ItemDto(item_to_pull, "是否拔轴", "DB12.W8")); list.add(new ItemDto(item_to_sleeve, "是否套轴", "DB12.W10")); - list.add(new ItemDto(item_to_size, "尺寸", "DB12.W12")); - list.add(new ItemDto(item_to_version, "代数", "DB12.W14")); - list.add(new ItemDto(item_to_qty, "子卷数量", "DB12.W16")); - list.add(new ItemDto(item_to_length1, "子卷1长度", "DB12.W18")); - list.add(new ItemDto(item_to_length2, "子卷2长度", "DB12.W20")); + list.add(new ItemDto(item_to_size, "气涨轴尺寸", "DB12.W12")); return list; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java index a5ea432ae..1ff2f8de5 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java @@ -68,64 +68,54 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp //工作模式 int mode = 0; - int last_mode = 0; + int lastMode = 0; //光电信号 int move = 0; - int last_move = 0; + int lastMove = 0; //动作信号 int action = 0; - int last_action = 0; + int lastAction = 0; //行走列 - int walk_y = 0; - int last_walk_y = 0; + int walkY = 0; + int lastWalkY = 0; //报警信号 int error = 0; - int last_error = 0; + int lastError = 0; //任务号 int task = 0; - int last_task = 0; + int lastTask = 0; // x坐标 - float x_position = 0; - float last_x_position = 0; + float xPosition = 0; + float lastXPosition = 0; // y坐标 - float y_position = 0; - float last_y_position = 0; + float yPosition = 0; + float lastYPosition = 0; int heartbeat = 0; - int last_heartbeat = 0; - int to_command = 0; - int last_to_command = 0; + int lastHeartbeat = 0; + int toCommand = 0; + int lastToCommand = 0; - int to_target = 0; - int last_to_target = 0; + int toTarget = 0; + int lastToTarget = 0; - int to_task = 0; - int last_to_task = 0; + int toTask = 0; + int lastToTask = 0; - int to_onset = 0; - int last_to_onset = 0; + int toOnset = 0; + int lastToOnset = 0; - int to_pull = 0; - int last_to_pull = 0; + int toPull = 0; + int lastToPull = 0; - int to_sleeve = 0; - int last_to_sleeve = 0; + int toSleeve = 0; + int lastToSleeve = 0; - int to_size = 0; - int last_to_size = 0; + int toSize = 0; + int lastToSize = 0; - int to_version = 0; - int last_to_version = 0; - - int to_qty = 0; - int last_to_qty = 0; - - // 子卷1长度 - float to_length1 = 0; - float last_to_length1 = 0; - // y坐标 - float to_length2 = 0; - float last_to_length2 = 0; + String toBarcode = null; + String lastToBarcode = null; @@ -179,91 +169,25 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp mode = this.itemProtocol.getMode(); move = this.itemProtocol.getMove(); action = this.itemProtocol.getAction(); - walk_y = this.itemProtocol.getWalk_y(); + walkY = this.itemProtocol.getWalk_y(); error = this.itemProtocol.getError(); task = this.itemProtocol.getTask(); heartbeat = this.itemProtocol.getHeartbeat(); - to_command = this.itemProtocol.getTo_command(); - to_target = this.itemProtocol.getTo_target(); - to_task = this.itemProtocol.getTo_task(); - to_pull = this.itemProtocol.getTo_pull(); - to_sleeve = this.itemProtocol.getTo_sleeve(); - to_size = this.itemProtocol.getTo_size(); - to_qty = this.itemProtocol.getTo_qty(); - to_version = this.itemProtocol.getTo_version(); - to_length1 = this.itemProtocol.getTo_length1(); - to_length2 = this.itemProtocol.getTo_length2(); - to_onset = this.itemProtocol.getTo_onset(); - x_position = this.itemProtocol.getX_position(); - y_position = this.itemProtocol.getY_position(); + toCommand = this.itemProtocol.getTo_command(); + toTarget = this.itemProtocol.getTo_target(); + toTask = this.itemProtocol.getTo_task(); + toPull = this.itemProtocol.getTo_pull(); + toSleeve = this.itemProtocol.getTo_sleeve(); + toSize = this.itemProtocol.getTo_size(); + toOnset = this.itemProtocol.getTo_onset(); + xPosition = this.itemProtocol.getX_position(); + yPosition = this.itemProtocol.getY_position(); - 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 (to_pull != last_to_pull) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号to_pull:" + last_to_pull + "->" + to_pull); - } - if (to_sleeve != last_to_sleeve) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号to_sleeve:" + last_to_sleeve + "->" + to_sleeve); - } - if (to_size != last_to_size) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号to_size:" + last_to_size + "->" + to_size); - } - if (to_version != last_to_version) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号to_version:" + last_to_version + "->" + to_version); - } - if (to_qty != last_to_qty) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号to_qty:" + last_to_qty + "->" + to_qty); - } - if (to_length1 != last_to_length1) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号to_length1:" + last_to_length1 + "->" + to_length1); - } - if (to_length2 != last_to_length2) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号to_length2:" + last_to_length2 + "->" + to_length2); - } - if (mode != last_mode) { + if (mode != lastMode) { 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); } + // 更新指令状态 if (mode == 3 && task > 0) { Date date = new Date(); @@ -289,14 +213,25 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp //任务完成 if (mode == 3 && action == 4 && move == 0 && task > 0) { - Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task)); - if (inst2 != null) { - if (StrUtil.equals(inst2.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) { + Instruction inst = instructionService.findByCodeFromCache(String.valueOf(task)); + if (inst != null) { + if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) { try { - finish_instruction(inst2); + TaskDto dto = taskserver.findByCode(inst.getTask_code()); Map map = new LinkedHashMap<>(); + if (ObjectUtil.isNotEmpty(dto)){ + String interaction_json = dto.getInteraction_json(); + if (ObjectUtil.isNotEmpty(interaction_json)){ + JSONObject jsonObject = (JSONObject) JSONObject.toJSON(interaction_json); + map.put("to_pull", jsonObject.getString("is_pulling")); + map.put("is_bushing", jsonObject.getString("is_bushing")); + map.put("to_size", jsonObject.getString("qzz_size")); + map.put("to_barcode", jsonObject.getString("qzz_no")); + } + } map.put("to_command", "5"); this.writing(map); + finish_instruction(inst); } catch (Exception e) { e.printStackTrace(); } @@ -315,11 +250,11 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp if (mode == 0) { this.setIsonline(false); - message = "未联机"; + message = "universal_off-line"; //有报警 } else if (error != 0) { this.setIserror(true); - message = "有报警"; + message = "universal_message3"; //无报警 } else { this.setIsonline(true); @@ -341,19 +276,19 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp //if (!requireSucess) { String remark = ""; if (mode != 2) { - remark = remark + "universal_remark2"; + remark = "universal_remark2"; } if (move != 0) { - remark = remark + "universal_remark3"; + remark = "universal_remark3"; } if (task != 0) { - remark = remark + "universal_remark4"; + remark = "universal_remark4"; if (ObjectUtil.isNotEmpty(this.inst)) { this.inst = null; } } if (requireSucess) { - remark = remark + "universal_remark5"; + remark = "universal_remark5"; } this.setNotCreateTaskMessage(remark); //} @@ -361,33 +296,27 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp } } - last_mode = mode; - last_move = move; - last_action = action; - last_walk_y = walk_y; - last_error = error; - last_task = task; - last_heartbeat = heartbeat; - last_to_task = to_task; - last_to_command = to_command; - last_to_target = to_target; - last_to_onset = to_onset; - last_x_position = x_position; - last_y_position = y_position; - last_to_pull = to_pull; - last_to_sleeve = to_sleeve; - last_to_size = to_size; - last_to_version = to_version; - last_to_qty = to_qty; - last_to_length1 = to_length1; - last_to_length2 = to_length2; + lastMode = mode; + lastMove = move; + lastAction = action; + lastWalkY = walkY; + lastError = error; + lastTask = task; + lastHeartbeat = heartbeat; + lastToTask = toTask; + lastToCommand = toCommand; + lastToTarget = toTarget; + lastToOnset = toOnset; + lastXPosition = xPosition; + lastYPosition = yPosition; + lastToPull = toPull; + lastToSleeve = toSleeve; + lastToSize = toSize; + lastToBarcode = toBarcode; } /** - * // * 申请任务 - * // * - * // * @param - * // + * 申请任务 */ public synchronized boolean applyTask() { Date date = new Date(); @@ -409,13 +338,13 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp taskDtos = this.sortTask(taskDtos); TaskDto taskDto = taskDtos.get(0); Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code()); - String start_device_code = instruction.getStart_device_code(); - String next_device_code = instruction.getNext_device_code(); + String startCode = instruction.getStart_device_code(); + String nextCode = instruction.getNext_device_code(); instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex()); instruction.setUpdate_time(DateUtil.now()); instructionService.update(instruction); - Device startDevice = deviceAppService.findDeviceByCode(start_device_code); - Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); + Device startDevice = deviceAppService.findDeviceByCode(startCode); + Device nextDevice = deviceAppService.findDeviceByCode(nextCode); if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { notCreateInstMessage = "universal_notCreateInstMessage1"; throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); @@ -424,13 +353,23 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp notCreateInstMessage = "universal_notCreateInstMessage1"; throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); } - String start_addr = startDevice.getExtraValue().get("address").toString(); - String next_addr = nextDevice.getExtraValue().get("address").toString(); + String startAddr = startDevice.getExtraValue().get("address").toString(); + String nextAddr = nextDevice.getExtraValue().get("address").toString(); + String interaction_json = taskDto.getInteraction_json(); + JSONObject jsonObject = JSONObject.parseObject(interaction_json); +// Object isBushing = jsonObject.get("is_bushing"); +// Object isPulling = jsonObject.get("is_pulling"); +// Object qzzNo = jsonObject.get("qzz_no"); +// Object qzzSize = jsonObject.get("qzz_size"); Map map = new LinkedHashMap<>(); map.put("to_command", CommonFinalParam.ONE); - map.put("to_onset", start_addr); + map.put("to_onset", startAddr); + map.put("to_target", nextAddr); map.put("to_task", instruction.getInstruction_code()); - map.put("to_target", next_addr); +// map.put("to_pull", isPulling); +// map.put("to_bushing", isBushing); +// map.put("to_size", qzzSize); +// map.put("to_barcode", qzzNo); this.writing(map); this.setRequireSucess(true); return true; @@ -447,35 +386,35 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp } } if (!ObjectUtil.isEmpty(task)) { - String taskid = task.getTask_id(); - String taskcode = task.getTask_code(); - String vehiclecode = task.getVehicle_code(); + String taskId = task.getTask_id(); + String taskCode = task.getTask_code(); + String vehicleCode = task.getVehicle_code(); String priority = task.getPriority(); - String start_point_code = task.getStart_point_code(); - String start_device_code = task.getStart_device_code(); - String route_plan_code = task.getRoute_plan_code(); - String next_point_code = task.getNext_point_code(); - String next_device_code = task.getNext_device_code(); + String startPointCode = task.getStart_point_code(); + String startDeviceCode = task.getStart_device_code(); + String routePlanCode = task.getRoute_plan_code(); + String nextPointCode = task.getNext_point_code(); + String nextDeviceCode = task.getNext_device_code(); Instruction instdto = new Instruction(); instdto.setInstruction_id(IdUtil.simpleUUID()); - instdto.setRoute_plan_code(route_plan_code); + instdto.setRoute_plan_code(routePlanCode); instdto.setRemark(task.getRemark()); instdto.setMaterial(task.getMaterial()); instdto.setQuantity(task.getQuantity()); - instdto.setTask_id(taskid); - instdto.setTask_code(taskcode); - instdto.setVehicle_code(vehiclecode); + instdto.setTask_id(taskId); + instdto.setTask_code(taskCode); + instdto.setVehicle_code(vehicleCode); String now = DateUtil.now(); instdto.setCreate_time(now); instdto.setCreate_by(SecurityUtils.getCurrentNickName()); - instdto.setStart_device_code(start_device_code); - instdto.setNext_device_code(next_device_code); - instdto.setStart_point_code(start_point_code); - instdto.setNext_point_code(next_point_code); + instdto.setStart_device_code(startDeviceCode); + instdto.setNext_device_code(nextDeviceCode); + instdto.setStart_point_code(startPointCode); + instdto.setNext_point_code(nextPointCode); instdto.setPriority(priority); instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex()); - instdto.setExecute_device_code(start_point_code); + instdto.setExecute_device_code(startPointCode); try { instructionService.create(instdto); @@ -502,13 +441,23 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code())); } - String start_addr = startDevice.getExtraValue().get("address").toString(); - String next_addr = nextDevice.getExtraValue().get("address").toString(); + String startAddr = startDevice.getExtraValue().get("address").toString(); + String nextAddr = nextDevice.getExtraValue().get("address").toString(); +// String interactionJson = task.getInteraction_json(); +// JSONObject jsonObject = JSONObject.parseObject(interactionJson); +// Object isBushing = jsonObject.get("is_bushing"); +// Object isPulling = jsonObject.get("is_pulling"); +// Object qzzNo = jsonObject.get("qzz_no"); +// Object qzzSize = jsonObject.get("qzz_size"); Map map = new LinkedHashMap<>(); map.put("to_command", CommonFinalParam.ONE); - map.put("to_onset", start_addr); + map.put("to_onset", startAddr); map.put("to_task", instdto.getInstruction_code()); - map.put("to_target", next_addr); + map.put("to_target", nextAddr); +// map.put("to_pull", isPulling); +// map.put("to_bushing", isBushing); +// map.put("to_size", qzzSize); +// map.put("to_barcode", qzzNo); this.writing(map); this.setRequireSucess(true); notCreateInstMessage = ""; @@ -612,7 +561,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp jo.put("move", move); jo.put("action", action); jo.put("task", task); - jo.put("walk_y", walk_y); + jo.put("walk_y", walkY); jo.put("isOnline", this.getIsonline()); jo.put("error", this.getError()); jo.put("isError", this.getIserror()); @@ -622,8 +571,8 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp jo.put("feedMessage", LangProcess.msg(feedMessage)); jo.put("driver_type", "siemens_conveyor"); jo.put("is_click", true); - jo.put("x", x_position); - jo.put("y", y_position); + jo.put("x", xPosition); + jo.put("y", yPosition); return jo; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java index 28d3d20b9..950a0d941 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java @@ -170,54 +170,8 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp x_position = this.itemProtocol.getX_position(); y_position = this.itemProtocol.getY_position(); - 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); - } - if (weight != last_weight) { - logServer.deviceItemValue(this.device_code, "weight", String.valueOf(weight)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号weight:" + last_weight + "->" + weight); } // 更新指令状态 @@ -329,13 +283,13 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp remark = remark + "光电信号(move)为有货状态,"; } if (task != 0) { - remark = remark + "universal_remark4"; + remark = "universal_remark4"; if (ObjectUtil.isNotEmpty(this.inst)) { this.inst = null; } } if (requireSucess) { - remark = remark + "universal_remark5"; + remark = "universal_remark5"; } this.setNotCreateTaskMessage(remark); //} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java index 6f13ce098..4c1504068 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java @@ -163,8 +163,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl heartbeat = this.itemProtocol.getHeartbeat(); 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 (mode == 3 && task > 0 && !requireSucess) { @@ -218,7 +216,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl if (!requireSucess) { String remark = ""; if (mode != 2) { - remark = remark + "universal_remark2"; + remark = "universal_remark2"; } if (move1 != 0) { remark = remark + "universal_remark6"; @@ -227,7 +225,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl remark = remark + "universal_remark7"; } if (task != 0) { - remark = remark + "universal_remark4"; + remark = "universal_remark4"; } this.setNotCreateTaskMessage(remark); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/subvolume_weighing_station/SubvolumeWeighingStationDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/subvolume_weighing_station/SubvolumeWeighingStationDriver.java index 6c7cf3a2d..61448083c 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/subvolume_weighing_station/SubvolumeWeighingStationDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/subvolume_weighing_station/SubvolumeWeighingStationDriver.java @@ -86,24 +86,6 @@ public class SubvolumeWeighingStationDriver extends AbstractOpcDeviceDriver impl weight = this.itemProtocol.getItem_weight(); 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 (weight != last_weight) { - logServer.deviceItemValue(this.device_code, "weight", String.valueOf(weight)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号weight:" + last_weight + "->" + weight); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/waste_foil_weighing_station/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/waste_foil_weighing_station/ItemProtocol.java index 4d5714a83..461d69f91 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/waste_foil_weighing_station/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/waste_foil_weighing_station/ItemProtocol.java @@ -98,7 +98,7 @@ public class ItemProtocol { public static List getWriteableItemDtos() { ArrayList list = new ArrayList(); list.add(new ItemDto(item_to_command, "下发命令", "DB20.W0")); - list.add(new ItemDto(item_to_error, "下发命令", "DB20.W1")); + list.add(new ItemDto(item_to_error, "下发故障代码", "DB20.W1")); return list; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/waste_foil_weighing_station/WasteFoilWeighingStationDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/waste_foil_weighing_station/WasteFoilWeighingStationDriver.java index 09201cac7..e07dbb7bf 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/waste_foil_weighing_station/WasteFoilWeighingStationDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/waste_foil_weighing_station/WasteFoilWeighingStationDriver.java @@ -101,28 +101,6 @@ public class WasteFoilWeighingStationDriver extends AbstractOpcDeviceDriver impl if (mode != last_mode) { requireSucess = false; this.setFeedbackSucess(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 (weight != last_weight) { - logServer.deviceItemValue(this.device_code, "weight", String.valueOf(weight)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号weight:" + last_weight + "->" + weight); - } - if (old_weight != last_old_weight) { - logServer.deviceItemValue(this.device_code, "old_weight", String.valueOf(old_weight)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号old_weight:" + last_old_weight + "->" + old_weight); } if (mode == 0) { @@ -155,13 +133,13 @@ public class WasteFoilWeighingStationDriver extends AbstractOpcDeviceDriver impl case 6: // 称重完成 if (move > 0 && !requireSucess) { - weightSuccess(); +// weightSuccess(); } break; case 7: // 称重确认完成 if (move > 0 && !requireSucess) { - weightConfirmSuccess(); +// weightConfirmSuccess(); } break; case 8: diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyManipulatorActionRequest.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyManipulatorActionRequest.java index 7abf5847f..bb907e351 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyManipulatorActionRequest.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyManipulatorActionRequest.java @@ -6,16 +6,7 @@ import lombok.Data; public class ApplyManipulatorActionRequest extends BaseRequest { private String vehicle_code; private String device_code; - /** - * 1- - * 2-反馈新放货点 - * 3-反馈新取货点 - * 4-反馈二次放货点 - * 6-套轴申请 - * 7-套轴完成 - * 8-拔轴完成 - */ - private String type; + /** * 行架任务号 @@ -35,15 +26,10 @@ public class ApplyManipulatorActionRequest extends BaseRequest { /** * 位置 1-左 2-右 */ - private String location; + private String direction; /** - * 左子卷号 + * 气涨轴编号 */ - private String left; - - /** - * 右子卷号 - */ - private String right; + private String qzz_no; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyManipulatorActionResponse.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyManipulatorActionResponse.java index 09bf24dd4..59ed81914 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyManipulatorActionResponse.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyManipulatorActionResponse.java @@ -8,13 +8,4 @@ import java.util.Map; @Data public class ApplyManipulatorActionResponse extends BaseResponse{ private Map data = new HashMap(); - /** - * 子卷号 - */ - private String barcode; - - /** - * 终点 - */ - private String next_point; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyPlugPullSitResponse.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyPlugPullSitResponse.java index 40e7e628c..8554c014d 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyPlugPullSitResponse.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/ApplyPlugPullSitResponse.java @@ -9,4 +9,5 @@ import java.util.Map; public class ApplyPlugPullSitResponse extends BaseResponse { private Map data = new HashMap(); + } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java index 3c7f2c67e..52c466b68 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java @@ -195,5 +195,14 @@ public class CreateTaskRequest extends BaseRequest { private String bushing_num; private String paper_array; + + /** + * 任务扩展字段 + */ private JSONObject interaction_json; + + /** + * 是否拔轴 0/1 + */ + private String is_pulling; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java index 7a843672b..ec27c8d44 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java @@ -107,6 +107,6 @@ public interface WmsToAcsService { * @param jsonObject * @return */ - PutWeightActionResponse putWeightAction(String jsonObject) throws Exception; + Map putWeightAction(String jsonObject) throws Exception; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index ac4bfe2e7..be040d076 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -360,15 +360,15 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { String type = ""; - if (result2.getStatus() == 200) { + if (ObjectUtil.isNotEmpty(result2) && result2.getStatus() == 200) { type = "info"; + JSONObject jo = JSONObject.parseObject(result2.body()); + log.info("feedbackTaskStatusToWms-----输出参数{}", jo.toString()); + return result2; } else { type = "error"; } - - JSONObject jo = JSONObject.parseObject(result2.body()); - log.info("feedbackTaskStatusToWms-----输出参数{}", jo.toString()); - return result2; + return null; } finally { MDC.remove(log_file_type); } @@ -617,7 +617,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { MDC.put(log_file_type, log_type); log.info("applyTaskToWms-----输入参数{}", param); String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("applyUpdatePointCode"); + AddressDto addressDto = addressService.findByCode("deviceApplyExceptional"); String url = wmsurl + addressDto.getMethods_url(); HttpResponse result2 = null; try { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index 282c2a579..f158dceb0 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -82,7 +82,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { public CreateTaskResponse crateTask(String param) { try { MDC.put(log_file_type, log_type); - log.info("crateTask-----输入参数{}", param); + log.info("crateTask-----输入参数{}", param); JSONArray datas = JSONArray.parseArray(param); CreateTaskResponse response = new CreateTaskResponse(); // ParamService paramService = SpringContextHolder.getBean(ParamService.class); @@ -114,6 +114,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { String truss_type = request.getTruss_type(); String empty_site = request.getEmpty_site(); String is_bushing = request.getIs_bushing(); + String is_pulling = request.getIs_pulling(); String size = request.getSize(); String version = request.getVersion(); String bushing_num = request.getBushing_num(); @@ -336,11 +337,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("truss_type", JSONUtil.toJsonStr(truss_type)); jo.put("empty_site", JSONUtil.toJsonStr(empty_site)); jo.put("is_bushing", JSONUtil.toJsonStr(is_bushing)); + jo.put("is_pulling", JSONUtil.toJsonStr(is_pulling)); jo.put("size", JSONUtil.toJsonStr(size)); jo.put("version", JSONUtil.toJsonStr(version)); jo.put("bushing_num", JSONUtil.toJsonStr(bushing_num)); - - if (!StrUtil.isEmpty(ext_task_id)) { jo.put("ext_task_id", ext_task_id); } @@ -464,19 +464,16 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } @Override - public PutWeightActionResponse putWeightAction(String jsonObject) throws Exception { + public Map putWeightAction(String jsonObject) throws Exception { try { MDC.put(log_file_type, log_type); log.info("putWeightAction--------------:输入参数" + jsonObject); JSONArray datas = JSONArray.parseArray(jsonObject); - PutWeightActionResponse response = new PutWeightActionResponse(); - JSONArray errArr = new JSONArray(); + JSONObject jo = new JSONObject(); for (int i = 0; i < datas.size(); i++) { - String data = datas.get(i).toString(); - PutWeightActionRequest request = JsonUtl.format(data, PutWeightActionRequest.class); - String device_code = request.getDevice_code(); - String code = request.getCode(); - String value = request.getValue(); + JSONObject data = (JSONObject) datas.get(i); + String device_code = data.getString("device_code"); + String type = data.getString("type"); Device device = deviceAppService.findDeviceByCode(device_code); if (ObjectUtil.isEmpty(device)) { throw new Exception("未找到对应设备:" + device_code); @@ -484,21 +481,35 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver; if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); - wasteFoilWeighingStationDriver.writing(code, value); try { - Thread.sleep(1000); //休眠1秒 + //称重完成 + if (StrUtil.equals("1", type)) { + Thread.sleep(1000); //休眠1秒 + if (wasteFoilWeighingStationDriver.getMode() == 6) { + jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量 + jo.put("lastWeight", wasteFoilWeighingStationDriver.getGap_weight());//上一次重量 + jo.put("weightGap", wasteFoilWeighingStationDriver.getOld_weight());//重量差 + wasteFoilWeighingStationDriver.writing("to_command", "6"); + } + } + //称重确认信号 + else if (StrUtil.equals("2", type)) { + Thread.sleep(1000); //休眠1秒 + if (wasteFoilWeighingStationDriver.getMode() == 7) { + wasteFoilWeighingStationDriver.writing("to_command", "8"); + } + } } catch (InterruptedException e) { e.printStackTrace(); } } } - response.setCode(200); - response.setMessage("success"); - LuceneLogDto luceneLogDto = new LuceneLogDto("putWeightAction", String.valueOf(response.getCode()), - jsonObject, String.valueOf(response), "LMS下发动作"); - luceneExecuteLogService.interfaceExecuteLog(luceneLogDto); - log.info("putWeightAction--------------:输出参数:" + response); - return response; + JSONObject resultJson = new JSONObject(); + resultJson.put("status", HttpStatus.OK.value()); + resultJson.put("message", "操作成功"); + resultJson.put("data", jo); + log.info("putWeightAction--------------:输出参数" + resultJson.toString()); + return resultJson; } finally { MDC.remove(log_file_type); } @@ -574,8 +585,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("device_code", boxManipulatorDeviceDriver.getDevice().getDevice_code()); jo.put("device_name", boxManipulatorDeviceDriver.getDevice().getDevice_name()); jo.put("status", Math.min(3, boxManipulatorDeviceDriver.getMode())); - jo.put("x", boxManipulatorDeviceDriver.getX_position()); - jo.put("y", boxManipulatorDeviceDriver.getY_position()); + jo.put("x", boxManipulatorDeviceDriver.getX()); + jo.put("y", boxManipulatorDeviceDriver.getY()); jo.put("mode", boxManipulatorDeviceDriver.getMode()); jo.put("move", boxManipulatorDeviceDriver.getMove()); jo.put("action", boxManipulatorDeviceDriver.getAction()); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java index 31a0c2f75..39346beda 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java @@ -184,6 +184,9 @@ public interface InstructionService extends CommonService { */ void create(Instruction dto) throws Exception; + + + /** * 创建2 * @@ -453,5 +456,4 @@ public interface InstructionService extends CommonService { */ Boolean querySameNextDeviceCodeInstByOut(String nextDeviceCode); - void updateByInstructionCode(Instruction instructionUpdate); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 9994ceeed..7f712bc79 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -5,7 +5,6 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.ListUtil; import cn.hutool.core.date.DateUtil; -import cn.hutool.core.stream.CollectorUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; @@ -14,7 +13,6 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -28,7 +26,6 @@ import org.nl.acs.agv.server.XianGongAgvService; import org.nl.acs.auto.initial.ApplicationAutoInitial; import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.device.domain.Device; -import org.nl.acs.device.domain.DeviceErpmapping; import org.nl.acs.device.enums.DeviceType; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.impl.DeviceServiceImpl; @@ -36,7 +33,6 @@ import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.DeviceDriverDefination; import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver; import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver; -import org.nl.acs.device_driver.conveyor.standard_conveyor_control.StandardCoveyorControlDeviceDriver; import org.nl.acs.device_driver.conveyor.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver; import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.two_conveyor.hongxiang_device.HongXiangConveyorDeviceDriver; @@ -365,17 +361,21 @@ public class InstructionServiceImpl extends CommonServiceImpl instructionMybatis = instructionMapper.selectList(Wrappers.lambdaQuery(InstructionMybatis.class) + .eq(InstructionMybatis::getTask_code, dto.getTask_code())); + if(CollUtil.isNotEmpty(instructionMybatis) && instructionMybatis.stream().anyMatch(inst -> inst.getStart_device_code() + .equals(start_device_code))){ return; } } @@ -441,7 +441,7 @@ public class InstructionServiceImpl extends CommonServiceImpl shortPathsList = @@ -465,19 +465,19 @@ public class InstructionServiceImpl extends CommonServiceImpl updateWrapper = new UpdateWrapper<>(); - updateWrapper.eq("instruction_code", instructionUpdate.getInstruction_code()); - instructionMapper.update(entity,updateWrapper); - } - private boolean regional( String start_device_code, String next_device_code) { + private boolean regional(String start_device_code, String next_device_code) { Device startdevice = deviceAppService.findDeviceByCode(start_device_code); Device nextdevice = deviceAppService.findDeviceByCode(next_device_code); String startRegion = startdevice.getRegion(); @@ -1838,8 +1833,8 @@ public class InstructionServiceImpl extends CommonServiceImpl{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value, sb}); -// this.businessLogger.setResource(itemDto.getDevice_code(), itemDto.getDevice_name()).log("信号{}变更从{}->{};信号快照:{}", new Object[]{itemId, his, value, sb}); + if (!itemDto.getItem_code().endsWith("heartbeat") && !itemDto.getItem_code().endsWith("time")) { + // 存在上次点位值为null情况 则不记录日志 + LuceneLogDto luceneLogDto = new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(), itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1), + String.valueOf(his), String.valueOf(value)); + luceneLogDto.setLogType(LogTypeEnum.DEVICE_LOG.getDesc()); + log.info("{}", JSON.toJSONString(luceneLogDto)); + } } else { // if(his instanceof int[]){ // if(!Arrays.equals((long[]) his, (long[]) value)){ @@ -437,8 +431,13 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC // log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value}); // } - log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value}); -// this.businessLogger.setResource(itemDto.getDevice_code(), itemDto.getDevice_name()).log("信号{}变更从{}->{}", new Object[]{itemId, his, value}); +// log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value}); + if (!itemDto.getItem_code().endsWith("heartbeat") && !itemDto.getItem_code().endsWith("time")) { + LuceneLogDto luceneLogDto = new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(), itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1), + String.valueOf(his), String.valueOf(value)); + luceneLogDto.setLogType(LogTypeEnum.DEVICE_LOG.getDesc()); + log.info("{}", JSON.toJSONString(luceneLogDto)); + } } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcUtl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcUtl.java index c8248c93e..87646a162 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcUtl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcUtl.java @@ -161,6 +161,8 @@ public class OpcUtl { return jiVariant.getObject(); } else if (e instanceof Float) { return jiVariant.getObject(); + } else if (e instanceof Double) { + return jiVariant.getObject(); } else { System.err.println(id + "不明类型" + e.getClass()); if (jiVariant.getType() == 0) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/WcsConfig.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/WcsConfig.java index bf2a71841..8d5564262 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/WcsConfig.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/WcsConfig.java @@ -17,6 +17,12 @@ public class WcsConfig { */ public static String task_container_type_default_desc; + /** + * 堆垛机异常入库次数限制 + */ + public static Integer stacker_error_in_count ; + + /** * 重复的指令下发超时 ms */ diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/TaskService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/TaskService.java index 45c25be8e..8860df2ef 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/TaskService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/TaskService.java @@ -388,6 +388,15 @@ public interface TaskService extends CommonService { */ TaskDto findByStartCodeAndReady(String device_code); + /** + * 根据起点设备编号查询当前是否有执行中任务 + * + * @param start_code + * @param next_code + * @return + */ + TaskDto findByCodeAndExcute(String start_code,String next_code); + /** * 根据终点设备编号查询当前是否有就绪任务 @@ -511,5 +520,4 @@ public interface TaskService extends CommonService { */ TaskDto findByTaskCode(String task_code); - void updateByTaskCode(Task taskUpdate); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskDto.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskDto.java index aba3dfdbc..34855a6b5 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskDto.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskDto.java @@ -307,6 +307,7 @@ public class TaskDto implements Serializable { * 交互字段 */ private String interaction_json; + private JSONObject interactionJson; /** @@ -338,4 +339,9 @@ public class TaskDto implements Serializable { * 扩展属性 */ String params2; + + /** + * 是否拔轴 0/1 + */ + private String is_pulling; } 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 6a88cf869..9a60e55ce 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 @@ -2,13 +2,12 @@ package org.nl.acs.task.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.map.MapUtil; -import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; -import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -17,6 +16,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; +import groovy.lang.Lazy; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; import org.nl.acs.AcsConfig; @@ -30,9 +30,6 @@ import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.dto.DeviceAssignedDto; import org.nl.acs.device.service.impl.DeviceServiceImpl; import org.nl.acs.device_driver.DeviceDriverDefination; -import org.nl.acs.device_driver.RequestMethodEnum; -import org.nl.acs.ext.wms.data.one.BaseRequest; -import org.nl.acs.ext.wms.data.one.feedBackTaskStatus.FeedBackTaskStatusRequest; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.domain.InstructionMybatis; @@ -48,7 +45,6 @@ import org.nl.acs.route.service.mapper.RoutePlanMapper; import org.nl.acs.task.enums.TaskStatusEnum; import org.nl.acs.task.enums.TaskTypeEnum; import org.nl.acs.task.service.TaskFeedbackService; -import org.nl.acs.task.service.dto.TaskFeedbackDto; import org.nl.acs.common.base.PageInfo; import org.nl.acs.common.base.QueryHelpMybatisPlus; import org.nl.acs.common.base.impl.CommonServiceImpl; @@ -75,7 +71,6 @@ import org.springframework.data.domain.Pageable; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.util.*; import java.util.concurrent.CopyOnWriteArrayList; import java.util.regex.Matcher; @@ -103,6 +98,7 @@ public class TaskServiceImpl extends CommonServiceImpl impleme private TaskFeedbackService taskFeedbackService; @Autowired private ISysParamService paramService; + @Lazy @Autowired private XianGongAgvService agvService; @Autowired @@ -154,7 +150,7 @@ public class TaskServiceImpl extends CommonServiceImpl impleme list.add(task); } } else { - if (StrUtil.equals(task.getTask_type(), TaskTypeEnum.Inner_Truss_Task.getIndex()) && StrUtil.isNotEmpty(task.getPut_device_code())) { + if (StrUtil.equals(task.getTask_type(), TaskTypeEnum.Truss_Task.getIndex()) && StrUtil.isNotEmpty(task.getPut_device_code())) { Instruction instruction = instructionService.findByDeviceCodeFromCache(task.getNext_device_code()); if (ObjectUtil.isNotEmpty(instruction)) { if (StrUtil.equals(instruction.getStart_device_code(), device_code)) { @@ -520,7 +516,7 @@ public class TaskServiceImpl extends CommonServiceImpl impleme public List findByTaskStatus(String status) { List taskDtoList = new ArrayList<>(); Iterator iterator = tasks.iterator(); - if (iterator.hasNext()) { + while (iterator.hasNext()) { TaskDto task = iterator.next(); if (StrUtil.equals(task.getTask_status(), status)) { taskDtoList.add(task); @@ -1081,6 +1077,17 @@ public class TaskServiceImpl extends CommonServiceImpl impleme return optionalTask.orElse(null); } + @Override + public TaskDto findByCodeAndExcute(String start_code, String next_code) { + Task task = this.lambdaQuery() + .eq(Task::getStart_device_code, start_code) + .eq(Task::getNext_device_code, next_code) + .eq(Task::getTask_status, TaskStatusEnum.BUSY.getIndex()) + .one(); + TaskDto taskDto = BeanUtil.copyProperties(task, TaskDto.class); + return taskDto; + } + @Override public TaskDto findByEndCodeAndReady(String device_code) { @@ -1115,7 +1122,8 @@ public class TaskServiceImpl extends CommonServiceImpl impleme CommonFinalParam commonFinalParam = new CommonFinalParam(); if (StrUtil.contains(start_point_code, commonFinalParam.getBARRE()) && StrUtil.count(start_point_code, commonFinalParam.getBARRE()) == 2) { String[] start_point = start_point_code.split(commonFinalParam.getBARRE()); - task.setFrom_x(start_point[0]); + Device starPoint = deviceAppService.findDeviceByCode(start_point[0]); + task.setFrom_x(starPoint.getExtraValue().get("x").toString()); task.setStart_device_code(start_point[0]); if (Integer.parseInt(start_point[1]) < 10 && start_point[1].length() == 1) { from_y = "0" + start_point[1]; @@ -1167,7 +1175,8 @@ public class TaskServiceImpl extends CommonServiceImpl impleme } else { from_z = task.getFrom_z(); } - task.setFrom_x(start_point_code); + Device starPoint = deviceAppService.findDeviceByCode(start_point_code); + task.setFrom_x(starPoint.getExtraValue().get("x").toString()); task.setStart_point_code(start_point_code + commonFinalParam.getBARRE() + from_y + commonFinalParam.getBARRE() + from_z); task.setStart_device_code(start_point_code); } @@ -1541,12 +1550,7 @@ public class TaskServiceImpl extends CommonServiceImpl impleme return null; } - @Override - public void updateByTaskCode(Task taskUpdate) { - UpdateWrapper updateWrapper = new UpdateWrapper<>(); - updateWrapper.eq("task_code", taskUpdate.getTask_code()); - taskMapper.update(taskUpdate,updateWrapper); - } + /** * 把多个字符串拼接的inst_nextDevice_code解析成集合 diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/taskscreen/rest/TaskScreenController.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/taskscreen/rest/TaskScreenController.java index 57eb3b726..42244bd43 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/taskscreen/rest/TaskScreenController.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/taskscreen/rest/TaskScreenController.java @@ -23,14 +23,12 @@ public class TaskScreenController { @GetMapping @Log("下拉选设备") - public ResponseEntity selectLedList() { return new ResponseEntity<>(taskScreenService.selectLedList(), HttpStatus.OK); } @GetMapping("/getLedMessage/{device}") @Log("根据关联设备获取任务信息") - public ResponseEntity getLedMessage(@PathVariable String device) { return new ResponseEntity<>(taskScreenService.getLedMessage(device), HttpStatus.OK); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/taskscreen/service/impl/TaskScreenServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/taskscreen/service/impl/TaskScreenServiceImpl.java index 87b71c161..c9e3ccd7d 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/taskscreen/service/impl/TaskScreenServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/taskscreen/service/impl/TaskScreenServiceImpl.java @@ -18,6 +18,7 @@ import org.nl.acs.device.service.dto.DeviceDto; import org.nl.acs.device.service.mapper.DeviceExtraMapper; import org.nl.acs.device.service.mapper.DeviceMapper; import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver; +import org.nl.acs.device_driver.one_conveyor.scanner_weight_conveyor.ConveyorWithScannerWeightDeviceDriver; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.taskscreen.mapper.TaskScreenMapper; import org.nl.acs.taskscreen.service.TaskScreenService; @@ -30,7 +31,7 @@ import java.util.List; /** * @author tuqiang - * @date 2023-05-09 + * @date 2023-12-09 */ @Service @AllArgsConstructor @@ -45,11 +46,15 @@ public class TaskScreenServiceImpl extends CommonServiceImpl list = new LambdaQueryChainWrapper(deviceMapper) @@ -85,11 +90,11 @@ public class TaskScreenServiceImpl extends CommonServiceImpl list = taskserver.queryAllByStatus("0"); for (int i = 0; i < list.size(); i++) { @@ -101,7 +100,7 @@ public class AutoCreateInst { continue; } - if (!StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE) && !StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.TWO)) { + if (!StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) { continue; } @@ -189,6 +188,7 @@ public class AutoCreateInst { } try { instructionService.create(instdto); + } catch (Exception e) { acsTask.setRemark(e.getMessage()); taskserver.updateByCodeFromCache(acsTask); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java index 109c37d4d..63809dbb7 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java @@ -3,6 +3,7 @@ package org.nl.system.service.quartz.task; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; @@ -55,10 +56,14 @@ public class CreateDDJInst { Device startDevice = appService.findDeviceByCode(start_device_code); String next_device_code = taskDto.getNext_device_code(); Device nextDevice = appService.findDeviceByCode(next_device_code); + //判断有无出入库任务是相同路线 + TaskDto dto = taskserver.findByCodeAndExcute(next_device_code, start_device_code); + if (ObjectUtil.isNotEmpty(dto)){ + return; + } if (startDevice.getDevice_type().equals(DeviceType.storage.name()) && (nextDevice.getDevice_type().equals(DeviceType.conveyor.name()) || nextDevice.getDevice_type().equals(DeviceType.storage.name()))) { taskDtoList.add(taskDto); - } } if (CollUtil.isNotEmpty(taskDtoList)) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/secutiry/impl/OnlineUserService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/secutiry/impl/OnlineUserService.java index 036c9a724..c7e8fc51f 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/secutiry/impl/OnlineUserService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/secutiry/impl/OnlineUserService.java @@ -15,6 +15,10 @@ */ package org.nl.system.service.secutiry.impl; +import cn.dev33.satoken.SaManager; +import cn.dev33.satoken.config.SaCookieConfig; +import cn.dev33.satoken.context.SaHolder; +import cn.dev33.satoken.context.model.SaCookie; import cn.dev33.satoken.secure.SaSecureUtil; import cn.dev33.satoken.stp.SaLoginModel; import cn.dev33.satoken.stp.StpUtil; @@ -257,6 +261,19 @@ public class OnlineUserService { .setDevice("PC") .setExtra("loginInfo", user) ); + String tokenValue = StpUtil.getTokenValue(); + SaCookieConfig cfg = SaManager.getConfig().getCookie(); + SaCookie cookie = new SaCookie() + .setName(StpUtil.getTokenValue()) + .setValue(tokenValue) + .setMaxAge(-1) + .setDomain(cfg.getDomain()) + .setPath(cfg.getPath()) + .setSecure(cfg.getSecure()) + .setHttpOnly(cfg.getHttpOnly()) + .setSameSite(cfg.getSameSite()) + ; + SaHolder.getResponse().addCookie(cookie); // 返回 token 与 用户信息 JSONObject jsonObject = new JSONObject(); diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml b/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml index ae420fba8..e6a974ebe 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml @@ -9,11 +9,12 @@ spring: db-type: com.alibaba.druid.pool.DruidDataSource driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy # url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true - url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true -# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true +# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true + url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true + username: ${DB_USER:root} # password: ${DB_PWD:Root.123456} - password: ${DB_PWD:p@ssw0rd} + password: ${DB_PWD:123456} # 初始连接数 initial-size: 5 # 最小连接数 diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device.properties index d32c104d9..fd1981f89 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device.properties @@ -14,6 +14,7 @@ one_message14=\u7533\u8BF7\u4EFB\u52A1\u5931\u8D25 one_message15=\u7533\u8BF7AGV\u642C\u8FD0\u4EFB\u52A1\u63A5\u53E3\u4E0D\u901A one_message16=\u7533\u8BF7AGV\u642C\u8FD0\u4EFB\u52A1\u6210\u529F one_message17=\u7533\u8BF7AGV\u642C\u8FD0\u4EFB\u52A1\u5931\u8D25 +one_message18=\u672A\u627E\u5230\u66F4\u65B0\u7684\u70B9\u4F4D one_mode1=\u7533\u8BF7\u5165\u5E93\u4EFB\u52A1 one_mode2=\u7533\u8BF7\u7A7A\u6258\u76D8\u5165\u5E93 one_mode3=\u7533\u8BF7AGV\u4EFB\u52A1 diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_en_US.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_en_US.properties index 5980c082f..5bc24ec89 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_en_US.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_en_US.properties @@ -14,6 +14,8 @@ one_message14=Task request failed one_message15=The interface for applying for a complement to the AGV carrying task fails. Procedure one_message16=Succeeded in applying for the AGV transfer task. Procedure one_message17=Failed to apply for the AGV transfer task. Procedure +one_message18=No updated point found + one_mode1=Request a warehouse entry task one_mode2=Request empty pallets for storage one_mode3=Request AGV diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_in_ID.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_in_ID.properties index 1e4bddf8e..80657582d 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_in_ID.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_in_ID.properties @@ -14,6 +14,8 @@ one_message14=Misi aplikasi gagal one_message15=Permintaan kode tambahan AGV memindahkan antarmuka misi tidak tersedia one_message16=Minta ijin ke operasi AGV one_message17=Aplikasi bantuan AGV pemindahan gagal +one_message18=Titik pembaruan tidak ditemukan + one_mode1=Berlaku untuk tugas pustaka one_mode2=Pendaftaran nampan kosong one_mode3=Permintaan AGV diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_zh_CN.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_zh_CN.properties index 67270528b..3ae3f4d8e 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_zh_CN.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_zh_CN.properties @@ -14,6 +14,8 @@ one_message14=\u7533\u8BF7\u4EFB\u52A1\u5931\u8D25 one_message15=\u7533\u8BF7\u8865\u7801AGV\u642C\u8FD0\u4EFB\u52A1\u63A5\u53E3\u4E0D\u901A one_message16=\u7533\u8BF7\u8865\u7801AGV\u642C\u8FD0\u4EFB\u52A1\u6210\u529F one_message17=\u7533\u8BF7\u8865\u7801AGV\u642C\u8FD0\u4EFB\u52A1\u5931\u8D25 +one_message18=\u672A\u627E\u5230\u66F4\u65B0\u7684\u70B9\u4F4D + one_mode1=\u7533\u8BF7\u5165\u5E93\u4EFB\u52A1 one_mode2=\u7533\u8BF7\u7A7A\u6258\u76D8\u5165\u5E93 one_mode3=\u7533\u8BF7AGV\u4EFB\u52A1 diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal.properties index b5f900cfe..9c3f82e55 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal.properties @@ -1,3 +1,4 @@ +universal_null = \u7A7A universal_off-line=\u8131\u673A universal_stand-alone=\u5355\u673A universal_standby=\u5F85\u673A diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_zh_CN.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_zh_CN.properties index 6dcc8c05e..3a88ce9d8 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_zh_CN.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_zh_CN.properties @@ -9,7 +9,7 @@ universal_delivery=\u53D6\u8D27\u4E2D universal_completed=\u53D6\u8D27\u5B8C\u6210 universal_releasing=\u653E\u8D27\u4E2D universal_releasing_completed=\u653E\u8D27\u5B8C\u6210 -universal_remark1=\u672A\u67E5\u627E\u4EFB\u52A1\u539F\u56E0\u4E3A\uFF1A +universal_remark1=\u672A\u67E5\u627E\u4EFB\u52A1\u539F\u56E0\u4E3A universal_remark2=\u5DE5\u4F5C\u6A21\u5F0F(mode)\u4E0D\u662F\u5F85\u673A\u72B6\u6001 universal_remark3=\u5149\u7535\u4FE1\u53F7(move)\u4E3A\u6709\u8D27\u72B6\u6001 universal_remark4=\u5F53\u524D\u4E0A\u62A5\u4EFB\u52A1\u53F7(task)\u5E94\u8BE5\u4E3A0 diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCAgvServiceImpl.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCAgvServiceImpl.xml new file mode 100644 index 000000000..f13d96f5f --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCAgvServiceImpl.xml @@ -0,0 +1,33 @@ + + + + + + + + + ${LOG_HOME}/agv下发/%d{yyyy-MM-dd}.%i.log + + 15 + + 200MB + + 2GB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + ${log.charset} + + + + + + + + + + + diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/log/OneNDCSocketConnectionAutoRun.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/log/OneNDCSocketConnectionAutoRun.xml index ca3f78791..8f4151a72 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/log/OneNDCSocketConnectionAutoRun.xml +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/log/OneNDCSocketConnectionAutoRun.xml @@ -3,7 +3,7 @@ - + ${LOG_HOME}/一楼NDC系统/%d{yyyy-MM-dd}.%i.log @@ -28,6 +28,6 @@ - + diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/log/TwoNDCSocketConnectionAutoRun.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/log/TwoNDCSocketConnectionAutoRun.xml new file mode 100644 index 000000000..63517b12f --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/log/TwoNDCSocketConnectionAutoRun.xml @@ -0,0 +1,33 @@ + + + + + + + + + ${LOG_HOME}/二楼NDC系统/%d{yyyy-MM-dd}.%i.log + + 15 + + 200MB + + 2GB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + ${log.charset} + + + + + + + + + + + diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml index 5e8238e7f..ab174d9ef 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml @@ -20,6 +20,8 @@ https://juejin.cn/post/6844903775631572999 + + diff --git a/acs2/nladmin-ui/dist (2).zip b/acs2/nladmin-ui/dist (2).zip new file mode 100644 index 000000000..7431eb8e4 Binary files /dev/null and b/acs2/nladmin-ui/dist (2).zip differ diff --git a/acs2/nladmin-ui/dist.zip b/acs2/nladmin-ui/dist.zip new file mode 100644 index 000000000..df068c6bb Binary files /dev/null and b/acs2/nladmin-ui/dist.zip differ diff --git a/acs2/nladmin-ui/public/config.js b/acs2/nladmin-ui/public/config.js index c9ef333db..4f5976990 100644 --- a/acs2/nladmin-ui/public/config.js +++ b/acs2/nladmin-ui/public/config.js @@ -1,9 +1,9 @@ window.g = { dev: { - VUE_APP_BASE_API: 'http://192.168.101.1:8011' + VUE_APP_BASE_API: 'http://127.0.0.1:8011' }, prod: { - VUE_APP_BASE_API: 'http://192.168.101.1:8011' + VUE_APP_BASE_API: 'http://10.1.3.96:8011' } } diff --git a/acs2/nladmin-ui/src/views/acs/device/config.vue b/acs2/nladmin-ui/src/views/acs/device/config.vue index 4ee8ce4ef..2eb9742a6 100644 --- a/acs2/nladmin-ui/src/views/acs/device/config.vue +++ b/acs2/nladmin-ui/src/views/acs/device/config.vue @@ -125,6 +125,7 @@ import return_good_manipulator from '@/views/acs/device/driver/one_manipulator/r import volume_two_manipulator from '@/views/acs/device/driver/one_manipulator/volume_two_manipulator.vue' import box_storage_out_conveyor from '@/views/acs/device/driver/one_conveyor/box_storage_out_conveyor.vue' import box_subvolumes_conveyor from '@/views/acs/device/driver/one_conveyor/box_subvolumes_conveyor.vue' +import manipulator_cache from '@/views/acs/device/driver/one_conveyor/manipulator_cache.vue' import finished_product_out_with_bind_lable_conveyor from '@/views/acs/device/driver/one_conveyor/finished_product_out_with_bind_lable_conveyor.vue' import fold_disc_site from '@/views/acs/device/driver/one_conveyor/fold_disc_site.vue' import scanner_weight_conveyor from '@/views/acs/device/driver/one_conveyor/scanner_weight_conveyor.vue' @@ -188,7 +189,8 @@ export default { xg_agv_car, oven_inspect_site, manipulator_agv_station, - volume_two_manipulator + volume_two_manipulator, + manipulator_cache }, dicts: ['device_type'], mixins: [crud], diff --git a/acs2/nladmin-ui/src/views/acs/device/driver/one_conveyor/manipulator_cache.vue b/acs2/nladmin-ui/src/views/acs/device/driver/one_conveyor/manipulator_cache.vue new file mode 100644 index 000000000..d5459f42f --- /dev/null +++ b/acs2/nladmin-ui/src/views/acs/device/driver/one_conveyor/manipulator_cache.vue @@ -0,0 +1,564 @@ + + + + + diff --git a/acs2/nladmin-ui/src/views/acs/device/driver/rgv.vue b/acs2/nladmin-ui/src/views/acs/device/driver/rgv.vue index b2c75978e..410be882d 100644 --- a/acs2/nladmin-ui/src/views/acs/device/driver/rgv.vue +++ b/acs2/nladmin-ui/src/views/acs/device/driver/rgv.vue @@ -188,6 +188,23 @@ + + + + + + + @@ -358,6 +375,13 @@ export default { label: '2楼' }], address: '', + directions: [{ + key: '1', + label: '左边' + }, { + key: '2', + label: '右边' + }], configLoading: false, dataOpcservers: [], dataOpcPlcs: [], diff --git a/acs2/nladmin-ui/src/views/screen/bigScreen.vue b/acs2/nladmin-ui/src/views/screen/bigScreen.vue index 8f8238373..065349377 100644 --- a/acs2/nladmin-ui/src/views/screen/bigScreen.vue +++ b/acs2/nladmin-ui/src/views/screen/bigScreen.vue @@ -152,7 +152,8 @@ export default { // 定时器 const timer = setInterval(() => { this.settime()// 你所加载数据的方法 - }, 1000) + this.getMessage() + }, 10000) // 销毁定时器 this.$once('hook:beforeDestroy', () => { clearInterval(timer) @@ -183,6 +184,11 @@ export default { this.initStatus() }, 10000) }, + getMessage() { + deviceCrud.getLedMessage(this.device).then(data => { + this.form = data + }) + }, settime() { const _this = this const yy = new Date().getFullYear() diff --git a/acs2/nladmin-ui/src/views/system/monitor/device/index.vue b/acs2/nladmin-ui/src/views/system/monitor/device/index.vue index 492c3ea73..c39409845 100644 --- a/acs2/nladmin-ui/src/views/system/monitor/device/index.vue +++ b/acs2/nladmin-ui/src/views/system/monitor/device/index.vue @@ -220,6 +220,29 @@ {{ $t('auto.common.Confirm') }} + + + + + + + + + + + + + + {{ $t('auto.common.false') }} + {{ $t('auto.common.true') }} + + + + + @@ -229,6 +252,7 @@ import deviceCrud from '@/api/acs/device/device' import { getDeviceByCodes } from '@/api/acs/device/deviceStageMonitor' import '@logicflow/core/dist/style/index.css' import '@logicflow/extension/lib/style/index.css' +import paramCrud from '@/api/system/param' import { LogicFlow } from '@logicflow/core' import { registerCustomElement } from '@/views/system/logicflow/editor/components/node' @@ -265,6 +289,7 @@ export default { hasGoodStatus: null, barcode: '', hand_barcode: '', + hand_material_barcode: '', suspended: null, material_type: '', requireSucess: '', @@ -416,6 +441,8 @@ export default { this.dialogFormVisible8 = true } else if (clickObj.data.driver_type === 'pull_head_manipulator') { this.dialogFormVisible9 = true + } else if (clickObj.data.driver_type === 'conveyor_with_scanner_weight') { + this.dialogFormVisible10 = true } else { this.dialogFormVisible = true } @@ -446,7 +473,7 @@ export default { } this.arr = [] // 清空 if (item.device_code && item.data) { - // console.log('item', item) + console.log('item', item) this.arr = [ { name: i18n.t('monitor.click.equipment_number'), value: item.device_code }, { name: i18n.t('monitor.click.device_name'), value: item.device_name } @@ -626,7 +653,7 @@ export default { const obj = { name: i18n.t('monitor.click.inventory_quantity'), value: data[val] } this.arr.push(obj) } else if (val === 'hand_barcode') { - const obj = { name: 'barcode', value: data[val] } + const obj = { name: 'hand_barcode', value: data[val] } this.arr.push(obj) } else if (val === 'x') { const obj = { name: 'X', value: data[val] } @@ -715,6 +742,7 @@ export default { this.dialogFormVisible7 = false this.dialogFormVisible8 = false this.dialogFormVisible9 = false + this.dialogFormVisible10 = false this.initStageData() }).catch(err => { this.dialogFormVisible = false @@ -724,6 +752,7 @@ export default { this.dialogFormVisible7 = false this.dialogFormVisible8 = false this.dialogFormVisible9 = false + this.dialogFormVisible10 = false console.log(err.response.data.message) }) }, @@ -736,6 +765,20 @@ export default { this.dialogFormVisible1 = false console.log(err.response.data.message) }) + }, + initStageData() { + // 获取舞台编码 + if (this.stage_code !== '') { + crudStage.getNewStageDataByCode(this.stage_code).then(res => { // 通过舞台编码获取舞台数据并且赋值到lf对象 + data = JSON.parse(res.stage_data) + lf.render(data) + this.initStatus() // 初始化状态 + }) + } + // this.timer = setInterval(() => { // 定时刷新设备的状态信息 + // console.log('定时器启动') + // this.initStatus() + // }, 2000) } } } @@ -780,22 +823,24 @@ body { background: #e5e5e5; } -::v-deep.el-radio-button{ +::v-deep.el-radio-button { margin-right: 15px; - border-radius:4px; + border-radius: 4px; +} + +.el-radio-button__inner { + width: 90px; + height: 30px; + background: #F7F8FA; + color: #333; + border: 0 !important; +} + +.el-radio-button__orig-radio:checked + .el-radio-button__inner { + color: #fff; + background-color: blue; + border-color: blue; + box-shadow: -1px 0 0 0 blue; } - .el-radio-button__inner { - width: 90px; - height: 30px; - background: #F7F8FA; - color:#333; - border: 0 !important; - } - .el-radio-button__orig-radio:checked + .el-radio-button__inner { - color: #fff; - background-color: blue; - border-color: blue; - box-shadow: -1px 0 0 0 blue; - } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/autotask/CleanTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/autotask/CleanTask.java new file mode 100644 index 000000000..2feac49b0 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/autotask/CleanTask.java @@ -0,0 +1,27 @@ +package org.nl.wms.autotask; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.system.service.param.ISysParamService; +import org.springframework.stereotype.Component; + +/** + * 自动清除日志(操作日志、异常日志)数据 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class CleanTask { + private final ISysParamService paramService; + + public void run() { + //delete from sys_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 30 day)) limit 10; + WQLObject taskTab = WQLObject.getWQLObject("sch_base_task"); + int days = Integer.parseInt(paramService.findByCode("task_day").getValue()); + taskTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))"); + + log.info("自动清理任务执行成功...!"); + } + +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/rest/MaterialbaseController.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/rest/MaterialbaseController.java index 5b7e71d47..c960062d2 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/rest/MaterialbaseController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/rest/MaterialbaseController.java @@ -83,15 +83,6 @@ public class MaterialbaseController { return new ResponseEntity<>(MaterOptTypeEnum.getObj(materOpt_code), HttpStatus.OK); } - @PostMapping("/synchronize") - @Log("物料同步") - - //@PreAuthorize("@el.check('materialtype:list')") - public ResponseEntity synchronize(@RequestBody Map whereJson) { - materialBaseService.synchronize(whereJson); - return new ResponseEntity<>(HttpStatus.OK); - } - @Log("查询产品系列类型") @GetMapping("/getProductSeries") diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/MaterialbaseService.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/MaterialbaseService.java index 7b69d9d38..ed22cc14f 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/MaterialbaseService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/MaterialbaseService.java @@ -88,8 +88,6 @@ public interface MaterialbaseService { */ JSONObject getMaterOptType(String materOpt_code); - void synchronize(Map whereJson); - JSONArray getProductSeries(String parent_class_id); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/impl/MaterialbaseServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/impl/MaterialbaseServiceImpl.java index 3ad1abbb6..6ea777cfa 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/impl/MaterialbaseServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/master/service/impl/MaterialbaseServiceImpl.java @@ -39,7 +39,6 @@ import java.util.Set; @Slf4j public class MaterialbaseServiceImpl implements MaterialbaseService { private final ClassstandardService classstandardService; - //private final WmsToErpService wmsToErpService; @Override public Map queryAll(Map whereJson, Pageable page) { @@ -214,12 +213,6 @@ public class MaterialbaseServiceImpl implements MaterialbaseService { return MaterOptTypeEnum.getObj(materOpt_code); } - @Override - public void synchronize(Map whereJson) { - /* wmsToErpService.getClassInfo(null); - wmsToErpService.getMaterialInfo(null);*/ - } - @Override public JSONArray getProductSeries(String parent_class_id) { WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard"); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/rest/StructivtController.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/rest/StructivtController.java index bd0b2b469..c5b40bc46 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/rest/StructivtController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/rest/StructivtController.java @@ -39,6 +39,7 @@ public class StructivtController { //@PreAuthorize("@el.check('structivt:list')") public ResponseEntity query(@RequestParam Map whereJson, Pageable page, String[] product_area, String[] ivt_flag) { return new ResponseEntity<>(structivtService.queryAll(whereJson, page, product_area, ivt_flag), HttpStatus.OK); + } @PostMapping diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructattrServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructattrServiceImpl.java index e7bd880af..3fe0b3eef 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructattrServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructattrServiceImpl.java @@ -28,10 +28,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.function.BiConsumer; import java.util.stream.Collectors; @@ -541,8 +538,9 @@ public class StructattrServiceImpl implements StructattrService { int createNum = whereJson.getIntValue("num"); // 开始生成数 int createNum_start = 1; + // 前缀 - String prefix = whereJson.getString("prefix"); + String prefix = ""; if (ObjectUtil.isNotEmpty(jsonAttr)) { String struct_code = jsonAttr.getString("struct_code"); @@ -559,6 +557,21 @@ public class StructattrServiceImpl implements StructattrService { createNum_start += Integer.parseInt(result); prefix = struct_code.substring(0, firstIndex); + } else { + // 截取第一个 - 之前的数据集合 + + List attrList = WQL.getWO("QST_STRUCT_ATTR").addParam("flag", "2").process() + .getResultJSONArray(0).toJavaList(JSONObject.class); + + List subStringList = attrList.stream() + .filter(row -> row.getString("struct_code").contains("-")) + .map(row -> row.getString("struct_code").substring(0, row.getString("struct_code").indexOf("-"))) + .distinct() + .sorted() + .filter(row -> row.matches("-?\\d+(\\.\\d+)?")) + .collect(Collectors.toList()); + + prefix = String.valueOf(Integer.parseInt(subStringList.get(subStringList.size() - 1)) + 1); } /* @@ -651,13 +664,16 @@ public class StructattrServiceImpl implements StructattrService { /* * 判断前缀是否存在 */ - List attrList = attrTab.query("1 = 1").getResultJSONArray(0).toJavaList(JSONObject.class); + List attrList = WQL.getWO("QST_STRUCT_ATTR").addParam("flag", "2").process() + .getResultJSONArray(0).toJavaList(JSONObject.class); // 截取第一个 - 之前的数据集合 List subStringList = attrList.stream() .filter(row -> row.getString("struct_code").contains("-")) .map(row -> row.getString("struct_code").substring(0, row.getString("struct_code").indexOf("-"))) .distinct() + .sorted() + .filter(row -> row.matches("-?\\d+(\\.\\d+)?")) .collect(Collectors.toList()); // 判断是否有相同的前缀 diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql index f06c3ed29..f8df38c80 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql @@ -82,7 +82,7 @@ WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '3' END AS sub_type, - DATEDIFF( NOW(), ivt.instorage_time ) AS stock_age + DATEDIFF( NOW(), sub.date_of_production ) AS stock_age FROM ST_IVT_StructIvt ivt diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCT_ATTR.wql b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCT_ATTR.wql index a90e95868..29a15aa70 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCT_ATTR.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCT_ATTR.wql @@ -86,5 +86,19 @@ ENDPAGEQUERY ENDIF + IF 输入.flag = "2" + QUERY + SELECT + struct.* + FROM + st_ivt_structattr struct + LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = struct.sect_id + WHERE + sect.sect_type_attr = '09' + + ENDSELECT + ENDQUERY + ENDIF + diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/stivt.xls b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/stivt.xls index 2a54c742c..706870f48 100644 Binary files a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/stivt.xls and b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/stivt.xls differ diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java index 0b808bd42..157217a62 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java @@ -182,6 +182,7 @@ public class SapToLmsServiceImpl implements SapToLmsService { } dtl.put("qty_unit_id", unit.getString("measure_unit_id")); dtl.put("qty_unit_name", unit.getString("unit_name")); + dtl.put("package_box_sn", sub_jo.getString("package_box_sn")); dtl.put("qty", sub_jo.getString("net_weight")); dtls.add(dtl); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls index cb8667c23..49269355a 100644 Binary files a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls and b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls differ diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/service/wql/QSCH_TASK_01.wql b/lms/nladmin-system/src/main/java/org/nl/wms/sch/service/wql/QSCH_TASK_01.wql index 3373402ea..0b37c4b2a 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/service/wql/QSCH_TASK_01.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/service/wql/QSCH_TASK_01.wql @@ -55,11 +55,13 @@ SELECT task.*, md.class_name task_type_name, + user.person_name AS create_name1, dict.label task_status_name, case when task.task_type like '0105%' then 'LK' ELSE task.product_area end AS final_product_area FROM sch_base_task task LEFT JOIN md_pb_classstandard md ON task.task_type = md.class_code + LEFT JOIN sys_user user ON user.username = task.create_name LEFT JOIN sys_dict dict ON dict.`value` = task.task_status AND dict.`code` = 'task_status' WHERE 1=1 diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/CheckOutBillService.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/CheckOutBillService.java index 20f1c8e0e..f1cf33c5a 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/CheckOutBillService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/CheckOutBillService.java @@ -295,4 +295,12 @@ public interface CheckOutBillService { * @throws IOException / */ void download(Map map, HttpServletResponse response, String[] stor_id, String[] bill_status, String[] bill_type) throws IOException; + + /** + * 更新是否超期 + * @param whereJson { + * 主表数据 + * } + */ + JSONObject updataIsOverdue(JSONObject whereJson); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql index 970ace7c3..d187cda6c 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql @@ -340,57 +340,6 @@ ENDQUERY ENDIF - IF 输入.flag = "8" - PAGEQUERY - SELECT - pp.CREATE_DATE AS receive_date, - pp.VBILLCODE AS source_bill_code, - mb.material_code, - mb.material_name, - class.class_desc, - mb.material_id, - pp.QTY AS receive_qty, - ( CASE WHEN a.real_qty IS NULL THEN pp.QTY ELSE ( pp.QTY - a.real_qty ) END ) AS need_qty, - mu.unit_name AS qty_unit_name, - '采购订单' AS source_type_name, - mu.measure_unit_id AS qty_unit_id, - pp.id AS source_billdtl_id, - 'PO' AS source_bill_type, - 'PCS_IF_PurchaseOrderProc' AS source_bill_table, - pp.id AS base_billdtl_id, - 'PO' AS base_bill_type, - '' AS base_bill_code, - 'PCS_IF_PurchaseOrderProc' AS base_bill_table - FROM - pcs_if_purchaseorderproc pp - LEFT JOIN md_me_materialbase mb ON mb.ext_id = pp.ITEM_ID - INNER JOIN md_pb_classstandard class ON class.class_id = mb.material_type_id - INNER JOIN md_pb_measureunit mu ON mu.ext_id = pp.M_UNIT_ID - LEFT JOIN ( SELECT dtl.source_billdtl_id, SUM( dtl.real_qty ) AS real_qty FROM st_ivt_iostorinvdtl dtl GROUP BY source_billdtl_id ) a ON a.source_billdtl_id = pp.id - WHERE - pp.proc_status IN ( '01', '02' ) - AND - pp.DR='0' - AND - mb.material_type_id IN 输入.clsss_ids - OPTION 输入.material_search <> "" - (mb.material_code like 输入.material_search - OR - mb.material_name like 输入.material_search) - ENDOPTION - OPTION 输入.bill_code <> "" - pp.VBILLCODE like 输入.bill_code - ENDOPTION - OPTION 输入.begin_time <> "" - pp.CREATE_DATE >= 输入.begin_time - ENDOPTION - OPTION 输入.end_time <> "" - pp.CREATE_DATE <= 输入.end_time - ENDOPTION - ENDSELECT - ENDPAGEQUERY - ENDIF - IF 输入.flag = "9" PAGEQUERY SELECT diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/ProductScrapServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/ProductScrapServiceImpl.java index 9d1f70e4a..3d19d9243 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/ProductScrapServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/ProductScrapServiceImpl.java @@ -479,6 +479,10 @@ public class ProductScrapServiceImpl implements ProductScrapService { .addParam("flag", "3").addParam("stor_id", stor_id).addParam("in_stor_id",in_stor_id) .process().getResultJSONArray(0).toJavaList(JSONObject.class); + // 查询不合格品来源字典 + List dictList = WQL.getWO("QST_IVT_PRODUCTSCRAP").addParam("flag", "3") + .process().getResultJSONArray(0).toJavaList(JSONObject.class); + // 循环获取的数据 ArrayList resultList = new ArrayList<>(); for (int i = 0; i < read.size(); i++) { @@ -488,10 +492,14 @@ public class ProductScrapServiceImpl implements ProductScrapService { String pcsn = list.get(0).toString(); // sap批次号 String sap_pcsn = list.get(1).toString(); - // 木箱号 +/* // 木箱号 String box_no = list.get(2).toString(); // 重量 - String qty = list.get(3).toString(); + String qty = list.get(3).toString();*/ + // 不合格品来源 + String fail_source = list.get(4).toString(); + // 不合格描述 + String remark = list.get(5).toString(); // 子卷号和批次号必须有一个不为空 if (ObjectUtil.isEmpty(pcsn) && ObjectUtil.isEmpty(sap_pcsn)) { @@ -513,6 +521,22 @@ public class ProductScrapServiceImpl implements ProductScrapService { .filter(row -> row.getString("storagevehicle_code").equals(json.getString("storagevehicle_code"))) .collect(Collectors.toList()); + // 匹配不合格品来源 + String value = ""; + List label = dictList.stream() + .filter(row -> row.getString("label").equals(fail_source)) + .collect(Collectors.toList()); + + if (ObjectUtil.isNotEmpty(label)) { + value = label.get(0).getString("value"); + } + // 插入不合格品来源、不合格品描述 + String finalValue = value; + boxList.forEach(row -> { + row.put("fail_source", finalValue); + row.put("remark",remark); + }); + resultList.addAll(boxList); } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/RecutPlanServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/RecutPlanServiceImpl.java index 89ba0d659..9f2bbd272 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/RecutPlanServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/RecutPlanServiceImpl.java @@ -131,6 +131,7 @@ public class RecutPlanServiceImpl implements RecutPlanService { jsonDtl.put("plan_id", jsonMst.getLongValue("plan_id")); jsonDtl.put("seq_no", i); jsonDtl.put("material_id", json.getLongValue("material_id")); + jsonDtl.put("package_box_sn", json.getLongValue("package_box_sn")); jsonDtl.put("pcsn", json.getString("sap_pcsn")); jsonDtl.put("qty_unit_id", json.getString("qty_unit_id")); jsonDtl.put("qty_unit_name", json.getString("qty_unit_name")); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_PRODUCTPLAN.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_PRODUCTPLAN.wql index 3ebdaa8b2..ae0799daf 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_PRODUCTPLAN.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_PRODUCTPLAN.wql @@ -98,11 +98,13 @@ SELECT dtl.*, mater.material_code, - mater.material_name + mater.material_name, + sub.package_box_sn FROM st_ivt_productplandtl dtl LEFT JOIN st_ivt_productplanmst mst ON mst.plan_id = dtl.plan_id LEFT JOIN md_me_materialbase mater ON mater.material_id = dtl.material_id + LEFT JOIN pdm_bi_subpackagerelation sub ON sub.sap_pcsn = dtl.pcsn WHERE 1 = 1 OPTION 输入.plan_id <> "" @@ -116,8 +118,7 @@ OPTION 输入.status <> "" dtl.status = 输入.status ENDOPTION - - order by dtl.seq_no + order by sub.package_box_sn ENDSELECT ENDQUERY ENDIF \ No newline at end of file diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_PRODUCTSCRAP.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_PRODUCTSCRAP.wql index d3dcb1ca1..cae98e5cd 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_PRODUCTSCRAP.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_PRODUCTSCRAP.wql @@ -109,4 +109,16 @@ order by dtl.seq_no ENDSELECT ENDQUERY + ENDIF + + IF 输入.flag = "3" + QUERY + SELECT + * + FROM + sys_dict + WHERE + code = 'FAIL_SOURCE' + ENDSELECT + ENDQUERY ENDIF \ No newline at end of file diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/rest/CheckOutBillController.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/rest/CheckOutBillController.java index 800368551..67455fed7 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/rest/CheckOutBillController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/rest/CheckOutBillController.java @@ -312,4 +312,11 @@ public class CheckOutBillController { public void download(@RequestParam Map map, HttpServletResponse response, String[] stor_id, String[] bill_status, String[] bill_type) throws IOException { checkOutBillService.download(map, response, stor_id, bill_status, bill_type); } + + + @PostMapping("/updataIsOverdue") + @Log("更新是否超期") + public ResponseEntity updataIsOverdue(@RequestBody JSONObject whereJson) { + return new ResponseEntity<>(checkOutBillService.updataIsOverdue(whereJson),HttpStatus.OK); + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java index 35440c6c6..78f7c64e9 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java @@ -1022,6 +1022,32 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { FileUtil.downloadExcel(list, response); } + @Override + public JSONObject updataIsOverdue(JSONObject whereJson) { + // 出入库主表 + WQLObject mstTab = WQLObject.getWQLObject("st_ivt_iostorinv"); + // 出入库分配明细表 + WQLObject disTab = WQLObject.getWQLObject("st_ivt_iostorinvdis"); + + // 更新主表 + JSONObject jsonMst = mstTab.query("iostorinv_id = '" + whereJson.getString("iostorinv_id") + "'").uniqueResult(0); + jsonMst.put("is_overdue", whereJson.getString("is_overdue")); + mstTab.update(jsonMst); + + // 计算超期数量 + List disList = disTab.query("iostorinvdtl_id = '" + whereJson.getString("iostorinvdtl_id") + "' AND is_overdue = '1'") + .getResultJSONArray(0).toJavaList(JSONObject.class); + + double overdue_qyt = disList.stream() + .map(row -> row.getDoubleValue("plan_qty")) + .reduce(Double::sum).orElse(0.00); + + JSONObject result = new JSONObject(); + result.put("overdue_qyt",overdue_qyt); + result.put("mst", jsonMst); + return result; + } + @Override @Transactional(rollbackFor = Exception.class) public void update(JSONObject whereJson) { @@ -1290,11 +1316,12 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { dtl.put("work_status", "00"); } - // 判断是否超期 - if (ivt2.getString("is_overdue").equals("1")) { - dtl.put("work_status", "01"); + if (jo_mst.getString("is_overdue").equals("1")) { + // 判断是否超期 + if (ivt2.getString("is_overdue").equals("1")) { + dtl.put("work_status", "01"); + } } - wo_dis.insert(dtl); } //记录需锁定的仓位 @@ -1358,9 +1385,12 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { } // 判断是否超期 - if (jsonIvt.getString("is_overdue").equals("1")) { - dtl.put("work_status", "01"); + if (jo_mst.getString("is_overdue").equals("1")) { + if (jsonIvt.getString("is_overdue").equals("1")) { + dtl.put("work_status", "01"); + } } + wo_dis.insert(dtl); //记录需锁定的仓位 (如果此明细有相同物料的且子卷号不能为空的则在最后一个明细分配完成后锁定仓位) @@ -1534,6 +1564,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { dtl.put("is_issued", "0"); dtl.put("plan_qty", ivt2.getDoubleValue("change_qty")); dtl.put("real_qty", ivt2.getDoubleValue("change_qty")); + dtl.put("is_overdue", ivt2.getString("is_overdue")); dtl.put("instorage_time", ivt2.getString("instorage_time")); // 如果所属仓位是虚拟区 则将分配明细状态变为生成 JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt2.getString("sect_id") + "'").uniqueResult(0); @@ -1542,6 +1573,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { } else { dtl.put("work_status", "00"); } + + if (jo_mst.getString("is_overdue").equals("1")) { + // 判断是否超期 + if (ivt2.getString("is_overdue").equals("1")) { + dtl.put("work_status", "01"); + } + } + wo_dis.insert(dtl); } //记录需锁定的仓位 @@ -1594,6 +1633,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { dtl.put("is_issued", "0"); dtl.put("plan_qty", jsonIvt.getDoubleValue("change_qty")); dtl.put("real_qty", jsonIvt.getDoubleValue("change_qty")); + dtl.put("is_overdue", jsonIvt.getString("is_overdue")); dtl.put("instorage_time", jsonIvt.getString("instorage_time")); // 如果所属仓位是虚拟区 则将分配明细状态变为生成 JSONObject jsonSect = wo_sect.query("sect_id = '" + jsonIvt.getString("sect_id") + "'").uniqueResult(0); @@ -1602,6 +1642,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { } else { dtl.put("work_status", "00"); } + + if (jo_mst.getString("is_overdue").equals("1")) { + // 判断是否超期 + if (jsonIvt.getString("is_overdue").equals("1")) { + dtl.put("work_status", "01"); + } + } + wo_dis.insert(dtl); //记录需锁定的仓位 Struct_map.put(jsonIvt.getString("struct_id"), jsonIvt); @@ -1658,6 +1706,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { json.put("is_issued", "0"); json.put("plan_qty", ivt.getDoubleValue("change_qty")); json.put("real_qty", ivt.getDoubleValue("change_qty")); + json.put("is_overdue", ivt.getString("is_overdue")); + json.put("instorage_time", ivt.getString("instorage_time")); // 如果所属仓位是虚拟区 则将分配明细状态变为生成 JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt.getString("sect_id") + "'").uniqueResult(0); if (StrUtil.equals(jsonSect.getString("sect_type_attr"), "09")) { @@ -1665,6 +1715,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { } else { json.put("work_status", "00"); } + + // 判断是否超期 + if (jo_mst.getString("is_overdue").equals("1")) { + if (ivt.getString("is_overdue").equals("1")) { + json.put("work_status", "01"); + } + } + wo_dis.insert(json); // 更新明细 @@ -4384,6 +4442,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { dtl.put("is_issued", "0"); dtl.put("plan_qty", ivt.getDoubleValue("change_qty")); dtl.put("real_qty", ivt.getDoubleValue("change_qty")); + dtl.put("is_overdue", ivt.getString("is_overdue")); dtl.put("instorage_time", ivt.getString("instorage_time")); // 如果所属仓位是虚拟区 则将分配明细状态变为生成 JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt.getString("sect_id") + "'").uniqueResult(0); @@ -4392,6 +4451,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { } else { dtl.put("work_status", "00"); } + + // 判断是否超期 + if (jo_mst.getString("is_overdue").equals("1")) { + if (ivt.getString("is_overdue").equals("1")) { + dtl.put("work_status", "01"); + } + } + wo_dis.insert(dtl); //记录需锁定的仓位 Struct_map.put(ivt.getString("struct_id"), ivt); @@ -4453,6 +4520,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { json.put("is_issued", "0"); json.put("plan_qty", ivt.getDoubleValue("change_qty")); json.put("real_qty", ivt.getDoubleValue("change_qty")); + json.put("is_overdue", ivt.getString("is_overdue")); json.put("instorage_time", ivt.getString("instorage_time")); // 如果所属仓位是虚拟区 则将分配明细状态变为生成 JSONObject jsonSect = wo_sect.query("sect_id = '" + ivt.getString("sect_id") + "'").uniqueResult(0); @@ -4461,6 +4529,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { } else { json.put("work_status", "00"); } + + // 判断是否超期 + if (jo_mst.getString("is_overdue").equals("1")) { + if (ivt.getString("is_overdue").equals("1")) { + json.put("work_status", "01"); + } + } + wo_dis.insert(json); // 更新明细 @@ -4585,8 +4661,12 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { dis.put("bill_code", jo_mst.getString("bill_code")); dis.put("bill_table", "ST_IVT_IOStorInv"); - if (dis.getString("is_overdue").equals("1")) { - storPublicService.IOStor(dis, "12"); + if (jo_mst.getString("is_overdue").equals("1")) { + if (dis.getString("is_overdue").equals("1")) { + storPublicService.IOStor(dis, "12"); + } else { + storPublicService.IOStor(dis, "21"); + } } else { storPublicService.IOStor(dis, "21"); } @@ -4596,15 +4676,28 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { from_start.put("struct_id", dis.getString("struct_id")); from_start.put("lock_type", "1"); from_start.put("is_overdue", dis.getString("is_overdue")); - if (dis.getString("is_overdue").equals("1")) { - from_start.put("storagevehicle_code", dis.getString("box_no")); + + if (jo_mst.getString("is_overdue").equals("1")) { + if (dis.getString("is_overdue").equals("1")) { + from_start.put("storagevehicle_code", dis.getString("box_no")); + } else { + from_start.put("storagevehicle_code", ""); + } } else { from_start.put("storagevehicle_code", ""); } + storPublicService.updateStructAndPoint(from_start); - if (dis.getString("is_overdue").equals("1")) { - continue; + // 更新分配明细执行状态为 - 99 + JSONObject jsonDis = wo_dis.query("iostorinvdis_id = '" + dis.getString("iostorinvdis_id") + "'").uniqueResult(0); + jsonDis.put("work_status", "99"); + wo_dis.update(jsonDis); + + if (jo_mst.getString("is_overdue").equals("1")) { + if (dis.getString("is_overdue").equals("1")) { + continue; + } } //查询对应明细 @@ -4637,11 +4730,6 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { jsonSub.put("record_id", IdUtil.getSnowflake(1, 1).nextId()); sub_record.insert(jsonSub); - // 更新分配明细执行状态为 - 99 - JSONObject jsonDis = wo_dis.query("iostorinvdis_id = '" + dis.getString("iostorinvdis_id") + "'").uniqueResult(0); - jsonDis.put("work_status", "99"); - wo_dis.update(jsonDis); - // 更新对应任务为完成 JSONObject jsonTask = taskTab.query("task_id = '" + jsonDis.getString("task_id") + "' and task_status < '07'").uniqueResult(0); if (ObjectUtil.isNotEmpty(jsonTask)) { @@ -4664,7 +4752,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { } JSONObject mst_row = mst_wql.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0); - JSONArray dis_rows = dis_wql.query("iostorinv_id = '" + iostorinv_id + "' and is_overdue = '0'").getResultJSONArray(0); + + JSONArray dis_rows = new JSONArray(); + + if (jo_mst.getString("is_overdue").equals("1")) { + dis_rows = dis_wql.query("iostorinv_id = '" + iostorinv_id + "' and is_overdue = '0'").getResultJSONArray(0); + } else { + dis_rows = dis_wql.query("iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0); + } //生成手工入库单 String new_iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + ""; @@ -4767,7 +4862,13 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { if ("1003".equals(out_jo.getString("bill_type")) || "1006".equals(out_jo.getString("bill_type"))) { //如果为返检出库或者改切出库删除对应的包装关系 - JSONArray dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + iostorinv_id + "' and is_overdue = '0'").getResultJSONArray(0); + JSONArray dis_rows = new JSONArray(); + if (jo_mst.getString("is_overdue").equals("1")) { + dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + iostorinv_id + "' and is_overdue = '0'").getResultJSONArray(0); + } else { + dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0); + } + for (int i = 0; i < dis_rows.size(); i++) { JSONObject dis_row = dis_rows.getJSONObject(i); String sect_code = dis_row.getString("sect_code"); @@ -5329,12 +5430,17 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { // 回传sap JSONObject jsonMst = mstTab.query("iostorinv_id = '" + whereJson.getString("iostorinv_id") + "'").uniqueResult(0); - JSONArray jsonArr = new JSONArray(); - jsonArr.add(jsonMst); + // 判断单据是否是完成状态:只回传完成状态的单据 + if (jsonMst.getString("bill_status").equals("99")) { + if (!jsonMst.getString("upload_sap").equals("1")) { + JSONArray jsonArr = new JSONArray(); + jsonArr.add(jsonMst); - JSONObject param = new JSONObject(); - param.put("rows", jsonArr); - inAndOutReturnService.uploadSAP(param); + JSONObject param = new JSONObject(); + param.put("rows", jsonArr); + inAndOutReturnService.uploadSAP(param); + } + } } @Override diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/QST_IVT_CHECKOUTBILL.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/QST_IVT_CHECKOUTBILL.wql index 9f3c310f5..7a3c9cb0f 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/QST_IVT_CHECKOUTBILL.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/QST_IVT_CHECKOUTBILL.wql @@ -97,6 +97,7 @@ cu.cust_simple_name, a.plan_qty, attr.stor_name AS out_stor_name + FROM ST_IVT_IOStorInv ios LEFT JOIN md_cs_customerbase cu ON ios.cust_code = cu.cust_code @@ -106,15 +107,32 @@ LEFT JOIN pdm_bi_subpackagerelationrecord sub ON sub.container_name = dis.pcsn AND dis.box_no = sub.package_box_sn AND sub.bill_code = ios.bill_code LEFT JOIN ( SELECT - SUM(a.assign_qty) AS plan_qty, + SUM(a.plan_qty) AS plan_qty, a.iostorinv_id FROM - st_ivt_iostorinvdtl a + st_ivt_iostorinvdis a LEFT JOIN ST_IVT_IOStorInv b ON a.iostorinv_id = b.iostorinv_id WHERE b.io_type = '1' and b.is_delete='0' + and a.is_overdue = '0' + and b.is_overdue = '1' GROUP BY a.iostorinv_id + + UNION + + SELECT + SUM(a.plan_qty) AS plan_qty, + a.iostorinv_id + FROM + st_ivt_iostorinvdis a + LEFT JOIN ST_IVT_IOStorInv b ON a.iostorinv_id = b.iostorinv_id + WHERE + b.io_type = '1' + and b.is_delete='0' + and b.is_overdue = '0' + GROUP BY a.iostorinv_id + ) a ON a.iostorinv_id = ios.iostorinv_id WHERE ios.io_type = '1' @@ -369,7 +387,14 @@ struct.storagevehicle_id, struct.storagevehicle_code, point.point_id, - sub.sap_pcsn + sub.sap_pcsn, + CASE + WHEN SUBSTRING(sub.container_name,1,1) = 'B' AND DATEDIFF( NOW(), sub.date_of_production ) > '180' + THEN '1' + WHEN SUBSTRING(sub.container_name,1,1) != 'B' AND DATEDIFF( NOW(), sub.date_of_production ) > '90' + THEN '1' + ELSE '0' + END AS is_overdue FROM ST_IVT_StructIvt ivt LEFT JOIN st_ivt_structattr struct ON struct.struct_id = ivt.struct_id @@ -437,7 +462,14 @@ struct.storagevehicle_id, struct.storagevehicle_code, point.point_id, - sub.sap_pcsn + sub.sap_pcsn, + CASE + WHEN SUBSTRING(sub.container_name,1,1) = 'B' AND DATEDIFF( NOW(), sub.date_of_production ) > '180' + THEN '1' + WHEN SUBSTRING(sub.container_name,1,1) != 'B' AND DATEDIFF( NOW(), sub.date_of_production ) > '90' + THEN '1' + ELSE '0' + END AS is_overdue FROM ST_IVT_StructIvt ivt2 LEFT JOIN st_ivt_structattr struct ON struct.struct_id = ivt2.struct_id diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/ST_OUTIVT01.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/ST_OUTIVT01.wql index ebd2006ad..189f4aaed 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/ST_OUTIVT01.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/ST_OUTIVT01.wql @@ -62,7 +62,11 @@ attr.struct_name, attr.struct_code, CASE - WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '1' ELSE '0' + WHEN SUBSTRING(sub.container_name,1,1) = 'B' AND DATEDIFF( NOW(), sub.date_of_production ) > '180' + THEN '1' + WHEN SUBSTRING(sub.container_name,1,1) != 'B' AND DATEDIFF( NOW(), sub.date_of_production ) > '90' + THEN '1' + ELSE '0' END AS is_overdue FROM ST_IVT_StructIvt ivt @@ -164,7 +168,11 @@ attr.struct_name, attr.struct_code, CASE - WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '1' ELSE '0' + WHEN SUBSTRING(sub.container_name,1,1) = 'B' AND DATEDIFF( NOW(), sub.date_of_production ) > '180' + THEN '1' + WHEN SUBSTRING(sub.container_name,1,1) != 'B' AND DATEDIFF( NOW(), sub.date_of_production ) > '90' + THEN '1' + ELSE '0' END AS is_overdue FROM ST_IVT_StructIvt ivt diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/returns/service/impl/InAndOutRetrunServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/returns/service/impl/InAndOutRetrunServiceImpl.java index eceaf4d19..4d354ec92 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/returns/service/impl/InAndOutRetrunServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/returns/service/impl/InAndOutRetrunServiceImpl.java @@ -488,6 +488,8 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { WQLObject sectTab = WQLObject.getWQLObject("st_ivt_sectattr"); // 子卷包装关系表 WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelationrecord"); + // 子卷包装关系表 + WQLObject subTab2 = WQLObject.getWQLObject("pdm_bi_subpackagerelation"); JSONArray rows = whereJson.getJSONArray("rows"); for (int i = 0; i < rows.size(); i++) { @@ -682,6 +684,9 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { JSONObject jsonSub = subTab.query("container_name = '" + json2.getString("pcsn") + "' AND package_box_sn = '" + json2.getString("box_no") + "' AND bill_id = '" + json2.getString("iostorinv_id") + "'").uniqueResult(0); if (ObjectUtil.isNotEmpty(jsonSub)) { jsonDis.put("CHARG", jsonSub.getString("sap_pcsn")); // sap批次 + } else { + JSONObject jsonSub2 = subTab2.query("container_name = '" + json2.getString("pcsn") + "'").uniqueResult(0); + jsonDis.put("CHARG", jsonSub2.getString("sap_pcsn")); // sap批次 } jsonDis.put("VBELN", json.getString("vbeln")); // 交货 jsonDis.put("POSNR", json.getString("posnr")); // 项目 @@ -978,6 +983,8 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { WQLObject sectTab = WQLObject.getWQLObject("st_ivt_sectattr"); // 子卷包装关系表 WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelationrecord"); + // 子卷包装关系表 + WQLObject subTab2 = WQLObject.getWQLObject("pdm_bi_subpackagerelation"); //根据出入单类型判断回传业务 //1、生产入库:回传MES;手工入库:回传SAP @@ -1299,8 +1306,12 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { } JSONObject jsonSub = subTab.query("container_name = '" + json2.getString("pcsn") + "' AND package_box_sn = '" + json2.getString("box_no") + "' AND bill_id = '" + json2.getString("iostorinv_id") + "'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(jsonSect)) { + if (ObjectUtil.isNotEmpty(jsonSub)) { jsonDis.put("CHARG", jsonSub.getString("sap_pcsn")); // sap批次 + } else { + JSONObject jsonSub2 = subTab2.query("container_name = '" + json2.getString("pcsn") + "'").uniqueResult(0); + jsonDis.put("CHARG", jsonSub2.getString("sap_pcsn")); // sap批次 + } jsonDis.put("VBELN", json.getString("vbeln")); // 交货 jsonDis.put("POSNR", json.getString("posnr")); // 项目 diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/stat/service/impl/OutBillQueryServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/stat/service/impl/OutBillQueryServiceImpl.java index 82ddf84b5..5f41caf70 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/stat/service/impl/OutBillQueryServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/stat/service/impl/OutBillQueryServiceImpl.java @@ -296,6 +296,8 @@ public class OutBillQueryServiceImpl implements OutBillQueryService { mp.put("净重", json.getString("net_weight")); mp.put("单位", json.getString("qty_unit_name")); mp.put("管件类型", json.getString("paper_type")); + mp.put("管件编码", json.getString("paper_code")); + mp.put("管件描述", json.getString("paper_name")); mp.put("客户编码", json.getString("customer_name")); mp.put("发货客户名称", json.getString("customer_description")); if (ObjectUtil.isEmpty(json.getString("sale_order_name"))) { diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/stat/wql/SendReceiveQuery.wql b/lms/nladmin-system/src/main/java/org/nl/wms/stat/wql/SendReceiveQuery.wql index 65021bc4f..472ff5511 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/stat/wql/SendReceiveQuery.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/stat/wql/SendReceiveQuery.wql @@ -18,7 +18,6 @@ 输入.begin_time TYPEAS s_string 输入.end_time TYPEAS s_string 输入.material_code TYPEAS s_string - 输入.classIds TYPEAS f_string 输入.pcsn TYPEAS s_string 输入.sap_pcsn TYPEAS s_string 输入.package_box_sn TYPEAS s_string @@ -53,14 +52,9 @@ stor.stor_name, da.sect_date, da.pcsn, - da.quality_scode, - class.class_name, - class.class_code, mater.material_id, mater.material_code, mater.material_name, - mater.material_model, - unit.unit_name, da.start_num, da.in_num, da.out_num, @@ -77,22 +71,17 @@ sum(end_num) AS end_num, sum(more_num) AS more_num, sum(less_num) AS less_num, - max(material_id) AS material_id, + max( material_id ) AS material_id, max(stor_id) AS stor_id, - max(sect_date) AS sect_date, - max(quality_scode) AS quality_scode, - max(pcsn) AS pcsn + sect_date, + pcsn FROM ST_IVT_IOStorDaily a GROUP BY - a.material_id, - a.quality_scode, a.pcsn, a.sect_date ) AS da LEFT JOIN MD_ME_MaterialBase mater ON da.material_id = mater.material_id - LEFT JOIN md_pb_classstandard class ON mater.material_type_id = class.class_id - LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = mater.base_unit_id LEFT JOIN st_ivt_bsrealstorattr stor ON stor.stor_id = da.stor_id LEFT JOIN pdm_bi_subpackagerelation sub ON sub.container_name = da.pcsn WHERE 1=1 @@ -127,10 +116,6 @@ sub.package_box_sn like 输入.package_box_sn ENDOPTION - OPTION 输入.classIds <> "" - class.class_id in 输入.classIds - ENDOPTION - ENDSELECT ENDPAGEQUERY ENDIF diff --git a/lms/nladmin-ui/src/views/login.vue b/lms/nladmin-ui/src/views/login.vue index 59876e706..fecaae2f5 100644 --- a/lms/nladmin-ui/src/views/login.vue +++ b/lms/nladmin-ui/src/views/login.vue @@ -56,7 +56,7 @@ export default { cookiePass: '', loginForm: { username: 'admin', - password: '123456', + password: '', rememberMe: false, code: '', uuid: '' diff --git a/lms/nladmin-ui/src/views/wms/basedata/master/material/index.vue b/lms/nladmin-ui/src/views/wms/basedata/master/material/index.vue index 13a7cd9a5..6f317bc34 100644 --- a/lms/nladmin-ui/src/views/wms/basedata/master/material/index.vue +++ b/lms/nladmin-ui/src/views/wms/basedata/master/material/index.vue @@ -36,18 +36,7 @@ - - - 同步 - - + { - this.fullscreenLoading = false - this.crud.notify('同步成功!', CRUD.NOTIFICATION_TYPE.SUCCESS) - }).catch(() => { - this.fullscreenLoading = false - }) - }, queryClassId() { const param = { 'class_idStr': this.class_idStr diff --git a/lms/nladmin-ui/src/views/wms/basedata/master/material/materialbase.js b/lms/nladmin-ui/src/views/wms/basedata/master/material/materialbase.js index 719b2a112..3b3f371f3 100644 --- a/lms/nladmin-ui/src/views/wms/basedata/master/material/materialbase.js +++ b/lms/nladmin-ui/src/views/wms/basedata/master/material/materialbase.js @@ -40,14 +40,6 @@ export function isAlongMaterType(data) { }) } -export function synchronize(data) { - return request({ - url: 'api/Materialbase/synchronize', - method: 'post', - data - }) -} - export function getProductSeries() { return request({ url: 'api/Materialbase/getProductSeries', @@ -55,4 +47,4 @@ export function getProductSeries() { }) } -export default { add, edit, del, getMaterOptType, isAlongMaterType, synchronize, getProductSeries } +export default { add, edit, del, getMaterOptType, isAlongMaterType, getProductSeries } diff --git a/lms/nladmin-ui/src/views/wms/basedata/st/ivt/index.vue b/lms/nladmin-ui/src/views/wms/basedata/st/ivt/index.vue index 5c7ff08f1..329ee1879 100644 --- a/lms/nladmin-ui/src/views/wms/basedata/st/ivt/index.vue +++ b/lms/nladmin-ui/src/views/wms/basedata/st/ivt/index.vue @@ -241,7 +241,7 @@ - + diff --git a/lms/nladmin-ui/src/views/wms/basedata/st/struct/OneCreateDialog.vue b/lms/nladmin-ui/src/views/wms/basedata/st/struct/OneCreateDialog.vue index 5d77938be..f4b5ff0a7 100644 --- a/lms/nladmin-ui/src/views/wms/basedata/st/struct/OneCreateDialog.vue +++ b/lms/nladmin-ui/src/views/wms/basedata/st/struct/OneCreateDialog.vue @@ -25,11 +25,11 @@ - + @@ -126,10 +126,6 @@ export default { return this.crud.notify('库区不能为空', CRUD.NOTIFICATION_TYPE.INFO) } - if (this.formMst.prefix === '') { - return this.crud.notify('前缀不能为空', CRUD.NOTIFICATION_TYPE.INFO) - } - if (this.formMst.num === '') { return this.crud.notify('数量不能为空', CRUD.NOTIFICATION_TYPE.INFO) } diff --git a/lms/nladmin-ui/src/views/wms/pdm/ivt/cutpointivt/index.vue b/lms/nladmin-ui/src/views/wms/pdm/ivt/cutpointivt/index.vue index d85b120b6..1a1a28ffc 100644 --- a/lms/nladmin-ui/src/views/wms/pdm/ivt/cutpointivt/index.vue +++ b/lms/nladmin-ui/src/views/wms/pdm/ivt/cutpointivt/index.vue @@ -175,7 +175,7 @@ - + @@ -205,8 +205,6 @@ export default { return { dialogVisible: false, dtlShow: false, - structShow: false, - structShow2: false, flagnow: false, nowrow: {}, nowindex: '', @@ -272,22 +270,6 @@ export default { } }) }, - custNameInput(val) { - for (let i = 0; i < this.form.tableData.length; i++) { - if (this.form.tableData[i].storagevehicle_code === val.storagevehicle_code) { - this.$set(this.form.tableData[i], 'remark', val.remark) - this.form.tableData.splice(i, 1, this.form.tableData[i]) // 通过splice 替换数据 触发视图更新 - } - } - }, - custNameInput2(val) { - for (let i = 0; i < this.form.tableData.length; i++) { - if (this.form.tableData[i].storagevehicle_code === val.storagevehicle_code) { - this.$set(this.form.tableData[i], 'fail_source', val.fail_source) - this.form.tableData.splice(i, 1, this.form.tableData[i]) // 通过splice 替换数据 触发视图更新 - } - } - }, async queryDtl() { if (!this.form.stor_id) { return this.crud.notify('请先选择仓库!', CRUD.NOTIFICATION_TYPE.INFO) @@ -295,19 +277,6 @@ export default { this.storId = this.form.stor_id this.dtlShow = true }, - allSend() { - if (this.form.tableData.length === 0) { - this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO) - return false - } - for (let i = 0; i < this.form.tableData.length; i++) { - // this.$set(this.form.tableData[i], 'fail_source', this.form.fail_source) - if (this.form.tableData[i].is_used === '1') { - this.$set(this.form.tableData[i], 'remark', this.form.dtl_remark) - this.form.tableData.splice(i, 1, this.form.tableData[i]) // 通过splice 替换数据 触发视图更新 - } - } - }, tableChanged(rows) { const tablemap = new Map() rows.forEach((item) => { @@ -322,29 +291,16 @@ export default { } if (!this.flagnow) { this.$set(item, 'edit', false) - this.$set(item, 'work_status', '10') - this.$set(item, 'turnin_sect_id', '') - this.$set(item, 'turnin_struct_id', '') - this.$set(item, 'turnin_sect_code', '') - this.$set(item, 'turnin_sect_name', '') - this.$set(item, 'turnin_struct_code', '') - this.$set(item, 'turnin_struct_name', '') - tablemap.set(item.stockrecord_id, item) + tablemap.set(item.pcsn, item) } } else { this.$set(item, 'edit', false) - this.$set(item, 'work_status', '10') - this.$set(item, 'turnin_sect_id', '') - this.$set(item, 'turnin_struct_id', '') - this.$set(item, 'turnin_sect_code', '') - this.$set(item, 'turnin_sect_name', '') - this.$set(item, 'turnin_struct_code', '') - this.$set(item, 'turnin_struct_name', '') - tablemap.set(item.stockrecord_id, item) + tablemap.set(item.pcsn, item) } }) for (const value of tablemap.values()) { value.pcsn = value.sap_pcsn + value.package_box_sn = value.storagevehicle_code this.form.tableData.push(value) } this.form.detail_count = this.form.tableData.length @@ -354,32 +310,6 @@ export default { } this.form.total_qty = qty }, - structChanged(row) { - debugger - let structflag = false - for (let i = 0; i < this.form.tableData.length; i++) { - if ((this.form.tableData[i].turnin_struct_id === row.struct_id) || (this.form.tableData[i].turnout_struct_id === row.struct_id)) { - structflag = true - } - } - if (structflag) { - this.crud.notify('该货位已被设置,不允许重复设置!', CRUD.NOTIFICATION_TYPE.INFO) - return false - } - for (let i = 0; i < this.form.tableData.length; i++) { - if (this.form.tableData[i].storagevehicle_code === this.nowrow.storagevehicle_code) { - this.form.tableData[i].turnin_struct_id = row.struct_id - this.form.tableData[i].turnin_struct_code = row.struct_code - this.form.tableData[i].turnin_struct_name = row.struct_name - - this.form.tableData[i].turnin_sect_id = row.sect_id - this.form.tableData[i].turnin_sect_code = row.sect_code - this.form.tableData[i].turnin_sect_name = row.sect_name - this.form.tableData.splice(i, 1, this.form.tableData[i]) // 通过splice 替换数据 触发视图更新 - } - } - console.log(this.form.tableData) - }, deleteRow(index, rows) { const storagevehicle_code = rows[index].storagevehicle_code let len = rows.length @@ -402,15 +332,6 @@ export default { this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO) return false } - }, - changeIsUsed(item) { - for (let i = 0; i < this.form.tableData.length; i++) { - const row = this.form.tableData[i] - if (item.storagevehicle_code === row.storagevehicle_code) { - row.is_used = item.is_used - this.form.tableData.splice(i, 1, this.form.tableData[i]) - } - } } } } diff --git a/lms/nladmin-ui/src/views/wms/st/inStor/reCutPlan/CheckDialog.vue b/lms/nladmin-ui/src/views/wms/st/inStor/reCutPlan/CheckDialog.vue index 621ad2226..d539cf5f0 100644 --- a/lms/nladmin-ui/src/views/wms/st/inStor/reCutPlan/CheckDialog.vue +++ b/lms/nladmin-ui/src/views/wms/st/inStor/reCutPlan/CheckDialog.vue @@ -116,16 +116,16 @@ - + @@ -140,8 +140,9 @@ - - + + + - + - + diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue b/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue index 2f9a18098..0b562af42 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue +++ b/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue @@ -143,6 +143,7 @@ 是否异常出库 + + 不发超期 + 发超期 + + @@ -227,6 +243,7 @@ style="width: 100%;" max-height="400" size="mini" + :row-style="rowStyle" border :highlight-current-row="true" :header-cell-style="{background:'#f5f7fa',color:'#606266'}" @@ -256,11 +273,11 @@ - + - + @@ -268,7 +285,7 @@ - + @@ -338,7 +355,8 @@ export default { invtypelist: [], pointList: [], rules: { - } + }, + overdue_qyt: 0 } }, watch: { @@ -459,6 +477,7 @@ export default { deleteRow(row) { checkoutbill.oneCancel(row).then(res => { this.queryTableDtl() + this.updataIsOverdue() }) }, handleDtlCurrentChange(current) { @@ -517,6 +536,7 @@ export default { checkoutbill.allDiv(this.mstrow).then(res => { this.crud.notify('分配成功!', CRUD.NOTIFICATION_TYPE.INFO) this.queryTableDtl() + this.updataIsOverdue() this.loadingAlldiv = false }).catch(() => { this.loadingAlldiv = false @@ -532,6 +552,7 @@ export default { this.mstrow.iostorinvdtl_id = this.currentRow.iostorinvdtl_id checkoutbill.allDivOne(this.mstrow).then(res => { this.queryTableDtl() + this.updataIsOverdue() this.loadingAutodiv = false }).catch(() => { this.loadingAutodiv = false @@ -542,6 +563,7 @@ export default { this.loadingAlldiv = true checkoutbill.allCancel(this.mstrow).then(res => { this.queryTableDtl() + this.updataIsOverdue() this.loadingAlldiv = false }).catch(() => { this.loadingAlldiv = false @@ -553,6 +575,7 @@ export default { checkoutbill.allCancel(this.currentRow).then(res => { this.queryTableDtl() this.loadingAlldiv = false + this.updataIsOverdue() }).catch(() => { this.loadingAlldiv = false }) @@ -673,6 +696,10 @@ export default { this.tableDtl = res }) }, + queryTableDtl2() { + this.queryTableDtl() + this.updataIsOverdue() + }, queryTableDdis(iostorinvdtl_id) { checkoutbill.getOutBillDis2({ 'iostorinvdtl_id': iostorinvdtl_id, 'bill_status': '01' }).then(res => { this.tabledis = res @@ -689,6 +716,23 @@ export default { return 'background: yellow' } } + }, + rowStyle({ row, rowIndex }) { + const stylejson = {} + + if (this.rowmst.is_overdue === '1') { + if (row.is_overdue === '1') { + stylejson.background = '#f3f071' + return stylejson + } + } + }, + updataIsOverdue() { + this.rowmst.iostorinvdtl_id = this.currentRow.iostorinvdtl_id + checkoutbill.updataIsOverdue(this.rowmst).then(res => { + this.overdue_qyt = res.overdue_qyt + this.rowmst = res.mst + }) } } } diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js b/lms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js index f63c48161..289a2d586 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js +++ b/lms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js @@ -241,4 +241,11 @@ export function outReturn(data) { data }) } -export default { add, edit, del, allDiv, allCancel, getOutBillDtl, getOutBillDis, getOutBillDis2, setPoint, oneSetPoint, getOutBillTask, getStructIvt, manualDiv, confirm, issueTask, finishTask, cancleTaskfinish, getInvTypes, paramByCodeType, schAreaType, backConfirm, getOutBillDisDtl, getType, allDivOne, moneySubmit, getDisNum, queryBox, getOutBillTask2, oneCancel, cancelTask, allSetPoint, oneSetPoint2, outReturn } +export function updataIsOverdue(data) { + return request({ + url: '/api/checkoutbill/updataIsOverdue', + method: 'post', + data + }) +} +export default { add, edit, del, allDiv, allCancel, getOutBillDtl, getOutBillDis, getOutBillDis2, setPoint, oneSetPoint, getOutBillTask, getStructIvt, manualDiv, confirm, issueTask, finishTask, cancleTaskfinish, getInvTypes, paramByCodeType, schAreaType, backConfirm, getOutBillDisDtl, getType, allDivOne, moneySubmit, getDisNum, queryBox, getOutBillTask2, oneCancel, cancelTask, allSetPoint, oneSetPoint2, outReturn, updataIsOverdue } diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/index.vue b/lms/nladmin-ui/src/views/wms/st/outbill/index.vue index 8362bc70a..716565c56 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/index.vue +++ b/lms/nladmin-ui/src/views/wms/st/outbill/index.vue @@ -319,6 +319,7 @@ + @@ -375,7 +376,7 @@ export default { }, mixins: [presenter(), header(), crud()], // 数据字典 - dicts: ['io_bill_status', 'ST_CREATE_MODE', 'ST_INV_OUT_TYPE', 'is_upload'], + dicts: ['io_bill_status', 'ST_CREATE_MODE', 'ST_INV_OUT_TYPE', 'is_upload', 'IS_OR_NOT'], data() { return { height: document.documentElement.clientHeight - 180 + 'px;', @@ -510,6 +511,9 @@ export default { create_modeFormat(row) { return this.dict.label.ST_CREATE_MODE[row.create_mode] }, + isOverdue(row) { + return this.dict.label.IS_OR_NOT[row.is_overdue] + }, handleCurrentChange(current) { if (current === null) { this.dis_flag = true diff --git a/lms/nladmin-ui/src/views/wms/stat/pastivt/index.vue b/lms/nladmin-ui/src/views/wms/stat/pastivt/index.vue index a347415b9..d56bfa50e 100644 --- a/lms/nladmin-ui/src/views/wms/stat/pastivt/index.vue +++ b/lms/nladmin-ui/src/views/wms/stat/pastivt/index.vue @@ -129,17 +129,6 @@ @keyup.enter.native="crud.toQuery" /> - - - + + + - + diff --git a/lms/nladmin-ui/src/views/wms/statistics/sendReceiveQuery/index.vue b/lms/nladmin-ui/src/views/wms/statistics/sendReceiveQuery/index.vue index 0ef07bedf..381deb5b8 100644 --- a/lms/nladmin-ui/src/views/wms/statistics/sendReceiveQuery/index.vue +++ b/lms/nladmin-ui/src/views/wms/statistics/sendReceiveQuery/index.vue @@ -96,25 +96,15 @@ - - - - - - - - - -