|
|
|
@ -2254,7 +2254,6 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
//不一样
|
|
|
|
|
return 10; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//绑定码
|
|
|
|
|
disStockListDetail.setStockPackageCode(stockupDTO.getPacketBarCode()); |
|
|
|
|
disStockListDetail.setId(list1.get(0).getId()); |
|
|
|
@ -2920,4 +2919,124 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
return stockConfigInfoVO; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 处理背货有包件库存品信息 |
|
|
|
|
* @param stockupDTO |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public R handlingPackages(StockupDTO stockupDTO) { |
|
|
|
|
//查询包件是不是属于该货位
|
|
|
|
|
WarehouseUpdownGoodsEntity warehouseUpdownGoods = new WarehouseUpdownGoodsEntity(); |
|
|
|
|
warehouseUpdownGoods.setAllocationId(stockupDTO.getAllocationId()); |
|
|
|
|
warehouseUpdownGoods.setAssociationType("3"); |
|
|
|
|
warehouseUpdownGoods.setAssociationValue(stockupDTO.getPacketBarCode()); |
|
|
|
|
warehouseUpdownGoods.setWarehouseId(stockupDTO.getWarehouseId()); |
|
|
|
|
List<WarehouseUpdownGoodsEntity> locationStockListInformation = warehouseUpdownGoodsClient.getLocationStockListInformation(warehouseUpdownGoods); |
|
|
|
|
if(locationStockListInformation.isEmpty() || ObjectUtils.isNull(locationStockListInformation)){ |
|
|
|
|
//不是该货位库存品包件信息;
|
|
|
|
|
return R.fail("不是该货位库存品包件信息"); |
|
|
|
|
} |
|
|
|
|
//查询属于那个批次的库存品
|
|
|
|
|
DistributionParcelListEntity byId = distributionParcelListService.getById(locationStockListInformation.get(0).getAssociationId()); |
|
|
|
|
if(ObjectUtils.isNull(byId)){ |
|
|
|
|
return R.fail("订单信息不存在!"); |
|
|
|
|
} |
|
|
|
|
DistributionStockListEntity distributionStockListEntity = distributionStockListMapper.selectOne(Wrappers.<DistributionStockListEntity>query().lambda() |
|
|
|
|
.eq(DistributionStockListEntity::getIncomingBatch, byId.getOrderCode()) |
|
|
|
|
.eq(DistributionStockListEntity::getWarehouseId,stockupDTO.getWarehouseId()) |
|
|
|
|
); |
|
|
|
|
if(ObjectUtils.isNull(distributionStockListEntity)){ |
|
|
|
|
return R.fail("该包件不是库存品!"); |
|
|
|
|
} |
|
|
|
|
//查询该预约的库存品信息
|
|
|
|
|
List<DistributionReservationStocklistEntity> list = distributionReservationStocklistService.list(Wrappers.<DistributionReservationStocklistEntity>query().lambda() |
|
|
|
|
.eq(ObjectUtils.isNotNull(stockupDTO.getReservationId()), DistributionReservationStocklistEntity::getReservationId, stockupDTO.getReservationId()) |
|
|
|
|
.apply("stock_list_status in (1,3)") |
|
|
|
|
); |
|
|
|
|
if(ObjectUtils.isNull(list)){ |
|
|
|
|
return R.fail("没有需要备货的库存品信息!"); |
|
|
|
|
} |
|
|
|
|
Optional<DistributionReservationStocklistEntity> first = list.stream().filter(i -> i.getStocklistId().equals(distributionStockListEntity.getId())).findFirst(); |
|
|
|
|
|
|
|
|
|
if(first.isPresent()){ |
|
|
|
|
//没有一样的库存品数据
|
|
|
|
|
return R.fail("没有一样的库存品数据"); |
|
|
|
|
} |
|
|
|
|
//判断数量是否可以直接备货
|
|
|
|
|
DistributionReservationStocklistEntity reservationStocklistEntity1 = first.get(); |
|
|
|
|
if(reservationStocklistEntity1.getRealityNum() > reservationStocklistEntity1.getReservationNum()){ |
|
|
|
|
return R.success("可以直接备货!"); |
|
|
|
|
} |
|
|
|
|
List<DistributionReservationStocklistEntity> keYi = new ArrayList<>(); //可以操作的库存品
|
|
|
|
|
//取出一样的库存品信息
|
|
|
|
|
list.forEach( i -> { |
|
|
|
|
DistributionStockListEntity distributionStockListEntity1 = distributionStockListMapper.selectById(i.getStocklistId()); |
|
|
|
|
if(distributionStockListEntity1.getDescriptionGoods().equals(distributionStockListEntity.getDescriptionGoods()) |
|
|
|
|
&& distributionStockListEntity1.getCargoNumber().equals(distributionStockListEntity.getCargoNumber()) |
|
|
|
|
&& i.getRealityNum() > i.getReservationNum() ){ |
|
|
|
|
keYi.add(i); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
if(keYi.isEmpty()){ |
|
|
|
|
return R.fail("没有可以操作的库存品数据"); |
|
|
|
|
} |
|
|
|
|
//获取数据
|
|
|
|
|
List<Long> collect1 = keYi.stream().map(DistributionReservationStocklistEntity::getStocklistId).collect(Collectors.toList()); |
|
|
|
|
//查询早期的库存品数据
|
|
|
|
|
List<DistributionStockListEntity> distributionStockListEntities = distributionStockListMapper.selectList(Wrappers.<DistributionStockListEntity>query().lambda() |
|
|
|
|
.in(DistributionStockListEntity::getId, collect1) |
|
|
|
|
.orderByAsc(DistributionStockListEntity::getCreateTime) |
|
|
|
|
); |
|
|
|
|
//修改可以修改的库存平
|
|
|
|
|
Optional<DistributionReservationStocklistEntity> collect2 = keYi.stream().filter(i -> i.getStocklistId().equals(distributionStockListEntities.get(0).getId())).findFirst(); |
|
|
|
|
if(!collect2.isPresent()){ |
|
|
|
|
DistributionReservationStocklistEntity distributionReservationStocklistEntity = collect2.get(); |
|
|
|
|
Integer reservationNum = distributionReservationStocklistEntity.getReservationNum() - 1; |
|
|
|
|
|
|
|
|
|
//减少其他一样的库存品数据
|
|
|
|
|
DistributionReservationStocklistEntity j = new DistributionReservationStocklistEntity();//减少
|
|
|
|
|
j.setId(distributionReservationStocklistEntity.getId()); |
|
|
|
|
j.setReservationNum(reservationNum); |
|
|
|
|
distributionReservationStocklistService.updateById(j); |
|
|
|
|
|
|
|
|
|
//修改待备货的数量
|
|
|
|
|
DistributionReservationStocklistEntity y = new DistributionReservationStocklistEntity();//要
|
|
|
|
|
y.setId(reservationStocklistEntity1.getId()); |
|
|
|
|
y.setReservationNum(reservationStocklistEntity1.getReservationNum()+1); |
|
|
|
|
distributionReservationStocklistService.updateById(y); |
|
|
|
|
//修改库存品备货记录表
|
|
|
|
|
List<DisStockListDetailEntity> list1 = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda() |
|
|
|
|
.eq(DisStockListDetailEntity::getReservationId, stockupDTO.getReservationId()) |
|
|
|
|
.eq(DisStockListDetailEntity::getStockListId, distributionReservationStocklistEntity.getStocklistId()) |
|
|
|
|
.isNull(DisStockListDetailEntity::getStockPackageCode) |
|
|
|
|
); |
|
|
|
|
if(list1.isEmpty()){ |
|
|
|
|
return R.fail("可用数据为空!"); |
|
|
|
|
} |
|
|
|
|
//修改第一条数据
|
|
|
|
|
DisStockListDetailEntity disStockListDetail = new DisStockListDetailEntity(); |
|
|
|
|
disStockListDetail.setId(list1.get(0).getId()); |
|
|
|
|
disStockListDetail.setStockListId(reservationStocklistEntity1.getStocklistId()); |
|
|
|
|
disStockListDetailService.updateById(disStockListDetail); |
|
|
|
|
//判断是否取消预约库存品数据
|
|
|
|
|
if(distributionReservationStocklistEntity.getRealityNum() == 0) { |
|
|
|
|
|
|
|
|
|
if(reservationNum == 0){ |
|
|
|
|
//取消当前库存品预约数据
|
|
|
|
|
DistributionReservationStocklistEntity q = new DistributionReservationStocklistEntity();//取消
|
|
|
|
|
q.setId(distributionReservationStocklistEntity.getId()); |
|
|
|
|
q.setStockListStatus("2"); |
|
|
|
|
distributionReservationStocklistService.updateById(q); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//回复冻结数量
|
|
|
|
|
DistributionStockListEntity distributionStockList = new DistributionStockListEntity(); |
|
|
|
|
distributionStockList.setId(distributionReservationStocklistEntity.getStocklistId()); |
|
|
|
|
distributionStockList.setQuantityStock(distributionStockListEntity.getQuantityStock() + 1); |
|
|
|
|
distributionStockList.setQuantityOccupied(distributionStockListEntity.getQuantityOccupied() -1); |
|
|
|
|
distributionStockListMapper.updateById(distributionStockList); |
|
|
|
|
} |
|
|
|
|
return R.success("成功!!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|