Browse Source

1.卸车逻辑优化

2.开单逻辑优化
visual
zhenghaoyu 5 months ago
parent
commit
6b27a911b7
  1. 4
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java
  2. 3
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java
  3. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java
  4. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java
  5. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java
  6. 25
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml
  7. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java
  8. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java
  9. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java
  10. 7
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml
  11. 1
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.java
  12. 6
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.xml
  13. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java
  14. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsOrderService.java
  15. 67
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java
  16. 5
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadScanServiceImpl.java
  17. 107
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java
  18. 6
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsOrderEntityServiceImpl.java

4
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java

@ -300,5 +300,9 @@ public interface IDistributionParcelListClient {
@PostMapping(API_PREFIX + "/findIdAndWarehouseIdListByOrderCodes") @PostMapping(API_PREFIX + "/findIdAndWarehouseIdListByOrderCodes")
List<DistributionParcelListEntity> findIdAndWarehouseIdListByOrderCodes(@RequestBody Set<String> orderCodeSet); List<DistributionParcelListEntity> findIdAndWarehouseIdListByOrderCodes(@RequestBody Set<String> orderCodeSet);
@PostMapping(API_PREFIX + "/findListByOrderPackageCodes")
List<DistributionParcelListEntity> findListByOrderPackageCodes(@RequestBody List<String> orderPackageCodes);
} }

3
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java

@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* 配送在库订单 Feign接口类 * 配送在库订单 Feign接口类
@ -219,4 +220,6 @@ public interface IDistributionStockArticleClient {
@PostMapping(value = API_PREFIX + "/deleteZeroOrderByWaybillNoList",consumes = MediaType.APPLICATION_JSON_VALUE) @PostMapping(value = API_PREFIX + "/deleteZeroOrderByWaybillNoList",consumes = MediaType.APPLICATION_JSON_VALUE)
void deleteZeroOrderByWaybillNoList(@RequestBody List<String> waybillNoList); void deleteZeroOrderByWaybillNoList(@RequestBody List<String> waybillNoList);
@PostMapping(API_PREFIX + "/findWaybillNoByOrderIds")
List<DistributionStockArticleEntity> findWaybillNoByOrderIds(@RequestBody Set<Long> stockArticleIds);
} }

5
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java

@ -636,4 +636,9 @@ public class DistributionParcelListClient implements IDistributionParcelListClie
return distributionParcelListService.findIdAndWarehouseIdListByOrderCodes(orderCodeSet); return distributionParcelListService.findIdAndWarehouseIdListByOrderCodes(orderCodeSet);
} }
@Override
public List<DistributionParcelListEntity> findListByOrderPackageCodes(List<String> orderPackageCodes) {
return distributionParcelListService.findListByOrderPackageCodes(orderPackageCodes);
}
} }

5
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java

@ -446,4 +446,9 @@ public class DistributionStockArticleClient implements IDistributionStockArticle
} }
@Override
public List<DistributionStockArticleEntity> findWaybillNoByOrderIds(Set<Long> stockArticleIds) {
return distributionParcelListService.findWaybillNoByOrderIds(stockArticleIds);
}
} }

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java

@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.distribution.dto.DistributionParcelListDTO; import com.logpm.distribution.dto.DistributionParcelListDTO;
import com.logpm.distribution.dto.app.StockupDTO; import com.logpm.distribution.dto.app.StockupDTO;
import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.excel.DistributionParcelListExcel; import com.logpm.distribution.excel.DistributionParcelListExcel;
import com.logpm.distribution.vo.*; import com.logpm.distribution.vo.*;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -334,4 +335,7 @@ public interface DistributionParcelListMapper extends BaseMapper<DistributionPar
List<DistributionParcelListEntity> findIdAndWarehouseIdListByOrderCodes(@Param("orderCodeSet") Set<String> orderCodeSet); List<DistributionParcelListEntity> findIdAndWarehouseIdListByOrderCodes(@Param("orderCodeSet") Set<String> orderCodeSet);
List<DistributionParcelListEntity> findListByOrderPackageCodes(@Param("orderPackageCodes") List<String> orderPackageCodes);
List<DistributionStockArticleEntity> findWaybillNoByOrderIds(@Param("stockArticleIds") Set<Long> stockArticleIds);
} }

