Commit 491e5751c50d699bde2f5cdf07c6ea1f99281a46
1 parent
4eaf4bb5
统一更新库存表的容器号、库位号
Showing
4 changed files
with
62 additions
and
97 deletions
ant-design-vue-jeecg/src/views/system/task/AllTaskHeaderList.vue
... | ... | @@ -310,14 +310,14 @@ export default { |
310 | 310 | align: "center", |
311 | 311 | dataIndex: 'completeTime' |
312 | 312 | }, |
313 | - { | |
314 | - title: '操作', | |
315 | - dataIndex: 'action', | |
316 | - align: "center", | |
317 | - fixed: "right", | |
318 | - width: 147, | |
319 | - scopedSlots: {customRender: 'action'}, | |
320 | - } | |
313 | + // { | |
314 | + // title: '操作', | |
315 | + // dataIndex: 'action', | |
316 | + // align: "center", | |
317 | + // fixed: "right", | |
318 | + // width: 147, | |
319 | + // scopedSlots: {customRender: 'action'}, | |
320 | + // } | |
321 | 321 | ], |
322 | 322 | url: { |
323 | 323 | list: "/task/taskHeader/list", |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryHeaderService.java
... | ... | @@ -34,6 +34,8 @@ public interface IInventoryHeaderService extends IService<InventoryHeader> { |
34 | 34 | |
35 | 35 | boolean updateInventoryLocationAndZoneById(String locationCode, String zoneCode, Integer id); |
36 | 36 | |
37 | + boolean updateInventoryContainerLocationZoneById(String contaienrCode, String locationCode, String zoneCode, Integer id); | |
38 | + | |
37 | 39 | boolean updateContainerStatusById(String containerStatus, Integer id); |
38 | 40 | |
39 | 41 | boolean updateContainerStatusAndLocationCode(String containerStatus, String locationCode, Integer id); |
... | ... | @@ -44,5 +46,5 @@ public interface IInventoryHeaderService extends IService<InventoryHeader> { |
44 | 46 | |
45 | 47 | Result shipmentInventoryDetail(List<InventoryDetail> inventoryDetailList, String warehouseCode); |
46 | 48 | |
47 | - boolean updateInventory(Integer inventoryHeaderId, List<InventoryDetail> inventoryDetailList, String containerStatus, String zoneCode, String locationCode); | |
49 | + boolean updateInventory(String containerCode, String locationCode, String warehouseCode); | |
48 | 50 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java
... | ... | @@ -12,6 +12,8 @@ import org.jeecg.common.api.vo.Result; |
12 | 12 | import org.jeecg.common.exception.JeecgBootException; |
13 | 13 | import org.jeecg.modules.wms.config.container.entity.Container; |
14 | 14 | import org.jeecg.modules.wms.config.container.service.IContainerService; |
15 | +import org.jeecg.modules.wms.config.location.entity.Location; | |
16 | +import org.jeecg.modules.wms.config.location.service.ILocationService; | |
15 | 17 | import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; |
16 | 18 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
17 | 19 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; |
... | ... | @@ -70,6 +72,8 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe |
70 | 72 | private IShipmentContainerDetailService shipmentContainerDetailService; |
71 | 73 | @Resource |
72 | 74 | private IHuahengMultiHandlerService huahengMultiHandlerService; |
75 | + @Resource | |
76 | + private ILocationService locationService; | |
73 | 77 | |
74 | 78 | @Override |
75 | 79 | @Transactional |
... | ... | @@ -103,22 +107,23 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe |
103 | 107 | return false; |
104 | 108 | } |
105 | 109 | InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); |
106 | - if (inventoryHeader != null) { | |
107 | - if (!inventoryHeaderService.updateContainerStatusById(container.getStatus(), inventoryHeader.getId())) { | |
108 | - throw new JeecgBootException("更新库存头表状态失败"); | |
110 | + if (inventoryHeader == null) { | |
111 | + return true; | |
112 | + } | |
113 | + if (!inventoryHeaderService.updateContainerStatusById(container.getStatus(), inventoryHeader.getId())) { | |
114 | + throw new JeecgBootException("更新库存头表状态失败"); | |
115 | + } | |
116 | + List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByContainerCode(containerCode, warehouseCode); | |
117 | + List<InventoryDetail> updateInventoryDetailList = new ArrayList<>(); | |
118 | + if (inventoryDetailList.size() > 0) { | |
119 | + for (InventoryDetail inventoryDetail : inventoryDetailList) { | |
120 | + InventoryDetail updateInventoryDetail = new InventoryDetail(); | |
121 | + updateInventoryDetail.setId(inventoryDetail.getId()); | |
122 | + updateInventoryDetail.setContainerStatus(container.getStatus()); | |
123 | + updateInventoryDetailList.add(updateInventoryDetail); | |
109 | 124 | } |
110 | - List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByContainerCode(containerCode, warehouseCode); | |
111 | - List<InventoryDetail> updateInventoryDetailList = new ArrayList<>(); | |
112 | - if (inventoryDetailList.size() > 0) { | |
113 | - for (InventoryDetail inventoryDetail : inventoryDetailList) { | |
114 | - InventoryDetail updateInventoryDetail = new InventoryDetail(); | |
115 | - updateInventoryDetail.setId(inventoryDetail.getId()); | |
116 | - updateInventoryDetail.setContainerStatus(container.getStatus()); | |
117 | - updateInventoryDetailList.add(updateInventoryDetail); | |
118 | - } | |
119 | - if (!inventoryDetailService.updateBatchById(updateInventoryDetailList)) { | |
120 | - throw new JeecgBootException("更新库存明细表状态失败"); | |
121 | - } | |
125 | + if (!inventoryDetailService.updateBatchById(updateInventoryDetailList)) { | |
126 | + throw new JeecgBootException("更新库存明细表状态失败"); | |
122 | 127 | } |
123 | 128 | } |
124 | 129 | return true; |
... | ... | @@ -134,6 +139,16 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe |
134 | 139 | } |
135 | 140 | |
136 | 141 | @Override |
142 | + public boolean updateInventoryContainerLocationZoneById(String containerCode, String locationCode, String zoneCode, Integer id) { | |
143 | + InventoryHeader inventoryHeader = new InventoryHeader(); | |
144 | + inventoryHeader.setId(id); | |
145 | + inventoryHeader.setContainerCode(containerCode); | |
146 | + inventoryHeader.setLocationCode(locationCode); | |
147 | + inventoryHeader.setZoneCode(zoneCode); | |
148 | + return inventoryHeaderService.updateById(inventoryHeader); | |
149 | + } | |
150 | + | |
151 | + @Override | |
137 | 152 | public boolean updateContainerStatusById(String containerStatus, Integer id) { |
138 | 153 | InventoryHeader inventoryHeader = new InventoryHeader(); |
139 | 154 | inventoryHeader.setId(id); |
... | ... | @@ -336,17 +351,21 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe |
336 | 351 | } |
337 | 352 | |
338 | 353 | @Override |
339 | - public boolean updateInventory(Integer inventoryHeaderId, List<InventoryDetail> inventoryDetailList, String containerStatus, String zoneCode, | |
340 | - String locationCode) { | |
341 | - InventoryHeader inventoryHeader = inventoryHeaderService.getById(inventoryHeaderId); | |
354 | + public boolean updateInventory(String containerCode, String locationCode, String warehouseCode) { | |
355 | + InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); | |
342 | 356 | if (inventoryHeader == null) { |
343 | 357 | return true; |
344 | 358 | } |
345 | - boolean success = inventoryHeaderService.updateInventoryLocationAndZoneById(locationCode, zoneCode, inventoryHeaderId); | |
346 | - if (!success) { | |
347 | - return success; | |
359 | + List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByInventoryHeaderId(inventoryHeader.getId()); | |
360 | + if (inventoryDetailList.size() == 0) { | |
361 | + return false; | |
362 | + } | |
363 | + Location toLocation = locationService.getLocationByCode(locationCode, warehouseCode); | |
364 | + if (toLocation == null) { | |
365 | + return false; | |
348 | 366 | } |
349 | - success = inventoryHeaderService.updateContainerStatusById(containerStatus, inventoryHeaderId); | |
367 | + String zoneCode = toLocation.getZoneCode(); | |
368 | + boolean success = inventoryHeaderService.updateInventoryContainerLocationZoneById(containerCode, locationCode, zoneCode, inventoryHeader.getId()); | |
350 | 369 | if (!success) { |
351 | 370 | return success; |
352 | 371 | } |
... | ... | @@ -354,7 +373,7 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe |
354 | 373 | for (InventoryDetail inventoryDetail : inventoryDetailList) { |
355 | 374 | InventoryDetail inventoryDetail1 = new InventoryDetail(); |
356 | 375 | inventoryDetail1.setId(inventoryDetail.getId()); |
357 | - inventoryDetail1.setContainerStatus(containerStatus); | |
376 | + inventoryDetail1.setContainerCode(containerCode); | |
358 | 377 | inventoryDetail1.setLocationCode(locationCode); |
359 | 378 | inventoryDetail1.setZoneCode(zoneCode); |
360 | 379 | updateInventoryDetailList.add(inventoryDetail1); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... | ... | @@ -338,7 +338,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
338 | 338 | List<InventoryDetail> inventoryDetailList1 = new ArrayList<>(); |
339 | 339 | if (inventoryDetailList.size() != 0) { |
340 | 340 | for (InventoryDetail inventoryDetail : inventoryDetailList) { |
341 | - inventoryDetail.setTaskQty(inventoryDetail.getQty()); | |
342 | 341 | InventoryDetail inventoryDetail1 = new InventoryDetail(); |
343 | 342 | inventoryDetail1.setId(inventoryDetail.getId()); |
344 | 343 | inventoryDetail1.setTaskQty(inventoryDetail.getQty()); |
... | ... | @@ -1045,27 +1044,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1045 | 1044 | return Result.error("完成入库任务时,没有找到目的库位"); |
1046 | 1045 | } |
1047 | 1046 | InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); |
1048 | - if (inventoryHeader != null) { | |
1049 | - if (taskType == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) { | |
1050 | - if (!inventoryHeaderService.updateInventoryLocationAndZoneById(toLocationCode, zoneCode, inventoryHeader.getId())) { | |
1051 | - throw new JeecgBootException("完成入库任务时,没有找到目的库位"); | |
1052 | - } | |
1053 | - List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByInventoryHeaderId(inventoryHeader.getId()); | |
1054 | - if (inventoryDetailList.size() > 0) { | |
1055 | - List<InventoryDetail> inventoryDetailList1 = new ArrayList<>(); | |
1056 | - for (InventoryDetail inventoryDetail : inventoryDetailList) { | |
1057 | - InventoryDetail inventoryDetail1 = new InventoryDetail(); | |
1058 | - inventoryDetail1.setId(inventoryDetail.getId()); | |
1059 | - inventoryDetail1.setLocationCode(toLocationCode); | |
1060 | - inventoryDetail1.setZoneCode(zoneCode); | |
1061 | - inventoryDetailList1.add(inventoryDetail1); | |
1062 | - } | |
1063 | - if (!inventoryDetailService.updateBatchById(inventoryDetailList1)) { | |
1064 | - throw new JeecgBootException("完成入库任务时,更新库存详情失败"); | |
1065 | - } | |
1066 | - } | |
1067 | - } | |
1068 | - } else { | |
1047 | + if (inventoryHeader == null) { | |
1069 | 1048 | inventoryHeader = new InventoryHeader(); |
1070 | 1049 | inventoryHeader.setWarehouseCode(warehouseCode); |
1071 | 1050 | inventoryHeader.setCompanyCode(taskHeader.getCompanyCode()); |
... | ... | @@ -1358,23 +1337,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1358 | 1337 | if (taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) { |
1359 | 1338 | throw new JeecgBootException("完成整盘出库任务,不能还剩库存详情"); |
1360 | 1339 | } |
1361 | - inventoryHeader.setContainerStatus(QuantityConstant.STATUS_CONTAINER_EMPTY); | |
1362 | - inventoryHeader.setLocationCode(toLocationCode); | |
1363 | - success = inventoryHeaderService.updateContainerStatusAndLocationCode(QuantityConstant.STATUS_CONTAINER_EMPTY, toLocationCode, inventoryHeader.getId()); | |
1364 | - if (!success) { | |
1365 | - throw new JeecgBootException("完成出库任务,更新库存头失败"); | |
1366 | - } | |
1367 | - List<InventoryDetail> updateInventoryDetailList = new ArrayList<>(); | |
1368 | - for (InventoryDetail inventoryDetail : inventoryDetailList) { | |
1369 | - InventoryDetail inventoryDetail1 = new InventoryDetail(); | |
1370 | - inventoryDetail1.setId(inventoryDetail.getId()); | |
1371 | - inventoryDetail1.setLocationCode(toLocationCode); | |
1372 | - updateInventoryDetailList.add(inventoryDetail1); | |
1373 | - } | |
1374 | - success = inventoryDetailService.updateBatchLocationCodeById(updateInventoryDetailList); | |
1375 | - if (!success) { | |
1376 | - throw new JeecgBootException("完成出库任务,更新库存详情失败"); | |
1377 | - } | |
1378 | 1340 | } |
1379 | 1341 | success = inventoryTransactionService.saveBatch(inventoryTransactionList); |
1380 | 1342 | if (!success) { |
... | ... | @@ -1410,11 +1372,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1410 | 1372 | if (!result.isSuccess()) { |
1411 | 1373 | throw new JeecgBootException(result.getMessage()); |
1412 | 1374 | } |
1413 | - success = | |
1414 | - inventoryHeaderService.updateInventory(inventoryHeader.getId(), inventoryDetailList, QuantityConstant.STATUS_CONTAINER_EMPTY, zoneCode, toLocationCode); | |
1415 | - if (!success) { | |
1416 | - throw new JeecgBootException("完成出库任务,更新库存状态失败"); | |
1417 | - } | |
1418 | 1375 | success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); |
1419 | 1376 | if (!success) { |
1420 | 1377 | throw new JeecgBootException("完成出库任务,保存任务头失败"); |
... | ... | @@ -1686,6 +1643,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1686 | 1643 | if (!container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_EMPTY)) { |
1687 | 1644 | return Result.error("创建跨站任务时, 容器状态不为空闲状态"); |
1688 | 1645 | } |
1646 | + if (StringUtils.isNotEmpty(container.getLocationCode())) { | |
1647 | + return Result.error("创建跨站任务时,容器不能在库位上"); | |
1648 | + } | |
1689 | 1649 | boolean success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_LOCK, warehouseCode); |
1690 | 1650 | if (!success) { |
1691 | 1651 | throw new JeecgBootException("创建跨站任务时,更新容器状态失败"); |
... | ... | @@ -1799,6 +1759,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1799 | 1759 | if (!inventoryHeaderService.updateInventoryContainerStatusByContainerCode(containerCode, warehouseCode)) { |
1800 | 1760 | throw new JeecgBootException("任务类型" + taskType + "完成任务时,更新托盘状态失败"); |
1801 | 1761 | } |
1762 | + success = inventoryHeaderService.updateInventory(containerCode, toLocationCode, warehouseCode); | |
1763 | + if (!success) { | |
1764 | + throw new JeecgBootException("任务类型" + taskType + "完成任务时,更新库存信息失败"); | |
1765 | + } | |
1802 | 1766 | return Result.OK("任务类型" + taskType + "完成任务成功"); |
1803 | 1767 | } |
1804 | 1768 | |
... | ... | @@ -2322,7 +2286,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
2322 | 2286 | InventoryTransaction inventoryTransaction = new InventoryTransaction(); |
2323 | 2287 | inventoryTransaction.setWarehouseCode(inventoryDetail.getWarehouseCode()); |
2324 | 2288 | inventoryTransaction.setZoneCode(zoneCode); |
2325 | - inventoryTransaction.setContainerCode(inventoryDetail.getContainerCode()); | |
2289 | + inventoryTransaction.setContainerCode(containerCode); | |
2326 | 2290 | inventoryTransaction.setCompanyCode(inventoryDetail.getCompanyCode()); |
2327 | 2291 | inventoryTransaction.setType(QuantityConstant.INVENTORY_TRANSACTION_TRANSFER); |
2328 | 2292 | inventoryTransaction.setFromLocationCode(fromLocationCode); |
... | ... | @@ -2345,22 +2309,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
2345 | 2309 | throw new JeecgBootException("完成移库任务时,保存库存交易失败"); |
2346 | 2310 | } |
2347 | 2311 | } |
2348 | - LambdaUpdateWrapper<InventoryHeader> inventoryHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
2349 | - inventoryHeaderLambdaUpdateWrapper.eq(InventoryHeader::getWarehouseCode, warehouseCode).eq(InventoryHeader::getContainerCode, containerCode) | |
2350 | - .eq(InventoryHeader::getLocationCode, fromLocationCode); | |
2351 | - InventoryHeader inventoryHeader = inventoryHeaderService.getOne(inventoryHeaderLambdaUpdateWrapper); | |
2352 | - if (inventoryHeader != null) { | |
2353 | - success = inventoryHeaderService.updateLocationCodeById(toLocationCode, inventoryHeader.getId()); | |
2354 | - if (!success) { | |
2355 | - throw new JeecgBootException("完成移库任务时, 更新库存头失败"); | |
2356 | - } | |
2357 | - } | |
2358 | - if (inventoryDetailList.size() != 0) { | |
2359 | - success = inventoryDetailService.updateBatchLocationCodeById(inventoryDetailList); | |
2360 | - if (!success) { | |
2361 | - throw new JeecgBootException("完成移库任务时, 更新库存详情失败"); | |
2362 | - } | |
2363 | - } | |
2364 | 2312 | Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_TRANSFER, |
2365 | 2313 | containerCode, fromLocationCode, toLocationCode, warehouseCode); |
2366 | 2314 | if (!result.isSuccess()) { |
... | ... | @@ -2497,10 +2445,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
2497 | 2445 | if (!success) { |
2498 | 2446 | throw new JeecgBootException("创建跨站任务时, 更新任务失败"); |
2499 | 2447 | } |
2500 | -// success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
2501 | -// if (!success) { | |
2502 | -// throw new JeecgBootException("创建跨站任务时, 更新容器状态失败"); | |
2503 | -// } | |
2504 | 2448 | log.info("完成跨站任务" + taskHeader.getId()); |
2505 | 2449 | return Result.OK("完成跨站任务成功"); |
2506 | 2450 | } |
... | ... |