库存调整记录查询

This commit is contained in:
zhou-hongcheng
2026-03-09 14:30:59 +08:00
parent b210c08863
commit d7ebb21f3b
3 changed files with 111 additions and 1 deletions
@@ -212,4 +212,36 @@ public class InventoryAdjustmentRecordPO extends BaseVOEntity {
@ApiModelProperty("关联单号")
@Excel(name = "关联单号")
private String relateNo;
@ApiModelProperty("调整前净重(KG)")
@Excel(name = "调整前净重(KG)")
private BigDecimal netWeight;
@ApiModelProperty("调整前毛重(KG)")
@Excel(name = "调整前毛重(KG)")
private BigDecimal grossWeight;
@ApiModelProperty("调整前体积")
@Excel(name = "调整前体积")
private BigDecimal volume;
@ApiModelProperty("调整前面积")
@Excel(name = "调整前面积")
private BigDecimal area;
@ApiModelProperty("调整后净重(KG)")
@Excel(name = "调整后净重(KG)")
private BigDecimal adjustedNetWeight;
@ApiModelProperty("调整后毛重(KG)")
@Excel(name = "调整后毛重(KG)")
private BigDecimal adjustedGrossWeight;
@ApiModelProperty("调整后体积")
@Excel(name = "调整后体积")
private BigDecimal adjustedVolume;
@ApiModelProperty("调整后面积")
@Excel(name = "调整后面积")
private BigDecimal adjustedArea;
}
@@ -3,11 +3,15 @@ package com.mhd.wms.domain.shiftMaterialDetail.repository.persistence;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mhd.common.core.domain.po.UserPo;
import com.mhd.common.core.exception.ServiceException;
import com.mhd.common.core.utils.IgnoreNullUtil;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.domain.cache.SystemServiceCacheUtil;
import com.mhd.system.api.model.LoginUser;
import com.mhd.wms.domain.inventoryAdjustmentRecord.entity.InventoryAdjustmentRecord;
import com.mhd.wms.domain.inventoryAdjustmentRecord.repository.mapper.InventoryAdjustmentRecordMapper;
import com.mhd.wms.domain.investigetionManageDetail.repository.todo.InvestigetionManageDetailDO;
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;
@@ -56,6 +60,9 @@ public class ShiftMaterialDetailImpl extends ServiceImpl<ShiftMaterialDetailMapp
@Autowired
private IOutMaterialDetailSerialNumberService outMaterialDetailSerialNumberService;
@Autowired
private InventoryAdjustmentRecordMapper inventoryAdjustmentRecordMapper;
/**
* 查询移位物料明细列表
@@ -367,6 +374,7 @@ public class ShiftMaterialDetailImpl extends ServiceImpl<ShiftMaterialDetailMapp
if (!CollectionUtils.isEmpty(shiftMaterialDetailListChild)){
shiftMaterialDetailList.addAll(shiftMaterialDetailListChild);
}
InventoryAdjustmentRecord(shiftMaterialDetailDO);
}
//保存物料明细信息
saveOrUpdateBatch(shiftMaterialDetailList);
@@ -376,6 +384,68 @@ public class ShiftMaterialDetailImpl extends ServiceImpl<ShiftMaterialDetailMapp
}
}
private void InventoryAdjustmentRecord(ShiftMaterialDetailDO shiftMaterialDetailDO){
//库存调整记录
Long materialBaseInfoId = shiftMaterialDetailDO.getMaterialInventoryId();//物料库存id
MaterialInventory materialInventory1 = materialInventoryMapper.selectById(materialBaseInfoId);
LoginUser loginUser = SecurityUtils.getLoginUser();
InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
inventoryAdjustmentRecord.setNetWeight(materialInventory1.getNetWeight() == null ? BigDecimal.ZERO : materialInventory1.getNetWeight());
inventoryAdjustmentRecord.setGrossWeight(materialInventory1.getGrossWeight() == null ? BigDecimal.ZERO : materialInventory1.getGrossWeight());
inventoryAdjustmentRecord.setVolume(materialInventory1.getVolume() == null ? BigDecimal.ZERO : materialInventory1.getVolume());
inventoryAdjustmentRecord.setArea(materialInventory1.getArea() == null ? BigDecimal.ZERO : materialInventory1.getArea());
inventoryAdjustmentRecord.setAdjustedNetWeight(shiftMaterialDetailDO.getNetWeight() == null ? BigDecimal.ZERO : shiftMaterialDetailDO.getNetWeight());
inventoryAdjustmentRecord.setAdjustedGrossWeight(shiftMaterialDetailDO.getGrossWeight() == null ? BigDecimal.ZERO : shiftMaterialDetailDO.getGrossWeight());
inventoryAdjustmentRecord.setAdjustedVolume(shiftMaterialDetailDO.getVolume() == null ? BigDecimal.ZERO : shiftMaterialDetailDO.getVolume());
inventoryAdjustmentRecord.setAdjustedArea(shiftMaterialDetailDO.getArea() == null ? BigDecimal.ZERO : shiftMaterialDetailDO.getArea());
inventoryAdjustmentRecord.setAdjustAction("移位管理");
inventoryAdjustmentRecord.setRelateNo(shiftMaterialDetailDO.getShiftNumber());
inventoryAdjustmentRecord.setAdjustAfterStatusCode("he_ge");
inventoryAdjustmentRecord.setAdjustBeforeStatusCode("he_ge");
inventoryAdjustmentRecord.setAdjustAfterStatusName("合格");
inventoryAdjustmentRecord.setAdjustBeforeStatusName("合格");
inventoryAdjustmentRecord.setMaterialBaseInfoId(shiftMaterialDetailDO.getMaterialBaseInfoId());
inventoryAdjustmentRecord.setMaterialCode(shiftMaterialDetailDO.getBarCode());
inventoryAdjustmentRecord.setMaterialName(shiftMaterialDetailDO.getMaterialName());
inventoryAdjustmentRecord.setBarCode(shiftMaterialDetailDO.getBarCode());
inventoryAdjustmentRecord.setMaterialBaseInfoId(shiftMaterialDetailDO.getMaterialBaseInfoId());
inventoryAdjustmentRecord.setAdjustType(1L);
inventoryAdjustmentRecord.setOrganizationId(shiftMaterialDetailDO.getOrganizationId());
inventoryAdjustmentRecord.setOrganizationName(shiftMaterialDetailDO.getOrganizationName());
inventoryAdjustmentRecord.setTopOrganizationId(shiftMaterialDetailDO.getTopOrganizationId());
inventoryAdjustmentRecord.setWarehouseCode(shiftMaterialDetailDO.getOldWarehouseCode());
inventoryAdjustmentRecord.setWarehouseName(shiftMaterialDetailDO.getOldWarehouseName());
inventoryAdjustmentRecord.setWarehouseId(shiftMaterialDetailDO.getOldWarehouseId());
inventoryAdjustmentRecord.setStorageCode(shiftMaterialDetailDO.getOldStorageCode());
inventoryAdjustmentRecord.setStorageName(shiftMaterialDetailDO.getOldStorageName());
inventoryAdjustmentRecord.setStorageLocationId(shiftMaterialDetailDO.getOldStorageLocationId());
inventoryAdjustmentRecord.setStorageLocationCode(shiftMaterialDetailDO.getOldStorageLocationCode());
inventoryAdjustmentRecord.setStorageLocationName(shiftMaterialDetailDO.getOldStorageLocationName());
inventoryAdjustmentRecord.setMaterialInventoryId(shiftMaterialDetailDO.getMaterialInventoryId());
inventoryAdjustmentRecord.setMaterialBaseInfoId(shiftMaterialDetailDO.getMaterialBaseInfoId());
MaterialInventory materialInventory = materialInventoryService.getById(shiftMaterialDetailDO.getMaterialInventoryId());
inventoryAdjustmentRecord.setShipperId(materialInventory.getShipperId());
inventoryAdjustmentRecord.setShipperName(materialInventory.getShipperName());
inventoryAdjustmentRecord.setStorageSectionId(shiftMaterialDetailDO.getOldStorageSectionId());
inventoryAdjustmentRecord.setStorageLocationId(shiftMaterialDetailDO.getOldStorageLocationId());
inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
UserPo userPo = loginUser.getUserPo();
if (userPo != null) inventoryAdjustmentRecord.setCreateByName(userPo.getUserName());
inventoryAdjustmentRecord.setCreateTime(new Date());
inventoryAdjustmentRecord.setInventoryBeforeQuantity(BigDecimal.ZERO);
inventoryAdjustmentRecord.setInventoryAfterQuantity(shiftMaterialDetailDO.getShiftQuantity());
// inventoryAdjustmentRecord.setAllocationAfterQuantity();
// inventoryAdjustmentRecord.setAllocationBeforeQuantity();
// inventoryAdjustmentRecord.setFreezeBeforeQuantity();
// inventoryAdjustmentRecord.setFreezeAfterQuantity();
inventoryAdjustmentRecord.setInventoryBeforeQuantity(shiftMaterialDetailDO.getInventoryQuantity());
inventoryAdjustmentRecord.setInventoryAfterQuantity(shiftMaterialDetailDO.getInventoryQuantity().subtract(shiftMaterialDetailDO.getShiftQuantity()));
inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
}
/**
* @description 生成流水号
* @author ZhouGY
@@ -67,7 +67,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.adjust_before_status_name, a.adjust_after_status_code, a.adjust_after_status_name, a.inventory_before_quantity,
a.allocation_before_quantity, a.freeze_before_quantity, a.inventory_after_quantity, a.allocation_after_quantity,
a.freeze_after_quantity, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name,
a.del_flag,b.ext_attr_1, b.ext_attr_2, b.ext_attr_3, b.ext_attr_4,
a.del_flag,a.net_weight,
a.gross_weight,
a.volume,
a.area,
a.adjusted_net_weight,
a.adjusted_gross_weight,
a.adjusted_volume,
a.adjusted_area,
b.ext_attr_1, b.ext_attr_2, b.ext_attr_3, b.ext_attr_4,
b.production_date, b.expiry_date, b.inventory_date,
b.batch_ref_no, b.sheet_ref_no, b.box_pallet_no,a.ADJUST_ACTION,a.RELATE_NO
from inventory_adjustment_record a left join material_inventory b on a.material_inventory_id = b.material_inventory_id