25
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml

@ -2243,4 +2243,29 @@
and ldpl.is_deleted = 0 and ldpl.is_deleted = 0
</select> </select>
<select id="findListByOrderPackageCodes" resultType="com.logpm.distribution.entity.DistributionParcelListEntity">
select ldpl.id,
ldpl.warehouse_id,
ldpl.stock_article_id
from logpm_distribution_parcel_list ldpl
where ldpl.order_package_code in
<foreach collection="orderPackageCodeSet" item="item" separator="," open="(" close=")">
#{item}
</foreach>
and ldpl.is_deleted = 0
</select>
<select id="findWaybillNoByOrderIds" resultType="com.logpm.distribution.entity.DistributionStockArticleEntity">
select ldpl.stock_article_id id,
GROUP_CONCAT(DISTINCT ldpl.waybill_number) waybillNumber
from logpm_distribution_parcel_list ldpl
where ldpl.stock_article_id in
<foreach collection="stockArticleIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
group by ldpl.stock_article_id
</select>
</mapper> </mapper>

5
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java

@ -20,6 +20,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.distribution.dto.app.StockupDTO; import com.logpm.distribution.dto.app.StockupDTO;
import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.excel.DistributionParcelListExcel; import com.logpm.distribution.excel.DistributionParcelListExcel;
import com.logpm.distribution.vo.*; import com.logpm.distribution.vo.*;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
@ -305,4 +306,8 @@ public interface IDistributionParcelListService extends BaseService<Distribution
List<DistributionParcelListEntity> findIdAndWarehouseIdListByAdvanceIds(List<Long> advanceIds); List<DistributionParcelListEntity> findIdAndWarehouseIdListByAdvanceIds(List<Long> advanceIds);
List<DistributionParcelListEntity> findIdAndWarehouseIdListByOrderCodes(Set<String> orderCodeSet); List<DistributionParcelListEntity> findIdAndWarehouseIdListByOrderCodes(Set<String> orderCodeSet);
List<DistributionParcelListEntity> findListByOrderPackageCodes(List<String> orderPackageCodes);
List<DistributionStockArticleEntity> findWaybillNoByOrderIds(Set<Long> stockArticleIds);
} }

10
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java

@ -1567,4 +1567,14 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
public List<DistributionParcelListEntity> findIdAndWarehouseIdListByOrderCodes(Set<String> orderCodeSet) { public List<DistributionParcelListEntity> findIdAndWarehouseIdListByOrderCodes(Set<String> orderCodeSet) {
return baseMapper.findIdAndWarehouseIdListByOrderCodes(orderCodeSet); return baseMapper.findIdAndWarehouseIdListByOrderCodes(orderCodeSet);
} }
@Override
public List<DistributionParcelListEntity> findListByOrderPackageCodes(List<String> orderPackageCodes) {
return baseMapper.findListByOrderPackageCodes(orderPackageCodes);
}
@Override
public List<DistributionStockArticleEntity> findWaybillNoByOrderIds(Set<Long> stockArticleIds) {
return baseMapper.findWaybillNoByOrderIds(stockArticleIds);
}
} }

2
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java

@ -189,4 +189,6 @@ public interface TrunklineCarsLoadScanMapper extends BaseMapper<TrunklineCarsLoa
Integer findStockNumByLoadId(@Param("loadId") Long loadId); Integer findStockNumByLoadId(@Param("loadId") Long loadId);
TrunklineCarsLoadScanEntity findEntityByLoadIdAndOrderPackageCodeAndScanStatus(@Param("loadId") Long loadId, @Param("orderPackageCode") String orderPackageCode, @Param("scanStatus") String scanStatus); TrunklineCarsLoadScanEntity findEntityByLoadIdAndOrderPackageCodeAndScanStatus(@Param("loadId") Long loadId, @Param("orderPackageCode") String orderPackageCode, @Param("scanStatus") String scanStatus);
List<TrunklineCarsLoadScanEntity> findListByLoadId(@Param("loadId") Long loadId);
} }

