库存调整记录修改;

This commit is contained in:
王奎兴
2026-01-28 15:15:46 +08:00
parent dc09743357
commit 04ed2148a7
2 changed files with 49 additions and 5 deletions
@@ -193,7 +193,7 @@ public class HandoverTaskOrderDomainService {
inventoryAdjustmentRecord.setMaterialName(outMaterialDetail.getCommodityName());
inventoryAdjustmentRecord.setBarCode(outMaterialDetail.getBarCode());
inventoryAdjustmentRecord.setMaterialBaseInfoId(outMaterialDetail.getMaterialBaseInfoId());
inventoryAdjustmentRecord.setAdjustType(0L);
inventoryAdjustmentRecord.setOrganizationId(stockOutOrder.getOrganizationId());
inventoryAdjustmentRecord.setOrganizationName(stockOutOrder.getOrganizationName());
inventoryAdjustmentRecord.setTopOrganizationId(stockOutOrder.getTopOrganizationId());
@@ -330,6 +330,7 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
//库存调整记录
InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
inventoryAdjustmentRecord.setAdjustType(0L);
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
inventoryAdjustmentRecord.setMaterialCode(outMaterialDetail.getMaterialNo());
inventoryAdjustmentRecord.setMaterialName(outMaterialDetail.getCommodityName());
@@ -458,6 +459,12 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
updateBatchById(outMaterialDetailList);
//取消分配
qxfp(outMaterialDetailList,outOrderNumber,loginUser);
return stockOutOrderPO;
}
private synchronized void qxfp(List<OutMaterialDetail> outMaterialDetailList,String outOrderNumber,LoginUser loginUser) {
StockOutOrder stockOutOrder = stockOutOrderMapper.selectOne(new QueryWrapper<StockOutOrder>().lambda().eq(StockOutOrder::getOutOrderNumber, outOrderNumber));
for (OutMaterialDetail outMaterialDetail : outMaterialDetailList) {
Long materialInventoryId = outMaterialDetail.getMaterialInventoryId();
BigDecimal allocationQuantity = outMaterialDetail.getAllocationQuantity();
@@ -474,12 +481,49 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(allocationQuantity);
materialInventoryPO.setAllocationQuantity(newAllocationQuantity);
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
MaterialInventory materialInventory = new MaterialInventory();
BeanUtils.copyProperties(materialInventoryPO, materialInventory);
materialInventoryMapper.updateById(materialInventory);
//MaterialInventory materialInventory = new MaterialInventory();
//BeanUtils.copyProperties(materialInventoryPO, materialInventory);
materialInventoryMapper.updateById(materialInventoryPO);
//库存调整记录
InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
inventoryAdjustmentRecord.setAdjustType(0L);
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
inventoryAdjustmentRecord.setMaterialCode(outMaterialDetail.getMaterialNo());
inventoryAdjustmentRecord.setMaterialName(outMaterialDetail.getCommodityName());
inventoryAdjustmentRecord.setBarCode(outMaterialDetail.getBarCode());
inventoryAdjustmentRecord.setMaterialBaseInfoId(outMaterialDetail.getMaterialBaseInfoId());
inventoryAdjustmentRecord.setOrganizationId(stockOutOrder.getOrganizationId());
inventoryAdjustmentRecord.setOrganizationName(stockOutOrder.getOrganizationName());
inventoryAdjustmentRecord.setTopOrganizationId(stockOutOrder.getTopOrganizationId());
inventoryAdjustmentRecord.setWarehouseCode(stockOutOrder.getWarehouseCode());
inventoryAdjustmentRecord.setWarehouseName(stockOutOrder.getWarehouseName());
inventoryAdjustmentRecord.setWarehouseId(stockOutOrder.getWarehouseId());
inventoryAdjustmentRecord.setStorageCode(materialInventoryPO.getStorageCode());
inventoryAdjustmentRecord.setStorageName(materialInventoryPO.getStorageName());
inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
inventoryAdjustmentRecord.setStorageLocationCode(materialInventoryPO.getStorageLocationCode());
inventoryAdjustmentRecord.setStorageLocationName(materialInventoryPO.getStorageLocationName());
inventoryAdjustmentRecord.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
inventoryAdjustmentRecord.setShipperId(stockOutOrder.getShipperId());
inventoryAdjustmentRecord.setShipperName(stockOutOrder.getShipperName());
inventoryAdjustmentRecord.setStorageSectionId(materialInventoryPO.getStorageSectionId());
inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
inventoryAdjustmentRecord.setCreateByName(loginUser.getUsername());
inventoryAdjustmentRecord.setCreateTime(new Date());
inventoryAdjustmentRecord.setAllocationAfterQuantity(newAllocationQuantity);
inventoryAdjustmentRecord.setAllocationBeforeQuantity(oldAllocationQuantity);
inventoryAdjustmentRecord.setFreezeBeforeQuantity(oldFreezeQuantity);
inventoryAdjustmentRecord.setFreezeAfterQuantity(newFreezeQuantity);
inventoryAdjustmentRecord.setInventoryBeforeQuantity(materialInventoryPO.getInventoryQuantity());
inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventoryPO.getInventoryQuantity());
inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
}
}
return stockOutOrderPO;
}
/**