From 4363235bfb5359cebaa575d38526479f0ec97ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A5=8E=E5=85=B4?= <2220574228@qq.com> Date: Fri, 30 Jan 2026 16:23:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E6=9E=B6=E5=BA=93=E5=AD=98=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E8=AE=B0=E5=BD=95;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/StockShelfOrderDomainService.java | 86 ++++++++++++++++++- 1 file changed, 84 insertions(+), 2 deletions(-) diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/stockShelfOrder/service/StockShelfOrderDomainService.java b/mhd_wms/src/main/java/com/mhd/wms/domain/stockShelfOrder/service/StockShelfOrderDomainService.java index c5ceae56c..bc75f23df 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/stockShelfOrder/service/StockShelfOrderDomainService.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/stockShelfOrder/service/StockShelfOrderDomainService.java @@ -27,6 +27,8 @@ import com.mhd.wms.domain.inMaterialDetailSerialNumber.repository.po.InMaterialD import com.mhd.wms.domain.inMaterialDetailSerialNumber.repository.todo.InMaterialDetailSerialNumberDO; import com.mhd.wms.domain.inOrderAbnormal.repository.facade.IInOrderAbnormalService; import com.mhd.wms.domain.inOrderAbnormal.repository.todo.InOrderAbnormalBaseDO; +import com.mhd.wms.domain.inventoryAdjustmentRecord.entity.InventoryAdjustmentRecord; +import com.mhd.wms.domain.inventoryAdjustmentRecord.repository.mapper.InventoryAdjustmentRecordMapper; import com.mhd.wms.domain.inventoryStandingDetail.repository.facade.IInventoryStandingDetailService; import com.mhd.wms.domain.inventoryStandingDetail.repository.todo.InventoryStandingDetailDO; import com.mhd.wms.domain.materialBaseInfo.repository.facade.IMaterialBaseInfoService; @@ -108,6 +110,8 @@ public class StockShelfOrderDomainService { private MaterialInventoryMapper materialInventoryMapper; @Autowired private IMaterialGoodsRuleService materialGoodsRuleService; + @Autowired + private InventoryAdjustmentRecordMapper inventoryAdjustmentRecordMapper; /** * 分页查询上架单列表 @@ -469,13 +473,91 @@ public class StockShelfOrderDomainService { materialInventory.setFreezeQuantity(BigDecimal.ZERO); materialInventoryMapper.insert(materialInventory); + + + //库存调整记录 + LoginUser loginUser = SecurityUtils.getLoginUser(); + InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord(); + inventoryAdjustmentRecord.setAdjustType(0L); + inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId()); + inventoryAdjustmentRecord.setMaterialCode(shelfMaterialDetail.getMaterialCode()); + inventoryAdjustmentRecord.setMaterialName(shelfMaterialDetail.getMaterialName()); + inventoryAdjustmentRecord.setBarCode(shelfMaterialDetail.getBarCode()); + inventoryAdjustmentRecord.setMaterialBaseInfoId(shelfMaterialDetail.getMaterialBaseInfoId()); + inventoryAdjustmentRecord.setOrganizationId(stockReceiptOrderDO.getOrganizationId()); + inventoryAdjustmentRecord.setOrganizationName(stockReceiptOrderDO.getOrganizationName()); + inventoryAdjustmentRecord.setTopOrganizationId(stockReceiptOrderDO.getTopOrganizationId()); + inventoryAdjustmentRecord.setWarehouseCode(stockReceiptOrderDO.getWarehouseCode()); + inventoryAdjustmentRecord.setWarehouseName(stockReceiptOrderDO.getWarehouseName()); + inventoryAdjustmentRecord.setWarehouseId(stockReceiptOrderDO.getWarehouseId()); + inventoryAdjustmentRecord.setStorageCode(materialInventory.getStorageCode()); + inventoryAdjustmentRecord.setStorageName(materialInventory.getStorageName()); + inventoryAdjustmentRecord.setStorageLocationId(materialInventory.getStorageLocationId()); + inventoryAdjustmentRecord.setStorageLocationCode(materialInventory.getStorageLocationCode()); + inventoryAdjustmentRecord.setStorageLocationName(materialInventory.getStorageLocationName()); + inventoryAdjustmentRecord.setMaterialInventoryId(materialInventory.getMaterialInventoryId()); + inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId()); + inventoryAdjustmentRecord.setShipperId(stockReceiptOrderDO.getShipperId()); + inventoryAdjustmentRecord.setShipperName(stockReceiptOrderDO.getShipperName()); + inventoryAdjustmentRecord.setStorageSectionId(materialInventory.getStorageSectionId()); + inventoryAdjustmentRecord.setStorageLocationId(materialInventory.getStorageLocationId()); + inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid()); + inventoryAdjustmentRecord.setCreateByName(loginUser.getUsername()); + inventoryAdjustmentRecord.setCreateTime(new Date()); + inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventory.getAllocationQuantity()); + inventoryAdjustmentRecord.setAllocationBeforeQuantity(BigDecimal.ZERO); + inventoryAdjustmentRecord.setFreezeBeforeQuantity(BigDecimal.ZERO); + inventoryAdjustmentRecord.setFreezeAfterQuantity(BigDecimal.ZERO); + inventoryAdjustmentRecord.setInventoryBeforeQuantity(BigDecimal.ZERO); + inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity()); + inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord); } else if (materialInventoryPOS.size() == 1) { MaterialInventory materialInventory = new MaterialInventory(); MaterialInventoryPO materialInventoryPO = materialInventoryPOS.get(0); - materialInventoryPO.setInventoryQuantity(materialInventoryPO.getInventoryQuantity().add(shelfMaterialDetail.getShelvesQuantity())); - materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity().add(shelfMaterialDetail.getShelvesQuantity())); + BigDecimal newInventoryQuantity = materialInventoryPO.getInventoryQuantity().add(shelfMaterialDetail.getShelvesQuantity()); + BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity(); + BigDecimal newAllocationQuantity = materialInventoryPO.getAllocationQuantity().add(shelfMaterialDetail.getShelvesQuantity()); + BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity(); + materialInventoryPO.setInventoryQuantity(newInventoryQuantity); + materialInventoryPO.setAllocationQuantity(newAllocationQuantity); BeanUtils.copyBeanProp(materialInventoryPO, materialInventory); materialInventoryMapper.updateById(materialInventory); + + LoginUser loginUser = SecurityUtils.getLoginUser(); + InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord(); + inventoryAdjustmentRecord.setAdjustType(0L); + inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId()); + inventoryAdjustmentRecord.setMaterialCode(shelfMaterialDetail.getMaterialCode()); + inventoryAdjustmentRecord.setMaterialName(shelfMaterialDetail.getMaterialName()); + inventoryAdjustmentRecord.setBarCode(shelfMaterialDetail.getBarCode()); + inventoryAdjustmentRecord.setMaterialBaseInfoId(shelfMaterialDetail.getMaterialBaseInfoId()); + inventoryAdjustmentRecord.setOrganizationId(stockReceiptOrderDO.getOrganizationId()); + inventoryAdjustmentRecord.setOrganizationName(stockReceiptOrderDO.getOrganizationName()); + inventoryAdjustmentRecord.setTopOrganizationId(stockReceiptOrderDO.getTopOrganizationId()); + inventoryAdjustmentRecord.setWarehouseCode(stockReceiptOrderDO.getWarehouseCode()); + inventoryAdjustmentRecord.setWarehouseName(stockReceiptOrderDO.getWarehouseName()); + inventoryAdjustmentRecord.setWarehouseId(stockReceiptOrderDO.getWarehouseId()); + inventoryAdjustmentRecord.setStorageCode(materialInventory.getStorageCode()); + inventoryAdjustmentRecord.setStorageName(materialInventory.getStorageName()); + inventoryAdjustmentRecord.setStorageLocationId(materialInventory.getStorageLocationId()); + inventoryAdjustmentRecord.setStorageLocationCode(materialInventory.getStorageLocationCode()); + inventoryAdjustmentRecord.setStorageLocationName(materialInventory.getStorageLocationName()); + inventoryAdjustmentRecord.setMaterialInventoryId(materialInventory.getMaterialInventoryId()); + inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId()); + inventoryAdjustmentRecord.setShipperId(stockReceiptOrderDO.getShipperId()); + inventoryAdjustmentRecord.setShipperName(stockReceiptOrderDO.getShipperName()); + inventoryAdjustmentRecord.setStorageSectionId(materialInventory.getStorageSectionId()); + inventoryAdjustmentRecord.setStorageLocationId(materialInventory.getStorageLocationId()); + inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid()); + inventoryAdjustmentRecord.setCreateByName(loginUser.getUsername()); + inventoryAdjustmentRecord.setCreateTime(new Date()); + inventoryAdjustmentRecord.setAllocationAfterQuantity(newAllocationQuantity); + inventoryAdjustmentRecord.setAllocationBeforeQuantity(oldAllocationQuantity); + inventoryAdjustmentRecord.setFreezeBeforeQuantity(materialInventory.getFreezeQuantity()); + inventoryAdjustmentRecord.setFreezeAfterQuantity(materialInventory.getFreezeQuantity()); + inventoryAdjustmentRecord.setInventoryBeforeQuantity(oldInventoryQuantity); + inventoryAdjustmentRecord.setInventoryAfterQuantity(newInventoryQuantity); + inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord); } } }