| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | |
| | | private BasOutStationAreaService basOutStationAreaService; |
| | | @Autowired |
| | | private WrkCommandRollbackService wrkCommandRollbackService; |
| | | @Autowired |
| | | private WrkAnalysisService wrkAnalysisService; |
| | | |
| | | /** |
| | | * 生成工作号 |
| | |
| | | News.error("移库任务 --- 保存工作档失败!"); |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | wrkAnalysisService.initForTask(wrkMast); |
| | | |
| | | sourceLocMast.setLocSts("R"); |
| | | sourceLocMast.setModiTime(new Date()); |
| | |
| | | News.error("入库任务 --- 保存工作档失败!"); |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | wrkAnalysisService.initForTask(wrkMast); |
| | | |
| | | locMast.setLocSts("S"); |
| | | locMast.setModiTime(new Date()); |
| | |
| | | News.error("出库任务 --- 保存工作档失败!"); |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | wrkAnalysisService.initForTask(wrkMast); |
| | | |
| | | locMast.setLocSts("R"); |
| | | locMast.setModiTime(new Date()); |
| | | locMastService.updateById(locMast); |
| | | return true; |
| | | } |
| | | |
| | | public boolean createOutTaskBatch(CreateOutTaskBatchParam param) { |
| | | if (param == null) { |
| | | throw new CoolException("参数不能为空"); |
| | | } |
| | | |
| | | List<CreateOutTaskParam> taskList = param.getTaskList(); |
| | | if (taskList == null || taskList.isEmpty()) { |
| | | throw new CoolException("任务列表不能为空"); |
| | | } |
| | | |
| | | List<CreateOutTaskParam> sortedTaskList = new ArrayList<>(taskList); |
| | | sortedTaskList.sort(Comparator.nullsLast(Comparator |
| | | .comparing(this::getSortableBatch, Comparator.nullsLast(String::compareTo)) |
| | | .thenComparing(this::getSortableBatchSeq, Comparator.nullsLast(Integer::compareTo)))); |
| | | |
| | | for (CreateOutTaskParam createOutTaskParam : sortedTaskList) { |
| | | if (createOutTaskParam == null) { |
| | | throw new CoolException("任务参数不能为空"); |
| | | } |
| | | createOutTask(createOutTaskParam); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | private String getSortableBatch(CreateOutTaskParam param) { |
| | | if (param == null) { |
| | | return null; |
| | | } |
| | | String batch = param.getBatch(); |
| | | if (batch == null || batch.trim().isEmpty()) { |
| | | return null; |
| | | } |
| | | return batch; |
| | | } |
| | | |
| | | private Integer getSortableBatchSeq(CreateOutTaskParam param) { |
| | | if (param == null) { |
| | | return null; |
| | | } |
| | | return param.getBatchSeq(); |
| | | } |
| | | |
| | | public FindCrnNoResult findCrnNoByLocNo(String locNo) { |
| | |
| | | Integer targetStationId = null; |
| | | for (StationObjModel stationObjModel : stationList) { |
| | | try { |
| | | List<NavigateNode> navigateNodes = navigateUtils.calcByStationId(sourceStationId, stationObjModel.getStationId()); |
| | | List<NavigateNode> navigateNodes = navigateUtils.calcReachablePathByStationId(sourceStationId, stationObjModel.getStationId()); |
| | | if(!navigateNodes.isEmpty()) { |
| | | targetStationId = stationObjModel.getStationId(); |
| | | break; |
| | |
| | | Integer finalSourceStationId = null; |
| | | for (StationObjModel stationObjModel : stationList) { |
| | | try { |
| | | List<NavigateNode> navigateNodes = navigateUtils.calcByStationId(stationObjModel.getStationId(), targetStationId); |
| | | List<NavigateNode> navigateNodes = navigateUtils.calcReachablePathByStationId(stationObjModel.getStationId(), targetStationId); |
| | | if(!navigateNodes.isEmpty()) { |
| | | finalSourceStationId = stationObjModel.getStationId(); |
| | | break; |