Commit 4806bbb2fa93e2df150bb69f720459f6b0c50c9a
1 parent
2c41888f
feat:优化自动出库
Showing
3 changed files
with
36 additions
and
14 deletions
src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderServiceImpl.java
... | ... | @@ -25,6 +25,7 @@ import com.huaheng.pc.config.shipmentType.service.ShipmentTypeService; |
25 | 25 | import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; |
26 | 26 | import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService; |
27 | 27 | import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; |
28 | +import com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentContainerHeader; | |
28 | 29 | import com.huaheng.pc.shipment.shipmentContainerHeader.service.ShipmentContainerHeaderService; |
29 | 30 | import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; |
30 | 31 | import com.huaheng.pc.shipment.shipmentDetail.service.ShipmentDetailService; |
... | ... | @@ -39,7 +40,9 @@ import com.huaheng.pc.shipment.shipmentHeaderHistory.service.ShipmentHeaderHisto |
39 | 40 | import com.huaheng.pc.system.dict.service.IDictDataService; |
40 | 41 | import com.huaheng.pc.task.taskDetail.domain.TaskDetail; |
41 | 42 | import com.huaheng.pc.task.taskDetail.service.TaskDetailService; |
43 | +import com.huaheng.pc.task.taskHeader.domain.ShipmentTaskCreateModel; | |
42 | 44 | import com.huaheng.pc.task.taskHeader.domain.TaskHeader; |
45 | +import com.huaheng.pc.task.taskHeader.service.ShipmentTaskService; | |
43 | 46 | import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; |
44 | 47 | import org.springframework.beans.BeanUtils; |
45 | 48 | import org.springframework.beans.factory.annotation.Autowired; |
... | ... | @@ -57,6 +60,8 @@ import java.util.stream.Collectors; |
57 | 60 | |
58 | 61 | @Service |
59 | 62 | public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, ShipmentHeader> implements ShipmentHeaderService { |
63 | + @Resource | |
64 | + private ShipmentTaskService shipmentTaskService; | |
60 | 65 | |
61 | 66 | @Resource |
62 | 67 | private ConfigService configService; |
... | ... | @@ -569,7 +574,7 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, |
569 | 574 | @Override |
570 | 575 | public void autoShipmentExecute(ShipmentHeader shipmentHeader) { |
571 | 576 | shipmentHeader.setAutoShipmentStatus(4); |
572 | - shipmentHeader.setErrorMsg("自动组盘过程中程序错误,请手动继续"); | |
577 | + shipmentHeader.setErrorMsg("自动组盘过程中程序错误,请手动组盘"); | |
573 | 578 | updateById(shipmentHeader); |
574 | 579 | //自动组盘 |
575 | 580 | AjaxResult containerResult = shipmentContainerHeaderService.autoCombination(shipmentHeader.getCode(), true); |
... | ... | @@ -578,14 +583,28 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, |
578 | 583 | return; |
579 | 584 | } |
580 | 585 | shipmentHeader.setAutoShipmentStatus(4); |
581 | - shipmentHeader.setErrorMsg("自生成任务过程中程序错误,请手动继续"); | |
586 | + shipmentHeader.setErrorMsg("自生成任务过程中程序错误,请手动生成任务"); | |
582 | 587 | updateById(shipmentHeader); |
583 | - //生成任务 | |
584 | - List<Integer> ids = (List<Integer>) containerResult.getData(); | |
585 | - AjaxResult taskResult = shipmentContainerHeaderService.createAutoTask(ids); | |
586 | - if (!updateShipmentErrorMsg(taskResult, shipmentHeader)) { | |
587 | - return; | |
588 | + | |
589 | + | |
590 | + List<ShipmentContainerHeader> shipmentContainerHeaders = shipmentContainerHeaderService.list(new LambdaQueryWrapper<ShipmentContainerHeader>() | |
591 | + .eq(ShipmentContainerHeader::getStatus, QuantityConstant.SHIPMENT_CONTAINER_BUILD)); | |
592 | + for (ShipmentContainerHeader item : shipmentContainerHeaders) { | |
593 | + ShipmentTaskCreateModel shipmentTask = new ShipmentTaskCreateModel(); | |
594 | + shipmentTask.setShipmentContainerHeaderIds(item.getId()); | |
595 | + AjaxResult taskResult = shipmentTaskService.createTaskFromShipmentContainers(shipmentTask, false); | |
596 | + if (!updateShipmentErrorMsg(taskResult, shipmentHeader)) { | |
597 | + return; | |
598 | + } | |
588 | 599 | } |
600 | + | |
601 | + //生成任务 | |
602 | + //List<Integer> ids = (List<Integer>) containerResult.getData(); | |
603 | + //AjaxResult taskResult = shipmentContainerHeaderService.createAutoTask(ids); | |
604 | + //if (!updateShipmentErrorMsg(taskResult, shipmentHeader)) { | |
605 | + // return; | |
606 | + //} | |
607 | + | |
589 | 608 | //自动打印 |
590 | 609 | int isPrint = Integer.parseInt(configService.getKey(QuantityConstant.AUTO_SHIPMENT_PRINT)); |
591 | 610 | if (isPrint == 1) { |
... | ... | @@ -608,7 +627,11 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, |
608 | 627 | public boolean updateShipmentErrorMsg(AjaxResult result, ShipmentHeader shipmentHeader) { |
609 | 628 | if (result.getCode() != 200) { |
610 | 629 | shipmentHeader.setAutoShipmentStatus(4); |
611 | - shipmentHeader.setErrorMsg(result.getMsg()); | |
630 | + String errorMsg = result.getMsg(); | |
631 | + if (errorMsg.length() > 500) { | |
632 | + errorMsg = errorMsg.substring(0, 500); | |
633 | + } | |
634 | + shipmentHeader.setErrorMsg(errorMsg); | |
612 | 635 | updateById(shipmentHeader); |
613 | 636 | return false; |
614 | 637 | } |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
... | ... | @@ -977,7 +977,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
977 | 977 | //组盘表新建状态任务+任务表任务 |
978 | 978 | Integer tasknum = shipmentContainerHeaderService.list(new LambdaQueryWrapper<ShipmentContainerHeader>() |
979 | 979 | .in(ShipmentContainerHeader::getStatus, 1, 10) |
980 | - .eq(ShipmentContainerHeader::getFlat, 0) | |
981 | 980 | .apply("(SUBSTRING(locationCode, 1, 3) in ('K05','K06','K07','K08') )")).size(); |
982 | 981 | return tasknum; |
983 | 982 | } |
... | ... |
src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html
... | ... | @@ -212,7 +212,7 @@ |
212 | 212 | shiro:hasPermission="shipment:bill:close"> |
213 | 213 | <i></i> 关闭自动出库 |
214 | 214 | </a> |
215 | - | |
215 | + | |
216 | 216 | |
217 | 217 | <a class="btn btn-outline btn-success btn-rounded" |
218 | 218 | onclick="autoShipmentChoose()" |
... | ... | @@ -289,10 +289,10 @@ |
289 | 289 | <i class="fa fa-code-fork"></i> 自动组盘 |
290 | 290 | </a> |
291 | 291 | |
292 | - <!-- <a class="btn btn-outline btn-primary btn-rounded auto-shipment-task" onclick="Toshipping(2)"--> | |
293 | - <!-- shiro:hasPermission="shipment:shippingCombination:combination">--> | |
294 | - <!-- <i class="fa fa-code-fork"></i> 自动组盘并生成任务--> | |
295 | - <!-- </a>--> | |
292 | + <a class="btn btn-outline btn-primary btn-rounded auto-shipment-task" onclick="Toshipping(2)" | |
293 | + shiro:hasPermission="shipment:shippingCombination:combination"> | |
294 | + <i class="fa fa-code-fork"></i> 自动组盘并生成任务 | |
295 | + </a> | |
296 | 296 | <a class="btn btn-outline btn-primary btn-rounded auto-shipment" onclick="Toshipping(3)" |
297 | 297 | shiro:hasPermission="shipment:shippingCombination:combination"> |
298 | 298 | <i class="fa fa-code-fork"></i> 自动平库组盘 |
... | ... |