Browse Source

1.干线开单逻辑优化

visual
zhenghaoyu 6 months ago
parent
commit
72656a14e8
  1. 4
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java
  2. 15
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/UpdateOrderDTO.java
  3. 6
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java
  4. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java
  5. 101
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java
  6. 4
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java
  7. 47
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml
  8. 4
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java
  9. 19
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java
  10. 10
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java
  11. 5
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java

4
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<DistributionParcelListEntity> findByWaybillNumber(@RequestParam String waybillNumber);

15
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<Long> advanceIds;
private Long waybillId;
}

6
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<DistributionParcelListEntity> findByWaybillNumber(String waybillNumber) {
return distributionParcelListService.findByWaybillNumber(waybillNumber);

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

@ -284,4 +284,6 @@ public interface IDistributionParcelListService extends BaseService<Distribution
boolean maintainInWarehouse(Long orderPackageId,String taskCode);
Map<String, Object> findOrderInfoByOrderPackageCode(String orderPackageCode, Long warehouseId);
void updateEntityByOpenOrderByAdvanceIds(UpdateOrderDTO updateOrderDTO);
}

101
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<Distribut
}
return orderInfoByOrderPackageCode;
}
@Override
public void updateEntityByOpenOrderByAdvanceIds(UpdateOrderDTO updateOrderDTO) {
Long waybillId = updateOrderDTO.getWaybillId();
List<Long> 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<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("advance_id", advanceIds)
.eq("is_deleted", 0);
List<DistributionParcelListEntity> listEntityList = baseMapper.selectList(queryWrapper);
Set<String> 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<DistributionStockArticleEntity> stockArticleEntityQueryWrapper = new QueryWrapper<>();
stockArticleEntityQueryWrapper.eq("order_code", orderCode)
.eq("is_deleted", 0);
List<DistributionStockArticleEntity> 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);
}
}
}

4
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java

@ -83,4 +83,8 @@ public interface TrunklineAdvanceDetailMapper extends BaseMapper<TrunklineAdvanc
void clearWaybillInfoByWaybillId(@Param("waybillId") Long waybillId);
AdvancenceTotalNumberVO findTotalNumberByAdvanceIds(@Param("advanceIds") List<Long> advanceIds);
void updateWaybillNoByAdvanceIds(@Param("advanceIds") List<Long> advanceIds, @Param("waybillNo") String waybillNo, @Param("waybillId") Long waybillId);
List<TrunklineAdvanceDetailVO> findListByAdvanceIds(@Param("advanceIds") List<Long> advanceIds);
}

47
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml

@ -184,6 +184,17 @@
where advance_id = #{advanceId}
</update>
<update id="updateWaybillNoByAdvanceIds" >
update logpm_trunkline_advance_detail
set waybill_no = #{waybillNo},
waybill_id = #{waybillId}
where advance_id in
<foreach collection="advanceIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<select id="findIncomingWarehouseName" resultType="String">
select incoming_warehouse_name
from logpm_trunkline_advance_detail
@ -517,4 +528,40 @@
and is_deleted = 0
</select>
<select id="findListByAdvanceIds" resultType="com.logpm.trunkline.vo.TrunklineAdvanceDetailVO">
select ltad.id id,
ltad.warehouse_id warehouseId,
ltad.warehouse_name warehouseName,
lta.waybill_no waybillNo,
ltad.order_code orderCode,
lta.train_number trainNumber,
ltad.package_status packageStatus,
ltad.first_pack_name firstPackName,
ltad.second_pack_name secondPackName,
ltad.third_pack_name thirdPackName,
ltad.material_code materialCode,
ltad.material_name materialName,
ltad.order_package_code orderPackageCode,
ltad.brand brand,
ltad.service_num serviceNum,
ltad.quantity quantity,
lwtg.tray_code trayCode,
lwt.pallet_name trayName,
ltad.system_type systemType,
ltad.weight weight,
ltad.volume volume,
ltad.advance_id advanceId,
ltad.incoming_warehouse_name incomingWarehouseName,
ltad.now_warehouse_name nowWarehouseName,
ltad.create_time createTime
from logpm_trunkline_advance_detail ltad
left join logpm_trunkline_advance lta on lta.id = ltad.advance_id
left join logpm_warehouse_tray_goods lwtg on lwtg.association_value = ltad.order_package_code
left join logpm_warehouse_tray lwt on lwt.id = lwtg.tray_id
where advance_id in
<foreach collection="advanceIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

4
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java

@ -100,4 +100,8 @@ public interface ITrunklineAdvanceDetailService extends BaseService<TrunklineAdv
void sendReportIncomingData(Long userId, String nickName, List<TrunklineAdvanceDetailEntity> sendAdvanceDetailEntityList, Long warehouseId, String warehouseName,Integer incomingType);
void sendReportAdvanceOpenData(String nickName, Long userId, Long warehouseId, String warehouseName, List<TrunklineAdvanceDetailEntity> updateAdvanceDetailList, WarehouseWaybillEntity waybillEntity);
void updateWaybillNoByAdvanceIds(List<Long> advanceIds, String waybillNo, Long waybillId);
List<TrunklineAdvanceDetailVO> findListByAdvanceIds(List<Long> advanceIds);
}

19
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<TrunklineAdvanceDetailVO> 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<TrunklineAdvanceDetailVO> 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<TrunklineAdvanceDetailEntity> updateAdvanceDetailList = openOrderDTO.getUpdateAdvanceDetailList();
advanceDetailService.updateBatchById(updateAdvanceDetailList);

10
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java

@ -542,4 +542,14 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
sendFanoutService.sendFanoutMsg(fanoutMsg);
}
@Override
public void updateWaybillNoByAdvanceIds(List<Long> advanceIds, String waybillNo, Long waybillId) {
baseMapper.updateWaybillNoByAdvanceIds(advanceIds, waybillNo, waybillId);
}
@Override
public List<TrunklineAdvanceDetailVO> findListByAdvanceIds(List<Long> advanceIds) {
return baseMapper.findListByAdvanceIds(advanceIds);
}
}

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

@ -830,6 +830,11 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
Long consigneeId = waybillEntity.getConsigneeId();
String consigneeName1= waybillEntity.getConsignee();
List<TrunklineAdvanceDetailEntity> 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());

Loading…
Cancel
Save