| | |
| | | if (staProtocol.isAutoing() |
| | | && staProtocol.isLoading() |
| | | && staProtocol.isInEnable() |
| | | && !staProtocol.isEmptyMk() |
| | | // && !staProtocol.isEmptyMk() |
| | | && staProtocol.isPakMk() |
| | | && staProtocol.getWorkNo() == 9999 |
| | | && (staProtocol.getWorkNo() == 9999 || staProtocol.getWorkNo() == 9998) |
| | | ) { |
| | | // 获取条码扫描仪信息 |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); |
| | |
| | | requestParam.put("wcsStatus", 0);//成功 |
| | | } |
| | | |
| | | String response = ""; |
| | | String response = "None"; |
| | | Boolean success = false; |
| | | try { |
| | | Object object = redisUtil.get(RedisKeyType.IN_TASK_LOCK.key); |
| | | Object object = redisUtil.get(RedisKeyType.IN_TASK_LOCK.key + inSta.getStaNo()); |
| | | if(object != null) { |
| | | continue; |
| | | } |
| | |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | redisUtil.set(RedisKeyType.IN_TASK_LOCK.key, "lock", 5); |
| | | log.info(response); |
| | | redisUtil.set(RedisKeyType.IN_TASK_LOCK.key + inSta.getStaNo(), "lock", 5); |
| | | if (jsonObject.getInteger("code") == 200) { |
| | | |
| | | } else if (jsonObject.getInteger("code") == 500) { |
| | | News.watchInfo(String.valueOf(staProtocol.getSiteId()), "条码:" + barcode + "申请WMS失败,系统回退,response=" + JSON.toJSONString(jsonObject)); |
| | | |
| | | staProtocol.setWorkNo(9997); |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // staProtocol.setWorkNo(9997); |
| | | // staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | // MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | continue; |
| | | }else { |
| | | News.watchInfo(String.valueOf(staProtocol.getSiteId()), "条码:" + barcode + "申请WMS失败,response=" + JSON.toJSONString(jsonObject)); |
| | |
| | | taskWrk.setBarcode(barcode);//条码 |
| | | taskWrk.setCrnNo(locMast.getCrnNo()); |
| | | taskWrk.setTargetPoint(resultLocNo); |
| | | taskWrk.setStartPoint(String.valueOf(staProtocol.getStaNo())); |
| | | taskWrk.setStartPoint(String.valueOf(inSta.getStaNo())); |
| | | if (!Cools.isEmpty(taskWrk.getTargetPoint())) { |
| | | taskWrk.setOriginTargetPoint(taskWrk.getTargetPoint()); |
| | | } |
| | |
| | | flag = true; |
| | | } |
| | | if (!flag) { |
| | | News.watchError(crnStn.getStaNo() + "站点", "入库 ===>> 堆垛机站点状态检测失败,站点需要满足:自动、有物、有工作号、站点可入"); |
| | | // News.watchError(crnStn.getStaNo() + "站点", "入库 ===>> 堆垛机站点状态检测失败,站点需要满足:自动、有物、有工作号、站点可入"); |
| | | continue; |
| | | } |
| | | |
| | |
| | | if (taskWrkMapper.updateById(taskWrk) == 0) { |
| | | log.error("修改工作档状态 11.生成出库ID => 12.吊车出库中 失败!!,工作号={}", taskWrk.getWrkNo()); |
| | | } |
| | | String response = ""; |
| | | Boolean bool=false; |
| | | HashMap<String, Object> headParam = new HashMap<>(); |
| | | headParam.put("TaskNo", taskWrk.getTaskNo()); |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | // .setHeaders(headParam) |
| | | .setUri(wmsUrl) |
| | | .setPath(taskExecCallback) |
| | | .setJson(JSON.toJSONString(headParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if(jsonObject.get("ReturnStatus").equals(0)){ |
| | | bool = true; |
| | | taskWrk.setStatus(2); |
| | | taskWrkMapper.updateById(taskWrk); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | log.error("wcs派发移库库任务上报wms失败", taskWrk); |
| | | // throw new CoolException("wcs派发移库库任务上报wms失败"); |
| | | }finally { |
| | | apiLogService.save("wcs派发移库任务上报wms" |
| | | , wmsUrl + taskExecCallback |
| | | , null |
| | | , "127.0.0.1" |
| | | , JSON.toJSONString(headParam) |
| | | , response |
| | | , bool |
| | | ); |
| | | //上报-移库任务开始时,WCS回调WMS |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:ss:mm"); |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("taskNo", taskWrk.getTaskNo()); |
| | | hashMap.put("status", TaskStatusType.DISTRIBUTE.id); |
| | | hashMap.put("ioType", 3); |
| | | hashMap.put("barcode", taskWrk.getBarcode()); |
| | | hashMap.put("reportTime", format.format(new Date())); |
| | | |
| | | NotifyCustomDataDto customDataDto = new NotifyCustomDataDto(); |
| | | customDataDto.setUri(wmsUrl); |
| | | customDataDto.setPath(taskExecCallback); |
| | | customDataDto.setData(JSON.toJSONString(hashMap)); |
| | | boolean notifyResult = notifyUtils.notify("task", 1, String.valueOf(taskWrk.getWrkNo()), taskWrk.getTaskNo(), NotifyMsgType.TASK_START, JSON.toJSONString(taskWrk), true, customDataDto); |
| | | if(notifyResult) { |
| | | taskWrk.setStatus(2); |
| | | taskWrkService.updateById(taskWrk); |
| | | } |
| | | |
| | | } |