|  |  | 
 |  |  | //                    WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode); | 
 |  |  |                     WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue()); | 
 |  |  |                     LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed()); | 
 |  |  |                     ledThread.errorReset(); | 
 |  |  |                     if (wrkMast == null) { | 
 |  |  |                         wrkMast = wrkMastMapper.selectPickStep(barcode); | 
 |  |  |                     } | 
 |  |  |                     if (wrkMast == null) { | 
 |  |  |                         // 无拣料数据 | 
 |  |  |  | 
 |  |  |                         Integer led = pickSta.getLed(); | 
 |  |  |                         if (ledThread != null) { | 
 |  |  |                             String errorMsg = "暂无拣料信息!!!"; | 
 |  |  |                             String errorMsg = "暂无拣料/盘点信息!!!"; | 
 |  |  |                             MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg)); | 
 |  |  |                         } | 
 |  |  | //                        // 更新站点信息 且 下发plc命令 | 
 |  |  | //                        devpThread.ioModeOf1F1 = IoModeType.PAKOUT_BOOTING; | 
 |  |  | //                        staProtocol.setWorkNo((short)9999); | 
 |  |  | //                        staProtocol.setStaNo((short)(staProtocol.getStaNo()-1)); | 
 |  |  | //                        devpThread.setPakMk(staProtocol.getSiteId(), false); | 
 |  |  | //                        boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); | 
 |  |  | //                        if (!result) { | 
 |  |  | //                            log.error("发布命令至输送线队列失败!!! [plc编号:{}]", devp.getId()); | 
 |  |  | //                        } | 
 |  |  |                         continue; | 
 |  |  |                     } | 
 |  |  |                     if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107) | 
 |  |  | 
 |  |  |                 if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() | 
 |  |  |                         && staProtocol.isEmptyMk() && (staProtocol.getWorkNo() >= 9990 | 
 |  |  |                         && staProtocol.getWorkNo() <= 9999) && staProtocol.isPakMk()) { | 
 |  |  |  | 
 |  |  |                     try { | 
 |  |  |                         LocTypeDto locTypeDto = new LocTypeDto(staProtocol); | 
 |  |  |  | 
 
 |  |  | 
 |  |  |                         || !command.getDestinationPosY().equals(one.getDestinationPosY()) || !command.getDestinationPosZ().equals(one.getDestinationPosZ()) | 
 |  |  |                 ){ | 
 |  |  |                     log.error("下发前:[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one)); | 
 |  |  |                     log.error("堆垛机命令回读失败后,重新添加任务到队列 ===>> [id:{}],{}", slave.getId(), JSON.toJSON(command)); | 
 |  |  |                     MessageQueue.offer(SlaveType.Crn, slave.getId(), new Task(2, command)); | 
 |  |  |                     Thread.sleep(100); | 
 |  |  |                     readStatus(); | 
 |  |  |                     return false; | 
 |  |  |                 } else { | 
 |  |  |                     log.info("下发前:[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one)); | 
 |  |  |                 } | 
 |  |  | 
 |  |  |         //堆垛机任务写入后,回读一次,看是否成功 | 
 |  |  |         Thread.sleep(200); | 
 |  |  |         try{ | 
 |  |  |             OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 24); | 
 |  |  |             OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 18); | 
 |  |  |             if (resultRead.IsSuccess) { | 
 |  |  |                 CrnCommand one = new CrnCommand(); | 
 |  |  |                 one.setTaskNo(siemensNet.getByteTransform().TransInt16(resultRead.Content, 2)); | 
 |  |  | 
 |  |  |                         || !command.getSourcePosZ().equals(one.getSourcePosZ()) || !command.getDestinationPosX().equals(one.getDestinationPosX()) | 
 |  |  |                         || !command.getDestinationPosY().equals(one.getDestinationPosY()) || !command.getDestinationPosZ().equals(one.getDestinationPosZ()) | 
 |  |  |                 ){ | 
 |  |  |                     log.error("堆垛机命令地址写入后回读失败[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one)); | 
 |  |  |                     try{ | 
 |  |  |                         log.error("堆垛机命令地址写入后回读失败[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one)); | 
 |  |  |                     }catch (Exception e){ | 
 |  |  |                         try{ | 
 |  |  |                             log.error("日志打印失败:===>>参数one报错 [id:{}],{}", slave.getId(), JSON.toJSON(command),JSON.toJSON(resultRead)); | 
 |  |  |                         }catch (Exception e1){ | 
 |  |  |                             log.error("日志打印失败:===>> [id:{}],{}", slave.getId(), JSON.toJSON(command)); | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     log.error("堆垛机命令回读失败后,重新添加任务到队列 ===>> [id:{}],{}", slave.getId(), JSON.toJSON(command)); | 
 |  |  |                     MessageQueue.offer(SlaveType.Crn, slave.getId(), new Task(2, command)); | 
 |  |  |                     Thread.sleep(100); | 
 |  |  | 
 |  |  |             log.error("堆垛机命令地址写入后回读出错"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         if (command.getAckFinish() == 0) { | 
 |  |  |             short commandFinish = 1; | 
 |  |  |             Thread.sleep(200L); | 
 |  |  |             result = siemensNet.Write("DB100.18", commandFinish); | 
 |  |  |             log.info("堆垛机commandFinish下发[id:{}] >>>>> {}", slave.getId(), commandFinish); | 
 |  |  | //            result = siemensNet.Write("DB100.22", commandFinish); | 
 |  |  |             if (result.IsSuccess) { | 
 |  |  |                 Thread.sleep(300); | 
 |  |  |                 //任务下发次数 | 
 |  |  |                 int writeCount2 = 0; | 
 |  |  |  | 
 |  |  |                 do { | 
 |  |  |                     writeCount2++; | 
 |  |  |                     short commandFinish = (short) 1; | 
 |  |  |                     result = siemensNet.Write("DB100.18", commandFinish); | 
 |  |  |                     if(result.IsSuccess){ | 
 |  |  |                         //堆垛机任务写入后,回读一次,看是否成功 | 
 |  |  |                         Thread.sleep(200); | 
 |  |  |                         OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.18", (short) 2); | 
 |  |  |                         if (resultRead.IsSuccess) { | 
 |  |  |                             commandFinish=siemensNet.getByteTransform().TransInt16(resultRead.Content, 0); | 
 |  |  |                             if (commandFinish != 1){ | 
 |  |  |                                 log.error("堆垛机任务确认位"+commandFinish+"写入数据与回读数据不一致!"+"循环执行次数:"+writeCount2+"次"); | 
 |  |  |                             }else{ | 
 |  |  |                                 //任务命令写入成功 | 
 |  |  |                                 log.info("堆垛机任务确认位"+commandFinish+"回读成功!"+"循环执行次数:"+writeCount2+"次"); | 
 |  |  |                                 break; | 
 |  |  |                             } | 
 |  |  |                         }else { | 
 |  |  |                             log.error("堆垛机任务确认位"+commandFinish+"回读失败!"+"循环执行次数:"+writeCount2+"次"); | 
 |  |  |                         } | 
 |  |  |                     } else { | 
 |  |  |                         log.error("堆垛机任务确认位"+commandFinish+"写入失败!"+"循环执行次数:"+writeCount2+"次"); | 
 |  |  |                     } | 
 |  |  |                 }while (writeCount2<5); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | //        if (command.getAckFinish() == 0) { | 
 |  |  | //            short commandFinish = 1; | 
 |  |  | //            Thread.sleep(200L); | 
 |  |  | //            result = siemensNet.Write("DB100.18", commandFinish); | 
 |  |  | //            log.info("堆垛机commandFinish下发[id:{}] >>>>> {}", slave.getId(), commandFinish); | 
 |  |  | ////            result = siemensNet.Write("DB100.22", commandFinish); | 
 |  |  | //        } | 
 |  |  |  | 
 |  |  |         try { | 
 |  |  |             // 日志记录 | 
 |  |  |             BasCrnOptService bean = SpringUtils.getBean(BasCrnOptService.class); | 
 
 |  |  | 
 |  |  |       staNo: 104 | 
 |  |  |       barcode: ${wcs-slave.barcode[1].id} | 
 |  |  |       backSta: 103 | 
 |  |  |       led: ${wcs-slave.led[0].id} | 
 |  |  |       led: ${wcs-slave.led[1].id} | 
 |  |  |     # 空板入库口1 | 
 |  |  |     emptyInSta[0]: | 
 |  |  |       staNo: 101 | 
 |  |  | 
 |  |  |       staNo: 104 | 
 |  |  |       barcode: ${wcs-slave.barcode[1].id} | 
 |  |  |       backSta: 103 | 
 |  |  |       led: ${wcs-slave.led[0].id} | 
 |  |  |       led: ${wcs-slave.led[1].id} | 
 |  |  |   # 条码扫描仪1 左下 1楼开始,111 | 
 |  |  |   barcode[0]: | 
 |  |  |     id: 1 | 
 |  |  | 
 |  |  |   # LED1 | 
 |  |  |   led[0]: | 
 |  |  |     id: 1 | 
 |  |  |     ip: 10.10.10.220 | 
 |  |  |     ip: 10.10.10.205 | 
 |  |  |     port: 5005 | 
 |  |  |     devpPlcId: ${wcs-slave.devp[0].id} | 
 |  |  |     staArr: 100 | 
 |  |  |   # LED2 | 
 |  |  |   led[1]: | 
 |  |  |     id: 2 | 
 |  |  |     ip: 10.10.10.221 | 
 |  |  |     ip: 10.10.10.206 | 
 |  |  |     port: 5005 | 
 |  |  |     devpPlcId: ${wcs-slave.devp[0].id} | 
 |  |  |     staArr: 103 | 
 
 |  |  | 
 |  |  |             "type": "rackDescs", | 
 |  |  |             "id": "lb_desc1", | 
 |  |  |             "text": "#1", | 
 |  |  |             "top": 324, | 
 |  |  |             "top": 388, | 
 |  |  |             "left": 1812, | 
 |  |  |             "width": 30, | 
 |  |  |             "height": 23 | 
 |  |  | 
 |  |  |             "type": "rackDescs", | 
 |  |  |             "id": "lb_desc2", | 
 |  |  |             "text": "#2", | 
 |  |  |             "top": 388, | 
 |  |  |             "top": 324, | 
 |  |  |             "left": 1812, | 
 |  |  |             "width": 30, | 
 |  |  |             "height": 23 |