| | |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | Integer workNo = staProtocol.getWorkNo(); |
| | | if (workNo!=9998){ |
| | | if (workNo!=9998 && workNo!=9997){ |
| | | continue; |
| | | } |
| | | Integer stano = staProtocol.getStaNo(); |
| | |
| | | // 判断是否满足入库条件 |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() |
| | | && staProtocol.isInEnable() |
| | | && workNo == 9998 |
| | | && (workNo == 9998 || workNo == 9997) |
| | | && staProtocol.isPakMk() |
| | | && staProtocol.isPakMkWalk() |
| | | ) { |
| | |
| | | continue; |
| | | } |
| | | String barcode = barcodeThread.getBarcode(); |
| | | if (!Cools.isEmpty(barcode) && !barcode.equals("99999999")) { |
| | | if (!Cools.isEmpty(barcode) && !barcode.equals("99999999") && !barcode.equals("000000")) { |
| | | // 请求wms接口,获取工作号和目标库位 |
| | | ToWmsDTO toWmsDTO = new ToWmsDTO(staProtocol.getSiteId(),staProtocol.getGrossWt(),barcode, 0); |
| | | ToWmsDTO toWmsDTO = new ToWmsDTO(staProtocol.getSiteId(),staProtocol.getGrossWt(),barcode, workNo == 9998? 0 : 1); |
| | | |
| | | TaskWrk taskWrk1 = taskWrkService.selectOne(new EntityWrapper<TaskWrk>().eq("barcode", barcode)); |
| | | if (!Cools.isEmpty(taskWrk1)) { |
| | | log.info("托盘码:" + barcode + "任务档存在"); |
| | |
| | | } else { |
| | | staProtocol.setWorkNo(taskWrk1.getWrkNo()); |
| | | staProtocol.setStaNo(staProtocol.getSiteId()); |
| | | devpThread.setPakMkWalk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | } |
| | | } |
| | |
| | | staProtocol.setWorkNo(9999); |
| | | staProtocol.setStaNo(inSta.getBackSta()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | devpThread.setPakMkWalk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | continue; |
| | | } |
| | |
| | | ); |
| | | log.info("入库请求参数{}" + JSON.toJSONString(toWmsDTO)); |
| | | log.info("入库请求返回参数{}" + JSON.toJSONString(response)); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | if (!Cools.isEmpty(jsonObject.getInteger("code")) && jsonObject.getInteger("code").equals(200)) { |
| | | try { |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | } catch (Exception e) { |
| | |
| | | && staProtocol.isPakMk() |
| | | && staProtocol.isPakMkWalk() |
| | | ) { |
| | | // 获取条码扫描仪信息 |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); |
| | | if (barcodeThread == null) { |
| | | continue; |
| | | } |
| | | String barcode = barcodeThread.getBarcode(); |
| | | if (Cools.isEmpty(barcode) || barcode.equals("0") || barcode.equals("000000")) { |
| | | staProtocol.setWorkNo(9999); |
| | | staProtocol.setStaNo(inSta.getBackSta()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | continue; |
| | | } |
| | | // 请求wms接口,获取工作号和目标库位 |
| | | ToWmsDTO toWmsDTO = new ToWmsDTO("", staProtocol.getSiteId(), 1); |
| | | |
| | | ToWmsDTO toWmsDTO = new ToWmsDTO(staProtocol.getSiteId(),staProtocol.getGrossWt(),barcode, 1); |
| | | HashMap<String, Object> headParam = new HashMap<>(); |
| | | headParam.put("Content-Type", "application/json"); |
| | | String response; |
| | |
| | | ); |
| | | log.info("入库请求参数{}" + JSON.toJSONString(toWmsDTO)); |
| | | log.info("入库请求返回参数{}" + JSON.toJSONString(response)); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | if (!Cools.isEmpty(jsonObject.getInteger("code")) && jsonObject.getInteger("code").equals(200)) { |
| | | try { |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | } catch (Exception e) { |
| | |
| | | // //开始运行 |
| | | // String response = CrnStartRunning(taskWrk); |
| | | // JSONObject jsonObject = JSON.parseObject(response); |
| | | // if (jsonObject.getInteger("code").equals(200)) { |
| | | // if (!Cools.isEmpty(jsonObject.getInteger("code")) && jsonObject.getInteger("code").equals(200)) { |
| | | // |
| | | // }else { |
| | | // log.error("入库开始运行通讯失败,"+jsonObject.get("msg")); |
| | |
| | | taskWrkService.updateById(taskWrk); |
| | | |
| | | |
| | | try { |
| | | HashMap<String, Object> headParam = new HashMap<>(); |
| | | headParam.put("taskNo",taskWrk.getTaskNo()); |
| | | headParam.put("taskStatus",taskWrk.getStatusWms()); |
| | | headParam.put("ioType",taskWrk.getIoTypeWms()); |
| | | headParam.put("barCode",taskWrk.getBarcode()); |
| | | headParam.put("reportTime", LocalDateTime.now()); |
| | | headParam.put("weight",taskWrk.getScWeight().doubleValue()); |
| | | |
| | | String response; |
| | | log.error("wcs完结任务上报wms==》", headParam); |
| | | |
| | | response = new HttpHandler.Builder() |
| | | // .setHeaders(headParam) |
| | | .setUri(wmsUrl) |
| | | .setPath(taskStatusFeedbackPath) |
| | | .setJson(JSON.toJSONString(headParam)) |
| | | .build() |
| | | .doPost(); |
| | | log.error("wcs完结任务上报wms==》", response); |
| | | |
| | | // JSONObject jsonObject = JSON.parseObject(response); |
| | | // log.error("wcs完结任务上报wms==》", jsonObject); |
| | | |
| | | apiLogService.save("wcs派发入库任务上报wms" |
| | | , wmsUrl + taskStatusFeedbackPath |
| | | , null |
| | | , "127.0.0.1" |
| | | , JSON.toJSONString(headParam) |
| | | , response |
| | | , true |
| | | ); |
| | | } catch (Exception e) { |
| | | log.error("wcs完结任务上报wms失败", taskWrk); |
| | | log.error("wcs完结任务上报wms失败,报错信息:", e); |
| | | // throw new CoolException("wcs派发入库任务上报wms失败"); |
| | | } |
| | | // try { |
| | | // HashMap<String, Object> headParam = new HashMap<>(); |
| | | // headParam.put("taskNo",taskWrk.getTaskNo()); |
| | | // headParam.put("taskStatus",taskWrk.getStatusWms()); |
| | | // headParam.put("ioType",taskWrk.getIoTypeWms()); |
| | | // headParam.put("barCode",taskWrk.getBarcode()); |
| | | // headParam.put("reportTime", LocalDateTime.now()); |
| | | // headParam.put("weight",taskWrk.getScWeight().doubleValue()); |
| | | // |
| | | // String response; |
| | | // log.error("wcs完结任务上报wms==》", headParam); |
| | | // |
| | | // response = new HttpHandler.Builder() |
| | | // // .setHeaders(headParam) |
| | | // .setUri(wmsUrl) |
| | | // .setPath(taskStatusFeedbackPath) |
| | | // .setJson(JSON.toJSONString(headParam)) |
| | | // .build() |
| | | // .doPost(); |
| | | // log.error("wcs完结任务上报wms==》", response); |
| | | // |
| | | //// JSONObject jsonObject = JSON.parseObject(response); |
| | | //// log.error("wcs完结任务上报wms==》", jsonObject); |
| | | // |
| | | // apiLogService.save("wcs派发入库任务上报wms" |
| | | // , wmsUrl + taskStatusFeedbackPath |
| | | // , null |
| | | // , "127.0.0.1" |
| | | // , JSON.toJSONString(headParam) |
| | | // , response |
| | | // , true |
| | | // ); |
| | | // } catch (Exception e) { |
| | | // log.error("wcs完结任务上报wms失败", taskWrk); |
| | | // log.error("wcs完结任务上报wms失败,报错信息:", e); |
| | | //// throw new CoolException("wcs派发入库任务上报wms失败"); |
| | | // } |
| | | } |
| | | |
| | | } |