|  |  |  | 
|---|
|  |  |  | .build() | 
|---|
|  |  |  | .doPost(); | 
|---|
|  |  |  | JSONObject jsonObject = JSON.parseObject(response); | 
|---|
|  |  |  | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); | 
|---|
|  |  |  | Integer code = jsonObject.getInteger("code"); | 
|---|
|  |  |  | //                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); | 
|---|
|  |  |  | //                        Integer code = jsonObject.getInteger("code"); | 
|---|
|  |  |  | if (jsonObject.getInteger("code").equals(200)) { | 
|---|
|  |  |  | StartupDto dto = jsonObject.getObject("data", StartupDto.class); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | staProtocol.setWorkNo(dto.getWorkNo().shortValue()); | 
|---|
|  |  |  | staProtocol.setStaNo(dto.getStaNo().shortValue()); | 
|---|
|  |  |  | devpThread.setPakMk(staProtocol.getSiteId(), false); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ledThread.errorReset(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); | 
|---|
|  |  |  | if (!result) { | 
|---|
|  |  |  | throw new CoolException("更新plc站点信息失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else if(code == 500){ | 
|---|
|  |  |  | if (ledThread != null) { | 
|---|
|  |  |  | String errorMsg = jsonObject.getString("msg"); | 
|---|
|  |  |  | if (!Cools.isEmpty(errorMsg)) { | 
|---|
|  |  |  | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); | 
|---|
|  |  |  | } else if (code == 700) { | 
|---|
|  |  |  | staProtocol.setWorkNo((short) 9995); | 
|---|
|  |  |  | staProtocol.setStaNo(inSta.getBackSta().shortValue()); | 
|---|
|  |  |  | devpThread.setPakMk(staProtocol.getSiteId(), false); | 
|---|
|  |  |  | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // led 异常显示 | 
|---|
|  |  |  | if (ledThread != null) { | 
|---|
|  |  |  | String errorMsg = barcode + "托盘识别异常,请先进行组托!"; | 
|---|
|  |  |  | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //                        if (jsonObject.getInteger("code").equals(200)) { | 
|---|
|  |  |  | //                            StartupDto dto = jsonObject.getObject("data", StartupDto.class); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                            barcodeThread.setBarcode(""); | 
|---|
|  |  |  | //                            staProtocol.setWorkNo(dto.getWorkNo().shortValue()); | 
|---|
|  |  |  | //                            staProtocol.setStaNo(dto.getStaNo().shortValue()); | 
|---|
|  |  |  | //                            devpThread.setPakMk(staProtocol.getSiteId(), false); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                            ledThread.errorReset(); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                            boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); | 
|---|
|  |  |  | //                            if (!result) { | 
|---|
|  |  |  | //                                throw new CoolException("更新plc站点信息失败"); | 
|---|
|  |  |  | //                            } | 
|---|
|  |  |  | //                        } else if(code == 500){ | 
|---|
|  |  |  | //                            if (ledThread != null) { | 
|---|
|  |  |  | //                                String errorMsg = jsonObject.getString("msg"); | 
|---|
|  |  |  | //                                if (!Cools.isEmpty(errorMsg)) { | 
|---|
|  |  |  | //                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); | 
|---|
|  |  |  | //                                } | 
|---|
|  |  |  | //                            } | 
|---|
|  |  |  | //                            log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); | 
|---|
|  |  |  | //                        } else if (code == 700) { | 
|---|
|  |  |  | //                            staProtocol.setWorkNo((short) 9995); | 
|---|
|  |  |  | //                            staProtocol.setStaNo(inSta.getBackSta().shortValue()); | 
|---|
|  |  |  | //                            devpThread.setPakMk(staProtocol.getSiteId(), false); | 
|---|
|  |  |  | //                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //                            // led 异常显示 | 
|---|
|  |  |  | //                            if (ledThread != null) { | 
|---|
|  |  |  | //                                String errorMsg = barcode + "托盘识别异常,请先进行组托!"; | 
|---|
|  |  |  | //                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); | 
|---|
|  |  |  | //                            } | 
|---|
|  |  |  | //                        } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //                        // 检索库位 | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!Cools.isEmpty(barcode) && "NoRead".equals(barcode)) { | 
|---|
|  |  |  | if (!Cools.isEmpty(barcode)) { | 
|---|
|  |  |  | log.info("{}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode); | 
|---|
|  |  |  | //                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) { | 
|---|
|  |  |  | //                        continue; | 
|---|
|  |  |  | 
|---|
|  |  |  | // 获取工作状态为11(生成出库ID)的出库工作档 | 
|---|
|  |  |  | //            WrkMast wrkMast = wrkMastMapper.selectPakOutStep1(slave.getId(), crnStn.getStaNo()); | 
|---|
|  |  |  | List<WrkMast> wrkMasts = wrkMastMapper.selectPakOutStep11(slave.getId(), crnStn.getStaNo()); | 
|---|
|  |  |  | //            获取工作状态为14的工作档 | 
|---|
|  |  |  | WrkMast wrkMast1 = wrkMastMapper.selectPakOutStep14(slave.getId(), crnStn.getStaNo()); | 
|---|
|  |  |  | if ( wrkMast1 !=null && (wrkMast1.getIoType().equals(103) || wrkMast1.getIoType().equals(107)) ) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (WrkMast wrkMast : wrkMasts) { | 
|---|
|  |  |  | if (wrkMast == null) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | LocMast sourceLoc = locMastService.queryDemoSourceLoc(crn.getId()); | 
|---|
|  |  |  | LocMast loc = locMastService.queryDemoLoc(crn.getId()); | 
|---|
|  |  |  | if (null == sourceLoc || null == loc) { | 
|---|
|  |  |  | if (null == sourceLoc ) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | LocMast loc = locMastService.queryDemoLoc0(crn.getId(),sourceLoc.getLocType1()); | 
|---|
|  |  |  | if ( null == loc) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|