diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java index 5e4e16492..ec786854c 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java @@ -21,6 +21,7 @@ import com.logpm.distribution.dto.FindParamterDTO; import com.logpm.distribution.dto.OrderPackageDTO; import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.vo.DistributionParcelListVO; +import com.logpm.distribution.vo.UpdateOrderDTO; import com.logpm.distribution.vo.ZeroPackageSupplyVO; import org.springblade.common.constant.ModuleNameConstant; import org.springblade.core.mp.support.BladePage; @@ -167,6 +168,9 @@ public interface IDistributionParcelListClient { @GetMapping(API_PREFIX + "/updateEntityByOpenOrder") void updateEntityByOpenOrder(@RequestParam Long advanceId, @RequestParam Long waybillId); + @PostMapping(API_PREFIX + "/updateEntityByOpenOrderByAdvanceIds") + void updateEntityByOpenOrderByAdvanceIds(@RequestBody UpdateOrderDTO updateOrderDTO); + @GetMapping(API_PREFIX + "/findByWaybillNumber") List findByWaybillNumber(@RequestParam String waybillNumber); diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/UpdateOrderDTO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/UpdateOrderDTO.java new file mode 100644 index 000000000..784b58282 --- /dev/null +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/UpdateOrderDTO.java @@ -0,0 +1,15 @@ +package com.logpm.distribution.vo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class UpdateOrderDTO implements Serializable { + + private List advanceIds; + + private Long waybillId; + +} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java index 07b2a590a..8f32ae7da 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java @@ -34,6 +34,7 @@ import com.logpm.distribution.service.IDistributionParcelListService; import com.logpm.distribution.service.IDistributionParcelNumberService; import com.logpm.distribution.service.IDistributionStockArticleService; import com.logpm.distribution.vo.DistributionParcelListVO; +import com.logpm.distribution.vo.UpdateOrderDTO; import com.logpm.distribution.vo.ZeroPackageSupplyVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -333,6 +334,11 @@ public class DistributionParcelListClient implements IDistributionParcelListClie } + @Override + public void updateEntityByOpenOrderByAdvanceIds(UpdateOrderDTO updateOrderDTO) { + distributionParcelListService.updateEntityByOpenOrderByAdvanceIds(updateOrderDTO); + } + @Override public List findByWaybillNumber(String waybillNumber) { return distributionParcelListService.findByWaybillNumber(waybillNumber); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java index d8b4102d4..929d55168 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java @@ -284,4 +284,6 @@ public interface IDistributionParcelListService extends BaseService findOrderInfoByOrderPackageCode(String orderPackageCode, Long warehouseId); + + void updateEntityByOpenOrderByAdvanceIds(UpdateOrderDTO updateOrderDTO); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java index 30b3cc3ee..a28c97c8a 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java @@ -24,7 +24,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.zxing.WriterException; import com.logpm.basic.entity.BasicMaterialEntity; import com.logpm.basic.feign.IBasicMaterialClient; import com.logpm.basicdata.entity.BasicdataClientEntity; @@ -35,30 +34,10 @@ import com.logpm.basicdata.feign.IBasicdataGoodsAllocationClient; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.distribution.dto.DistributionParcelListDTO; import com.logpm.distribution.dto.app.StockupDTO; -import com.logpm.distribution.entity.DistributionParcelListEntity; -import com.logpm.distribution.entity.DistributionParcelNumberEntity; -import com.logpm.distribution.entity.DistributionReservationZeroPackageEntity; -import com.logpm.distribution.entity.DistributionStockArticleEntity; -import com.logpm.distribution.entity.DistributionStockListEntity; -import com.logpm.distribution.entity.DistributionStockListInfoEntity; -import com.logpm.distribution.entity.DistrilbutionBillPackageEntity; import com.logpm.distribution.entity.*; import com.logpm.distribution.excel.DistributionParcelListExcel; import com.logpm.distribution.mapper.DistributionParcelListMapper; import com.logpm.distribution.mapper.DistributionStockArticleMapper; -import com.logpm.distribution.service.IDistributionParcelDetailsService; -import com.logpm.distribution.service.IDistributionParcelListService; -import com.logpm.distribution.service.IDistributionParcelNumberService; -import com.logpm.distribution.service.IDistributionReservationZeroPackageService; -import com.logpm.distribution.service.IDistributionStockArticleService; -import com.logpm.distribution.service.IDistributionStockListInfoService; -import com.logpm.distribution.service.IDistributionStockListService; -import com.logpm.distribution.service.IDistrilbutionBillPackageService; -import com.logpm.distribution.vo.DistributionParcelListBaseVO; -import com.logpm.distribution.vo.DistributionParcelListNodeVO; -import com.logpm.distribution.vo.DistributionParcelListVO; -import com.logpm.distribution.vo.DistributionParcelListZeroVO; -import com.logpm.distribution.vo.PackageStockupVO; import com.logpm.distribution.service.*; import com.logpm.distribution.vo.*; import com.logpm.trunkline.feign.ITrunklinePackageTrackLogClient; @@ -98,20 +77,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; -import java.awt.image.BufferedImage; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.TreeSet; +import java.util.*; import java.util.stream.Collectors; /** @@ -1487,4 +1454,70 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl advanceIds = updateOrderDTO.getAdvanceIds(); + + WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillId(waybillId); + if (Objects.isNull(waybillEntity)) { + log.warn("############updateEntityByOpenOrderByAdvanceIds: 运单信息不存在 waybillId={}", waybillId); + throw new CustomerException(405, "运单信息不存在"); + } + Long departureWarehouseId = waybillEntity.getDepartureWarehouseId(); + String departureWarehouseName = waybillEntity.getDepartureWarehouseName(); + Long destinationWarehouseId = waybillEntity.getDestinationWarehouseId(); + String destinationWarehouseName = waybillEntity.getDestinationWarehouseName(); + String waybillNo = waybillEntity.getWaybillNo(); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in("advance_id", advanceIds) + .eq("is_deleted", 0); + List listEntityList = baseMapper.selectList(queryWrapper); + Set orderCodes = new TreeSet<>(); + for (DistributionParcelListEntity parcelListEntity : listEntityList) { + Long packageWarehouseId = parcelListEntity.getWarehouseId(); + parcelListEntity.setWaybillId(waybillId); + parcelListEntity.setWaybillNumber(waybillNo); + parcelListEntity.setSendWarehouseId(departureWarehouseId); + parcelListEntity.setSendWarehouseName(departureWarehouseName); + parcelListEntity.setAcceptWarehouseId(destinationWarehouseId); + parcelListEntity.setAcceptWarehouseName(destinationWarehouseName); + if (departureWarehouseId.equals(destinationWarehouseId)) { + parcelListEntity.setIsTransfer(0); + } else { + if (destinationWarehouseId.equals(packageWarehouseId)) { + parcelListEntity.setIsTransfer(0); + } else { + parcelListEntity.setIsTransfer(1); + } + } + orderCodes.add(parcelListEntity.getOrderCode()); + } + updateBatchById(listEntityList); + + Long consigneeId = waybillEntity.getConsigneeId(); + BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findEntityById(consigneeId); + + for (String orderCode : orderCodes) { + QueryWrapper stockArticleEntityQueryWrapper = new QueryWrapper<>(); + stockArticleEntityQueryWrapper.eq("order_code", orderCode) + .eq("is_deleted", 0); + List stockArticleEntities = distributionStockArticleMapper.selectList(stockArticleEntityQueryWrapper); + for (DistributionStockArticleEntity stockArticleEntity : stockArticleEntities) { + Long orderId = stockArticleEntity.getId(); + String waybillNumber = baseMapper.findOrderWaybillNo(orderId); + stockArticleEntity.setWaybillNumber(waybillNumber); + stockArticleEntity.setMallId(consigneeId); + stockArticleEntity.setMallCode(basicdataClientEntity.getClientCode()); + stockArticleEntity.setMallName(basicdataClientEntity.getClientName()); + stockArticleEntity.setConsigneePerson(waybillEntity.getConsigneeName()); + stockArticleEntity.setConsigneeMobile(waybillEntity.getConsigneeMobile()); + stockArticleEntity.setConsigneeAddress(waybillEntity.getConsigneeAddress()); + stockArticleEntity.setConsigneeUnit(basicdataClientEntity.getClientName()); + } + distributionStockArticleService.updateBatchById(stockArticleEntities); + } + } } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java index 59d578758..42b7e598b 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java @@ -83,4 +83,8 @@ public interface TrunklineAdvanceDetailMapper extends BaseMapper advanceIds); + + void updateWaybillNoByAdvanceIds(@Param("advanceIds") List advanceIds, @Param("waybillNo") String waybillNo, @Param("waybillId") Long waybillId); + + List findListByAdvanceIds(@Param("advanceIds") List advanceIds); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml index caf947386..47ec044be 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml @@ -184,6 +184,17 @@ where advance_id = #{advanceId} + + + update logpm_trunkline_advance_detail + set waybill_no = #{waybillNo}, + waybill_id = #{waybillId} + where advance_id in + + #{item} + + + + + diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java index c614fa3a2..3deb213cd 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java @@ -100,4 +100,8 @@ public interface ITrunklineAdvanceDetailService extends BaseService sendAdvanceDetailEntityList, Long warehouseId, String warehouseName,Integer incomingType); void sendReportAdvanceOpenData(String nickName, Long userId, Long warehouseId, String warehouseName, List updateAdvanceDetailList, WarehouseWaybillEntity waybillEntity); + + void updateWaybillNoByAdvanceIds(List advanceIds, String waybillNo, Long waybillId); + + List findListByAdvanceIds(List advanceIds); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java index dd00ce783..9fbb945cb 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java @@ -23,6 +23,7 @@ import com.logpm.distribution.feign.IDistributionParcelListClient; import com.logpm.distribution.feign.IDistributionParcelNumberClient; import com.logpm.distribution.feign.IDistributionReservationStockarticleClient; import com.logpm.distribution.feign.IDistributionStockArticleClient; +import com.logpm.distribution.vo.UpdateOrderDTO; import com.logpm.statistics.feign.IOrderInfoClient; import com.logpm.trunkline.dto.*; import com.logpm.trunkline.entity.*; @@ -657,12 +658,6 @@ public class OpenOrderServiceImpl implements IOpenOrderService { waybillOrderEntity.setHandleNumber(incomingNum); waybillOrderEntities.add(waybillOrderEntity); - //更新暂存单包件的运单信息 - advanceDetailService.updateWaybillNoByAdvanceId(advanceId, waybillNo, waybillId); - List list = advanceDetailService.findList(advanceId); - trunklineWaybillPackageService.saveList(list, waybillEntity); - trunklineWaybillPackageService.updateWaybillStatus(waybillEntity); - distributionParcelListClient.updateEntityByOpenOrder(advanceId, waybillId); // orderCodes.add(advanceEntity.getOrderCode()); advanceEntity.setWaybillStatus("1"); advanceEntity.setWaybillNo(waybillNo); @@ -672,6 +667,18 @@ public class OpenOrderServiceImpl implements IOpenOrderService { //修改暂存单的状态为已开单 advanceService.updateBatchById(advanceEntityList); + //更新暂存单包件的运单信息 + if(CollUtil.isNotEmpty(advanceIds)){ + advanceDetailService.updateWaybillNoByAdvanceIds(advanceIds, waybillNo, waybillId); + List list = advanceDetailService.findListByAdvanceIds(advanceIds); + trunklineWaybillPackageService.saveList(list, waybillEntity); + UpdateOrderDTO updateOrderDTO = new UpdateOrderDTO(); + updateOrderDTO.setAdvanceIds(advanceIds); + updateOrderDTO.setWaybillId(waybillId); + distributionParcelListClient.updateEntityByOpenOrderByAdvanceIds(updateOrderDTO); + } + trunklineWaybillPackageService.updateWaybillStatus(waybillEntity); + //修改暂存单明细的结算品类 List updateAdvanceDetailList = openOrderDTO.getUpdateAdvanceDetailList(); advanceDetailService.updateBatchById(updateAdvanceDetailList); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java index 2c6bf4a54..96dd6a9b9 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java @@ -542,4 +542,14 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl advanceIds, String waybillNo, Long waybillId) { + baseMapper.updateWaybillNoByAdvanceIds(advanceIds, waybillNo, waybillId); + } + + @Override + public List findListByAdvanceIds(List advanceIds) { + return baseMapper.findListByAdvanceIds(advanceIds); + } } 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 60e8313e8..2c798f171 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 @@ -830,6 +830,11 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl advanceDetailEntities1 = orderCodeMap.get(orderCode); + //把advanceDetailEntities1中素有所有元素的incomeCategoryName去重并拼接成一个字符串 + String incomeCategoryName = advanceDetailEntities1.stream().map(TrunklineAdvanceDetailEntity::getIncomeCategoryName).distinct().collect(Collectors.joining(",")); + stockArticleEntity.setDescriptionGoods(incomeCategoryName); + BasicdataClientEntity clientEntity = basicdataClientClient.findByName(consigneeName1); if(!Objects.isNull(clientEntity)){ stockArticleEntity.setMallId(clientEntity.getId());