| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.dto.NotifyCustomDataDto; |
| | | import com.zy.asrs.domain.enums.NotifyMsgType; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.domain.enums.WorkNoType; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.Result; |
| | | import com.zy.asrs.entity.param.StorageEscalationParam; |
| | | import com.zy.asrs.mapper.*; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.CommandUtils; |
| | | import com.zy.asrs.utils.CrnOperaUtils; |
| | | import com.zy.asrs.utils.NotifyUtils; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.utils.HttpHandler; |
| | |
| | | private CommonService commonService; |
| | | @Autowired |
| | | private CrnOperaUtils crnOperaUtils; |
| | | @Autowired |
| | | private NotifyUtils notifyUtils; |
| | | @Value("${wms.count}") |
| | | private Integer maxCount; |
| | | @Autowired |
| | |
| | | staProtocol.setStaNo(staDesc.getCrnStn().shortValue()); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | |
| | | //上报 |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("TaskNo", taskWrk.getTaskNo()); |
| | | try { |
| | | //开始上报,任务开始时,WCS回调WMS |
| | | response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath(taskStatusFeedbackPath) |
| | | .setJson(JSON.toJSONString(hashMap)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject1 = JSON.parseObject(response); |
| | | boolean bool = false; |
| | | if(jsonObject1.get("ReturnStatus").equals(0)){ |
| | | taskWrk.setStatus(2);//派发任务 |
| | | bool = true; |
| | | taskWrkService.updateById(taskWrk); |
| | | } |
| | | apiLogService.save("wcs开始入库任务上报wms" |
| | | , wmsUrl + TaskExecCallback |
| | | , null |
| | | , "127.0.0.1" |
| | | , JSON.toJSONString(hashMap) |
| | | , response |
| | | , bool |
| | | ); |
| | | } catch (Exception e) { |
| | | |
| | | NotifyCustomDataDto customDataDto = new NotifyCustomDataDto(); |
| | | customDataDto.setUri(wmsUrl); |
| | | customDataDto.setPath(taskStatusFeedbackPath); |
| | | 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); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | continue; |
| | | } |
| | | |
| | | // int workNo = commonService.getWorkNo(WorkNoType.PAKIN.type);//获取入库工作号 |
| | | // taskWrk.setWrkNo(workNo);//工作号 |
| | | // taskWrk.setStatus(TaskStatusType.DISTRIBUTE.id);//派发状态 |
| | | taskWrk.setAssignTime(new Date());//派发时间 |
| | | taskWrk.setWrkSts(3);//工作状态 3.吊车入库 |
| | | taskWrk.setCrnNo(staDesc.getCrnNo());//堆垛机号 |
| | |
| | | */ |
| | | public synchronized void locToCrnStn(CrnSlave slave, CrnProtocol crnProtocol) { |
| | | List<TaskWrk> taskWrksInitial = taskWrkMapper.selectPakOut(slave.getId(), null); |
| | | if (taskWrksInitial.size() == 0) { |
| | | if (taskWrksInitial.isEmpty()) { |
| | | return; |
| | | } |
| | | for (CrnSlave.CrnStn crnStn : slave.getCrnOutStn()) { |
| | |
| | | log.error("修改工作档状态 11.生成出库ID => 12.吊车出库中 失败!!,工作号={}", taskWrk.getWrkNo()); |
| | | log.error("修改工作档状态 11.生成出库ID => 12.吊车出库中 失败!!,异常:" + e); |
| | | } |
| | | // try { |
| | | // HashMap<String, Object> headParam = new HashMap<>(); |
| | | // headParam.put("taskNo", taskWrk.getTaskNo()); |
| | | // headParam.put("status", taskWrk.getStatus()); |
| | | // headParam.put("ioType", taskWrk.getIoType()); |
| | | // headParam.put("barcode", taskWrk.getBarcode()); |
| | | // String response; |
| | | // response = new HttpHandler.Builder() |
| | | // // .setHeaders(headParam) |
| | | // .setUri(wmsUrl) |
| | | // .setPath(taskStatusFeedbackPath) |
| | | // .setJson(JSON.toJSONString(headParam)) |
| | | // .build() |
| | | // .doPost(); |
| | | // JSONObject jsonObject = JSON.parseObject(response); |
| | | // apiLogService.save("wcs派发出库任务上报wms" |
| | | // , wmsUrl + taskStatusFeedbackPath |
| | | // , null |
| | | // , "127.0.0.1" |
| | | // , JSON.toJSONString(headParam) |
| | | // , response |
| | | // , true |
| | | // ); |
| | | // } catch (Exception e) { |
| | | // log.error("wcs派发出库任务上报wms失败", JSON.toJSONString(taskWrk)); |
| | | //// throw new CoolException("wcs派发入库任务上报wms失败"); |
| | | // } |
| | | |
| | | //上报-出库任务开始时,WCS回调WMS |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("TaskNo", taskWrk.getTaskNo()); |
| | | |
| | | NotifyCustomDataDto customDataDto = new NotifyCustomDataDto(); |
| | | customDataDto.setUri(wmsUrl); |
| | | customDataDto.setPath(taskStatusFeedbackPath); |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | if (taskWrk.getIoType() == 1 && taskWrk.getWrkSts() == 3) { |
| | | taskWrk.setWrkSts(4);//入库完成 |
| | | taskWrk.setStatus(5);//完结 |
| | | |
| | | //更新库位状态 |
| | | LocMast locMast = locMastService.selectByLocNo(taskWrk.getTargetPoint()); |
| | | locMast.setLocSts("F");//F.在库 |
| | |
| | | } else if (taskWrk.getIoType() == 2 && taskWrk.getWrkSts() == 12) { |
| | | taskWrk.setWrkSts(13);//出库完成 |
| | | taskWrk.setStatus(5);//完结 |
| | | |
| | | //更新库位状态 |
| | | LocMast locMast = locMastService.selectByLocNo(taskWrk.getStartPoint()); |
| | | locMast.setLocSts("O");//O.空库位 |