diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineBillladingNumVO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineBillladingNumVO.java new file mode 100644 index 000000000..fb0cef0ca --- /dev/null +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineBillladingNumVO.java @@ -0,0 +1,15 @@ +package com.logpm.trunkline.vo; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class TrunklineBillladingNumVO implements Serializable { + + private Integer num; + private BigDecimal weight; + private BigDecimal volume; + +} diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineBillladingWaybillVO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineBillladingWaybillVO.java index 05f0b421e..01bb905d5 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineBillladingWaybillVO.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineBillladingWaybillVO.java @@ -32,5 +32,6 @@ public class TrunklineBillladingWaybillVO extends TrunklineBillladingWaybillEnti private Integer stockCount; private Long billladingWaybillId; + private Integer totalPlanNum; } diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseWaybillVO.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseWaybillVO.java index 46fa7ded8..5ba77c4af 100644 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseWaybillVO.java +++ b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseWaybillVO.java @@ -40,6 +40,7 @@ public class WarehouseWaybillVO extends WarehouseWaybillEntity { private Integer handleNum; private Integer planNum; + private Integer totalPlanNum; private Long waybillId; diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingMapper.xml index 76a3f0a49..8df7ff53e 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingMapper.xml @@ -94,7 +94,7 @@ lww.customer_train customerTrain, lww.shipper shipper, lww.total_count totalCount, - lww.total_count-lww.billlading_num planNum, + lww.total_count-lww.billlading_num totalPlanNum, lww.total_weight totalWeight, lww.total_volume totalVolume, lww.total_freight totalFreight, diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingWaybillMapper.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingWaybillMapper.java index 4dcf1583e..4383cda82 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingWaybillMapper.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingWaybillMapper.java @@ -3,6 +3,7 @@ package com.logpm.trunkline.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.logpm.trunkline.entity.TrunklineBillladingWaybillEntity; import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity; +import com.logpm.trunkline.vo.TrunklineBillladingNumVO; import com.logpm.trunkline.vo.TrunklineBillladingWaybillVO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -25,5 +26,9 @@ public interface TrunklineBillladingWaybillMapper extends BaseMapper findNoFinishWaybillByBillladingId(@Param("billladingId") Long billladingId); + + TrunklineBillladingNumVO getNumVOByBillladingId(@Param("billladingId") Long billladingId); } 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 d8c80620d..4d1bbf44f 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 @@ -40,18 +40,16 @@ lww.consignee_mobile consigneeMobile, lww.consignee_address consigneeAddress, lww.remark remark, - lww.total_count totalCount, - sum(ltbw2.real_num) stockCount, + lww.total_count-lww.billlading_num totalPlanNum, + ltbw.plan_num planNum, + ltbw.real_num realNum, 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 + 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 @@ -82,9 +80,27 @@ update logpm_trunkline_billlading_waybill - set is_deleted = 0 + set is_deleted = 0, + plan_num = #{planNum} where billlading_id = #{billladingId} and waybill_no = #{waybillNo} + + + + diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineBillladingWaybillService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineBillladingWaybillService.java index c960ff80a..2251baff1 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineBillladingWaybillService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineBillladingWaybillService.java @@ -3,6 +3,7 @@ package com.logpm.trunkline.service; import com.logpm.trunkline.entity.TrunklineBillladingEntity; import com.logpm.trunkline.entity.TrunklineBillladingWaybillEntity; import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity; +import com.logpm.trunkline.vo.TrunklineBillladingNumVO; import com.logpm.trunkline.vo.TrunklineBillladingWaybillVO; import org.springblade.core.mp.base.BaseService; @@ -33,5 +34,9 @@ public interface ITrunklineBillladingWaybillService extends BaseService findNoFinishWaybillByBillladingId(Long billladingId); + + TrunklineBillladingNumVO getNumVOByBillladingId(Long billladingId); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java index b1bf48a77..cee666a21 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java @@ -925,6 +925,7 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl> parcelListEntityMap = parcelListEntityList.stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getWaybillNumber)); + + List updateWaybillList = new ArrayList<>(); + parcelListEntityMap.keySet().forEach(waybillNo->{ + WarehouseWaybillEntity waybillEntity = waybillEntityMap.get(waybillNo); + + if(!Objects.isNull(waybillEntity)){ + List pl = parcelListEntityMap.get(waybillNo); + Integer size = 0; + if(!pl.isEmpty()){ + size = pl.size(); + } + waybillEntity.setStockCount(waybillEntity.getStockCount() + size); + updateWaybillList.add(waybillEntity); + } + }); + + warehouseWaybillClient.updateList(updateWaybillList); + orderCodeSet.forEach(orderCode->{ stockArticleClient.updateOrderInfo(orderCode,warehouseId); }); 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 1a2900a1a..7eef8e040 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 @@ -264,10 +264,10 @@ public class TrunklineBillladingPackageServiceImpl extends BaseServiceImpl totalCount){ - waybillEntity.setStockCount(totalCount); +// waybillEntity.setStockCount(totalCount); diff = totalCount - stockCount; }else{ - waybillEntity.setStockCount(all); +// waybillEntity.setStockCount(all); diff = size; } Integer integer = waybillNoMNumMap.get(waybillNo); @@ -281,65 +281,69 @@ 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<>(); + TrunklineBillladingWaybillEntity noWaybillNoData = trunklineBillladingWaybillService.findNoWaybillNoData(billladingId); + + + for (String waybillNo : waybillNoSet) { + Integer integer = waybillNoMNumMap.get(waybillNo); + TrunklineBillladingWaybillEntity billladingWaybillEntity = billladingWaybillEntityMap.get(waybillNo); + if(Objects.isNull(billladingWaybillEntity)){ + //查询是否有一条无运单的数据 + if(Objects.isNull(noWaybillNoData)){ + noWaybillNoData = new TrunklineBillladingWaybillEntity(); + noWaybillNoData.setWarehouseId(warehouseId); + noWaybillNoData.setWarehouseName(warehouseEntity.getName()); + noWaybillNoData.setBillladingId(billladingId); + noWaybillNoData.setBilladingCode(trunklineBillladingEntity.getBillladingCode()); + noWaybillNoData.setWaybillNo("————"); + noWaybillNoData.setRealNum(integer); + noWaybillNoData.setRealWeight(BigDecimal.ZERO); + noWaybillNoData.setRealVolume(BigDecimal.ZERO); + addList.add(noWaybillNoData); + }else{ + Integer realNum = noWaybillNoData.getRealNum(); + noWaybillNoData.setRealNum(realNum+integer); + updateList.add(noWaybillNoData); + } + }else{ + Integer realNum = billladingWaybillEntity.getRealNum(); + billladingWaybillEntity.setRealNum(realNum + integer); + updateList.add(billladingWaybillEntity); + } + + } + + + if(!addList.isEmpty()){ + 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); + } + + List warehouseWaybillEntities = new ArrayList<>(); waybillEntityMap.keySet().forEach(waybillNo -> { WarehouseWaybillEntity waybillEntity = waybillEntityMap.get(waybillNo); - if(Objects.isNull(waybillEntity)){ + if(!Objects.isNull(waybillEntity)){ Integer totalCount = waybillEntity.getTotalCount(); Integer stockCount = waybillEntity.getStockCount(); if(stockCount.equals(totalCount)){ @@ -360,10 +364,9 @@ public class TrunklineBillladingPackageServiceImpl extends BaseServiceImpl warehouseWaybillEntities = new ArrayList<>(waybillEntityMap.values()); warehouseWaybillClient.updateList(warehouseWaybillEntities); //根据提货单id重新计算每个运单的费用 diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingServiceImpl.java index b269b6742..baf97c318 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingServiceImpl.java @@ -105,6 +105,8 @@ public class TrunklineBillladingServiceImpl extends BaseServiceImpl saveBillladingWaybillList = new ArrayList<>(); + Map waybillBillladingNumMap = new HashMap<>(); //保存提货运单 List billladingWaybillList = billladingDTO.getBillladingWaybillList(); for (TrunklineBillladingWaybillVO billladingWaybillVO:billladingWaybillList){ @@ -117,12 +119,28 @@ public class TrunklineBillladingServiceImpl extends BaseServiceImpl waybillIds = waybillBillladingNumMap.keySet(); + List waybillEntityList = warehouseWaybillClient.findListByWaybillIds(new ArrayList<>(waybillIds)); + waybillEntityList.forEach(waybillEntity -> { + Long waybillEntityId = waybillEntity.getId(); + Integer planNum = waybillBillladingNumMap.get(waybillEntityId); + if(Objects.isNull(planNum)){ + planNum = 0; + } + Integer billladingNum = waybillEntity.getBillladingNum(); + if(Objects.isNull(billladingNum)){ + billladingNum = 0; + } + waybillEntity.setBillladingNum(billladingNum+planNum); + }); + warehouseWaybillClient.updateList(waybillEntityList); TrunklineBillladingLogEntity logEntity = new TrunklineBillladingLogEntity(); @@ -205,18 +223,42 @@ public class TrunklineBillladingServiceImpl extends BaseServiceImpl oldWaybillBillladingNumMap = new HashMap<>(); + List billladingWaybillVOList = billladingWaybillService.findWaybillInfoListByBillladingId(billladingId); + billladingWaybillVOList.forEach(billladingWaybillVO -> { + oldWaybillBillladingNumMap.put(billladingWaybillVO.getWaybillId(),billladingWaybillVO.getPlanNum()); + }); + + Set oldWaybillIdSet = oldWaybillBillladingNumMap.keySet(); + + List oldWaybillList = warehouseWaybillClient.findListByWaybillIds(new ArrayList<>(oldWaybillIdSet)); + oldWaybillList.forEach(waybillEntity -> { + Long waybillEntityId = waybillEntity.getId(); + Integer planNum = oldWaybillBillladingNumMap.get(waybillEntityId); + if(Objects.isNull(planNum)){ + planNum = 0; + } + Integer billladingNum = waybillEntity.getBillladingNum(); + if(Objects.isNull(billladingNum)){ + billladingNum = 0; + } + waybillEntity.setBillladingNum(Math.max(billladingNum - planNum, 0)); + }); + warehouseWaybillClient.updateList(oldWaybillList); //先删除所有对应的运单 billladingWaybillService.deletedByBillladingId(billladingId); + Map newWaybillBillladingNumMap = new HashMap<>(); //保存提货运单 List billladingWaybillList = billladingDTO.getBillladingWaybillList(); for (TrunklineBillladingWaybillVO billladingWaybillVO:billladingWaybillList){ String waybillNo = billladingWaybillVO.getWaybillNo(); + Integer planNum = billladingWaybillVO.getPlanNum(); //查询运单以前是否挂在当前提货单下 TrunklineBillladingWaybillEntity one = billladingWaybillService.getOneByBillladingIdAndWaybillNo(billladingId,waybillNo); if(!Objects.isNull(one)){ - billladingWaybillService.updateByBillladingIdAndWaybillNo(billladingId,waybillNo); + billladingWaybillService.updateByBillladingIdAndWaybillNo(billladingId,waybillNo,planNum); }else{ TrunklineBillladingWaybillEntity billladingWaybillEntity = new TrunklineBillladingWaybillEntity(); BeanUtil.copy(billladingWaybillVO,billladingWaybillEntity); @@ -228,8 +270,25 @@ public class TrunklineBillladingServiceImpl extends BaseServiceImpl newWaybillIdSet = newWaybillBillladingNumMap.keySet(); + List newWaybillList = warehouseWaybillClient.findListByWaybillIds(new ArrayList<>(newWaybillIdSet)); + newWaybillList.forEach(waybillEntity -> { + Long waybillEntityId = waybillEntity.getId(); + Integer planNum = newWaybillBillladingNumMap.get(waybillEntityId); + if(Objects.isNull(planNum)){ + planNum = 0; + } + Integer billladingNum = waybillEntity.getBillladingNum(); + if(Objects.isNull(billladingNum)){ + billladingNum = 0; + } + waybillEntity.setBillladingNum(billladingNum + planNum); + }); + warehouseWaybillClient.updateList(newWaybillList); + logEntity.setAfterOpreation(JSON.toJSONString(billladingEntity)); trunklineBillladingLogService.save(logEntity); @@ -364,6 +423,28 @@ public class TrunklineBillladingServiceImpl extends BaseServiceImpl billladingWaybillEntities = billladingWaybillService.findNoFinishWaybillByBillladingId(billladingId); + Map map = new HashMap<>(); + billladingWaybillEntities.forEach(billladingWaybillEntity -> { + map.put(billladingWaybillEntity.getWaybillId(),billladingWaybillEntity.getPlanNum() - billladingWaybillEntity.getRealNum()); + }); + + Set waybillIdSet = map.keySet(); + List waybillEntityList = warehouseWaybillClient.findListByWaybillIds(new ArrayList<>(waybillIdSet)); + waybillEntityList.forEach(waybillEntity -> { + Integer integer = map.get(waybillEntity.getId()); + if(Objects.isNull(integer)){ + integer = 0; + } + Integer billladingNum = waybillEntity.getBillladingNum(); + if(Objects.isNull(billladingNum)){ + billladingNum = 0; + } + waybillEntity.setBillladingNum(Math.max(billladingNum - integer, 0)); + }); + warehouseWaybillClient.updateList(waybillEntityList); + } else { log.warn("##################updateBillladingStatus: 提货单不能更新为已结算 billladingStatus={}", billladingStatus); throw new CustomerException(405, "提货单不能更新为提货中"); @@ -371,16 +452,16 @@ public class TrunklineBillladingServiceImpl extends BaseServiceImpl totalCount){ - log.warn("###############updateBillladingWaybillNum: 运单提货数量已经大于总数 waybillId={} totalCount={}",waybillId,totalCount); - throw new CustomerException(405,"【"+waybillNo+"】运单提货数量已经大于总数"); + if(enterNum > planNum){ + log.warn("###############updateBillladingWaybillNum: 运单提货数量已经大于计划数 waybillId={} planNum={}",waybillId,planNum); + throw new CustomerException(405,"【"+waybillNo+"】运单提货数量已经大于计划数"); } - BigDecimal enterWeight = billladingWaybillDTO.getEnterWeight(); - BigDecimal enterVolume = billladingWaybillDTO.getEnterVolume(); - - stockNum = stockNum + enterNum; - stockWeight = stockWeight.add(enterWeight); - stockVolume = stockVolume.add(enterVolume); billladingWaybillService.updateDataByBillladingWaybillId(billladingWaybillId,enterNum,enterWeight,enterVolume); - WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillId(waybillId); - waybillEntity.setStockCount(enterNum); - waybillEntity.setStockWeight(enterWeight); - waybillEntity.setStockVolume(enterVolume); - - - if(totalCount.equals(enterNum)){ - waybillEntity.setWaybillStatus("10"); - try{ - TrunklineWaybillTrackEntity waybillTrackEntity = new TrunklineWaybillTrackEntity(); - waybillTrackEntity.setWarehouseId(billladingEntity.getWarehouseId()); - waybillTrackEntity.setWarehouseName(billladingEntity.getWarehouseName()); - waybillTrackEntity.setWaybillId(waybillId); - waybillTrackEntity.setWaybillNo(waybillNo); - waybillTrackEntity.setTrackType("20"); - waybillTrackEntity.setRefer("已入库"); - waybillTrackEntity.setOperationRemark("运单入库:"+enterNum+"/"+totalCount+",入库类型:【批量入库】,入库时间:"+ CommonUtil.dateToString(new Date())); - trunklineWaybillTrackService.save(waybillTrackEntity); - }catch (Exception e){ - log.warn("#################updateBillladingWaybillNum: 存入日志失败"); - } - } - warehouseWaybillClient.updateEntity(waybillEntity); +// Integer diffNum = enterNum-realNum; +// BigDecimal diffWeight = realWeight.subtract(enterWeight); +// BigDecimal diffVolume = realVolume.subtract(enterVolume); + +// WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillId(waybillId); +// waybillEntity.setStockCount(Math.max(waybillEntity.getStockCount() + diffNum, 0)); +// waybillEntity.setStockWeight(waybillEntity.getStockWeight().add(diffWeight).compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : diffWeight); +// waybillEntity.setStockVolume(waybillEntity.getStockVolume().add(diffVolume).compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : diffVolume); + +// Integer totalCount = waybillEntity.getTotalCount(); +// Integer stockCount = waybillEntity.getStockCount(); + +// if(totalCount.equals(stockCount)){ +// waybillEntity.setWaybillStatus("10"); +// try{ +// TrunklineWaybillTrackEntity waybillTrackEntity = new TrunklineWaybillTrackEntity(); +// waybillTrackEntity.setWarehouseId(billladingEntity.getWarehouseId()); +// waybillTrackEntity.setWarehouseName(billladingEntity.getWarehouseName()); +// waybillTrackEntity.setWaybillId(waybillId); +// waybillTrackEntity.setWaybillNo(waybillNo); +// waybillTrackEntity.setTrackType("20"); +// waybillTrackEntity.setRefer("已入库"); +// waybillTrackEntity.setOperationRemark("运单入库:"+enterNum+"/"+totalCount+",入库类型:【批量入库】,入库时间:"+ CommonUtil.dateToString(new Date())); +// trunklineWaybillTrackService.save(waybillTrackEntity); +// }catch (Exception e){ +// log.warn("#################updateBillladingWaybillNum: 存入日志失败"); +// } +// } +// warehouseWaybillClient.updateEntity(waybillEntity); } - billladingEntity.setRealNum(stockNum); - billladingEntity.setRealWeight(stockWeight); - billladingEntity.setRealVolume(stockVolume); + TrunklineBillladingNumVO numVO = billladingWaybillService.getNumVOByBillladingId(billladingId); + + billladingEntity.setRealNum(numVO.getNum()); + billladingEntity.setRealWeight(numVO.getWeight()); + billladingEntity.setRealVolume(numVO.getVolume()); updateById(billladingEntity); billladingWaybillService.updateBillladingFeeByBillladingId(billladingEntity); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingWaybillServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingWaybillServiceImpl.java index 2faf91918..84ef9dc35 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingWaybillServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingWaybillServiceImpl.java @@ -6,6 +6,7 @@ import com.logpm.trunkline.entity.TrunklineBillladingWaybillEntity; import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity; import com.logpm.trunkline.mapper.TrunklineBillladingWaybillMapper; import com.logpm.trunkline.service.ITrunklineBillladingWaybillService; +import com.logpm.trunkline.vo.TrunklineBillladingNumVO; import com.logpm.trunkline.vo.TrunklineBillladingWaybillVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -134,8 +135,18 @@ public class TrunklineBillladingWaybillServiceImpl extends BaseServiceImpl findNoFinishWaybillByBillladingId(Long billladingId) { + return baseMapper.findNoFinishWaybillByBillladingId(billladingId); + } + + @Override + public TrunklineBillladingNumVO getNumVOByBillladingId(Long billladingId) { + return baseMapper.getNumVOByBillladingId(billladingId); } } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java index 3be4ea2a1..4ea83a6ce 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java @@ -884,8 +884,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl qw = new QueryWrapper<>(); - qw.eq("association_value",orderPackageCode) - .eq("tenant_id","627683"); + qw.eq("association_value",orderPackageCode); WarehouseTrayGoodsEntity trayGoodsEntity = warehouseTrayGoodsService.getOne(qw); if(!Objects.isNull(trayGoodsEntity)){ @@ -900,8 +899,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl updownGoodsEntityQueryWrapper = new QueryWrapper<>(); - updownGoodsEntityQueryWrapper.eq("association_value",orderPackageCode) - .eq("tenant_id","627683"); + updownGoodsEntityQueryWrapper.eq("association_value",orderPackageCode); WarehouseUpdownGoodsEntity updownGoodsEntity = warehouseUpdownGoodsService.getOne(updownGoodsEntityQueryWrapper); if(!Objects.isNull(updownGoodsEntity)){ String positionCode = updownGoodsEntity.getPositionCode(); @@ -957,7 +955,6 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.eq("tray_code",trayCode) - .eq("tenant_id","627683") .eq("is_deleted",0); WarehouseTrayTypeEntity trayTypeEntity = baseMapper.selectOne(queryWrapper); if(Objects.isNull(trayTypeEntity)){