|
|
@ -154,6 +154,8 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb |
|
|
|
private IDisStockListDetailService disStockListDetailService; |
|
|
|
private IDisStockListDetailService disStockListDetailService; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private BladeRedis redis; |
|
|
|
private BladeRedis redis; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private FactoryDataMessageSender factoryDataMessageSender; |
|
|
|
private FactoryDataMessageSender factoryDataMessageSender; |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
@ -378,92 +380,157 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb |
|
|
|
}*/ |
|
|
|
}*/ |
|
|
|
//修改库存品
|
|
|
|
//修改库存品
|
|
|
|
if (!distrilbutionBillLading.getStockDTOList().isEmpty()) { |
|
|
|
if (!distrilbutionBillLading.getStockDTOList().isEmpty()) { |
|
|
|
|
|
|
|
List<DistributionStockListDTO> stockDTOList = distrilbutionBillLading.getStockDTOList(); |
|
|
|
|
|
|
|
boolean flag = stockDTOList.stream().anyMatch(distributionStockListDTO -> Func.isEmpty(distributionStockListDTO.getInventoryQuantity())|| distributionStockListDTO.getInventoryQuantity().equals(0)); |
|
|
|
|
|
|
|
if (flag){ |
|
|
|
|
|
|
|
String collect = stockDTOList.stream().filter(distributionStockListDTO -> Func.isEmpty(distributionStockListDTO.getInventoryQuantity())).map(DistributionStockListDTO::getIncomingBatch).collect(Collectors.joining(",")); |
|
|
|
|
|
|
|
log.info("自提修改库存品未填写数量>>>未填写库存品批次号:{}",collect); |
|
|
|
|
|
|
|
throw new RuntimeException("请填写正确的库存品数量"); |
|
|
|
|
|
|
|
} |
|
|
|
//全部库存品数据
|
|
|
|
//全部库存品数据
|
|
|
|
List<DistributionDeliveryDetailsEntity> listDetails = distributionDeliveryDetailsService.list(Wrappers.<DistributionDeliveryDetailsEntity>query().lambda() |
|
|
|
List<DistributionDeliveryDetailsEntity> listDetails = distributionDeliveryDetailsService.list(Wrappers.<DistributionDeliveryDetailsEntity>query().lambda() |
|
|
|
.eq(DistributionDeliveryDetailsEntity::getBillLadingId, distrilbutionBillLading.getId()) |
|
|
|
.eq(DistributionDeliveryDetailsEntity::getBillLadingId, distrilbutionBillLading.getId()) |
|
|
|
|
|
|
|
.ne(DistributionDeliveryDetailsEntity::getInventoryStatus, "2") |
|
|
|
); |
|
|
|
); |
|
|
|
if (!listDetails.isEmpty()) { |
|
|
|
Map<Long, List<DistributionDeliveryDetailsEntity>> map = null; |
|
|
|
List<Long> ids = new ArrayList<>(); |
|
|
|
if (!listDetails.isEmpty()){ |
|
|
|
//有
|
|
|
|
map = listDetails.stream().collect(Collectors.groupingBy(DistributionDeliveryDetailsEntity::getStockListId)); |
|
|
|
//修改
|
|
|
|
} |
|
|
|
listDetails.forEach(i -> { |
|
|
|
for (DistributionStockListDTO distributionStockListDTO : stockDTOList) { |
|
|
|
boolean b = distrilbutionBillLading.getStockDTOList().stream().anyMatch(a -> i.getStockListId().equals(a.getId())); |
|
|
|
if (!map.isEmpty()){ |
|
|
|
//查询是否存签收扫描数量
|
|
|
|
DistributionDeliveryDetailsEntity distributionDeliveryDetailsEntity = map.get(distributionStockListDTO.getId()).get(0); |
|
|
|
|
|
|
|
Integer quantity = distributionDeliveryDetailsEntity.getQuantity(); |
|
|
|
|
|
|
|
int i = quantity - distributionStockListDTO.getInventoryQuantity(); |
|
|
|
|
|
|
|
DistributionDeliveryDetailsEntity deliveryDetails = new DistributionDeliveryDetailsEntity(); |
|
|
|
|
|
|
|
deliveryDetails.setId(distributionDeliveryDetailsEntity.getId()); |
|
|
|
List<DistributionStockEntity> list1 = distributionStockService.list(Wrappers.<DistributionStockEntity>query().lambda() |
|
|
|
List<DistributionStockEntity> list1 = distributionStockService.list(Wrappers.<DistributionStockEntity>query().lambda() |
|
|
|
.eq(DistributionStockEntity::getBillLadingId, distrilbutionBillLading.getId()) |
|
|
|
.eq(DistributionStockEntity::getBillLadingId, distrilbutionBillLading.getId()) |
|
|
|
.eq(DistributionStockEntity::getStockListId, i.getStockListId()) |
|
|
|
.eq(DistributionStockEntity::getStockListId, distributionDeliveryDetailsEntity.getStockListId()) |
|
|
|
.eq(DistributionStockEntity::getType, "2") |
|
|
|
.eq(DistributionStockEntity::getType, "2") |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
if (i != 0){ |
|
|
|
|
|
|
|
deliveryDetails.setStockStatus("1"); |
|
|
|
|
|
|
|
if (i > 0){ |
|
|
|
|
|
|
|
deliveryDetails.setQuantity(distributionDeliveryDetailsEntity.getQuantity() - i); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//减少
|
|
|
|
|
|
|
|
//查询原有包件
|
|
|
|
|
|
|
|
List<DisStockListDetailEntity> stockListDetailEntities = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda() |
|
|
|
|
|
|
|
.eq(DisStockListDetailEntity::getStockListId, distributionStockListDTO.getId()) |
|
|
|
|
|
|
|
.eq(DisStockListDetailEntity::getReservationId, distrilbutionBillLading.getId()) |
|
|
|
|
|
|
|
.ne(DisStockListDetailEntity::getStockPackageStatus, "2") |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
boolean a = false; |
|
|
|
|
|
|
|
if (!stockListDetailEntities.isEmpty()){ |
|
|
|
|
|
|
|
int sum = stockListDetailEntities.stream().filter(f -> !Func.isEmpty(f.getStockPackageCode())).mapToInt(DisStockListDetailEntity::getNum).sum(); |
|
|
|
|
|
|
|
log.info("自提修改库存品>>>>>>>>当前计划数量:{},备货数量:{}",deliveryDetails.getQuantity(),sum); |
|
|
|
|
|
|
|
// 优先取消未备货
|
|
|
|
|
|
|
|
if (sum > 0){ |
|
|
|
|
|
|
|
//存在备货
|
|
|
|
|
|
|
|
throw new RuntimeException("该库存品已备货无法减少"); |
|
|
|
|
|
|
|
// if (sum >= deliveryDetails.getQuantity()) {
|
|
|
|
|
|
|
|
// //满足备货或者备货数量超过
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }else {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
//对于包件进行随机删除
|
|
|
|
if (b) { |
|
|
|
List<Long> ids = stockListDetailEntities.subList(0, i).stream().map(DisStockListDetailEntity::getId).collect(Collectors.toList()); |
|
|
|
//有
|
|
|
|
disStockListDetailService.removeBatchByIds(ids); |
|
|
|
Iterator<DistributionStockListDTO> iterator = distrilbutionBillLading.getStockDTOList().iterator(); |
|
|
|
distributionAsyncService.getInventoryNumUpdate(distributionStockListDTO.getId(), i, 2); |
|
|
|
while (iterator.hasNext()) { |
|
|
|
|
|
|
|
DistributionStockListDTO next = iterator.next(); |
|
|
|
|
|
|
|
if (i.getStockListId().equals(next.getId())) { |
|
|
|
|
|
|
|
DistributionDeliveryDetailsEntity deliveryDetails = new DistributionDeliveryDetailsEntity(); |
|
|
|
|
|
|
|
deliveryDetails.setQuantity(next.getInventoryQuantity()); |
|
|
|
|
|
|
|
deliveryDetails.setId(i.getId()); |
|
|
|
|
|
|
|
distributionDeliveryDetailsService.updateById(deliveryDetails); |
|
|
|
|
|
|
|
Integer inventoryQuantity = next.getInventoryQuantity(); //修改数量
|
|
|
|
|
|
|
|
Integer quantity = i.getQuantity();//原来的数量
|
|
|
|
|
|
|
|
int num = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (inventoryQuantity > quantity) { |
|
|
|
|
|
|
|
num = inventoryQuantity - quantity; //多 添加了数量
|
|
|
|
|
|
|
|
//修改库存占用数量
|
|
|
|
|
|
|
|
distributionAsyncService.getInventoryNumUpdate(i.getStockListId(), num, 1); |
|
|
|
|
|
|
|
//kk备货
|
|
|
|
|
|
|
|
if ("20".equals(i.getConditions())) { |
|
|
|
|
|
|
|
//xiugai
|
|
|
|
|
|
|
|
DistributionDeliveryDetailsEntity d = new DistributionDeliveryDetailsEntity(); |
|
|
|
|
|
|
|
d.setId(i.getId()); |
|
|
|
|
|
|
|
d.setConditions(BillLadingStatusConstant.daitihuo.getValue()); |
|
|
|
|
|
|
|
distributionDeliveryDetailsService.updateById(d); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (inventoryQuantity < quantity) { |
|
|
|
|
|
|
|
num = quantity - inventoryQuantity; //少 减少了数量
|
|
|
|
|
|
|
|
/*if(list1.size() < 1){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
//有备货
|
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("20".equals(i.getConditions())) { |
|
|
|
|
|
|
|
//todo 已完成
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
//todo 未完成
|
|
|
|
|
|
|
|
int size = list1.size(); //扫描的数量
|
|
|
|
|
|
|
|
int i1 = quantity - size; //未扫的数量
|
|
|
|
|
|
|
|
if (i1 > num) { |
|
|
|
|
|
|
|
//可以减少
|
|
|
|
|
|
|
|
//修改库存占用数量
|
|
|
|
|
|
|
|
distributionAsyncService.getInventoryNumUpdate(i.getStockListId(), num, 2); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
//todo 未扫小于减少
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
iterator.remove(); |
|
|
|
} |
|
|
|
|
|
|
|
//回复对应库存品的冻结数量
|
|
|
|
|
|
|
|
//删除对应的包件维度数据
|
|
|
|
|
|
|
|
if (!list1.isEmpty()){ |
|
|
|
|
|
|
|
int sum = list1.stream().mapToInt(DistributionStockEntity::getStockQuantity).sum(); |
|
|
|
|
|
|
|
if (sum == deliveryDetails.getQuantity()){ |
|
|
|
|
|
|
|
deliveryDetails.setStockStatus("3"); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
deliveryDetails.setStockStatus("1"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
//增加
|
|
|
|
|
|
|
|
//生成包件
|
|
|
|
|
|
|
|
deliveryDetails.setQuantity(distributionDeliveryDetailsEntity.getQuantity() - i); |
|
|
|
|
|
|
|
List<DisStockListDetailEntity> disStockListDetailEntities = new ArrayList<>(); |
|
|
|
|
|
|
|
for (int i1 = 0; i1 < -i; i1++) { |
|
|
|
|
|
|
|
DisStockListDetailEntity disStockListDetailEntity = new DisStockListDetailEntity(); |
|
|
|
|
|
|
|
disStockListDetailEntity.setReservationId(distrilbutionBillLading.getId()); |
|
|
|
|
|
|
|
disStockListDetailEntity.setStockListId(distributionStockListDTO.getId()); |
|
|
|
|
|
|
|
disStockListDetailEntity.setNum(1); |
|
|
|
|
|
|
|
disStockListDetailEntity.setWarehouseId(distributionStockListDTO.getWarehouseId()); |
|
|
|
|
|
|
|
disStockListDetailEntity.setWarehouseName(distributionStockListDTO.getWarehouseName()); |
|
|
|
|
|
|
|
disStockListDetailEntity.setStockPackageStatus("3"); |
|
|
|
|
|
|
|
disStockListDetailEntity.setStockLockingStatus("10"); |
|
|
|
|
|
|
|
disStockListDetailEntity.setStockStatus("10"); |
|
|
|
|
|
|
|
disStockListDetailEntity.setStockSignfoStatus("10"); |
|
|
|
|
|
|
|
disStockListDetailEntity.setSku(distributionStockListDTO.getCargoNumber()); |
|
|
|
|
|
|
|
disStockListDetailEntity.setStockType("10"); |
|
|
|
|
|
|
|
disStockListDetailEntities.add(disStockListDetailEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
disStockListDetailService.saveBatch(disStockListDetailEntities); |
|
|
|
|
|
|
|
//对于该库存品冻结数量进行增加
|
|
|
|
|
|
|
|
distributionAsyncService.getInventoryNumUpdate(distributionStockListDTO.getId(), i, 2); |
|
|
|
|
|
|
|
if (!list1.isEmpty()){ |
|
|
|
|
|
|
|
deliveryDetails.setStockStatus("2"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
distributionDeliveryDetailsService.updateById(deliveryDetails); |
|
|
|
|
|
|
|
} |
|
|
|
if (list1.isEmpty()) { |
|
|
|
} else { |
|
|
|
//取消库存占用数量
|
|
|
|
DistributionDeliveryDetailsEntity deliveryDetails = new DistributionDeliveryDetailsEntity(); |
|
|
|
distributionAsyncService.getInventoryNumUpdate(i.getStockListId(), i.getQuantity(), 2); |
|
|
|
deliveryDetails.setBillLadingId(distrilbutionBillLading.getId()); |
|
|
|
} |
|
|
|
deliveryDetails.setStockListId(distributionStockListDTO.getId()); |
|
|
|
//没有 删除
|
|
|
|
deliveryDetails.setQuantity(distributionStockListDTO.getInventoryQuantity()); |
|
|
|
ids.add(i.getId()); |
|
|
|
deliveryDetails.setInventoryStatus("3"); |
|
|
|
|
|
|
|
deliveryDetails.setConditions("10"); |
|
|
|
|
|
|
|
deliveryDetails.setStockStatus("1"); |
|
|
|
|
|
|
|
distributionDeliveryDetailsService.save(deliveryDetails); |
|
|
|
|
|
|
|
distributionAsyncService.getInventoryNumUpdate(deliveryDetails.getStockListId(), deliveryDetails.getQuantity(), 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//增加
|
|
|
|
|
|
|
|
List<DisStockListDetailEntity> disStockListDetailEntities = new ArrayList<>(); |
|
|
|
|
|
|
|
for (int i1 = 0; i1 < deliveryDetails.getQuantity(); i1++) { |
|
|
|
|
|
|
|
DisStockListDetailEntity disStockListDetailEntity = new DisStockListDetailEntity(); |
|
|
|
|
|
|
|
disStockListDetailEntity.setReservationId(distrilbutionBillLading.getId()); |
|
|
|
|
|
|
|
disStockListDetailEntity.setStockListId(distributionStockListDTO.getId()); |
|
|
|
|
|
|
|
disStockListDetailEntity.setNum(1); |
|
|
|
|
|
|
|
disStockListDetailEntity.setWarehouseId(distributionStockListDTO.getWarehouseId()); |
|
|
|
|
|
|
|
disStockListDetailEntity.setWarehouseName(distributionStockListDTO.getWarehouseName()); |
|
|
|
|
|
|
|
disStockListDetailEntity.setStockPackageStatus("3"); |
|
|
|
|
|
|
|
disStockListDetailEntity.setStockLockingStatus("10"); |
|
|
|
|
|
|
|
disStockListDetailEntity.setStockStatus("10"); |
|
|
|
|
|
|
|
disStockListDetailEntity.setStockSignfoStatus("10"); |
|
|
|
|
|
|
|
disStockListDetailEntity.setSku(distributionStockListDTO.getCargoNumber()); |
|
|
|
|
|
|
|
disStockListDetailEntity.setStockType("10"); |
|
|
|
|
|
|
|
disStockListDetailEntities.add(disStockListDetailEntity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
disStockListDetailService.saveBatch(disStockListDetailEntities); |
|
|
|
|
|
|
|
//进行包件维度的构建
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
map.remove(distributionStockListDTO.getId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!map.isEmpty()) { |
|
|
|
|
|
|
|
List<Long> ids = new ArrayList<>(); |
|
|
|
|
|
|
|
//进行删除
|
|
|
|
|
|
|
|
map.forEach((k,v)->{ |
|
|
|
|
|
|
|
ids.add(v.get(0).getId()); |
|
|
|
|
|
|
|
distributionAsyncService.getInventoryNumUpdate(k, v.get(0).getQuantity(), 2); |
|
|
|
|
|
|
|
//删除
|
|
|
|
|
|
|
|
disStockListDetailService.remove(Wrappers.<DisStockListDetailEntity>query().lambda() |
|
|
|
|
|
|
|
.eq(DisStockListDetailEntity::getReservationId,distrilbutionBillLading.getId()) |
|
|
|
|
|
|
|
.eq(DisStockListDetailEntity::getStockListId,k) |
|
|
|
|
|
|
|
.eq(DisStockListDetailEntity::getStockPackageStatus,"2") |
|
|
|
|
|
|
|
); |
|
|
|
}); |
|
|
|
}); |
|
|
|
//删除没有的库存品
|
|
|
|
//删除没有的库存品
|
|
|
|
if (!ids.isEmpty()) { |
|
|
|
if (!ids.isEmpty()) { |
|
|
@ -474,7 +541,100 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb |
|
|
|
distributionDeliveryDetailsService.updateById(deliveryDetails); |
|
|
|
distributionDeliveryDetailsService.updateById(deliveryDetails); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if (!listDetails.isEmpty()) {
|
|
|
|
|
|
|
|
// List<Long> ids = new ArrayList<>();
|
|
|
|
|
|
|
|
// //有
|
|
|
|
|
|
|
|
// //修改
|
|
|
|
|
|
|
|
// listDetails.forEach(i -> {
|
|
|
|
|
|
|
|
// boolean b = distrilbutionBillLading.getStockDTOList().stream().anyMatch(a -> i.getStockListId().equals(a.getId()));
|
|
|
|
|
|
|
|
// //查询是否存签收扫描数量
|
|
|
|
|
|
|
|
// List<DistributionStockEntity> list1 = distributionStockService.list(Wrappers.<DistributionStockEntity>query().lambda()
|
|
|
|
|
|
|
|
// .eq(DistributionStockEntity::getBillLadingId, distrilbutionBillLading.getId())
|
|
|
|
|
|
|
|
// .eq(DistributionStockEntity::getStockListId, i.getStockListId())
|
|
|
|
|
|
|
|
// .eq(DistributionStockEntity::getType, "2")
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// if (b) {
|
|
|
|
|
|
|
|
// //有
|
|
|
|
|
|
|
|
// Iterator<DistributionStockListDTO> iterator = distrilbutionBillLading.getStockDTOList().iterator();
|
|
|
|
|
|
|
|
// while (iterator.hasNext()) {
|
|
|
|
|
|
|
|
// DistributionStockListDTO next = iterator.next();
|
|
|
|
|
|
|
|
// if (i.getStockListId().equals(next.getId())) {
|
|
|
|
|
|
|
|
// DistributionDeliveryDetailsEntity deliveryDetails = new DistributionDeliveryDetailsEntity();
|
|
|
|
|
|
|
|
// deliveryDetails.setQuantity(next.getInventoryQuantity());
|
|
|
|
|
|
|
|
// deliveryDetails.setId(i.getId());
|
|
|
|
|
|
|
|
// distributionDeliveryDetailsService.updateById(deliveryDetails);
|
|
|
|
|
|
|
|
// Integer inventoryQuantity = next.getInventoryQuantity(); //修改数量
|
|
|
|
|
|
|
|
// Integer quantity = i.getQuantity();//原来的数量
|
|
|
|
|
|
|
|
// int num = 0;
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if (inventoryQuantity > quantity) {
|
|
|
|
|
|
|
|
// num = inventoryQuantity - quantity; //多 添加了数量
|
|
|
|
|
|
|
|
// //修改库存占用数量
|
|
|
|
|
|
|
|
// distributionAsyncService.getInventoryNumUpdate(i.getStockListId(), num, 1);
|
|
|
|
|
|
|
|
// //kk备货
|
|
|
|
|
|
|
|
// if ("20".equals(i.getConditions())) {
|
|
|
|
|
|
|
|
// //xiugai
|
|
|
|
|
|
|
|
// DistributionDeliveryDetailsEntity d = new DistributionDeliveryDetailsEntity();
|
|
|
|
|
|
|
|
// d.setId(i.getId());
|
|
|
|
|
|
|
|
// d.setConditions(BillLadingStatusConstant.daitihuo.getValue());
|
|
|
|
|
|
|
|
// d.setInventoryStatus("3");
|
|
|
|
|
|
|
|
// distributionDeliveryDetailsService.updateById(d);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else if (inventoryQuantity < quantity) {
|
|
|
|
|
|
|
|
// num = quantity - inventoryQuantity; //少 减少了数量
|
|
|
|
|
|
|
|
// /*if(list1.size() < 1){
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }else{
|
|
|
|
|
|
|
|
// //有备货
|
|
|
|
|
|
|
|
// }*/
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if ("20".equals(i.getConditions())) {
|
|
|
|
|
|
|
|
// //todo 已完成
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// //todo 未完成
|
|
|
|
|
|
|
|
// int size = list1.size(); //扫描的数量
|
|
|
|
|
|
|
|
// int i1 = quantity - size; //未扫的数量
|
|
|
|
|
|
|
|
// if (i1 > num) {
|
|
|
|
|
|
|
|
// //可以减少
|
|
|
|
|
|
|
|
// //修改库存占用数量
|
|
|
|
|
|
|
|
// distributionAsyncService.getInventoryNumUpdate(i.getStockListId(), num, 2);
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// //todo 未扫小于减少
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// iterator.remove();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if (list1.isEmpty()) {
|
|
|
|
|
|
|
|
// //取消库存占用数量
|
|
|
|
|
|
|
|
// distributionAsyncService.getInventoryNumUpdate(i.getStockListId(), i.getQuantity(), 2);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// //没有 删除
|
|
|
|
|
|
|
|
// ids.add(i.getId());
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// //删除没有的库存品
|
|
|
|
|
|
|
|
// if (!ids.isEmpty()) {
|
|
|
|
|
|
|
|
// ids.forEach(a -> {
|
|
|
|
|
|
|
|
// DistributionDeliveryDetailsEntity deliveryDetails = new DistributionDeliveryDetailsEntity();
|
|
|
|
|
|
|
|
// deliveryDetails.setId(a);
|
|
|
|
|
|
|
|
// deliveryDetails.setInventoryStatus("2");
|
|
|
|
|
|
|
|
// distributionDeliveryDetailsService.updateById(deliveryDetails);
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
updateStockBill(distrilbutionBillLading); |
|
|
|
updateStockBill(distrilbutionBillLading); |
|
|
|
} |
|
|
|
} |
|
|
@ -741,33 +901,51 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb |
|
|
|
if (!distrilbutionBillLading.getPrintList().isEmpty()) { |
|
|
|
if (!distrilbutionBillLading.getPrintList().isEmpty()) { |
|
|
|
addPrint(distrilbutionBillLading); |
|
|
|
addPrint(distrilbutionBillLading); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!distrilbutionBillLading.getStockDTOList().isEmpty()) { |
|
|
|
|
|
|
|
boolean flag = distrilbutionBillLading.getStockDTOList().stream().anyMatch(distributionStockListDTO -> Func.isEmpty(distributionStockListDTO.getInventoryQuantity()) || distributionStockListDTO.getInventoryQuantity().equals(0)); |
|
|
|
|
|
|
|
if (flag){ |
|
|
|
|
|
|
|
String collect = distrilbutionBillLading.getStockDTOList().stream().filter(distributionStockListDTO -> Func.isEmpty(distributionStockListDTO.getInventoryQuantity())).map(DistributionStockListDTO::getIncomingBatch).collect(Collectors.joining(",")); |
|
|
|
|
|
|
|
log.info("自提添加库存品未填写数量>>>未填写库存品批次号:{}",collect); |
|
|
|
|
|
|
|
throw new RuntimeException("请填写正确的库存品数量"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//没有
|
|
|
|
|
|
|
|
List<DistributionDeliveryDetailsEntity> detailsEntities = new ArrayList<>(); |
|
|
|
|
|
|
|
Boolean finalLas = las; |
|
|
|
|
|
|
|
distrilbutionBillLading.getStockDTOList().forEach(i -> { |
|
|
|
|
|
|
|
DistributionDeliveryDetailsEntity details = new DistributionDeliveryDetailsEntity(); |
|
|
|
|
|
|
|
details.setBillLadingId(distrilbutionBillLading.getId()); |
|
|
|
|
|
|
|
details.setStockListId(i.getId()); |
|
|
|
|
|
|
|
details.setQuantity(i.getInventoryQuantity()); |
|
|
|
|
|
|
|
details.setConditions(BillLadingStatusConstant.daitihuo.getValue()); |
|
|
|
|
|
|
|
details.setRealityQuantity(0); |
|
|
|
|
|
|
|
details.setInventoryStatus("1"); |
|
|
|
|
|
|
|
List<DisStockListDetailEntity> list = new ArrayList<>(); |
|
|
|
|
|
|
|
for (int i1 = 0; i1 < details.getQuantity(); i1++) { |
|
|
|
|
|
|
|
DisStockListDetailEntity disStockListDetailEntity = new DisStockListDetailEntity(); |
|
|
|
|
|
|
|
disStockListDetailEntity.setReservationId(distrilbutionBillLading.getId()); |
|
|
|
|
|
|
|
disStockListDetailEntity.setStockListId(details.getStockListId()); |
|
|
|
|
|
|
|
disStockListDetailEntity.setNum(1); |
|
|
|
|
|
|
|
disStockListDetailEntity.setWarehouseId(i.getWarehouseId()); |
|
|
|
|
|
|
|
disStockListDetailEntity.setWarehouseName(i.getWarehouseName()); |
|
|
|
|
|
|
|
disStockListDetailEntity.setStockPackageStatus("1"); |
|
|
|
|
|
|
|
disStockListDetailEntity.setStockLockingStatus("10"); |
|
|
|
|
|
|
|
disStockListDetailEntity.setStockStatus("10"); |
|
|
|
|
|
|
|
disStockListDetailEntity.setStockSignfoStatus("10"); |
|
|
|
|
|
|
|
disStockListDetailEntity.setSku(i.getCargoNumber()); |
|
|
|
|
|
|
|
disStockListDetailEntity.setStockType("10"); |
|
|
|
|
|
|
|
list.add(disStockListDetailEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
disStockListDetailService.saveBatch(list); |
|
|
|
|
|
|
|
detailsEntities.add(details); |
|
|
|
|
|
|
|
//修改库存数量
|
|
|
|
|
|
|
|
distributionAsyncService.getInventoryNumUpdate(i.getId(), i.getInventoryQuantity(), 2); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
distributionDeliveryDetailsService.saveBatch(detailsEntities); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//添加库存品信息
|
|
|
|
//添加库存品信息
|
|
|
|
if (!distrilbutionBillLading.getStockDTOList().isEmpty()) { |
|
|
|
|
|
|
|
//没有
|
|
|
|
|
|
|
|
List<DistributionDeliveryDetailsEntity> detailsEntities = new ArrayList<>(); |
|
|
|
|
|
|
|
Boolean finalLas = las; |
|
|
|
|
|
|
|
distrilbutionBillLading.getStockDTOList().forEach(i -> { |
|
|
|
|
|
|
|
DistributionDeliveryDetailsEntity details = new DistributionDeliveryDetailsEntity(); |
|
|
|
|
|
|
|
details.setBillLadingId(distrilbutionBillLading.getId()); |
|
|
|
|
|
|
|
details.setStockListId(i.getId()); |
|
|
|
|
|
|
|
details.setQuantity(i.getInventoryQuantity()); |
|
|
|
|
|
|
|
details.setConditions(BillLadingStatusConstant.daitihuo.getValue()); |
|
|
|
|
|
|
|
details.setRealityQuantity(0); |
|
|
|
|
|
|
|
if (finalLas) { |
|
|
|
|
|
|
|
details.setInventoryStatus("2"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
details.setInventoryStatus("1"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
detailsEntities.add(details); |
|
|
|
|
|
|
|
//修改库存数量
|
|
|
|
|
|
|
|
distributionAsyncService.getInventoryNumUpdate(i.getId(), i.getInventoryQuantity(), 1); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
distributionDeliveryDetailsService.saveBatch(detailsEntities); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//添加费用
|
|
|
|
//添加费用
|
|
|
|
if (!distrilbutionBillLading.getFei().isEmpty()) { |
|
|
|
if (!distrilbutionBillLading.getFei().isEmpty()) { |
|
|
@ -1694,7 +1872,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb |
|
|
|
List<Long> collect = parcelListEntities.stream().map(DistributionParcelListEntity::getId).collect(Collectors.toList()); |
|
|
|
List<Long> collect = parcelListEntities.stream().map(DistributionParcelListEntity::getId).collect(Collectors.toList()); |
|
|
|
distributionParcelListService.update(Wrappers.<DistributionParcelListEntity>update() |
|
|
|
distributionParcelListService.update(Wrappers.<DistributionParcelListEntity>update() |
|
|
|
.in("id", collect) |
|
|
|
.in("id", collect) |
|
|
|
.set("order_package_reservation_status", OrderPackageReservationStatusConstant.daiyuyue.getValue()) |
|
|
|
.set("order_package_reservation_status", OrderPackageReservationStatusConstant.yiyueyue.getValue()) |
|
|
|
); |
|
|
|
); |
|
|
|
}else { |
|
|
|
}else { |
|
|
|
log.error("#########################无可用包件orderIds:{}",addOrderIds); |
|
|
|
log.error("#########################无可用包件orderIds:{}",addOrderIds); |
|
|
|