| | |
| | | * 组托 |
| | | * 入库站,根据条码扫描生成入库工作档,工作状态 2 |
| | | */ |
| | | public synchronized void generateStoreWrkFile(Integer mark) { |
| | | public synchronized void generateStoreWrkFile(Integer mark) throws InterruptedException { |
| | | // 根据输送线plc遍历 |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // 遍历入库口 |
| | |
| | | continue; |
| | | } |
| | | } |
| | | if (wrkMast != null) { |
| | | News.error("" + mark + " - 4" + " - 工作档中已存在该站状态为( 3.开始执行入库任务 )的数据,工作号={}", wrkMast.getWrkNo()); |
| | | // if (wrkMast != null) { |
| | | // News.error("" + mark + " - 4" + " - 工作档中已存在该站状态为( 3.开始执行入库任务 )的数据,工作号={}", wrkMast.getWrkNo()); |
| | | |
| | | // led 异常显示 |
| | | // if (ledThread != null) { |
| | | // String errorMsg = "工作档已存在该条码号===>>" + barcode; |
| | | // MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg)); |
| | | // } |
| | | LiftProtocol liftProtocol = devpThread.getLiftStatus(); |
| | | |
| | | if (liftProtocol == null) { |
| | | continue; |
| | | } |
| | | if (liftProtocol.getMode() != 1) { |
| | | continue; |
| | | } |
| | | if (liftProtocol.getDeviceStatus() != 0) { |
| | | continue; |
| | | } |
| | | if (liftProtocol.getWorkNo() > 0) { |
| | | continue; |
| | | } |
| | | |
| | | Integer staNo = Utils.getStaNoByLocNo(wrkMast.getLocNo()); |
| | | |
| | | LiftCommand command = new LiftCommand(); |
| | | command.setWorkNo(wrkMast.getWrkNo()); |
| | | command.setSourceStaNo(inSta.getStaNo()); |
| | | command.setTargetStaNo(staNo); |
| | | |
| | | barcodeThread.setBarcode(""); |
| | | |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, command)); |
| | | if (result) { |
| | | News.info("WCS--->PLC下发任务成功:{}",command.toString()); |
| | | } |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | |
| | | wrkMast.setWrkSts(3L);// 3.设备执行中 |
| | | wrkMast.setCrnStrTime(new Date()); |
| | | wrkMastService.updateById(wrkMast); |
| | | break; |
| | | } |
| | | // LiftProtocol liftProtocol = devpThread.getLiftStatus(); |
| | | // |
| | | // if (liftProtocol == null) { |
| | | // continue; |
| | | // } |
| | | // if (liftProtocol.getMode() != 1) { |
| | | // continue; |
| | | // } |
| | | // if (liftProtocol.getDeviceStatus() != 0) { |
| | | // continue; |
| | | // } |
| | | // if (liftProtocol.getWorkNo() > 0) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // Integer staNo = Utils.getStaNoByLocNo(wrkMast.getLocNo()); |
| | | // |
| | | // LiftCommand command = new LiftCommand(); |
| | | // command.setWorkNo(wrkMast.getWrkNo()); |
| | | // command.setSourceStaNo(inSta.getStaNo()); |
| | | // command.setTargetStaNo(staNo); |
| | | // |
| | | // barcodeThread.setBarcode(""); |
| | | // |
| | | // boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, command)); |
| | | // if (result) { |
| | | // News.info("WCS--->PLC下发任务成功:{}",command.toString()); |
| | | // } |
| | | // if (!result) { |
| | | // throw new CoolException("更新plc站点信息失败"); |
| | | // } |
| | | // |
| | | // wrkMast.setWrkSts(3L);// 3.设备执行中 |
| | | // wrkMast.setCrnStrTime(new Date()); |
| | | // wrkMastService.updateById(wrkMast); |
| | | // Thread.sleep(300);// 延时3S |
| | | // continue; |
| | | // } |
| | | |
| | | LiftProtocol liftProtocol = devpThread.getLiftStatus(); |
| | | if(liftProtocol == null) { |
| | |
| | | wrkMastService.updateById(currentWrkMast); |
| | | Thread.sleep(3000); // 延时3S |
| | | } else { |
| | | News.error("" + mark + " - 5" + " - 请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | // News.error("" + mark + " - 5" + " - 请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | |
| | | // led 异常显示 |
| | | if (ledThread != null) { |
| | | String errorMsg = jsonObject.getString("msg"); |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg)); |
| | | } |
| | | |
| | | // if (ledThread != null) { |
| | | // String errorMsg = jsonObject.getString("msg"); |
| | | // MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg)); |
| | | // } |
| | | //托盘退回 |
| | | // LiftCommand command = new LiftCommand(); |
| | | // command.setWorkNo(9998); |
| | | // command.setSourceStaNo(inSta.getStaNo()); |
| | | // command.setTargetStaNo(inSta.getBackSta()); |
| | | Integer back = 999; |
| | | if (wrkMast != null){ |
| | | Integer staNo = Utils.getStaNoByLocNo(wrkMast.getLocNo()); |
| | | |
| | | barcodeThread.setBarcode(""); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(4, back)); |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | LiftCommand commandEmpty = new LiftCommand(); |
| | | commandEmpty.setWorkNo(wrkMast.getWrkNo()); |
| | | commandEmpty.setSourceStaNo(inSta.getStaNo()); |
| | | commandEmpty.setTargetStaNo(staNo); |
| | | |
| | | barcodeThread.setBarcode(""); |
| | | |
| | | boolean resultEmpty = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, commandEmpty)); |
| | | if (resultEmpty) { |
| | | News.info("WCS--->PLC下发任务成功:{}",commandEmpty.toString()); |
| | | } |
| | | if (!resultEmpty) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | |
| | | wrkMast.setWrkSts(3L);// 3.设备执行中 |
| | | wrkMast.setCrnStrTime(new Date()); |
| | | wrkMastService.updateById(wrkMast); |
| | | Thread.sleep(3000); // 延时3S |
| | | }else { |
| | | Integer back = 999; |
| | | |
| | | barcodeThread.setBarcode(""); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(4, back)); |
| | | if (result) { |
| | | log.error("托盘退回任务下发成功"); |
| | | } |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | } |
| | | } |
| | | |