7
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml

@ -1020,4 +1020,11 @@
and scan_status = #{scanStatus} and scan_status = #{scanStatus}
</select> </select>
<select id="findListByLoadId" resultType="com.logpm.trunkline.entity.TrunklineCarsLoadScanEntity">
select *
from logpm_trunkline_cars_load_scan
where load_id = #{loadId}
</select>
</mapper> </mapper>

1
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.java

@ -71,4 +71,5 @@ public interface TrunklineCarsOrderMapper extends BaseMapper<TrunklineCarsOrderE
List<SignScanOrderVO> findSignZeroOrderListBySignOrderId(@Param("signOrderId") Long signOrderId); List<SignScanOrderVO> findSignZeroOrderListBySignOrderId(@Param("signOrderId") Long signOrderId);
List<TrunklineCarsOrderEntity> findListByLoadId(@Param("loadId") Long loadId);
} }

6
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.xml

@ -385,4 +385,10 @@
and ltco.is_customer = '1' and ltco.is_customer = '1'
</select> </select>
<select id="findListByLoadId" resultType="com.logpm.trunkline.entity.TrunklineCarsOrderEntity">
select ltco.*
from logpm_trunkline_cars_order ltco
where ltco.load_id = #{loadId}
</select>
</mapper> </mapper>

2
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java

@ -185,4 +185,6 @@ public interface ITrunklineCarsLoadScanService extends BaseService<TrunklineCars
Integer findStockNumByLoadId(Long loadId); Integer findStockNumByLoadId(Long loadId);
TrunklineCarsLoadScanEntity findEntityByLoadIdAndOrderPackageCodeAndScanStatus(Long loadId, String orderPackageCode, String scanStatus); TrunklineCarsLoadScanEntity findEntityByLoadIdAndOrderPackageCodeAndScanStatus(Long loadId, String orderPackageCode, String scanStatus);
List<TrunklineCarsLoadScanEntity> findListByLoadId(Long loadId);
} }

2
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsOrderService.java

@ -68,4 +68,6 @@ public interface ITrunklineCarsOrderService extends BaseService<TrunklineCarsOrd
List<SignScanOrderVO> findSignZeroOrderListBySignOrderId(Long signOrderId); List<SignScanOrderVO> findSignZeroOrderListBySignOrderId(Long signOrderId);
List<TrunklineCarsOrderEntity> findListByLoadId(Long loadId);
} }

67
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java

