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/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/auto/run/TwoNDCSocketConnectionAutoRun.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java index 102900aaf..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 @@ -117,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]; 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/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 21a4e11df..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 @@ -489,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 { 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 1d695130d..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 @@ -707,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; @@ -732,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; @@ -812,8 +814,9 @@ 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) { map.put("code", "to_command"); map.put("value", "2"); @@ -920,8 +923,9 @@ 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("code", "to_command"); map.put("value", "4"); 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 ce84c9005..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); + /** * 根据终点设备编号查询当前是否有就绪任务 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 586a00b55..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 @@ -516,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); @@ -1077,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) { 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/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/logback-spring.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml index f53004205..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 @@ -21,6 +21,7 @@ https://juejin.cn/post/6844903775631572999 +