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.QueryOrderOverStockDO;
import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailBaseDO; import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailBaseDO;
import com.mhd.oms.domain.reservationInMaterialDetail.repository.todo.ReservationInMaterialDetailDO; 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 com.mhd.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -47,6 +49,9 @@ public class ReservationInMaterialDetailImpl extends ServiceImpl<ReservationInMa
@Autowired @Autowired
private IdGenerator idGenerator; private IdGenerator idGenerator;
@Autowired
private IReservationMaterialInventoryService reservationMaterialInventoryService;
/** /**
* 查询物料明细列表 * 查询物料明细列表
@@ -155,9 +160,30 @@ public class ReservationInMaterialDetailImpl extends ServiceImpl<ReservationInMa
} }
inMaterialDetailList.add(inMaterialDetail); inMaterialDetailList.add(inMaterialDetail);
} }
//插入库存表
putIntoInventory(inMaterialDetailList);
return saveBatch(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 批量修改物流明细 * @description 批量修改物流明细
* @author ZhouGY * @author ZhouGY
@@ -27,7 +27,7 @@ public class ReservationMaterialInventory extends BaseVOEntity {
@ApiModelProperty("物料库存id") @ApiModelProperty("物料库存id")
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
private Long materialInventoryId; private Long reservationMaterialInventoryId;
@ApiModelProperty("组织表ID") @ApiModelProperty("组织表ID")
@Excel(name = "组织表ID") @Excel(name = "组织表ID")
@@ -100,7 +100,7 @@ public class ReservationMaterialInventoryImpl extends ServiceImpl<ReservationMat
List<ReservationMaterialInventory> list = new ArrayList<>(); List<ReservationMaterialInventory> list = new ArrayList<>();
for (Long id : materialInventoryIds) { for (Long id : materialInventoryIds) {
ReservationMaterialInventory materialInventory = new ReservationMaterialInventory(); ReservationMaterialInventory materialInventory = new ReservationMaterialInventory();
materialInventory.setMaterialInventoryId(id); materialInventory.setReservationMaterialInventoryId(id);
materialInventory.setDelFlag(2); materialInventory.setDelFlag(2);
list.add(materialInventory); list.add(materialInventory);
} }
@@ -133,7 +133,7 @@ public class ReservationMaterialInventoryImpl extends ServiceImpl<ReservationMat
.eq(ReservationMaterialInventory::getWarehouseId, warehouseId)); .eq(ReservationMaterialInventory::getWarehouseId, warehouseId));
if (reservationMaterialInventories != null && reservationMaterialInventories.size() > 0) { if (reservationMaterialInventories != null && reservationMaterialInventories.size() > 0) {
ReservationMaterialInventory reservationMaterialInventory = reservationMaterialInventories.get(0); ReservationMaterialInventory reservationMaterialInventory = reservationMaterialInventories.get(0);
Long materialInventoryId = reservationMaterialInventory.getMaterialInventoryId(); Long materialInventoryId = reservationMaterialInventory.getReservationMaterialInventoryId();
materialInventoryOmsParamDO.setMaterialInventoryId(materialInventoryId); materialInventoryOmsParamDO.setMaterialInventoryId(materialInventoryId);
} }
kctzjl(materialInventoryOmsParamDO, materialInventoryOmsParamDO.getKctzType(), materialInventoryOmsParamDO.getLoginUser()); kctzjl(materialInventoryOmsParamDO, materialInventoryOmsParamDO.getKctzType(), materialInventoryOmsParamDO.getLoginUser());
@@ -211,7 +211,7 @@ public class ReservationMaterialInventoryImpl extends ServiceImpl<ReservationMat
//库存调整记录(在 xgkc 更新库存前调用,materialInventory 为调整前快照) //库存调整记录(在 xgkc 更新库存前调用,materialInventory 为调整前快照)
Long materialInventoryId = materialInventoryParamDO.getMaterialInventoryId(); Long materialInventoryId = materialInventoryParamDO.getMaterialInventoryId();
ReservationMaterialInventory materialInventory = materialInventoryMapper.selectOne(new QueryWrapper<ReservationMaterialInventory>().lambda() ReservationMaterialInventory materialInventory = materialInventoryMapper.selectOne(new QueryWrapper<ReservationMaterialInventory>().lambda()
.eq(ReservationMaterialInventory::getMaterialInventoryId, materialInventoryId)); .eq(ReservationMaterialInventory::getReservationMaterialInventoryId, materialInventoryId));
if (materialInventory == null) { if (materialInventory == null) {
throw new ServiceException("物料库存不存在,无法生成库存调整记录"); throw new ServiceException("物料库存不存在,无法生成库存调整记录");
} }
@@ -258,7 +258,7 @@ public class ReservationMaterialInventoryImpl extends ServiceImpl<ReservationMat
inventoryAdjustmentRecord.setStorageLocationId(materialInventory.getStorageLocationId()); inventoryAdjustmentRecord.setStorageLocationId(materialInventory.getStorageLocationId());
inventoryAdjustmentRecord.setStorageLocationCode(materialInventory.getStorageLocationCode()); inventoryAdjustmentRecord.setStorageLocationCode(materialInventory.getStorageLocationCode());
inventoryAdjustmentRecord.setStorageLocationName(materialInventory.getStorageLocationName()); inventoryAdjustmentRecord.setStorageLocationName(materialInventory.getStorageLocationName());
inventoryAdjustmentRecord.setMaterialInventoryId(materialInventory.getMaterialInventoryId()); inventoryAdjustmentRecord.setMaterialInventoryId(materialInventory.getReservationMaterialInventoryId());
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId()); inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId());
inventoryAdjustmentRecord.setStorageSectionId(materialInventory.getStorageSectionId()); inventoryAdjustmentRecord.setStorageSectionId(materialInventory.getStorageSectionId());
inventoryAdjustmentRecord.setStorageLocationId(materialInventory.getStorageLocationId()); inventoryAdjustmentRecord.setStorageLocationId(materialInventory.getStorageLocationId());
@@ -484,7 +484,7 @@ public class ReservationMaterialInventoryImpl extends ServiceImpl<ReservationMat
materialInventory.setBatchNumber((materialInventoryParamDO.getBatchNumber())); materialInventory.setBatchNumber((materialInventoryParamDO.getBatchNumber()));
materialInventory.setInOrderNumber((materialInventoryParamDO.getInOrderNumber())); materialInventory.setInOrderNumber((materialInventoryParamDO.getInOrderNumber()));
materialInventoryMapper.insert(materialInventory); materialInventoryMapper.insert(materialInventory);
materialInventoryParamDO.setMaterialInventoryId(materialInventory.getMaterialInventoryId()); materialInventoryParamDO.setMaterialInventoryId(materialInventory.getReservationMaterialInventoryId());
} else { } else {
ReservationMaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId); ReservationMaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
if (materialInventoryPO != null) { if (materialInventoryPO != null) {
@@ -6,12 +6,17 @@ import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication @SpringBootApplication
@EnableRyFeignClients @EnableRyFeignClients
@EnableDiscoveryClient @EnableDiscoveryClient
@MapperScan("com.mhd.wms.domain.**.mapper") @MapperScan("com.mhd.wms.domain.**.mapper")
@EnableMethodCache(basePackages = "com.mhd.platform.domain.**.cache") @EnableMethodCache(basePackages = "com.mhd.platform.domain.**.cache")
@ComponentScan(basePackages = {
"com.mhd.wms",
"com.mhd.system.api.factory"
})
public class MhdWmsApplication { public class MhdWmsApplication {
public static void main(String[] args) { public static void main(String[] args) {