@ -23,7 +23,6 @@ import com.logpm.distribution.feign.IDistributionParcelListClient;
import com.logpm.distribution.feign.IDistributionParcelNumberClient; import com.logpm.distribution.feign.IDistributionParcelNumberClient;
import com.logpm.distribution.feign.IDistributionReservationStockarticleClient; import com.logpm.distribution.feign.IDistributionReservationStockarticleClient;
import com.logpm.distribution.feign.IDistributionStockArticleClient; import com.logpm.distribution.feign.IDistributionStockArticleClient;
import com.logpm.distribution.vo.UpdateOrderDTO;
import com.logpm.statistics.feign.IOrderInfoClient; import com.logpm.statistics.feign.IOrderInfoClient;
import com.logpm.trunkline.dto.*; import com.logpm.trunkline.dto.*;
import com.logpm.trunkline.entity.*; import com.logpm.trunkline.entity.*;
@ -684,24 +683,46 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceService.updateBatchById(advanceEntityList); advanceService.updateBatchById(advanceEntityList);
//更新暂存单包件的运单信息 //更新暂存单包件的运单信息
if(CollUtil.isNotEmpty(advanceIds)){
advanceDetailService.updateWaybillNoByAdvanceIds(advanceIds, waybillNo, waybillId); List<TrunklineAdvanceDetailVO> list = advanceDetailService.findListByAdvanceIds(advanceIds);
List<TrunklineAdvanceDetailVO> list = advanceDetailService.findListByAdvanceIds(advanceIds); trunklineWaybillPackageService.saveList(list, waybillEntity);
trunklineWaybillPackageService.saveList(list, waybillEntity);
UpdateOrderDTO updateOrderDTO = new UpdateOrderDTO(); //把updateAdvanceDetailList转化成以id为key的Map
updateOrderDTO.setAdvanceIds(advanceIds); Map<Long, TrunklineAdvanceDetailVO> updateAdvanceDetailMap = list.stream()
updateOrderDTO.setWaybillId(waybillId); .collect(Collectors.toMap(TrunklineAdvanceDetailVO::getId, detail -> detail));
distributionParcelListClient.updateEntityByOpenOrderByAdvanceIds(updateOrderDTO);
List<TrunklineAdvanceDetailEntity> updateAdvanceDetailList = openOrderDTO.getUpdateAdvanceDetailList();
List<String> orderPackageCodes = new ArrayList<>();
String finalWaybillNo = waybillNo;
updateAdvanceDetailList.forEach(detail -> {
Long id = detail.getId();
TrunklineAdvanceDetailEntity trunklineAdvanceDetailEntity = updateAdvanceDetailMap.get(id);
detail.setWaybillId(waybillId);
detail.setWaybillNo(finalWaybillNo);
detail.setCostCategoryId(trunklineAdvanceDetailEntity.getCostCategoryId());
detail.setCostCategoryName(trunklineAdvanceDetailEntity.getCostCategoryName());
detail.setIncomeCategoryId(trunklineAdvanceDetailEntity.getIncomeCategoryId());
detail.setIncomeCategoryName(trunklineAdvanceDetailEntity.getIncomeCategoryName());
orderPackageCodes.add(detail.getOrderPackageCode());
});
if(CollUtil.isNotEmpty(orderPackageCodes)){
//把orderPackageCodes每500条分为一组
List<List<String>> orderPackageCodeList = CollUtil.split(orderPackageCodes, 500);
List<DistributionParcelListEntity> parcelListEntities = new ArrayList<>();
orderPackageCodeList.forEach(orderPackageCodeList1 -> {
parcelListEntities.addAll(distributionParcelListClient.findListByOrderPackageCodes(orderPackageCodeList1));
});
String departureWarehouseName = waybillEntity.getDepartureWarehouseName(); String departureWarehouseName = waybillEntity.getDepartureWarehouseName();
String destinationWarehouseName = waybillEntity.getDestinationWarehouseName(); String destinationWarehouseName = waybillEntity.getDestinationWarehouseName();
Long consigneeId1 = waybillEntity.getConsigneeId(); Long consigneeId1 = waybillEntity.getConsigneeId();
BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findEntityById(consigneeId1); BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findEntityById(consigneeId1);
// List<DistributionParcelListEntity> parcelListEntities = distributionParcelListClient.findIdAndWarehouseIdListByAdvanceIds(advanceIds);
List<DistributionParcelListEntity> parcelListEntities = distributionParcelListClient.findIdAndWarehouseIdListByOrderCodes(orderCodeSet);
Set<Long> stockArticleIds = new TreeSet<>(); Set<Long> stockArticleIds = new TreeSet<>();
String finalWaybillNo = waybillNo;
parcelListEntities.forEach(parcelListEntity -> { parcelListEntities.forEach(parcelListEntity -> {
Long packageWarehouseId = parcelListEntity.getWarehouseId(); Long packageWarehouseId = parcelListEntity.getWarehouseId();
parcelListEntity.setWaybillId(waybillId); parcelListEntity.setWaybillId(waybillId);
@ -724,11 +745,11 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
distributionParcelListClient.updateList(parcelListEntities); distributionParcelListClient.updateList(parcelListEntities);
List<DistributionStockArticleEntity> updateList = new ArrayList<>(); //根据订单id获取每个订单的运单拼接数据
stockArticleIds.forEach(stockArticleId -> {
DistributionStockArticleEntity stockArticleEntity = new DistributionStockArticleEntity(); List<DistributionStockArticleEntity> stockArticleEntities = distributionStockArticleClient.findWaybillNoByOrderIds(stockArticleIds);
stockArticleEntity.setId(stockArticleId);
stockArticleEntity.setWaybillNumber(finalWaybillNo); stockArticleEntities.forEach(stockArticleEntity -> {
stockArticleEntity.setMallId(consigneeId1); stockArticleEntity.setMallId(consigneeId1);
stockArticleEntity.setMallCode(basicdataClientEntity.getClientCode()); stockArticleEntity.setMallCode(basicdataClientEntity.getClientCode());
stockArticleEntity.setMallName(basicdataClientEntity.getClientName()); stockArticleEntity.setMallName(basicdataClientEntity.getClientName());
@ -737,20 +758,20 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
stockArticleEntity.setConsigneeMobile(waybillEntity.getConsigneeMobile()); stockArticleEntity.setConsigneeMobile(waybillEntity.getConsigneeMobile());
stockArticleEntity.setConsigneeAddress(waybillEntity.getConsigneeAddress()); stockArticleEntity.setConsigneeAddress(waybillEntity.getConsigneeAddress());
stockArticleEntity.setConsigneeUnit(basicdataClientEntity.getClientName()); stockArticleEntity.setConsigneeUnit(basicdataClientEntity.getClientName());
updateList.add(stockArticleEntity);
}); });
if(CollUtil.isNotEmpty(updateList)){ if(CollUtil.isNotEmpty(stockArticleEntities)){
distributionStockArticleClient.updateByBatchId(updateList); distributionStockArticleClient.updateByBatchId(stockArticleEntities);
} }
}
trunklineWaybillPackageService.updateWaybillStatus(waybillEntity);
}
//修改暂存单明细的结算品类 //修改暂存单明细的结算品类
List<TrunklineAdvanceDetailEntity> updateAdvanceDetailList = openOrderDTO.getUpdateAdvanceDetailList();
advanceDetailService.updateBatchById(updateAdvanceDetailList); advanceDetailService.updateBatchById(updateAdvanceDetailList);
trunklineWaybillPackageService.updateWaybillStatus(waybillEntity);
//计算扫码入库的包件是否需要把运单和提货单挂上 //计算扫码入库的包件是否需要把运单和提货单挂上
openOrderAsyncService.dealwithBillladingInfo(advanceIds,warehouseId,warehouseName,waybillId,waybillNo); openOrderAsyncService.dealwithBillladingInfo(advanceIds,warehouseId,warehouseName,waybillId,waybillNo);

5
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadScanServiceImpl.java

@ -474,4 +474,9 @@ public class TrunklineCarsLoadScanServiceImpl extends BaseServiceImpl<TrunklineC
return baseMapper.findEntityByLoadIdAndOrderPackageCodeAndScanStatus(loadId,orderPackageCode,scanStatus); return baseMapper.findEntityByLoadIdAndOrderPackageCodeAndScanStatus(loadId,orderPackageCode,scanStatus);
} }
@Override
public List<TrunklineCarsLoadScanEntity> findListByLoadId(Long loadId) {
return baseMapper.findListByLoadId(loadId);
}
} }

