Commit d77906fd125e2fe84ebbcd126e124d8d5f8ca7cd
1 parent
64c4e6ca
feat:被设置为前置任务的任务,是浅库位,设有前置任务的任务,是深库位,浅库位任务要优先出,所以深库位优先级-1
Showing
3 changed files
with
33 additions
and
29 deletions
src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignServiceImpl.java
... | ... | @@ -145,7 +145,7 @@ public class TaskAssignServiceImpl implements TaskAssignService { |
145 | 145 | // 出库动作 |
146 | 146 | if (!direction) { |
147 | 147 | int rowFlag = location.getRowFlag(); |
148 | - //如果是外侧库位 | |
148 | + //当前任务如果是深库位 | |
149 | 149 | if (rowFlag == QuantityConstant.ROW_OUT) { |
150 | 150 | Location insideLocation = locationService.getInsideNear(location); |
151 | 151 | String insideLocationCode = insideLocation.getCode(); |
... | ... | @@ -155,7 +155,7 @@ public class TaskAssignServiceImpl implements TaskAssignService { |
155 | 155 | //获取是否有未完成的任务 |
156 | 156 | TaskHeader taskHeader2 = taskHeaderService.getUndoneTaskByFromLocationCode(insideLocationCode); |
157 | 157 | if (taskHeader2 != null) { |
158 | - preTaskNo = taskHeader2.getId(); | |
158 | + preTaskNo = taskHeader2.getId();//浅库位任务号 | |
159 | 159 | } else { |
160 | 160 | //是否自建单据库位 |
161 | 161 | int isSelfCreated = 0; |
... | ... | @@ -220,9 +220,6 @@ public class TaskAssignServiceImpl implements TaskAssignService { |
220 | 220 | wcsTask.setFromPort(""); |
221 | 221 | wcsTask.setToPort(taskHeader.getPort()); |
222 | 222 | wcsTask.setContainerCode(taskHeader.getContainerCode()); |
223 | - if (preTaskNo != 0) { | |
224 | - wcsTask.setPreTaskNo(String.valueOf(preTaskNo)); | |
225 | - } | |
226 | 223 | |
227 | 224 | if (location != null) { |
228 | 225 | wcsTask.setStation(location.getRoadway()); |
... | ... | @@ -251,7 +248,11 @@ public class TaskAssignServiceImpl implements TaskAssignService { |
251 | 248 | } |
252 | 249 | wcsTask.setRemark("0"); |
253 | 250 | wcsTask.setPlatform(platform); |
254 | - | |
251 | + //浅库位任务优先出,深库位优先级-1 | |
252 | + if (preTaskNo != 0) { | |
253 | + wcsTask.setPreTaskNo(String.valueOf(preTaskNo)); | |
254 | + wcsTask.setPriority(wcsTask.getPriority() - 1); | |
255 | + } | |
255 | 256 | Container container = containerService.getContainerByCode(containerCode, warehouseCode); |
256 | 257 | String area = container.getArea(); |
257 | 258 | //4、发送数据 |
... | ... |
src/main/java/com/huaheng/pc/monitor/job/task/RyTask.java
... | ... | @@ -193,12 +193,13 @@ public class RyTask extends BaseController { |
193 | 193 | * 自动出库,自动出库单据间隔从定时任务那边配置 |
194 | 194 | */ |
195 | 195 | public void autoShipment() { |
196 | + //上一个出库单未完成,不执行下一个 | |
196 | 197 | ShipmentHeader header = shipmentHeaderService.getOne(new LambdaQueryWrapper<ShipmentHeader>() |
197 | 198 | .eq(ShipmentHeader::getDeleted, 0) |
198 | 199 | .in(ShipmentHeader::getAutoShipmentStatus, 2) |
199 | 200 | .last("ORDER BY requestedStartDate asc,id asc limit 1")); |
200 | - if (header!=null) { | |
201 | - if(header.getLastStatus()<QuantityConstant.SHIPMENT_HEADER_COMPLETED){ | |
201 | + if (header != null) { | |
202 | + if (header.getLastStatus() < QuantityConstant.SHIPMENT_HEADER_COMPLETED) { | |
202 | 203 | return; |
203 | 204 | } |
204 | 205 | } |
... | ... | @@ -208,7 +209,7 @@ public class RyTask extends BaseController { |
208 | 209 | .in(ShipmentHeader::getAutoShipmentStatus, 1) |
209 | 210 | .last("ORDER BY requestedStartDate asc,id asc limit 1")); |
210 | 211 | if (!shipmentHeaders.isEmpty()) { |
211 | - AjaxResult ajaxResult = handleMultiProcessV1("autoShipment",new MultiProcessListener() { | |
212 | + AjaxResult ajaxResult = handleMultiProcessV1("autoShipment", new MultiProcessListener() { | |
212 | 213 | @Override |
213 | 214 | public AjaxResult doProcess() { |
214 | 215 | shipmentHeaderService.autoShipmentExecute(shipmentHeaders.get(0)); |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/ShipmentTaskService.java
... | ... | @@ -489,7 +489,8 @@ public class ShipmentTaskService { |
489 | 489 | |
490 | 490 | //设置出库货箱表头状态为拣货任务完成 |
491 | 491 | LambdaUpdateWrapper<ShipmentContainerHeader> shipmentContainerHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); |
492 | - shipmentContainerHeaderLambdaUpdateWrapper.eq(ShipmentContainerHeader::getId, task.getAllocationHeadId()) | |
492 | + shipmentContainerHeaderLambdaUpdateWrapper | |
493 | + .eq(ShipmentContainerHeader::getId, task.getAllocationHeadId()) | |
493 | 494 | .set(ShipmentContainerHeader::getStatus, QuantityConstant.SHIPMENT_CONTAINER_FINISHED); |
494 | 495 | if (!containerHeaderService.update(shipmentContainerHeaderLambdaUpdateWrapper)) { |
495 | 496 | throw new ServiceException("更新组盘头状态失败"); |
... | ... | @@ -502,9 +503,9 @@ public class ShipmentTaskService { |
502 | 503 | ShipmentDetail shipmentDetail = shipmentDetailService.getById(taskDetail.getBillDetailId()); |
503 | 504 | if (StringUtils.isNotNull(shipmentDetail)) { |
504 | 505 | if (shipmentDetail.getQty().compareTo(shipmentDetail.getTaskQty()) == 0) { |
505 | - | |
506 | 506 | //一条单据明细可能有多条组盘多条任务 |
507 | - List<ShipmentContainerDetail> list = shipmentContainerDetailService.list(new LambdaQueryWrapper<ShipmentContainerDetail>().eq(ShipmentContainerDetail::getShipmentDetailId, shipmentDetail.getId())); | |
507 | + List<ShipmentContainerDetail> list = shipmentContainerDetailService.list(new LambdaQueryWrapper<ShipmentContainerDetail>() | |
508 | + .eq(ShipmentContainerDetail::getShipmentDetailId, shipmentDetail.getId())); | |
508 | 509 | boolean flag = true; |
509 | 510 | for (ShipmentContainerDetail shipmentContainerDetail : list) { |
510 | 511 | if (shipmentContainerDetail.getStatus() != 20) { |
... | ... | @@ -524,31 +525,32 @@ public class ShipmentTaskService { |
524 | 525 | |
525 | 526 | } |
526 | 527 | |
527 | - /*更新出库单状态*/ | |
528 | + /* 更新出库单状态 */ | |
528 | 529 | for (Integer id : ids) { |
529 | 530 | ShipmentHeader shipmentHeader = shipmentHeaderService.getById(id); |
530 | 531 | if (shipmentHeader != null) { |
531 | 532 | Map<String, Integer> status = shipmentDetailService.selectStatus(shipmentHeader.getId()); |
532 | 533 | Integer maxStatus = status.get("maxStatus"); |
533 | 534 | Integer minStatus = status.get("minStatus"); |
534 | - if (maxStatus.equals(QuantityConstant.SHIPMENT_HEADER_COMPLETED)) { | |
535 | - shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); | |
536 | - } | |
537 | - if (minStatus.equals(QuantityConstant.SHIPMENT_HEADER_COMPLETED)) { | |
538 | - shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); | |
539 | - shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); | |
540 | - shipmentHeader.setCompleteTime(new Date()); | |
535 | + | |
536 | + // 检查 maxStatus 和 minStatus 是否不为空 | |
537 | + if (maxStatus != null && minStatus != null) { | |
538 | + boolean isStatusCompleted = QuantityConstant.SHIPMENT_HEADER_COMPLETED.equals(maxStatus); | |
539 | + | |
540 | + if (isStatusCompleted) { | |
541 | + shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); | |
542 | + } | |
543 | + | |
544 | + if (QuantityConstant.SHIPMENT_HEADER_COMPLETED.equals(minStatus)) { | |
545 | + shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); | |
546 | + shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); | |
547 | + shipmentHeader.setCompleteTime(new Date()); | |
548 | + } | |
541 | 549 | } |
542 | 550 | shipmentHeader.setLastUpdated(new Date()); |
543 | - shipmentHeaderService.updateById(shipmentHeader); | |
544 | -// // 单子每完成,返回给MOM--merge(合并订单) | |
545 | -// if (("MOM".equals(shipmentHeader.getCreatedBy()) || "merge".equals(shipmentHeader.getShipmentType())) &&minStatus >= 500) { | |
546 | -// if (!mesReceiptController.postE_Rd_Out(shipmentHeader)){ | |
547 | -// logger.debug("在出库单据(ID: " + shipmentHeader.getId() + ")完成后反馈给MOM失败!!!"); | |
548 | -// }else { | |
549 | -// logger.debug("在出库单据(ID: " + shipmentHeader + ")完成后反馈给MOM成功!!!"); | |
550 | -// } | |
551 | -// } | |
551 | + if (!shipmentHeaderService.updateById(shipmentHeader)) { | |
552 | + throw new ServiceException("更新入库单头表失败"); | |
553 | + } | |
552 | 554 | } |
553 | 555 | } |
554 | 556 | //删除自建单据物料 |
... | ... |