oms入库存入库存

This commit is contained in:
zhou-hongcheng
2026-04-23 14:22:48 +08:00
parent b5bc44a619
commit 6bdbaa0fda
4 changed files with 37 additions and 6 deletions
@@ -16,6 +16,8 @@ import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.InventoryA
import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.QueryOrderOverStockDO;
import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailBaseDO;
import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDO;
import com.mhd.oms.domain.reservationMaterialInventory.entity.ReservationMaterialInventory;
import com.mhd.oms.domain.reservationMaterialInventory.repository.facade.IReservationMaterialInventoryService;
import com.mhd.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -47,6 +49,9 @@ public class ReservationInMaterialDetailImpl extends ServiceImpl<ReservationInMa
@Autowired
private IdGenerator idGenerator;
@Autowired
private IReservationMaterialInventoryService reservationMaterialInventoryService;
/**
* 查询物料明细列表
@@ -155,9 +160,30 @@ public class ReservationInMaterialDetailImpl extends ServiceImpl<ReservationInMa
}
inMaterialDetailList.add(inMaterialDetail);
}
//插入库存表
putIntoInventory(inMaterialDetailList);
return saveBatch(inMaterialDetailList);
}
private void putIntoInventory(List<ReservationInMaterialDetail> inMaterialDetailList) {
for (ReservationInMaterialDetail reservationInMaterialDetail : inMaterialDetailList) {
ReservationMaterialInventory reservationMaterialInventory = new ReservationMaterialInventory();
BeanUtils.copyProperties(reservationInMaterialDetail, reservationMaterialInventory);
reservationMaterialInventory.setLotNumber(reservationInMaterialDetail.getLotNo());
UpdateWrapper<ReservationMaterialInventory> updateWrapper = new UpdateWrapper<>();
updateWrapper.lambda()
.eq(reservationMaterialInventory.getShipperId() != null,ReservationMaterialInventory::getShipperId, reservationMaterialInventory.getShipperId())
.eq(reservationMaterialInventory.getWarehouseId() != null,ReservationMaterialInventory::getWarehouseId, reservationMaterialInventory.getWarehouseId())
.eq(reservationMaterialInventory.getMaterialBaseInfoId() != null,ReservationMaterialInventory::getMaterialBaseInfoId, reservationMaterialInventory.getMaterialBaseInfoId())
.eq(reservationMaterialInventory.getInOrderNumber() != null,ReservationMaterialInventory::getInOrderNumber, reservationMaterialInventory.getInOrderNumber())
.eq(reservationMaterialInventory.getLotNumber() != null,ReservationMaterialInventory::getLotNumber, reservationMaterialInventory.getLotNumber())
.eq(reservationMaterialInventory.getBatchNumber() != null,ReservationMaterialInventory::getBatchNumber, reservationMaterialInventory.getBatchNumber())
;
reservationMaterialInventoryService.saveOrUpdate(reservationMaterialInventory,updateWrapper);
}
}
/**
* @description 批量修改物流明细
* @author ZhouGY
@@ -27,7 +27,7 @@ public class ReservationMaterialInventory extends BaseVOEntity {
@ApiModelProperty("物料库存id")
@TableId(type = IdType.AUTO)
private Long materialInventoryId;
private Long reservationMaterialInventoryId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
@@ -100,7 +100,7 @@ public class ReservationMaterialInventoryImpl extends ServiceImpl<ReservationMat
List<ReservationMaterialInventory> list = new ArrayList<>();
for (Long id : materialInventoryIds) {
ReservationMaterialInventory materialInventory = new ReservationMaterialInventory();
materialInventory.setMaterialInventoryId(id);
materialInventory.setReservationMaterialInventoryId(id);
materialInventory.setDelFlag(2);
list.add(materialInventory);
}
@@ -133,7 +133,7 @@ public class ReservationMaterialInventoryImpl extends ServiceImpl<ReservationMat
.eq(ReservationMaterialInventory::getWarehouseId, warehouseId));
if (reservationMaterialInventories != null && reservationMaterialInventories.size() > 0) {
ReservationMaterialInventory reservationMaterialInventory = reservationMaterialInventories.get(0);
Long materialInventoryId = reservationMaterialInventory.getMaterialInventoryId();
Long materialInventoryId = reservationMaterialInventory.getReservationMaterialInventoryId();
materialInventoryOmsParamDO.setMaterialInventoryId(materialInventoryId);
}
kctzjl(materialInventoryOmsParamDO, materialInventoryOmsParamDO.getKctzType(), materialInventoryOmsParamDO.getLoginUser());
@@ -211,7 +211,7 @@ public class ReservationMaterialInventoryImpl extends ServiceImpl<ReservationMat
//库存调整记录(在 xgkc 更新库存前调用,materialInventory 为调整前快照)
Long materialInventoryId = materialInventoryParamDO.getMaterialInventoryId();
ReservationMaterialInventory materialInventory = materialInventoryMapper.selectOne(new QueryWrapper<ReservationMaterialInventory>().lambda()
.eq(ReservationMaterialInventory::getMaterialInventoryId, materialInventoryId));
.eq(ReservationMaterialInventory::getReservationMaterialInventoryId, materialInventoryId));
if (materialInventory == null) {
throw new ServiceException("物料库存不存在,无法生成库存调整记录");
}
@@ -258,7 +258,7 @@ public class ReservationMaterialInventoryImpl extends ServiceImpl<ReservationMat
inventoryAdjustmentRecord.setStorageLocationId(materialInventory.getStorageLocationId());
inventoryAdjustmentRecord.setStorageLocationCode(materialInventory.getStorageLocationCode());
inventoryAdjustmentRecord.setStorageLocationName(materialInventory.getStorageLocationName());
inventoryAdjustmentRecord.setMaterialInventoryId(materialInventory.getMaterialInventoryId());
inventoryAdjustmentRecord.setMaterialInventoryId(materialInventory.getReservationMaterialInventoryId());
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId());
inventoryAdjustmentRecord.setStorageSectionId(materialInventory.getStorageSectionId());
inventoryAdjustmentRecord.setStorageLocationId(materialInventory.getStorageLocationId());
@@ -484,7 +484,7 @@ public class ReservationMaterialInventoryImpl extends ServiceImpl<ReservationMat
materialInventory.setBatchNumber((materialInventoryParamDO.getBatchNumber()));
materialInventory.setInOrderNumber((materialInventoryParamDO.getInOrderNumber()));
materialInventoryMapper.insert(materialInventory);
materialInventoryParamDO.setMaterialInventoryId(materialInventory.getMaterialInventoryId());
materialInventoryParamDO.setMaterialInventoryId(materialInventory.getReservationMaterialInventoryId());
} else {
ReservationMaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
if (materialInventoryPO != null) {