| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.Result.CancelTaskBatchResult; |
| | | import com.zy.asrs.domain.param.*; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.service.*; |
| | |
| | | throw new CoolException("任务不存在"); |
| | | } |
| | | |
| | | boolean cancelSuccess = false; |
| | | if (wrkMast.getIoType().equals(WrkIoType.IN.id) && !wrkMast.getWrkSts().equals(WrkStsType.NEW_INBOUND.sts)) { |
| | | cancelSuccess = true; |
| | | } else if (wrkMast.getIoType().equals(WrkIoType.OUT.id) && !wrkMast.getWrkSts().equals(WrkStsType.NEW_OUTBOUND.sts)) { |
| | | cancelSuccess = true; |
| | | } else if (wrkMast.getIoType().equals(WrkIoType.LOC_MOVE.id) && !wrkMast.getWrkSts().equals(WrkStsType.NEW_LOC_MOVE.sts)) { |
| | | cancelSuccess = true; |
| | | } |
| | | |
| | | if (cancelSuccess) { |
| | | throw new CoolException("任务已执行,取消失败"); |
| | | } |
| | | |
| | | wrkMast.setMk("taskCancel"); |
| | | wrkMast.setModiTime(new Date()); |
| | | wrkMastService.updateById(wrkMast); |
| | | return true; |
| | | } |
| | | |
| | | public CancelTaskBatchResult cancelTaskBatch(CancelTaskBatchParam param) { |
| | | if (param == null) { |
| | | throw new CoolException("参数不能为空"); |
| | | } |
| | | |
| | | List<CancelTaskParam> taskList = param.getTaskList(); |
| | | if (taskList == null || taskList.isEmpty()) { |
| | | throw new CoolException("任务参数列表为空"); |
| | | } |
| | | |
| | | List<String> successList = new ArrayList<>(); |
| | | List<String> failList = new ArrayList<>(); |
| | | |
| | | for (CancelTaskParam cancelTaskParam : taskList) { |
| | | if (cancelTaskParam == null) { |
| | | throw new CoolException("任务参数不能为空"); |
| | | } |
| | | |
| | | boolean cancelStatus = false; |
| | | try { |
| | | cancelStatus = cancelTask(cancelTaskParam); |
| | | } catch (Exception e) { |
| | | } |
| | | |
| | | if (cancelStatus) { |
| | | successList.add(cancelTaskParam.getTaskNo()); |
| | | }else { |
| | | failList.add(cancelTaskParam.getTaskNo()); |
| | | } |
| | | } |
| | | |
| | | CancelTaskBatchResult result = new CancelTaskBatchResult(); |
| | | result.setSuccessList(successList); |
| | | result.setFailList(failList); |
| | | return result; |
| | | } |
| | | |
| | | //移库任务 |
| | | public boolean createLocMoveTask(CreateLocMoveTaskParam param) { |
| | | Date now = new Date(); |