| | |
| | | continue; |
| | | } |
| | | String barcode = barcodeThread.getBarcode(); |
| | | if (!Cools.isEmpty(barcode)) { |
| | | log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode); |
| | | if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | continue; |
| | | } |
| | | } else { |
| | | continue; |
| | | } |
| | | |
| | | // 获取入库站信息 |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | |
| | | continue; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | |
| | | if (!Cools.isEmpty(barcode)) { |
| | | log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode); |
| | | if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) { |
| | | if (inSta.getStaNo()==101 || inSta.getStaNo()==109 || inSta.getStaNo()==117){ |
| | | staProtocol.setWorkNo((short)9998); |
| | | staProtocol.setStaNo((short)100); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | }else if (inSta.getStaNo()==201 || inSta.getStaNo()==207 || inSta.getStaNo()==213){ |
| | | staProtocol.setWorkNo((short)9998); |
| | | if (inSta.getStaNo()==201){ |
| | | staProtocol.setStaNo((short)200); |
| | | }else if (inSta.getStaNo()==207){ |
| | | staProtocol.setStaNo((short)206); |
| | | }else if (inSta.getStaNo()==213){ |
| | | staProtocol.setStaNo((short)212); |
| | | } |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | } |
| | | continue; |
| | | } |
| | | } else if (staProtocol.getWorkNo()==9999 && staProtocol.isLoading() && !staProtocol.isEmptyMk()){ |
| | | if (inSta.getStaNo()==101 || inSta.getStaNo()==109 || inSta.getStaNo()==117){ |
| | | staProtocol.setWorkNo((short)9998); |
| | | staProtocol.setStaNo((short)100); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | }else if (inSta.getStaNo()==201 || inSta.getStaNo()==207 || inSta.getStaNo()==213){ |
| | | staProtocol.setWorkNo((short)9998); |
| | | if (inSta.getStaNo()==201){ |
| | | staProtocol.setStaNo((short)200); |
| | | }else if (inSta.getStaNo()==207){ |
| | | staProtocol.setStaNo((short)206); |
| | | }else if (inSta.getStaNo()==213){ |
| | | staProtocol.setStaNo((short)212); |
| | | } |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | } |
| | | continue; |
| | | }else { |
| | | continue; |
| | | } |
| | | |
| | | // 入出库模式判断 |
| | |
| | | |
| | | // 判断重复工作档 |
| | | WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode); |
| | | WrkMast wrkMast1 = wrkMastMapper.selectPakInStepBarcode(barcode); |
| | | if (wrkMast1 !=null){ |
| | | if (wrkMast1.getIoType()==103 || wrkMast1.getIoType()==107 || wrkMast1.getIoType()==104){ |
| | | continue; |
| | | } |
| | | } |
| | | if (wrkMast != null) { |
| | | log.error("工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast.getWrkNo()); |
| | | if (inSta.getStaNo()==100 || inSta.getStaNo()==108 || inSta.getStaNo()==116){ |
| | | if (inSta.getStaNo()==101 || inSta.getStaNo()==109 || inSta.getStaNo()==117){ |
| | | staProtocol.setWorkNo((short)9999); |
| | | staProtocol.setStaNo((short)100); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | }else if (inSta.getStaNo()==201 || inSta.getStaNo()==207 || inSta.getStaNo()==213){ |
| | | staProtocol.setWorkNo((short)9999); |
| | | if (inSta.getStaNo()==201){ |
| | | staProtocol.setStaNo((short)200); |
| | | }else if (inSta.getStaNo()==207){ |
| | | staProtocol.setStaNo((short)206); |
| | | }else if (inSta.getStaNo()==213){ |
| | | staProtocol.setStaNo((short)212); |
| | | } |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (!result) { |
| | |
| | | } |
| | | } else { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | if (inSta.getStaNo()==101 || inSta.getStaNo()==109 || inSta.getStaNo()==117){ |
| | | staProtocol.setWorkNo((short)9999); |
| | | staProtocol.setStaNo((short)100); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | }else if (inSta.getStaNo()==201 || inSta.getStaNo()==207 || inSta.getStaNo()==213){ |
| | | staProtocol.setWorkNo((short)9999); |
| | | if (inSta.getStaNo()==201){ |
| | | staProtocol.setStaNo((short)200); |
| | | }else if (inSta.getStaNo()==207){ |
| | | staProtocol.setStaNo((short)206); |
| | | }else if (inSta.getStaNo()==213){ |
| | | staProtocol.setStaNo((short)212); |
| | | } |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | // if (devpThread.ioMode != IoModeType.PAKIN_MODE) { continue; } |
| | | |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()) { |
| | | // WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode); |
| | | WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue()); |
| | | WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode); |
| | | // WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue()); |
| | | if (wrkMast == null) { |
| | | // 无拣料数据 |
| | | continue; |
| | |
| | | } |
| | | // 命令下发 ------------------------------------------------------------------------------- |
| | | if (!commands.isEmpty()) { |
| | | if (led.getId() == 7) { |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, commands))) { |
| | | log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | continue; |
| | | } else { |
| | | ledThread.setLedMk(false); |
| | | } |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, commands))) { |
| | | log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | continue; |
| | | } else { |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(1, commands))) { |
| | | log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | continue; |
| | | } else { |
| | | ledThread.setLedMk(false); |
| | | } |
| | | ledThread.setLedMk(false); |
| | | } |
| | | |
| | | } |
| | |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId()); |
| | | // led显示默认内容 |
| | | if (reset && !ledThread.isLedMk()) { |
| | | if (led.getId() == 7) { |
| | | ledThread.setLedMk(true); |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) { |
| | | log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | } else { |
| | | |
| | | } |
| | | ledThread.setLedMk(true); |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) { |
| | | log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | } else { |
| | | ledThread.setLedMk(true); |
| | | if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) { |
| | | log.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort()); |
| | | } else { |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |