diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingWaybillMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingWaybillMapper.xml index 4086707db..d8c80620d 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingWaybillMapper.xml +++ b/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 diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingPackageServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingPackageServiceImpl.java index 1f1edac4a..1a2900a1a 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingPackageServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingPackageServiceImpl.java @@ -281,60 +281,60 @@ public class TrunklineBillladingPackageServiceImpl extends BaseServiceImpl billladingWaybillEntityQueryWrapper = new QueryWrapper<>(); - billladingWaybillEntityQueryWrapper.in("waybill_no",waybillNoSet) - .eq("billlading_id",billladingId) - .eq("is_deleted",0); - - List billladingWaybillEntityList = trunklineBillladingWaybillService.list(billladingWaybillEntityQueryWrapper); - - //把billladingWaybillEntityList转化成waybillNo为key的Map - Map billladingWaybillEntityMap = billladingWaybillEntityList.stream().collect(Collectors.toMap(TrunklineBillladingWaybillEntity::getWaybillNo, Function.identity())); - - List addList = new ArrayList<>(); - List 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 billladingWaybillEntityQueryWrapper = new QueryWrapper<>(); +// billladingWaybillEntityQueryWrapper.in("waybill_no",waybillNoSet) +// .eq("billlading_id",billladingId) +// .eq("is_deleted",0); +// +// List billladingWaybillEntityList = trunklineBillladingWaybillService.list(billladingWaybillEntityQueryWrapper); +// +// //把billladingWaybillEntityList转化成waybillNo为key的Map +// Map billladingWaybillEntityMap = billladingWaybillEntityList.stream().collect(Collectors.toMap(TrunklineBillladingWaybillEntity::getWaybillNo, Function.identity())); +// +// List addList = new ArrayList<>(); +// List 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 queryWrapper = new QueryWrapper<>(); // queryWrapper.eq("order_package_code",orderPackageCode);