107
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java

@ -1580,59 +1580,78 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
log.warn("###########updateNumByLoadId: 配载计划数据不存在 loadId={}", loadId); log.warn("###########updateNumByLoadId: 配载计划数据不存在 loadId={}", loadId);
throw new CustomerException(400, "配载计划数据不存在"); throw new CustomerException(400, "配载计划数据不存在");
} }
TrunklineCarsLoadEntity updateCarsLoadEntity = new TrunklineCarsLoadEntity();
updateCarsLoadEntity.setId(loadId);
//计划件数 //计划件数
Integer loadPlanNum = 0; Integer loadPlanNum = 0;
List<NodeNumDataVO> nodeNumDataVOS = trunklineCarsOrderService.findNodeDataByLoadId(loadId); List<NodeNumDataVO> nodeNumDataVOS = trunklineCarsOrderService.findNodeDataByLoadId(loadId);
for (NodeNumDataVO nodeNumDataVO : nodeNumDataVOS) { //把nodeNumDataVOS中所有元素的planNum求和
Long loadLineId = nodeNumDataVO.getLoadLineId(); loadPlanNum = nodeNumDataVOS.stream().mapToInt(NodeNumDataVO::getPlanNum).sum();
Integer planNum = nodeNumDataVO.getPlanNum();
loadPlanNum = loadPlanNum + planNum;
trunklineCarsLoadLineService.updatePlanLoadingNumberByLoadLineId(planNum, loadLineId);
}
carsLoadEntity.setPlanLoadingNumber(loadPlanNum);
// updateById(carsLoadEntity);
//装车 卸车数量 //把nodeNumDataVOS转化成以loadLineId为key的Map
Integer realLoadingNum = trunklineCarsLoadScanService.findNumByLoadId(loadId);//配载计划实际装车数量 Map<Long, NodeNumDataVO> nodeNumDataVOMap = nodeNumDataVOS.stream().collect(Collectors.toMap(NodeNumDataVO::getLoadLineId, Function.identity()));
Integer realUnloadingNum = trunklineCarsLoadScanService.findUnloadNumByLoadId(loadId);//配载计划实际卸车数量
Integer stockCarNum = trunklineCarsLoadScanService.findStockNumByLoadId(loadId);//配载计划在车件数
Integer abnormalNum = trunklineCarsLoadScanService.findAbnormalNumByLoadId(loadId);//配载计划装车异常数量
// Integer unloadAbnormalNum = trunklineCarsUnloadLogService.findAbnormalNumByLoadId(loadId);//配载计划卸车异常数量
carsLoadEntity.setRealLoadingNumber(realLoadingNum);
carsLoadEntity.setUnloadNumber(realUnloadingNum);
carsLoadEntity.setStockNumber(stockCarNum);
carsLoadEntity.setAbnormalNum(abnormalNum);
updateById(carsLoadEntity);
carsLoadEntity.setPlanLoadingNumber(loadPlanNum);
//查询所有的装车明细数据
List<TrunklineCarsLoadScanEntity> scanList = trunklineCarsLoadScanService.findListByLoadId(loadId);
//把scanList中warehouseId不为空的num值求和 为空则用0代替
Integer realLoadingNum = scanList.stream().filter(scan -> !Objects.isNull(scan.getWarehouseId())).mapToInt(TrunklineCarsLoadScanEntity::getNum).sum();
///把scanList中scanStatus不为1的unloadNum值求和 为空则用0代替
Integer realUnloadingNum = scanList.stream().filter(scan -> !Objects.isNull(scan.getScanStatus()) && !scan.getScanStatus().equals("1")).mapToInt(TrunklineCarsLoadScanEntity::getUnloadNum).sum();
Integer stockCarNum = scanList.stream().filter(scan -> !Objects.isNull(scan.getScanStatus()) && scan.getScanStatus().equals("1")).mapToInt(TrunklineCarsLoadScanEntity::getUnloadNum).sum();
updateCarsLoadEntity.setPlanLoadingNumber(loadPlanNum);
updateCarsLoadEntity.setRealLoadingNumber(realLoadingNum);
updateCarsLoadEntity.setUnloadNumber(realUnloadingNum);
updateCarsLoadEntity.setStockNumber(stockCarNum);
updateById(updateCarsLoadEntity);
//节点数据
List<TrunklineCarsLoadLineEntity> carsLoadLineList = trunklineCarsLoadLineService.findListByLoadId(loadId); List<TrunklineCarsLoadLineEntity> carsLoadLineList = trunklineCarsLoadLineService.findListByLoadId(loadId);
for (TrunklineCarsLoadLineEntity carsLoadLineEntity : carsLoadLineList) { List<TrunklineCarsLoadLineEntity> updateLoadLineList = new ArrayList<>();
carsLoadLineList.forEach(carsLoadLineEntity -> {
Long loadLingId = carsLoadLineEntity.getId();
Long nodeId = carsLoadLineEntity.getNodeId(); Long nodeId = carsLoadLineEntity.getNodeId();
Integer lineLoadingNum = trunklineCarsLoadScanService.findNumByLoadIdAndNodeId(loadId, nodeId);//节点实际装车数量 NodeNumDataVO nodeNumDataVO = nodeNumDataVOMap.get(loadLingId);
Integer lineUnloadingNum = trunklineCarsLoadScanService.findUnloadNumByLoadIdAndNodeId(loadId, nodeId);//节点实际卸车数量 Integer planNum = nodeNumDataVO.getPlanNum();
Integer lineAbnormalNum = trunklineCarsLoadScanService.findAbnormalNumByLoadIdAndNodeId(loadId, nodeId);//节点实际装车异常数量 Integer lineRealLoadingNum = scanList.stream().filter(scan -> NumberUtil.equals(nodeId,scan.getWarehouseId())).mapToInt(TrunklineCarsLoadScanEntity::getNum).sum();
// Integer lineUnloadingAbnormalNum = trunklineCarsUnloadLogService.findAbnormalNumByLoadIdAndNodeId(loadId,nodeId);//节点实际卸车异常数量 Integer lineRealUnloadingNum = scanList.stream().filter(scan -> !Objects.isNull(scan.getScanStatus()) && !scan.getScanStatus().equals("1") && NumberUtil.equals(nodeId,scan.getWarehouseId())).mapToInt(TrunklineCarsLoadScanEntity::getUnloadNum).sum();
carsLoadLineEntity.setRealLoadingNumber(lineLoadingNum); TrunklineCarsLoadLineEntity updateEntity = new TrunklineCarsLoadLineEntity();
carsLoadLineEntity.setUnloadNumber(lineUnloadingNum); updateEntity.setPlanLoadingNumber(planNum);
carsLoadLineEntity.setAbnormalNum(lineAbnormalNum); updateEntity.setRealLoadingNumber(lineRealLoadingNum);
trunklineCarsLoadLineService.updateById(carsLoadLineEntity); updateEntity.setUnloadNumber(lineRealUnloadingNum);
updateLoadLineList.add(updateEntity);
});
//查询订单上 if(CollUtil.isNotEmpty(updateLoadLineList)){
List<TrunklineCarsOrderEntity> carsOrderEntities = trunklineCarsOrderService.findListByLoadIdAndNodeId(loadId, nodeId); trunklineCarsLoadLineService.updateBatchById(updateLoadLineList);
for (TrunklineCarsOrderEntity carsOrderEntity : carsOrderEntities) { }
String orderCode = carsOrderEntity.getOrderCode();
String waybillNo = carsOrderEntity.getWaybillNo(); //订单数据
Integer orderLoadingNum = trunklineCarsLoadScanService.findNumByLoadIdAndNodeIdAndOrderCodeAndWaybillNo(loadId, nodeId, orderCode, waybillNo);//节点实际装车数量 List<TrunklineCarsOrderEntity> carsOrderList = trunklineCarsOrderService.findListByLoadId(loadId);
Integer orderUnloadingNum = trunklineCarsLoadScanService.findUnloadNumByLoadIdAndNodeIdAndOrderCodeAndWaybillNo(loadId, nodeId, orderCode, waybillNo);//节点实际卸车数量 List<TrunklineCarsOrderEntity> updateOrderList = new ArrayList<>();
Integer orderSignNum = trunklineCarsLoadScanService.findSignNumByLoadIdAndNodeIdAndOrderCodeAndeWaybillNo(loadId, nodeId, orderCode, waybillNo); carsOrderList.forEach(carsOrderEntity -> {
// Integer orderLoadingAbnormalNum = trunklineCarsLoadScanService.findAbnormalNumByLoadIdAndNodeId(loadId,nodeId,orderCode,waybillNo);//节点实际装车异常数量 Long carsOrderId = carsOrderEntity.getId();
// Integer orderUnloadingAbnormalNum = trunklineCarsUnloadLogService.findAbnormalNumByLoadIdAndNodeId(loadId,nodeId,orderCode,waybillNo);//节点实际卸车异常数量 Long nodeId = carsOrderEntity.getNodeId();
carsOrderEntity.setRealNum(orderLoadingNum); String orderCode = carsOrderEntity.getOrderCode();
carsOrderEntity.setUnloadNum(orderUnloadingNum); String waybillNo = carsOrderEntity.getWaybillNo();
carsOrderEntity.setSignNum(orderSignNum); Integer carsOrderRealLoadingNum = scanList.stream().filter(scan -> NumberUtil.equals(nodeId,scan.getWarehouseId()) && StringUtil.equals(orderCode,scan.getOrderCode()) && StringUtil.equals(waybillNo,scan.getWaybillNo())).mapToInt(TrunklineCarsLoadScanEntity::getNum).sum();
trunklineCarsOrderService.updateById(carsOrderEntity); Integer carsOrderRealUnloadingNum = scanList.stream().filter(scan -> !Objects.isNull(scan.getScanStatus()) && !scan.getScanStatus().equals("1") && NumberUtil.equals(nodeId,scan.getWarehouseId()) && StringUtil.equals(orderCode,scan.getOrderCode()) && StringUtil.equals(waybillNo,scan.getWaybillNo())).mapToInt(TrunklineCarsLoadScanEntity::getUnloadNum).sum();
} Integer carsOrderRealSignNum = scanList.stream().filter(scan -> !Objects.isNull(scan.getScanStatus()) && scan.getScanStatus().equals("3") && NumberUtil.equals(nodeId,scan.getWarehouseId()) && StringUtil.equals(orderCode,scan.getOrderCode()) && StringUtil.equals(waybillNo,scan.getWaybillNo())).mapToInt(TrunklineCarsLoadScanEntity::getUnloadNum).sum();
TrunklineCarsOrderEntity updateCarsOrderEntity = new TrunklineCarsOrderEntity();
updateCarsOrderEntity.setId(carsOrderId);
updateCarsOrderEntity.setRealNum(carsOrderRealLoadingNum);
updateCarsOrderEntity.setUnloadNum(carsOrderRealUnloadingNum);
updateCarsOrderEntity.setSignNum(carsOrderRealSignNum);
updateOrderList.add(updateCarsOrderEntity);
});
if(CollUtil.isNotEmpty(updateOrderList)){
trunklineCarsOrderService.updateBatchById(updateOrderList);
} }
log.info("#########updateNumByLoadId: 更新配载计划数量 完成"); log.info("#########updateNumByLoadId: 更新配载计划数量 完成");
} }

6
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsOrderEntityServiceImpl.java

@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
@ -163,4 +164,9 @@ public class TrunklineCarsOrderEntityServiceImpl extends BaseServiceImpl<Trunkli
return baseMapper.findSignZeroOrderListBySignOrderId(signOrderId); return baseMapper.findSignZeroOrderListBySignOrderId(signOrderId);
} }
@Override
public List<TrunklineCarsOrderEntity> findListByLoadId(Long loadId) {
return baseMapper.findListByLoadId(loadId);
}
} }

Loading…
Cancel
Save