差异过账生成库存调整记录

This commit is contained in:
zhou-hongcheng
2026-03-05 16:19:34 +08:00
parent e7e5fb0101
commit 5ae7149ea5
@@ -12,11 +12,14 @@ import com.mhd.wms.domain.differentManage.repository.facade.IDifferentManageServ
import com.mhd.wms.domain.differentManage.repository.mapper.DifferentManageMapper; import com.mhd.wms.domain.differentManage.repository.mapper.DifferentManageMapper;
import com.mhd.wms.domain.differentManage.repository.po.DifferentManagePO; import com.mhd.wms.domain.differentManage.repository.po.DifferentManagePO;
import com.mhd.wms.domain.differentManage.repository.todo.DifferentManageDO; import com.mhd.wms.domain.differentManage.repository.todo.DifferentManageDO;
import com.mhd.wms.domain.inventoryAdjustmentRecord.entity.InventoryAdjustmentRecord;
import com.mhd.wms.domain.inventoryAdjustmentRecord.repository.mapper.InventoryAdjustmentRecordMapper;
import com.mhd.wms.domain.investigationManage.entity.InvestigationManage; import com.mhd.wms.domain.investigationManage.entity.InvestigationManage;
import com.mhd.wms.domain.investigetionManageDetail.entity.InvestigetionManageDetail; import com.mhd.wms.domain.investigetionManageDetail.entity.InvestigetionManageDetail;
import com.mhd.wms.domain.investigetionManageDetail.repository.mapper.InvestigetionManageDetailMapper; import com.mhd.wms.domain.investigetionManageDetail.repository.mapper.InvestigetionManageDetailMapper;
import com.mhd.wms.domain.investigetionManageDetail.repository.todo.InvestigetionManageDetailDO; import com.mhd.wms.domain.investigetionManageDetail.repository.todo.InvestigetionManageDetailDO;
import com.mhd.wms.domain.materialInventory.entity.MaterialInventory; import com.mhd.wms.domain.materialInventory.entity.MaterialInventory;
import com.mhd.wms.domain.materialInventory.repository.facade.IMaterialInventoryService;
import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryMapper; import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryMapper;
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO; import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO;
import com.mhd.wms.enums.StatusInvestigationEnum; import com.mhd.wms.enums.StatusInvestigationEnum;
@@ -55,6 +58,12 @@ public class DifferentManageImpl extends ServiceImpl<DifferentManageMapper, Diff
@Autowired @Autowired
private MaterialInventoryMapper materialInventoryMapper; private MaterialInventoryMapper materialInventoryMapper;
@Autowired
private InventoryAdjustmentRecordMapper inventoryAdjustmentRecordMapper;
@Autowired
private IMaterialInventoryService materialInventoryService;
/** /**
* 查询差异单列表 * 查询差异单列表
*/ */
@@ -179,13 +188,61 @@ public class DifferentManageImpl extends ServiceImpl<DifferentManageMapper, Diff
if (e.getInvestigationStatus() != 3){ // 库存更新 if (e.getInvestigationStatus() != 3){ // 库存更新
materialInventory = materialInventoryMapper.selectById(e.getMaterialInventoryId()); materialInventory = materialInventoryMapper.selectById(e.getMaterialInventoryId());
materialInventory.setInventoryQuantity(e.getInvestigationQuantity()); materialInventory.setInventoryQuantity(e.getInvestigationQuantity());
} }
InventoryAdjustmentRecord(e);
materialInventoryMapper.updateMaterial(JSONUtil.toBean(JSONUtil.toJsonStr(materialInventory), MaterialInventoryDO.class)); materialInventoryMapper.updateMaterial(JSONUtil.toBean(JSONUtil.toJsonStr(materialInventory), MaterialInventoryDO.class));
}); });
return true; return true;
} }
private void InventoryAdjustmentRecord(InvestigetionManageDetailDO investigetionManageDetailDO){
//库存调整记录
LoginUser loginUser = SecurityUtils.getLoginUser();
InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
inventoryAdjustmentRecord.setAdjustAction("差异过账");
inventoryAdjustmentRecord.setRelateNo(investigetionManageDetailDO.getInvestigationNumber());
inventoryAdjustmentRecord.setAdjustAfterStatusCode("he_ge");
inventoryAdjustmentRecord.setAdjustBeforeStatusCode("he_ge");
inventoryAdjustmentRecord.setAdjustAfterStatusName("合格");
inventoryAdjustmentRecord.setAdjustBeforeStatusName("合格");
inventoryAdjustmentRecord.setMaterialBaseInfoId(investigetionManageDetailDO.getMaterialBaseInfoId());
inventoryAdjustmentRecord.setMaterialCode(investigetionManageDetailDO.getBarCode());
inventoryAdjustmentRecord.setMaterialName(investigetionManageDetailDO.getMaterialName());
inventoryAdjustmentRecord.setBarCode(investigetionManageDetailDO.getBarCode());
inventoryAdjustmentRecord.setMaterialBaseInfoId(investigetionManageDetailDO.getMaterialBaseInfoId());
inventoryAdjustmentRecord.setAdjustType(1L);
inventoryAdjustmentRecord.setOrganizationId(investigetionManageDetailDO.getOrganizationId());
inventoryAdjustmentRecord.setOrganizationName(investigetionManageDetailDO.getOrganizationName());
inventoryAdjustmentRecord.setTopOrganizationId(investigetionManageDetailDO.getTopOrganizationId());
inventoryAdjustmentRecord.setWarehouseCode(investigetionManageDetailDO.getWarehouseCode());
inventoryAdjustmentRecord.setWarehouseName(investigetionManageDetailDO.getWarehouseName());
inventoryAdjustmentRecord.setWarehouseId(investigetionManageDetailDO.getWarehouseId());
inventoryAdjustmentRecord.setStorageCode(investigetionManageDetailDO.getStorageCode());
inventoryAdjustmentRecord.setStorageName(investigetionManageDetailDO.getStorageName());
inventoryAdjustmentRecord.setStorageLocationId(investigetionManageDetailDO.getStorageLocationId());
inventoryAdjustmentRecord.setStorageLocationCode(investigetionManageDetailDO.getStorageLocationCode());
inventoryAdjustmentRecord.setStorageLocationName(investigetionManageDetailDO.getStorageLocationName());
inventoryAdjustmentRecord.setMaterialInventoryId(investigetionManageDetailDO.getMaterialInventoryId());
inventoryAdjustmentRecord.setMaterialBaseInfoId(investigetionManageDetailDO.getMaterialBaseInfoId());
MaterialInventory materialInventory = materialInventoryService.getById(investigetionManageDetailDO.getMaterialInventoryId());
inventoryAdjustmentRecord.setShipperId(materialInventory.getShipperId());
inventoryAdjustmentRecord.setShipperName(materialInventory.getShipperName());
inventoryAdjustmentRecord.setStorageSectionId(investigetionManageDetailDO.getStorageSectionId());
inventoryAdjustmentRecord.setStorageLocationId(investigetionManageDetailDO.getStorageLocationId());
inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
UserPo userPo = loginUser.getUserPo();
if (userPo != null) inventoryAdjustmentRecord.setCreateByName(userPo.getUserName());
inventoryAdjustmentRecord.setCreateTime(new Date());
// inventoryAdjustmentRecord.setAllocationAfterQuantity();
// inventoryAdjustmentRecord.setAllocationBeforeQuantity();
// inventoryAdjustmentRecord.setFreezeBeforeQuantity();
// inventoryAdjustmentRecord.setFreezeAfterQuantity();
inventoryAdjustmentRecord.setInventoryBeforeQuantity(investigetionManageDetailDO.getInventoryQuantity());
inventoryAdjustmentRecord.setInventoryAfterQuantity(investigetionManageDetailDO.getInvestigationQuantity());
inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
}
@Override @Override
public DifferentManagePO getDifferentManageDO(Long differentManageId) { public DifferentManagePO getDifferentManageDO(Long differentManageId) {
DifferentManage differentManage = differentManageMapper.selectById(differentManageId); DifferentManage differentManage = differentManageMapper.selectById(differentManageId);