| | |
| | | } |
| | | WrkMast mast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", params.getSuperTaskNo())); |
| | | if (Objects.isNull(mast)) { |
| | | // pakoutOrderPause 中止时,WMS 在 WCS 确认取消后会立即本地取消并归档任务。 |
| | | // 如果 WCS 后续又补发 task_cancel 回调,此时当前工作档已不存在,按幂等成功处理。 |
| | | if (isTaskCancelCallback(params)) { |
| | | return R.ok(); |
| | | } |
| | | throw new CoolException("任务档不存在!!"); |
| | | } |
| | | |
| | |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | } |
| | | } else if ("task".equalsIgnoreCase(params.getNotifyType())) { |
| | | } else if (isTaskCompleteCallback(params)) { |
| | | //任务 |
| | | if ("task_complete".equalsIgnoreCase(params.getMsgType())) { |
| | | |
| | | if (mast.getIoType() == 1 || mast.getIoType() == 2 || mast.getIoType() == 10 || mast.getIoType() == CHANGE_LOC_IO_TYPE) { |
| | | mast.setWrkSts(4L); |
| | | } else if (isOutboundTask(mast) && canMarkOutboundTaskComplete(mast)) { |
| | | mast.setWrkSts(14L); |
| | | if(Cools.isEmpty(mast.getStaNo())){ |
| | | mast.setOveMk("Y"); |
| | | } |
| | | if (isInboundOrMoveTask(mast)) { |
| | | mast.setWrkSts(4L); |
| | | } else if (isOutboundTask(mast) && canMarkOutboundTaskComplete(mast)) { |
| | | mast.setWrkSts(14L); |
| | | if(Cools.isEmpty(mast.getStaNo())){ |
| | | mast.setOveMk("Y"); |
| | | } |
| | | if (!wrkMastService.updateById(mast)) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | //wcs任务取消接口 |
| | | } else if ("task_cancel".equalsIgnoreCase(params.getMsgType())) { |
| | | workService.cancelWrkMast(String.valueOf(mast.getWrkNo()), 9955L); |
| | | } |
| | | if (!wrkMastService.updateById(mast)) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | } else if (isTaskCancelCallback(params)) { |
| | | //wcs任务取消接口 |
| | | workService.cancelWrkMast(String.valueOf(mast.getWrkNo()), 9955L); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | private boolean isTaskCompleteCallback(ReceviceTaskParams params) { |
| | | return params != null && "task_complete".equalsIgnoreCase(params.getMsgType()); |
| | | } |
| | | |
| | | private boolean isTaskCancelCallback(ReceviceTaskParams params) { |
| | | return params != null && "task_cancel".equalsIgnoreCase(params.getMsgType()); |
| | | } |
| | | |
| | | private boolean isInboundOrMoveTask(WrkMast mast) { |
| | | if (mast == null || mast.getIoType() == null) { |
| | | return false; |
| | | } |
| | | Integer ioType = mast.getIoType(); |
| | | return Objects.equals(ioType, 1) |
| | | || Objects.equals(ioType, 2) |
| | | || Objects.equals(ioType, 11) |
| | | || Objects.equals(ioType, CHANGE_LOC_IO_TYPE); |
| | | } |
| | | |
| | | private boolean isOutboundCrnTaskRun(ReceviceTaskParams params) { |
| | |
| | | if (params == null || Cools.isEmpty(params.getLocNo())) { |
| | | return R.error("locNo不能为空"); |
| | | } |
| | | String s = Utils.WCSLocToWMSLoc(params.getLocNo()); |
| | | if (Cools.isEmpty(params.getLocNo())) { |
| | | return R.error("locNo<UNK>"); |
| | | } |
| | | params.setLocNo(s); |
| | | LocMast sourceLoc = locMastService.selectById(params.getLocNo()); |
| | | if (sourceLoc == null) { |
| | | return R.error("当前库位不存在"); |
| | |
| | | } |
| | | |
| | | private CrnDepthRuleProfile resolveChangeLocProfile(LocMast sourceLoc) { |
| | | RowLastno rowLastno = rowLastnoService.selectById(sourceLoc.getWhsType()); |
| | | RowLastno rowLastno = rowLastnoService.selectById(3); |
| | | return basCrnDepthRuleService.resolveProfile(rowLastno, sourceLoc.getCrnNo(), sourceLoc.getRow1()); |
| | | } |
| | | |
| | |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setWrkSts(11L); |
| | | wrkMast.setIoType(CHANGE_LOC_IO_TYPE); |
| | | wrkMast.setWrkSts(1L); |
| | | wrkMast.setIoType(11); |
| | | wrkMast.setIoPri(10D); |
| | | wrkMast.setCrnNo(sourceLoc.getCrnNo()); |
| | | wrkMast.setSourceLocNo(sourceLoc.getLocNo()); |
| | |
| | | if (Objects.isNull(wrkMast)) { |
| | | return; |
| | | } |
| | | if (wrkMast.getIoType()==1 || wrkMast.getIoType()==10) { |
| | | if (wrkMast.getIoType()==1 || wrkMast.getIoType()==11) { |
| | | wrkMast.setWrkSts(2L); |
| | | wrkMast.setModiTime(new Date()); |
| | | wrkMastService.updateById(wrkMast); |