diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java index 714b4bd..09386c6 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java @@ -24,6 +24,7 @@ import org.nl.acs.opc.DeviceType; import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.system.service.ParamService; import org.nl.modules.wql.util.SpringContextHolder; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.HashMap; @@ -35,81 +36,85 @@ import java.util.Map; @RequiredArgsConstructor public class NDCAgvServiceImpl implements NDCAgvService { - private final DeviceAppService deviceAppService; - private final ParamService paramService; - private final AcsToWmsService acsToWmsService; - - private final DeviceExecuteLogService logServer; + @Autowired + private DeviceAppService deviceAppService; + @Autowired + private ParamService paramService; + @Autowired + private AcsToWmsService acsToWmsService; + @Autowired + private DeviceExecuteLogService logServer; Map AGVDeviceStatus = new HashMap(); @LokiLog(type = LokiLogType.AGV) @Override public void deleteAgvInstToNDC(Instruction inst) throws Exception { - if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { - int index = Integer.parseInt(inst.getAgv_jobno()); + if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { + int index = Integer.parseInt(inst.getAgv_jobno()); - byte indexhigh = (byte) IntToHexHigh(index); - byte indexlow = (byte) IntToHexLow(index); + byte indexhigh = (byte) IntToHexHigh(index); + byte indexlow = (byte) IntToHexLow(index); - String str = "十进制下发:"; - String str1 = "十六进制下发:"; - str += "index:" + index; - str1 += "ikey:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF); - System.out.println(str); - System.out.println(str1); + String str = "十进制下发:"; + String str1 = "十六进制下发:"; + str += "index:" + index; + str1 += "ikey:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF); + System.out.println(str); + System.out.println(str1); - byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, - (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X06, - (byte) 0X00, (byte) 0X01, - (byte) 0X00, (byte) 0X6E, - (byte) 0X00, (byte) 0X02, - (byte) indexhigh, (byte) indexlow, - }; - log.info("下发删除AGV指令--{}", Bytes2HexString(b)); + byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, + (byte) 0X00, (byte) 0X08, + (byte) 0X00, (byte) 0X06, + (byte) 0X00, (byte) 0X01, + (byte) 0X00, (byte) 0X6E, + (byte) 0X00, (byte) 0X02, + (byte) indexhigh, (byte) indexlow, + }; + log.info("下发删除AGV指令--{}", Bytes2HexString(b)); // NDCSocketConnectionAutoRun.write(b); - System.out.println("下发删除agv指令数据:" + Bytes2HexString(b)); - } + System.out.println("下发删除agv指令数据:" + Bytes2HexString(b)); + } } @LokiLog(type = LokiLogType.AGV) @Override public byte[] sendAgvOneModeInst(int phase, int index, int result1, int result2) { - if (phase < 0 || index < 0) - return null; - byte indexhigh = (byte) IntToHexHigh(index); - byte indexlow = (byte) IntToHexLow(index); - byte phasehigh = (byte) IntToHexHigh(phase); - byte phaselow = (byte) IntToHexLow(phase); - byte resulthigh1 = (byte) IntToHexHigh(result1); - byte resultlow1 = (byte) IntToHexLow(result1); - byte resulthigh2 = (byte) IntToHexHigh(result2); - byte resultlow2 = (byte) IntToHexLow(result2); + if (phase < 0 || index < 0) + return null; + byte indexhigh = (byte) IntToHexHigh(index); + byte indexlow = (byte) IntToHexLow(index); + byte phasehigh = (byte) IntToHexHigh(phase); + byte phaselow = (byte) IntToHexLow(phase); + byte resulthigh1 = (byte) IntToHexHigh(result1); + byte resultlow1 = (byte) IntToHexLow(result1); + byte resulthigh2 = (byte) IntToHexHigh(result2); + byte resultlow2 = (byte) IntToHexLow(result2); - byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, - (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X0D, - (byte) 0X00, (byte) 0X01, - (byte) 0X00, (byte) 0X6D, - (byte) 0X00, (byte) 0X08, - (byte) indexhigh, (byte) indexlow, - (byte) 0X01, (byte) 0X12, - (byte) phasehigh, (byte) phaselow, - (byte) resulthigh1, (byte) resultlow1, - (byte) resulthigh2, (byte) resultlow2 - }; + byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, + (byte) 0X00, (byte) 0X08, + (byte) 0X00, (byte) 0X0D, + (byte) 0X00, (byte) 0X01, + (byte) 0X00, (byte) 0X6D, + (byte) 0X00, (byte) 0X08, + (byte) indexhigh, (byte) indexlow, + (byte) 0X01, (byte) 0X12, + (byte) phasehigh, (byte) phaselow, + (byte) resulthigh1, (byte) resultlow1, + (byte) resulthigh2, (byte) resultlow2 + }; - log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF)); - //87CD 0008 000C 0001 006D 0008 0000 0114 000E 0000 - //87CD 0008 000C 0001 006D 0008 0003 0114 008F 0000 - System.out.println("反馈agv动作数据:" + Bytes2HexString(b)); - return b; + log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF)); + //87CD 0008 000C 0001 006D 0008 0000 0114 000E 0000 + //87CD 0008 000C 0001 006D 0008 0003 0114 008F 0000 + System.out.println("反馈agv动作数据:" + Bytes2HexString(b)); + return b; } + @LokiLog(type = LokiLogType.AGV) @Override public void sendAgvOneInstToNDC(Instruction inst) { @@ -171,66 +176,67 @@ public class NDCAgvServiceImpl implements NDCAgvService { System.out.println("下发agv指令数据:" + Bytes2HexString(b)); } } + @LokiLog(type = LokiLogType.AGV) @Override public void sendAgvInstToNDC(Instruction inst) { - if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { - 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()); + if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { + 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); + 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); + 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 += "/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 += "/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); + str += "/priority:" + (priority); + str1 += "/priority:" + hexToString(prioritylow & 0xFF); - System.out.println(str); - System.out.println(str1); + 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); + 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); // NDCSocketConnectionAutoRun.write(b); - System.out.println("下发agv指令数据:" + Bytes2HexString(b)); - } + System.out.println("下发agv指令数据:" + Bytes2HexString(b)); + } } @LokiLog(type = LokiLogType.AGV) @@ -280,129 +286,129 @@ public class NDCAgvServiceImpl implements NDCAgvService { @LokiLog(type = LokiLogType.AGV) @Override public byte[] sendAgvOneModeInst(int phase, int index, int result) { - if (phase < 0 || index < 0) - return null; - byte indexhigh = (byte) IntToHexHigh(index); - byte indexlow = (byte) IntToHexLow(index); - byte phasehigh = (byte) IntToHexHigh(phase); - byte phaselow = (byte) IntToHexLow(phase); - byte resulthigh = (byte) IntToHexHigh(result); - byte resultlow = (byte) IntToHexLow(result); + if (phase < 0 || index < 0) + return null; + byte indexhigh = (byte) IntToHexHigh(index); + byte indexlow = (byte) IntToHexLow(index); + byte phasehigh = (byte) IntToHexHigh(phase); + byte phaselow = (byte) IntToHexLow(phase); + byte resulthigh = (byte) IntToHexHigh(result); + byte resultlow = (byte) IntToHexLow(result); - int type = Integer.parseInt(paramService.findByCode(AcsConfig.BUSINESSTYPE).getValue()); - byte[] b = new byte[]{}; - switch (type) { - case 0: - b = new byte[]{(byte) 0X87, (byte) 0XCD, - (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X0A, - (byte) 0X00, (byte) 0X01, - (byte) 0X00, (byte) 0X6D, - (byte) 0X00, (byte) 0X06, - (byte) indexhigh, (byte) indexlow, - (byte) 0X01, (byte) 0X12, - (byte) phasehigh, (byte) phaselow - }; - break; - case 1: - b = new byte[]{(byte) 0X87, (byte) 0XCD, - (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X0D, - (byte) 0X00, (byte) 0X01, - (byte) 0X00, (byte) 0X6D, - (byte) 0X00, (byte) 0X08, - (byte) indexhigh, (byte) indexlow, - (byte) 0X01, (byte) 0X12, - (byte) phasehigh, (byte) phaselow, - (byte) resulthigh, (byte) resultlow - }; - break; - case 2: - b = new byte[]{(byte) 0X87, (byte) 0XCD, - (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X0A, - (byte) 0X00, (byte) 0X01, - (byte) 0X00, (byte) 0X6D, - (byte) 0X00, (byte) 0X06, - (byte) indexhigh, (byte) indexlow, - (byte) 0X01, (byte) 0X12, - (byte) phasehigh, (byte) phaselow - }; - break; - case 5: - b = new byte[]{(byte) 0X87, (byte) 0XCD, - (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X0A, - (byte) 0X00, (byte) 0X01, - (byte) 0X00, (byte) 0X6D, - (byte) 0X00, (byte) 0X06, - (byte) indexhigh, (byte) indexlow, - (byte) 0X01, (byte) 0X12, - (byte) phasehigh, (byte) phaselow - }; - break; - case 7: - b = new byte[]{(byte) 0X87, (byte) 0XCD, - (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X0A, - (byte) 0X00, (byte) 0X01, - (byte) 0X00, (byte) 0X6D, - (byte) 0X00, (byte) 0X06, - (byte) indexhigh, (byte) indexlow, - (byte) 0X01, (byte) 0X12, - (byte) phasehigh, (byte) phaselow - }; - break; - } - log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF)); + int type = Integer.parseInt(paramService.findByCode(AcsConfig.BUSINESSTYPE).getValue()); + byte[] b = new byte[]{}; + switch (type) { + case 0: + b = new byte[]{(byte) 0X87, (byte) 0XCD, + (byte) 0X00, (byte) 0X08, + (byte) 0X00, (byte) 0X0A, + (byte) 0X00, (byte) 0X01, + (byte) 0X00, (byte) 0X6D, + (byte) 0X00, (byte) 0X06, + (byte) indexhigh, (byte) indexlow, + (byte) 0X01, (byte) 0X12, + (byte) phasehigh, (byte) phaselow + }; + break; + case 1: + b = new byte[]{(byte) 0X87, (byte) 0XCD, + (byte) 0X00, (byte) 0X08, + (byte) 0X00, (byte) 0X0D, + (byte) 0X00, (byte) 0X01, + (byte) 0X00, (byte) 0X6D, + (byte) 0X00, (byte) 0X08, + (byte) indexhigh, (byte) indexlow, + (byte) 0X01, (byte) 0X12, + (byte) phasehigh, (byte) phaselow, + (byte) resulthigh, (byte) resultlow + }; + break; + case 2: + b = new byte[]{(byte) 0X87, (byte) 0XCD, + (byte) 0X00, (byte) 0X08, + (byte) 0X00, (byte) 0X0A, + (byte) 0X00, (byte) 0X01, + (byte) 0X00, (byte) 0X6D, + (byte) 0X00, (byte) 0X06, + (byte) indexhigh, (byte) indexlow, + (byte) 0X01, (byte) 0X12, + (byte) phasehigh, (byte) phaselow + }; + break; + case 5: + b = new byte[]{(byte) 0X87, (byte) 0XCD, + (byte) 0X00, (byte) 0X08, + (byte) 0X00, (byte) 0X0A, + (byte) 0X00, (byte) 0X01, + (byte) 0X00, (byte) 0X6D, + (byte) 0X00, (byte) 0X06, + (byte) indexhigh, (byte) indexlow, + (byte) 0X01, (byte) 0X12, + (byte) phasehigh, (byte) phaselow + }; + break; + case 7: + b = new byte[]{(byte) 0X87, (byte) 0XCD, + (byte) 0X00, (byte) 0X08, + (byte) 0X00, (byte) 0X0A, + (byte) 0X00, (byte) 0X01, + (byte) 0X00, (byte) 0X6D, + (byte) 0X00, (byte) 0X06, + (byte) indexhigh, (byte) indexlow, + (byte) 0X01, (byte) 0X12, + (byte) phasehigh, (byte) phaselow + }; + break; + } + log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF)); - System.out.println("反馈agv动作数据:" + Bytes2HexString(b)); - return b; + System.out.println("反馈agv动作数据:" + Bytes2HexString(b)); + return b; } @LokiLog(type = LokiLogType.AGV) @Override public String queryDoorStatus(String device) { - log.info("AGV查询自动门状态,参数:{}", device); - int type = Integer.parseInt(paramService.findByCode(AcsConfig.BUSINESSTYPE).getValue()); - switch (type) { - case 4: - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASOTHERSYSTEM).getValue(), "1")) { - String result = acsToWmsService.queryDoorsStatus().body(); - JSONArray ja = JSONArray.parseArray(result); - log.info("AGV查询自动门状态,反馈:{}", ja.toString()); - return ja.toString(); - } - return null; - default: - if (StrUtil.equals("doors", device)) { - List list = deviceAppService.findDevice(DeviceType.autodoor); - JSONArray ja = new JSONArray(); - for (int i = 0; i < list.size(); i++) { - Device doordevice = deviceAppService.findDeviceByCode(list.get(i).getDevice_code()); - if (ObjectUtil.isEmpty(doordevice)) { - throw new BadRequestException("未找到对应设备"); - } - String mes = null; - - JSONObject jo = JSONObject.parseObject(mes); - ja.add(jo); - } - log.info("AGV查询自动门状态,反馈:{}", ja.toString()); - return ja.toString(); - - } else { - Device doordevice = deviceAppService.findDeviceByCode(device); + log.info("AGV查询自动门状态,参数:{}", device); + int type = Integer.parseInt(paramService.findByCode(AcsConfig.BUSINESSTYPE).getValue()); + switch (type) { + case 4: + if (StrUtil.equals(paramService.findByCode(AcsConfig.HASOTHERSYSTEM).getValue(), "1")) { + String result = acsToWmsService.queryDoorsStatus().body(); + JSONArray ja = JSONArray.parseArray(result); + log.info("AGV查询自动门状态,反馈:{}", ja.toString()); + return ja.toString(); + } + return null; + default: + if (StrUtil.equals("doors", device)) { + List list = deviceAppService.findDevice(DeviceType.autodoor); + JSONArray ja = new JSONArray(); + for (int i = 0; i < list.size(); i++) { + Device doordevice = deviceAppService.findDeviceByCode(list.get(i).getDevice_code()); if (ObjectUtil.isEmpty(doordevice)) { throw new BadRequestException("未找到对应设备"); } String mes = null; + JSONObject jo = JSONObject.parseObject(mes); - log.info("AGV查询自动门状态,反馈:{}", jo.toString()); - return jo.toString(); + ja.add(jo); } - } + log.info("AGV查询自动门状态,反馈:{}", ja.toString()); + return ja.toString(); + + } else { + Device doordevice = deviceAppService.findDeviceByCode(device); + if (ObjectUtil.isEmpty(doordevice)) { + throw new BadRequestException("未找到对应设备"); + } + String mes = null; + JSONObject jo = JSONObject.parseObject(mes); + log.info("AGV查询自动门状态,反馈:{}", jo.toString()); + return jo.toString(); + } + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java index 9a6fa44..9f0525d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java @@ -169,55 +169,56 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { //共挤线三工位 if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) { hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver(); -// if ((hailiangSmartplcTestDeviceDriver.getAction() == 1 || hailiangSmartplcTestDeviceDriver.getAction() == 3) && hailiangSmartplcTestDeviceDriver.getMove() == 1) { -// inst.setExecute_status("1"); -// is_feedback = true; -// } - is_feedback = true; + if ((hailiangSmartplcTestDeviceDriver.getAction() == 1 || hailiangSmartplcTestDeviceDriver.getAction() == 3) && hailiangSmartplcTestDeviceDriver.getMove() == 1) { + inst.setExecute_status("1"); + is_feedback = true; + } + //is_feedback = true; } //叠盘位 - if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) { + else if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) { emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver(); -// int number = emptyVehicleStackingPositionDeviceDriver.getNumber(); -// if (number < Integer.valueOf(str)) { -// log.info("叠盘位:" + jobno + "当前层高为:" + number + ",不存在第" + str + "的托盘!"); -// return null; -// } -// inst.setExecute_status("1"); + int number = emptyVehicleStackingPositionDeviceDriver.getNumber(); + if (number < Integer.valueOf(str)) { + log.info("叠盘位:" + jobno + "当前层高为:" + number + ",不存在第" + str + "的托盘!"); + return null; + } + inst.setExecute_status("1"); is_feedback = true; } //货梯对接线 - if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { + else if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver(); -// if ((cargoLiftConveyorDeviceDriver.getAction() == 1 || cargoLiftConveyorDeviceDriver.getAction() == 3) && cargoLiftConveyorDeviceDriver.getMove() == 1) { -// inst.setExecute_status("1"); -// is_feedback = true; -// } - is_feedback = true; + if ((cargoLiftConveyorDeviceDriver.getAction() == 1 || cargoLiftConveyorDeviceDriver.getAction() == 3) && cargoLiftConveyorDeviceDriver.getMove() == 1) { + inst.setExecute_status("1"); + is_feedback = true; + } + //is_feedback = true; } //豪凯自动线对接位 - if (addressdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) { + else if (addressdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) { haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) addressdevice.getDeviceDriver(); -// if ((haoKaiAutoConveyorDeviceDriver.getAction() == 1 || haoKaiAutoConveyorDeviceDriver.getAction() == 3) && haoKaiAutoConveyorDeviceDriver.getMove() == 1) { -// inst.setExecute_status("1"); -// is_feedback = true; -// } - is_feedback = true; + if ((haoKaiAutoConveyorDeviceDriver.getAction() == 1 || haoKaiAutoConveyorDeviceDriver.getAction() == 3) && haoKaiAutoConveyorDeviceDriver.getMove() == 1) { + inst.setExecute_status("1"); + is_feedback = true; + } + //is_feedback = true; } //油漆线 - if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) { + else if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) { paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver(); -// if ((paintConveyorDeviceDriver.getAction() == 1 || paintConveyorDeviceDriver.getAction() == 3) && paintConveyorDeviceDriver.getMove() == 1) { -// inst.setExecute_status("1"); -// is_feedback = true; -// } - is_feedback = true; + if ((paintConveyorDeviceDriver.getAction() == 1 || paintConveyorDeviceDriver.getAction() == 3) && paintConveyorDeviceDriver.getMove() == 1) { + inst.setExecute_status("1"); + is_feedback = true; + } + // is_feedback = true; - } - if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { + }/* else if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { + is_feedback = true; + } */else { is_feedback = true; } } @@ -226,37 +227,40 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver(); inst.setExecute_status("2"); hailiangSmartplcTestDeviceDriver.writing(2); - is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) { + if (hailiangSmartplcTestDeviceDriver.getItemProtocol().getOpcIntegerValue("to_command") == 2) { + is_feedback = true; + } + } else if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) { emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver(); inst.setExecute_status("2"); emptyVehicleStackingPositionDeviceDriver.writing(2); - is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { + if (emptyVehicleStackingPositionDeviceDriver.getItemProtocol().getOpcIntegerValue("to_command") == 2) { + is_feedback = true; + } + } else if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver(); inst.setExecute_status("2"); cargoLiftConveyorDeviceDriver.writing(2); - is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) { + if (cargoLiftConveyorDeviceDriver.getItemProtocol().getOpcIntegerValue("to_command") == 2) { + is_feedback = true; + } + } else if (addressdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) { haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) addressdevice.getDeviceDriver(); inst.setExecute_status("2"); haoKaiAutoConveyorDeviceDriver.writing(2); - is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) { + if (haoKaiAutoConveyorDeviceDriver.getItemProtocol().getOpcIntegerValue("to_command") == 2) { + is_feedback = true; + } + } else if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) { paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver(); inst.setExecute_status("2"); paintConveyorDeviceDriver.writing(2); + if (paintConveyorDeviceDriver.getItemProtocol().getOpcIntegerValue("to_command") == 2) { + is_feedback = true; + } + }/* else if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { is_feedback = true; - } - if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { + } */else { is_feedback = true; } @@ -321,102 +325,93 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { if ("EntryRequired".equals(type)) { if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) { hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver(); -// if ((hailiangSmartplcTestDeviceDriver.getAction() == 2 || hailiangSmartplcTestDeviceDriver.getAction() == 3) && hailiangSmartplcTestDeviceDriver.getMove() == 0) { -// inst.setExecute_status("3"); -// is_feedback = true; -// } + if ((hailiangSmartplcTestDeviceDriver.getAction() == 2 || hailiangSmartplcTestDeviceDriver.getAction() == 3) && hailiangSmartplcTestDeviceDriver.getMove() == 0) { + inst.setExecute_status("3"); + is_feedback = true; + } + //is_feedback = true; + + } else if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) { + emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver(); + int number = emptyVehicleStackingPositionDeviceDriver.getNumber(); + if (number >= Integer.valueOf(str)) { + log.info("叠盘位:" + jobno + "第" + str + "上有货!"); + return null; + } + inst.setExecute_status("3"); is_feedback = true; - - } - - if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) { -// emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver(); -// int number = emptyVehicleStackingPositionDeviceDriver.getNumber(); -// if (number >= Integer.valueOf(str)) { -// log.info("叠盘位:" + jobno + "第" + str + "上有货!"); -// return null; -// } -// inst.setExecute_status("3"); - is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { + } else if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver(); -// if ((cargoLiftConveyorDeviceDriver.getAction() == 2 || cargoLiftConveyorDeviceDriver.getAction() == 3) && cargoLiftConveyorDeviceDriver.getMove() == 0) { -// inst.setExecute_status("3"); -// is_feedback = true; -// } - is_feedback = true; - - } - - if (addressdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) { + if ((cargoLiftConveyorDeviceDriver.getAction() == 2 || cargoLiftConveyorDeviceDriver.getAction() == 3) && cargoLiftConveyorDeviceDriver.getMove() == 0) { + inst.setExecute_status("3"); + is_feedback = true; + } + //is_feedback = true; + } else if (addressdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) { haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) addressdevice.getDeviceDriver(); -// if ((haoKaiAutoConveyorDeviceDriver.getAction() == 2 || haoKaiAutoConveyorDeviceDriver.getAction() == 3) && haoKaiAutoConveyorDeviceDriver.getMove() == 0) { -// inst.setExecute_status("3"); -// is_feedback = true; -// } - is_feedback = true; + if ((haoKaiAutoConveyorDeviceDriver.getAction() == 2 || haoKaiAutoConveyorDeviceDriver.getAction() == 3) && haoKaiAutoConveyorDeviceDriver.getMove() == 0) { + inst.setExecute_status("3"); + is_feedback = true; + } + // is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) { + } else if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) { paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver(); -// if ((paintConveyorDeviceDriver.getAction() == 2 || paintConveyorDeviceDriver.getAction() == 3) && paintConveyorDeviceDriver.getMove() == 0) { -// inst.setExecute_status("3"); -// is_feedback = true; -// } + if ((paintConveyorDeviceDriver.getAction() == 2 || paintConveyorDeviceDriver.getAction() == 3) && paintConveyorDeviceDriver.getMove() == 0) { + inst.setExecute_status("3"); + is_feedback = true; + } + // is_feedback = true; + + }/* else if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { is_feedback = true; - - } - - if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { + } else if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + }*/ else { is_feedback = true; } } if ("PauseOnStation".equals(type)) { - if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - is_feedback = true; - } if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) { -// hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver(); -// inst.setExecute_status("4"); -// hailiangSmartplcTestDeviceDriver.writing(3); + hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver(); + inst.setExecute_status("4"); + hailiangSmartplcTestDeviceDriver.writing(3); + if (hailiangSmartplcTestDeviceDriver.getItemProtocol().getOpcIntegerValue("to_command") == 3) { + is_feedback = true; + } + } else if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) { + emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver(); + inst.setExecute_status("4"); + emptyVehicleStackingPositionDeviceDriver.writing(3); + if (emptyVehicleStackingPositionDeviceDriver.getItemProtocol().getOpcIntegerValue("to_command") == 3) { + is_feedback = true; + } + } else if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { + cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver(); + inst.setExecute_status("4"); + cargoLiftConveyorDeviceDriver.writing(3); + if (cargoLiftConveyorDeviceDriver.getItemProtocol().getOpcIntegerValue("to_command") == 3) { + is_feedback = true; + } + } else if (addressdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) { + haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) addressdevice.getDeviceDriver(); + inst.setExecute_status("4"); + haoKaiAutoConveyorDeviceDriver.writing(3); + if (haoKaiAutoConveyorDeviceDriver.getItemProtocol().getOpcIntegerValue("to_command") == 3) { + is_feedback = true; + } + } else if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) { + paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver(); + inst.setExecute_status("4"); + paintConveyorDeviceDriver.writing(3); + if (paintConveyorDeviceDriver.getItemProtocol().getOpcIntegerValue("to_command") == 3) { + is_feedback = true; + } + }/* else if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) { -// emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver(); -// inst.setExecute_status("4"); -// emptyVehicleStackingPositionDeviceDriver.writing(3); + } else if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { -// cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver(); -// inst.setExecute_status("4"); -// cargoLiftConveyorDeviceDriver.writing(3); - is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) { -// haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) addressdevice.getDeviceDriver(); -// inst.setExecute_status("4"); -// haoKaiAutoConveyorDeviceDriver.writing(3); - is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) { -// paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver(); -// inst.setExecute_status("4"); -// paintConveyorDeviceDriver.writing(3); - is_feedback = true; - } - if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { + } */else { is_feedback = true; } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java index 5640f96..731cebc 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java @@ -257,12 +257,12 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe // logServer.deviceExecuteLog(this.device_code, "", "", "扫码器扫到的条码为:" + barcode()); // } //申请任务 - if (!StrUtil.isEmpty(barcode()) && !StrUtil.equals(barcode(), "NoRead") && barcode().trim().length() == 12 && !requireSucess) { + if (!StrUtil.isEmpty(barcode()) && !StrUtil.equals(barcode(), "NoRead") && barcode().trim().length() == 12 && barcode().trim().startsWith("TTP") && !requireSucess) { logServer.deviceExecuteLog(this.device_code, "", "", "开始申请任务~~~~~~"); instruction_require(barcode()); logServer.deviceExecuteLog(this.device_code, "", "", "申请任务成功~~~~~~"); } - if (!StrUtil.isEmpty(barcode()) && !StrUtil.equals(barcode(), "NoRead") && barcode().trim().length() == 12 && !applySucess) { + if (!StrUtil.isEmpty(barcode()) && !StrUtil.equals(barcode(), "NoRead") && barcode().trim().length() == 12 && barcode().trim().startsWith("TTP") && !applySucess) { instruction_apply(barcode()); } } @@ -577,18 +577,18 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe message = "申请任务中..."; logServer.deviceExecuteLog(device_code, "", "", "开始申请任务...条码信息:" + container_code); JSONObject apply = new JSONObject(); - if(action == 4){ - if(this.itemProtocol.getItem_task() == 0 ){ + if (action == 4) { + if (this.itemProtocol.getItem_task() == 0) { logServer.deviceExecuteLog(device_code, "", "", "开始申请一楼任务...上次指令号为0"); return false; } Instruction inst = instructionService.findByCode(String.valueOf(this.itemProtocol.getItem_task())); - if(ObjectUtil.isEmpty(inst)){ + if (ObjectUtil.isEmpty(inst)) { logServer.deviceExecuteLog(device_code, "", "", "开始申请一楼任务...指令号:" + String.valueOf(this.itemProtocol.getItem_task() + "未找到对应指令")); return false; } TaskDto taskDto = taskserver.findByCode(inst.getTask_code()); - if(ObjectUtil.isEmpty(taskDto)){ + if (ObjectUtil.isEmpty(taskDto)) { logServer.deviceExecuteLog(device_code, "", "", "开始申请一楼任务...指令号:" + String.valueOf(this.itemProtocol.getItem_task() + "未找到对应任务")); return false; } @@ -681,10 +681,10 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe @Override public void setDeviceStatus(JSONObject data) { String requireSucess = data.getString("requireSucess"); - if (StrUtil.isNotEmpty(requireSucess)){ - if (requireSucess.equals("1")){ + if (StrUtil.isNotEmpty(requireSucess)) { + if (requireSucess.equals("1")) { this.requireSucess = true; - } else if (requireSucess.equals("0")){ + } else if (requireSucess.equals("0")) { this.requireSucess = false; } }