|  |  | 
 |  |  |                         } | 
 |  |  | //                        News.warn("扫码入库失败,{}入库站因{}异常,托盘已被退回", inSta.getStaNo(), errMsg); | 
 |  |  |                         staProtocol.setWorkNo(workNo); | 
 |  |  |                         staProtocol.setStaNo(inSta.getBackSta().shortValue()); | 
 |  |  |                         staProtocol.setStaNo(inSta.getStaNo().shortValue()); | 
 |  |  |                         devpThread.setPakMk(staProtocol.getSiteId(), false); | 
 |  |  |                         MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol)); | 
 |  |  |                         MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); | 
 |  |  |                         TaskWrk taskWrk = taskWrkMapper.selectByWrkNo(Integer.valueOf(workNo)); | 
 |  |  |                         if (taskWrk != null) { | 
 |  |  |                             taskWrk.setMemo(errMsg);//将错误码存入备注字段进行展示 | 
 |  |  | 
 |  |  |                             HashMap<String, Object> headParam = new HashMap<>(); | 
 |  |  |                             headParam.put("Content-Type","application/json"); | 
 |  |  |                             String response; | 
 |  |  |                             try{ | 
 |  |  |                             response = new HttpHandler.Builder() | 
 |  |  |                                    // .setHeaders(headParam) | 
 |  |  |                                     .setUri(wmsUrl) | 
 |  |  | 
 |  |  |                                     .setJson(JSON.toJSONString(toWmsDTO)) | 
 |  |  |                                     .build() | 
 |  |  |                                     .doPost(); | 
 |  |  |                             }catch (Exception e){ | 
 |  |  |                                 log.error("请求入库调用接口失败"); | 
 |  |  |                                 log.error("异常信息打印:"+e); | 
 |  |  |                                 try{ | 
 |  |  |                                     BasDevp basDevp = basDevpService.selectById(inSta.getStaNo()); | 
 |  |  |                                     if (Cools.isEmpty(basDevp)){ | 
 |  |  |                                         log.error("站点号异常"+inSta.getStaNo()); | 
 |  |  |                                     } else if (basDevp.getStaErr()!=0){ | 
 |  |  |                                         basDevp.setStaErr(2); | 
 |  |  |                                         basDevpService.updateById(basDevp); | 
 |  |  |                                     } | 
 |  |  |                                 }catch (Exception e1){ | 
 |  |  |                                     // 退回 | 
 |  |  |                                     log.error("扫码检测程序异常"+inSta.getStaNo()+"异常信息"+e1); | 
 |  |  |                                 } | 
 |  |  |                                 staProtocol.setWorkNo((short)9999); | 
 |  |  |                                 staProtocol.setStaNo(inSta.getStaNo().shortValue()); | 
 |  |  |                                 devpThread.setPakMk(staProtocol.getSiteId(), false); | 
 |  |  |                                 MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); | 
 |  |  | //                                    TaskWrk taskWrk = taskWrkMapper.selectByWrkNo(Integer.valueOf(workNo)); | 
 |  |  | //                                    if (taskWrk != null) { | 
 |  |  | //                                        taskWrk.setMemo(errMsg);//将错误码存入备注字段进行展示 | 
 |  |  | //                                        taskWrkMapper.updateById(taskWrk); | 
 |  |  | //                                    } | 
 |  |  |                                 continue; | 
 |  |  |                             } | 
 |  |  |  | 
 |  |  |                             JSONObject jsonObject = JSON.parseObject(response); | 
 |  |  |                             apiLogService.save("wms请求入库货位接口" | 
 |  |  | 
 |  |  |                             log.info("入库请求参数{}" + JSON.toJSONString(toWmsDTO)); | 
 |  |  |                             if (jsonObject.getInteger("code").equals(200) && !Cools.isEmpty(jsonObject.get("data").toString())) { | 
 |  |  |                                 GetWmsDto getWmsDto = JSON.parseObject(jsonObject.get("data").toString(), GetWmsDto.class); | 
 |  |  |                                 try{ | 
 |  |  |                                     BasDevp basDevp = basDevpService.selectById(inSta.getStaNo()); | 
 |  |  |                                     if (Cools.isEmpty(basDevp)){ | 
 |  |  |                                         log.error("站点号异常"+inSta.getStaNo()); | 
 |  |  |                                         throw new CoolException("站点号异常"+inSta.getStaNo()); | 
 |  |  |                                     } | 
 |  |  |                                     Integer staNoCrnNo = Utils.StaNoCrnNo(inSta.getStaNo()); | 
 |  |  |                                     if (staNoCrnNo==0){ | 
 |  |  |                                         basDevp.setStaErr(1); | 
 |  |  |                                         basDevpService.updateById(basDevp); | 
 |  |  |                                         throw new CoolException("站点号异常"+inSta.getStaNo()); | 
 |  |  |                                     }else { | 
 |  |  |                                         LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>() | 
 |  |  |                                                 .eq("crn_no", staNoCrnNo.longValue()) | 
 |  |  |                                                 .eq("loc_no", getWmsDto.getLocNo())); | 
 |  |  |                                         if (Cools.isEmpty(locMast)){ | 
 |  |  |                                             basDevp.setStaErr(1); | 
 |  |  |                                             basDevpService.updateById(basDevp); | 
 |  |  |                                             throw new CoolException("站点号异常"+inSta.getStaNo()); | 
 |  |  |                                         } | 
 |  |  |                                     } | 
 |  |  |                                 } catch (Exception e){ | 
 |  |  | //                                    log.error("扫码检测程序异常"+inSta.getStaNo()+"异常信息"+e); | 
 |  |  |                                     // 退回 | 
 |  |  |                                     log.error("扫码检测程序异常"+inSta.getStaNo()+errMsg); | 
 |  |  |  | 
 |  |  |                                     staProtocol.setWorkNo((short)9999); | 
 |  |  |                                     staProtocol.setStaNo(inSta.getStaNo().shortValue()); | 
 |  |  |                                     devpThread.setPakMk(staProtocol.getSiteId(), false); | 
 |  |  |                                     MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); | 
 |  |  | //                                    TaskWrk taskWrk = taskWrkMapper.selectByWrkNo(Integer.valueOf(workNo)); | 
 |  |  | //                                    if (taskWrk != null) { | 
 |  |  | //                                        taskWrk.setMemo(errMsg);//将错误码存入备注字段进行展示 | 
 |  |  | //                                        taskWrkMapper.updateById(taskWrk); | 
 |  |  | //                                    } | 
 |  |  |                                     continue; | 
 |  |  |                                 } | 
 |  |  |                                 //查看该库位是否为空库位 | 
 |  |  |                                 LocMast locMast=locMastService.selectOne(new EntityWrapper<LocMast>() | 
 |  |  |                                         .eq("loc_sts","O") | 
 |  |  | 
 |  |  |                                 continue; | 
 |  |  |                             } | 
 |  |  |  | 
 |  |  | //                        StaDescService staDescService = SpringUtils.getBean(StaDescService.class); | 
 |  |  | // | 
 |  |  | //                        ToWmsDTO toWmsDTO = new ToWmsDTO(); | 
 |  |  | //                        Map<String, Object> map = new HashMap<>(); | 
 |  |  | //                        map.put("x-api-key","7a15b5db-29b6-552c-8cff-0cfec3756da2"); | 
 |  |  | //                        List<Integer> list = openServiceImpl.getInEnableRoadway(); | 
 |  |  | //                        TaskWrk taskWrk = taskWrkService.selectOne(new EntityWrapper<TaskWrk>().eq("barcode", barcode)); | 
 |  |  | // | 
 |  |  | //                        if (Cools.isEmpty(taskWrk)){ | 
 |  |  | //                            continue; | 
 |  |  | //                        } | 
 |  |  | //                        //StaDesc staDesc1 = staDescService.selectOne(new EntityWrapper<StaDesc>().eq("stn_no",inSta.getBackSta())); | 
 |  |  | //                        if (taskWrk.getTargetPoint() != null && taskWrk.getStartPoint() != null){ | 
 |  |  | //                            if ( taskWrk.getWrkNo() != null && taskWrk.getWrkNo().shortValue() == workNo ){ | 
 |  |  | //                                continue; | 
 |  |  | //                            } | 
 |  |  | //                            //获取堆垛机站点 | 
 |  |  | //                            StaDesc staDesc = new StaDesc(); | 
 |  |  | //                            if (devp.getId() <= 1){ | 
 |  |  | //                                staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() | 
 |  |  | //                                        .eq("crn_no", taskWrk.getCrnNo()).eq("type_no",1).lt("stn_no", 200)); | 
 |  |  | //                            }else { | 
 |  |  | //                                staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() | 
 |  |  | //                                        .eq("crn_no", taskWrk.getCrnNo()).eq("type_no",1).lt("stn_no", 400).ge("stn_no", 250)); | 
 |  |  | //                            } | 
 |  |  | //                            staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue()); | 
 |  |  | //                            staProtocol.setStaNo(staDesc.getCrnStn().shortValue()); | 
 |  |  | //                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol)); | 
 |  |  | //                            Thread.sleep(500); | 
 |  |  | //                        }else { | 
 |  |  | //                            //TaskWrk taskWrk = taskWrkService.selectByTaskNo(param.getTaskNo()); | 
 |  |  | //                            toWmsDTO.setWarehouseId("1688469798893297665"); | 
 |  |  | //                            toWmsDTO.setContainerCode(barcode); | 
 |  |  | //                            toWmsDTO.setApplyType("TUNNEL_LOCATION"); | 
 |  |  | //                            toWmsDTO.setTaskTunnel(taskWrk.getCrnNo()); | 
 |  |  | //                            toWmsDTO.setCanInboundTunnels(list); | 
 |  |  | //                            String response = null; | 
 |  |  | //                            try { | 
 |  |  | //                                response = new HttpHandler.Builder() | 
 |  |  | //                                        .setHeaders(map) | 
 |  |  | //                                        .setUri(wmsUrl) | 
 |  |  | //                                        .setPath(inboundTaskApplyPath) | 
 |  |  | //                                        .setJson(JSON.toJSONString(toWmsDTO)) | 
 |  |  | //                                        .build() | 
 |  |  | //                                        .doPost(); | 
 |  |  | //                            }catch (Exception e){ | 
 |  |  | //                                log.error("wms通讯失败,"+e.getMessage()); | 
 |  |  | //                                continue; | 
 |  |  | //                            } | 
 |  |  | //                            apiLogService.save("wms请求入库货位接口" | 
 |  |  | //                                    ,wmsUrl+"wcsManager/wcsInterface/inboundTaskApply" | 
 |  |  | //                                    ,null | 
 |  |  | //                                    ,"127.0.0.1" | 
 |  |  | //                                    ,JSON.toJSONString(toWmsDTO) | 
 |  |  | //                                    ,response | 
 |  |  | //                                    ,true | 
 |  |  | //                            ); | 
 |  |  | //                            JSONObject jsonObject = JSON.parseObject(response); | 
 |  |  | //                            if (jsonObject.getInteger("code").equals(200)) { | 
 |  |  | //                                GetWmsDto getWmsDto = JSON.parseObject(jsonObject.get("data").toString(), GetWmsDto.class); | 
 |  |  | //                                taskWrk.setOriginTargetPoint(getWmsDto.getTargetLocationCode()); | 
 |  |  | //                                taskWrk.setTargetPoint(Utils.getWcsLocNo(getWmsDto.getTargetLocationCode())); | 
 |  |  | //                                taskWrk.setStartPoint(String.valueOf(inSta.getBackSta())); | 
 |  |  | //                                if (!taskWrkService.updateById(taskWrk)){ | 
 |  |  | //                                    log.error("保存wms库位号失败"); | 
 |  |  | //                                } | 
 |  |  | // | 
 |  |  | //                            }else { | 
 |  |  | //                                log.error("wms通讯失败,"+jsonObject.get("msg")); | 
 |  |  | // | 
 |  |  | //                            } | 
 |  |  | //                        } | 
 |  |  |  | 
 |  |  |                         } else { | 
 |  |  |                             // 退回 | 
 |  |  |                             log.error("扫码入库失败,{}入库站因{}异常,托盘已被退回", inSta.getStaNo(), errMsg); | 
 |  |  | //                            staProtocol.setWorkNo((short)0); | 
 |  |  | //                            staProtocol.setStaNo(inSta.getStaNo().shortValue()); | 
 |  |  | //                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); | 
 |  |  | // | 
 |  |  | //                            Thread.sleep(500); | 
 |  |  |  | 
 |  |  |                             staProtocol.setWorkNo((short)9999); | 
 |  |  |                             staProtocol.setStaNo(inSta.getStaNo().shortValue()); |