diff --git a/ant-design-vue-jeecg/src/views/system/task/AllTaskHeaderList.vue b/ant-design-vue-jeecg/src/views/system/task/AllTaskHeaderList.vue index 657d460..d5b542b 100644 --- a/ant-design-vue-jeecg/src/views/system/task/AllTaskHeaderList.vue +++ b/ant-design-vue-jeecg/src/views/system/task/AllTaskHeaderList.vue @@ -310,14 +310,14 @@ export default { align: "center", dataIndex: 'completeTime' }, - { - title: '操作', - dataIndex: 'action', - align: "center", - fixed: "right", - width: 147, - scopedSlots: {customRender: 'action'}, - } + // { + // title: '操作', + // dataIndex: 'action', + // align: "center", + // fixed: "right", + // width: 147, + // scopedSlots: {customRender: 'action'}, + // } ], url: { list: "/task/taskHeader/list", diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryHeaderService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryHeaderService.java index 4a822f3..f8a8498 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryHeaderService.java +++ b/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> { boolean updateInventoryLocationAndZoneById(String locationCode, String zoneCode, Integer id); + boolean updateInventoryContainerLocationZoneById(String contaienrCode, String locationCode, String zoneCode, Integer id); + boolean updateContainerStatusById(String containerStatus, Integer id); boolean updateContainerStatusAndLocationCode(String containerStatus, String locationCode, Integer id); @@ -44,5 +46,5 @@ public interface IInventoryHeaderService extends IService<InventoryHeader> { Result shipmentInventoryDetail(List<InventoryDetail> inventoryDetailList, String warehouseCode); - boolean updateInventory(Integer inventoryHeaderId, List<InventoryDetail> inventoryDetailList, String containerStatus, String zoneCode, String locationCode); + boolean updateInventory(String containerCode, String locationCode, String warehouseCode); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java index 4baf64e..8661683 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java +++ b/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; import org.jeecg.common.exception.JeecgBootException; import org.jeecg.modules.wms.config.container.entity.Container; import org.jeecg.modules.wms.config.container.service.IContainerService; +import org.jeecg.modules.wms.config.location.entity.Location; +import org.jeecg.modules.wms.config.location.service.ILocationService; import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; @@ -70,6 +72,8 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe private IShipmentContainerDetailService shipmentContainerDetailService; @Resource private IHuahengMultiHandlerService huahengMultiHandlerService; + @Resource + private ILocationService locationService; @Override @Transactional @@ -103,22 +107,23 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe return false; } InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); - if (inventoryHeader != null) { - if (!inventoryHeaderService.updateContainerStatusById(container.getStatus(), inventoryHeader.getId())) { - throw new JeecgBootException("更新库存头表状态失败"); + if (inventoryHeader == null) { + return true; + } + if (!inventoryHeaderService.updateContainerStatusById(container.getStatus(), inventoryHeader.getId())) { + throw new JeecgBootException("更新库存头表状态失败"); + } + List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByContainerCode(containerCode, warehouseCode); + List<InventoryDetail> updateInventoryDetailList = new ArrayList<>(); + if (inventoryDetailList.size() > 0) { + for (InventoryDetail inventoryDetail : inventoryDetailList) { + InventoryDetail updateInventoryDetail = new InventoryDetail(); + updateInventoryDetail.setId(inventoryDetail.getId()); + updateInventoryDetail.setContainerStatus(container.getStatus()); + updateInventoryDetailList.add(updateInventoryDetail); } - List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByContainerCode(containerCode, warehouseCode); - List<InventoryDetail> updateInventoryDetailList = new ArrayList<>(); - if (inventoryDetailList.size() > 0) { - for (InventoryDetail inventoryDetail : inventoryDetailList) { - InventoryDetail updateInventoryDetail = new InventoryDetail(); - updateInventoryDetail.setId(inventoryDetail.getId()); - updateInventoryDetail.setContainerStatus(container.getStatus()); - updateInventoryDetailList.add(updateInventoryDetail); - } - if (!inventoryDetailService.updateBatchById(updateInventoryDetailList)) { - throw new JeecgBootException("更新库存明细表状态失败"); - } + if (!inventoryDetailService.updateBatchById(updateInventoryDetailList)) { + throw new JeecgBootException("更新库存明细表状态失败"); } } return true; @@ -134,6 +139,16 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe } @Override + public boolean updateInventoryContainerLocationZoneById(String containerCode, String locationCode, String zoneCode, Integer id) { + InventoryHeader inventoryHeader = new InventoryHeader(); + inventoryHeader.setId(id); + inventoryHeader.setContainerCode(containerCode); + inventoryHeader.setLocationCode(locationCode); + inventoryHeader.setZoneCode(zoneCode); + return inventoryHeaderService.updateById(inventoryHeader); + } + + @Override public boolean updateContainerStatusById(String containerStatus, Integer id) { InventoryHeader inventoryHeader = new InventoryHeader(); inventoryHeader.setId(id); @@ -336,17 +351,21 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe } @Override - public boolean updateInventory(Integer inventoryHeaderId, List<InventoryDetail> inventoryDetailList, String containerStatus, String zoneCode, - String locationCode) { - InventoryHeader inventoryHeader = inventoryHeaderService.getById(inventoryHeaderId); + public boolean updateInventory(String containerCode, String locationCode, String warehouseCode) { + InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); if (inventoryHeader == null) { return true; } - boolean success = inventoryHeaderService.updateInventoryLocationAndZoneById(locationCode, zoneCode, inventoryHeaderId); - if (!success) { - return success; + List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByInventoryHeaderId(inventoryHeader.getId()); + if (inventoryDetailList.size() == 0) { + return false; + } + Location toLocation = locationService.getLocationByCode(locationCode, warehouseCode); + if (toLocation == null) { + return false; } - success = inventoryHeaderService.updateContainerStatusById(containerStatus, inventoryHeaderId); + String zoneCode = toLocation.getZoneCode(); + boolean success = inventoryHeaderService.updateInventoryContainerLocationZoneById(containerCode, locationCode, zoneCode, inventoryHeader.getId()); if (!success) { return success; } @@ -354,7 +373,7 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe for (InventoryDetail inventoryDetail : inventoryDetailList) { InventoryDetail inventoryDetail1 = new InventoryDetail(); inventoryDetail1.setId(inventoryDetail.getId()); - inventoryDetail1.setContainerStatus(containerStatus); + inventoryDetail1.setContainerCode(containerCode); inventoryDetail1.setLocationCode(locationCode); inventoryDetail1.setZoneCode(zoneCode); updateInventoryDetailList.add(inventoryDetail1); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java index af93cc1..106f96e 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java +++ b/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 List<InventoryDetail> inventoryDetailList1 = new ArrayList<>(); if (inventoryDetailList.size() != 0) { for (InventoryDetail inventoryDetail : inventoryDetailList) { - inventoryDetail.setTaskQty(inventoryDetail.getQty()); InventoryDetail inventoryDetail1 = new InventoryDetail(); inventoryDetail1.setId(inventoryDetail.getId()); inventoryDetail1.setTaskQty(inventoryDetail.getQty()); @@ -1045,27 +1044,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea return Result.error("完成入库任务时,没有找到目的库位"); } InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); - if (inventoryHeader != null) { - if (taskType == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) { - if (!inventoryHeaderService.updateInventoryLocationAndZoneById(toLocationCode, zoneCode, inventoryHeader.getId())) { - throw new JeecgBootException("完成入库任务时,没有找到目的库位"); - } - List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByInventoryHeaderId(inventoryHeader.getId()); - if (inventoryDetailList.size() > 0) { - List<InventoryDetail> inventoryDetailList1 = new ArrayList<>(); - for (InventoryDetail inventoryDetail : inventoryDetailList) { - InventoryDetail inventoryDetail1 = new InventoryDetail(); - inventoryDetail1.setId(inventoryDetail.getId()); - inventoryDetail1.setLocationCode(toLocationCode); - inventoryDetail1.setZoneCode(zoneCode); - inventoryDetailList1.add(inventoryDetail1); - } - if (!inventoryDetailService.updateBatchById(inventoryDetailList1)) { - throw new JeecgBootException("完成入库任务时,更新库存详情失败"); - } - } - } - } else { + if (inventoryHeader == null) { inventoryHeader = new InventoryHeader(); inventoryHeader.setWarehouseCode(warehouseCode); inventoryHeader.setCompanyCode(taskHeader.getCompanyCode()); @@ -1358,23 +1337,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea if (taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) { throw new JeecgBootException("完成整盘出库任务,不能还剩库存详情"); } - inventoryHeader.setContainerStatus(QuantityConstant.STATUS_CONTAINER_EMPTY); - inventoryHeader.setLocationCode(toLocationCode); - success = inventoryHeaderService.updateContainerStatusAndLocationCode(QuantityConstant.STATUS_CONTAINER_EMPTY, toLocationCode, inventoryHeader.getId()); - if (!success) { - throw new JeecgBootException("完成出库任务,更新库存头失败"); - } - List<InventoryDetail> updateInventoryDetailList = new ArrayList<>(); - for (InventoryDetail inventoryDetail : inventoryDetailList) { - InventoryDetail inventoryDetail1 = new InventoryDetail(); - inventoryDetail1.setId(inventoryDetail.getId()); - inventoryDetail1.setLocationCode(toLocationCode); - updateInventoryDetailList.add(inventoryDetail1); - } - success = inventoryDetailService.updateBatchLocationCodeById(updateInventoryDetailList); - if (!success) { - throw new JeecgBootException("完成出库任务,更新库存详情失败"); - } } success = inventoryTransactionService.saveBatch(inventoryTransactionList); if (!success) { @@ -1410,11 +1372,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea if (!result.isSuccess()) { throw new JeecgBootException(result.getMessage()); } - success = - inventoryHeaderService.updateInventory(inventoryHeader.getId(), inventoryDetailList, QuantityConstant.STATUS_CONTAINER_EMPTY, zoneCode, toLocationCode); - if (!success) { - throw new JeecgBootException("完成出库任务,更新库存状态失败"); - } success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); if (!success) { throw new JeecgBootException("完成出库任务,保存任务头失败"); @@ -1686,6 +1643,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea if (!container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_EMPTY)) { return Result.error("创建跨站任务时, 容器状态不为空闲状态"); } + if (StringUtils.isNotEmpty(container.getLocationCode())) { + return Result.error("创建跨站任务时,容器不能在库位上"); + } boolean success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_LOCK, warehouseCode); if (!success) { throw new JeecgBootException("创建跨站任务时,更新容器状态失败"); @@ -1799,6 +1759,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea if (!inventoryHeaderService.updateInventoryContainerStatusByContainerCode(containerCode, warehouseCode)) { throw new JeecgBootException("任务类型" + taskType + "完成任务时,更新托盘状态失败"); } + success = inventoryHeaderService.updateInventory(containerCode, toLocationCode, warehouseCode); + if (!success) { + throw new JeecgBootException("任务类型" + taskType + "完成任务时,更新库存信息失败"); + } return Result.OK("任务类型" + taskType + "完成任务成功"); } @@ -2322,7 +2286,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea InventoryTransaction inventoryTransaction = new InventoryTransaction(); inventoryTransaction.setWarehouseCode(inventoryDetail.getWarehouseCode()); inventoryTransaction.setZoneCode(zoneCode); - inventoryTransaction.setContainerCode(inventoryDetail.getContainerCode()); + inventoryTransaction.setContainerCode(containerCode); inventoryTransaction.setCompanyCode(inventoryDetail.getCompanyCode()); inventoryTransaction.setType(QuantityConstant.INVENTORY_TRANSACTION_TRANSFER); inventoryTransaction.setFromLocationCode(fromLocationCode); @@ -2345,22 +2309,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea throw new JeecgBootException("完成移库任务时,保存库存交易失败"); } } - LambdaUpdateWrapper<InventoryHeader> inventoryHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); - inventoryHeaderLambdaUpdateWrapper.eq(InventoryHeader::getWarehouseCode, warehouseCode).eq(InventoryHeader::getContainerCode, containerCode) - .eq(InventoryHeader::getLocationCode, fromLocationCode); - InventoryHeader inventoryHeader = inventoryHeaderService.getOne(inventoryHeaderLambdaUpdateWrapper); - if (inventoryHeader != null) { - success = inventoryHeaderService.updateLocationCodeById(toLocationCode, inventoryHeader.getId()); - if (!success) { - throw new JeecgBootException("完成移库任务时, 更新库存头失败"); - } - } - if (inventoryDetailList.size() != 0) { - success = inventoryDetailService.updateBatchLocationCodeById(inventoryDetailList); - if (!success) { - throw new JeecgBootException("完成移库任务时, 更新库存详情失败"); - } - } Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_TRANSFER, containerCode, fromLocationCode, toLocationCode, warehouseCode); if (!result.isSuccess()) { @@ -2497,10 +2445,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea if (!success) { throw new JeecgBootException("创建跨站任务时, 更新任务失败"); } -// success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); -// if (!success) { -// throw new JeecgBootException("创建跨站任务时, 更新容器状态失败"); -// } log.info("完成跨站任务" + taskHeader.getId()); return Result.OK("完成跨站任务成功"); }