Browse Source

1.提货数据关联逻辑修改

master
zhenghaoyu 10 months ago
parent
commit
ce54d373cd
  1. 5
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingWaybillMapper.xml
  2. 112
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingPackageServiceImpl.java

5
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingWaybillMapper.xml

@ -41,14 +41,17 @@
lww.consignee_address consigneeAddress,
lww.remark remark,
lww.total_count totalCount,
lww.stock_count stockCount,
sum(ltbw2.real_num) stockCount,
ltbw.billlading_fee billladingFee,
lww.collect_pay collectPay
from logpm_trunkline_billlading_waybill ltbw
left join logpm_trunkline_billlading_waybill ltbw2 on ltbw2.waybill_id = ltbw.waybill_id
left join logpm_trunkline_billlading ltb on ltb.id = ltbw.billlading_id
left join logpm_warehouse_waybill lww on lww.waybill_no = ltbw.waybill_no
where ltbw.billlading_id = #{billladingId}
and ltbw.is_deleted = 0
group by ltb.billlading_code,
ltbw.waybill_id
</select>
<update id="updateDataByBillladingWaybillId" >

112
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingPackageServiceImpl.java

@ -281,60 +281,60 @@ public class TrunklineBillladingPackageServiceImpl extends BaseServiceImpl<Trunk
}
});
QueryWrapper<TrunklineBillladingWaybillEntity> billladingWaybillEntityQueryWrapper = new QueryWrapper<>();
billladingWaybillEntityQueryWrapper.in("waybill_no",waybillNoSet)
.eq("billlading_id",billladingId)
.eq("is_deleted",0);
List<TrunklineBillladingWaybillEntity> billladingWaybillEntityList = trunklineBillladingWaybillService.list(billladingWaybillEntityQueryWrapper);
//把billladingWaybillEntityList转化成waybillNo为key的Map
Map<String, TrunklineBillladingWaybillEntity> billladingWaybillEntityMap = billladingWaybillEntityList.stream().collect(Collectors.toMap(TrunklineBillladingWaybillEntity::getWaybillNo, Function.identity()));
List<TrunklineBillladingWaybillEntity> addList = new ArrayList<>();
List<TrunklineBillladingWaybillEntity> updateList = new ArrayList<>();
final TrunklineBillladingWaybillEntity[] noWaybillData = {trunklineBillladingWaybillService.findNoWaybillNoData(billladingId)};
waybillNoSet.forEach(waybillNo -> {
Integer integer = waybillNoMNumMap.get(waybillNo);
TrunklineBillladingWaybillEntity billladingWaybillEntity = billladingWaybillEntityMap.get(waybillNo);
if(Objects.isNull(billladingWaybillEntity)){
//查询是否有一条无运单的数据
if(Objects.isNull(noWaybillData[0])){
noWaybillData[0] = new TrunklineBillladingWaybillEntity();
noWaybillData[0].setWarehouseId(warehouseId);
noWaybillData[0].setWarehouseName(warehouseEntity.getName());
noWaybillData[0].setBillladingId(billladingId);
noWaybillData[0].setBilladingCode(trunklineBillladingEntity.getBillladingCode());
noWaybillData[0].setWaybillNo("————");
noWaybillData[0].setRealNum(integer);
noWaybillData[0].setRealWeight(BigDecimal.ZERO);
noWaybillData[0].setRealVolume(BigDecimal.ZERO);
}else{
Integer realNum = noWaybillData[0].getRealNum();
noWaybillData[0].setRealNum(realNum+integer);
}
}else{
Integer realNum = billladingWaybillEntity.getRealNum();
billladingWaybillEntity.setRealNum(realNum + integer);
updateList.add(billladingWaybillEntity);
}
});
addList.add(noWaybillData[0]);
trunklineBillladingWaybillService.saveBatch(addList);
trunklineBillladingWaybillService.updateBatchById(updateList);
TrunklineBillladingEntity billladingEntity = trunklineBillladingService.getById(billladingId);
if(!Objects.isNull(billladingEntity)){
int realNum = billladingEntity.getRealNum();
Integer all = waybillNoMNumMap.values().stream().reduce(Integer::sum).get();
billladingEntity.setRealNum(realNum+all);
trunklineBillladingService.updateById(billladingEntity);
}
// QueryWrapper<TrunklineBillladingWaybillEntity> billladingWaybillEntityQueryWrapper = new QueryWrapper<>();
// billladingWaybillEntityQueryWrapper.in("waybill_no",waybillNoSet)
// .eq("billlading_id",billladingId)
// .eq("is_deleted",0);
//
// List<TrunklineBillladingWaybillEntity> billladingWaybillEntityList = trunklineBillladingWaybillService.list(billladingWaybillEntityQueryWrapper);
//
// //把billladingWaybillEntityList转化成waybillNo为key的Map
// Map<String, TrunklineBillladingWaybillEntity> billladingWaybillEntityMap = billladingWaybillEntityList.stream().collect(Collectors.toMap(TrunklineBillladingWaybillEntity::getWaybillNo, Function.identity()));
//
// List<TrunklineBillladingWaybillEntity> addList = new ArrayList<>();
// List<TrunklineBillladingWaybillEntity> updateList = new ArrayList<>();
//
// final TrunklineBillladingWaybillEntity[] noWaybillData = {trunklineBillladingWaybillService.findNoWaybillNoData(billladingId)};
//
//
// waybillNoSet.forEach(waybillNo -> {
// Integer integer = waybillNoMNumMap.get(waybillNo);
// TrunklineBillladingWaybillEntity billladingWaybillEntity = billladingWaybillEntityMap.get(waybillNo);
// if(Objects.isNull(billladingWaybillEntity)){
// //查询是否有一条无运单的数据
// if(Objects.isNull(noWaybillData[0])){
// noWaybillData[0] = new TrunklineBillladingWaybillEntity();
// noWaybillData[0].setWarehouseId(warehouseId);
// noWaybillData[0].setWarehouseName(warehouseEntity.getName());
// noWaybillData[0].setBillladingId(billladingId);
// noWaybillData[0].setBilladingCode(trunklineBillladingEntity.getBillladingCode());
// noWaybillData[0].setWaybillNo("————");
// noWaybillData[0].setRealNum(integer);
// noWaybillData[0].setRealWeight(BigDecimal.ZERO);
// noWaybillData[0].setRealVolume(BigDecimal.ZERO);
// }else{
// Integer realNum = noWaybillData[0].getRealNum();
// noWaybillData[0].setRealNum(realNum+integer);
// }
// }else{
// Integer realNum = billladingWaybillEntity.getRealNum();
// billladingWaybillEntity.setRealNum(realNum + integer);
// updateList.add(billladingWaybillEntity);
// }
// });
//
// addList.add(noWaybillData[0]);
//
// trunklineBillladingWaybillService.saveBatch(addList);
// trunklineBillladingWaybillService.updateBatchById(updateList);
//
// TrunklineBillladingEntity billladingEntity = trunklineBillladingService.getById(billladingId);
// if(!Objects.isNull(billladingEntity)){
// int realNum = billladingEntity.getRealNum();
// Integer all = waybillNoMNumMap.values().stream().reduce(Integer::sum).get();
// billladingEntity.setRealNum(realNum+all);
// trunklineBillladingService.updateById(billladingEntity);
// }
waybillEntityMap.keySet().forEach(waybillNo -> {
@ -367,8 +367,10 @@ public class TrunklineBillladingPackageServiceImpl extends BaseServiceImpl<Trunk
warehouseWaybillClient.updateList(warehouseWaybillEntities);
//根据提货单id重新计算每个运单的费用
trunklineBillladingWaybillService.updateBillladingFeeByBillladingId(trunklineBillladingEntity);
// trunklineBillladingWaybillService.updateBillladingFeeByBillladingId(trunklineBillladingEntity);
//--------------------------------------分割线------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// QueryWrapper<TrunklineBillladingPackageEntity> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("order_package_code",orderPackageCode);

Loading…
Cancel
Save