库存及调整记录 添加创建人信息;

This commit is contained in:
王奎兴
2026-02-03 09:44:37 +08:00
parent 3c3f6a2bc8
commit b34b7d8792
@@ -428,6 +428,7 @@ public class StockShelfOrderDomainService {
Long shipperId = stockReceiptOrderDO.getShipperId();
MaterialInventory param = getParam(shelfMaterialDetail, fieldNames, shipperId);
List<MaterialInventoryPO> materialInventoryPOS = materialInventoryMapper.selectListByWhere(param);
LoginUser loginUser = SecurityUtils.getLoginUser();
if (materialInventoryPOS.size() == 0) {
MaterialInventory materialInventory = new MaterialInventory();
//仓库信息
@@ -472,11 +473,15 @@ public class StockShelfOrderDomainService {
materialInventory.setAllocationQuantity(shelfMaterialDetail.getShelvesQuantity());
materialInventory.setFreezeQuantity(BigDecimal.ZERO);
//创建人信息
materialInventory.setCreateBy(loginUser.getUserid());
materialInventory.setCreateByName(loginUser.getUsername());
materialInventory.setCreateTime(new Date());
materialInventoryMapper.insert(materialInventory);
//库存调整记录
LoginUser loginUser = SecurityUtils.getLoginUser();
InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
inventoryAdjustmentRecord.setAdjustType(0L);
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId());
@@ -510,6 +515,9 @@ public class StockShelfOrderDomainService {
inventoryAdjustmentRecord.setFreezeAfterQuantity(BigDecimal.ZERO);
inventoryAdjustmentRecord.setInventoryBeforeQuantity(BigDecimal.ZERO);
inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity());
inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
inventoryAdjustmentRecord.setCreateByName(loginUser.getUsername());
inventoryAdjustmentRecord.setCreateTime(new Date());
inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
} else if (materialInventoryPOS.size() == 1) {
MaterialInventory materialInventory = new MaterialInventory();
@@ -521,9 +529,12 @@ public class StockShelfOrderDomainService {
materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
materialInventoryPO.setAllocationQuantity(newAllocationQuantity);
BeanUtils.copyBeanProp(materialInventoryPO, materialInventory);
materialInventory.setUpdateBy(loginUser.getUserid());
materialInventory.setUpdateByName(loginUser.getUsername());
materialInventory.setUpdateTime(new Date());
materialInventoryMapper.updateById(materialInventory);
LoginUser loginUser = SecurityUtils.getLoginUser();
InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
inventoryAdjustmentRecord.setAdjustType(0L);
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId());
@@ -557,6 +568,9 @@ public class StockShelfOrderDomainService {
inventoryAdjustmentRecord.setFreezeAfterQuantity(materialInventory.getFreezeQuantity());
inventoryAdjustmentRecord.setInventoryBeforeQuantity(oldInventoryQuantity);
inventoryAdjustmentRecord.setInventoryAfterQuantity(newInventoryQuantity);
inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
inventoryAdjustmentRecord.setCreateByName(loginUser.getUsername());
inventoryAdjustmentRecord.setCreateTime(new Date());
inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
}
}