Browse Source

1.干线先入库再开单数据逻辑优化

visual
zhenghaoyu 4 months ago
parent
commit
f34d879c56
  1. 2
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java
  2. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java
  3. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java
  4. 17
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml
  5. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java
  6. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml
  7. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java
  8. 35
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java
  9. 14
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java
  10. 54
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java
  11. 7
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml

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

@ -295,5 +295,7 @@ public interface IDistributionParcelListClient {
@PostMapping(API_PREFIX + "/updateZeroList")
void updateZeroList(@RequestBody List<DistributionParcelListEntity> updateParceListEntityList);
@PostMapping(API_PREFIX + "/findIdAndWarehouseIdListByAdvanceIds")
List<DistributionParcelListEntity> findIdAndWarehouseIdListByAdvanceIds(@RequestBody List<Long> advanceIds);
}

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

@ -626,4 +626,9 @@ public class DistributionParcelListClient implements IDistributionParcelListClie
}
@Override
public List<DistributionParcelListEntity> findIdAndWarehouseIdListByAdvanceIds(List<Long> advanceIds) {
return distributionParcelListService.findIdAndWarehouseIdListByAdvanceIds(advanceIds);
}
}

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

@ -329,4 +329,6 @@ public interface DistributionParcelListMapper extends BaseMapper<DistributionPar
IPage<DistributionParcelListEntity> pageOweListTransfer(IPage<Object> page, @Param("param") DistributionParcelListDTO distributionParcelListDTO);
List<DistributionOrderZeroPackafeVO> pageOweZeroListTransfer(@Param("orderCode") String orderCode, @Param("waybillNumber") String waybillNumber);
List<DistributionParcelListEntity> selectParcelListListByAdvanceIds(@Param("advanceIds") List<Long> advanceIds);
}

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

@ -2210,5 +2210,22 @@
) AS t
</select>
<select id="selectParcelListListByAdvanceIds" resultType="com.logpm.distribution.entity.DistributionParcelListEntity">
select ldpl.id,
ldpl.warehouse_id,
ldpl.stock_article_id
from logpm_distribution_parcel_list ldpl
jion(
<foreach collection="advanceIds" index="ind" item="item">
<if test="ind == 0">
select #{item} advanceId
</if>
<if test="ind != 0">
union all
select #{item} advanceId
</if>
</foreach>
) t on t.advanceId = ldpl.advance_id
</select>
</mapper>

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java

@ -28,6 +28,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 配送在库订单 Mapper 接口
@ -235,4 +236,6 @@ public interface DistributionStockArticleMapper extends BaseMapper<DistributionS
Integer findSignNumByWaybillNo(@Param("waybillNo") String waybillNo, @Param("destinationWarehouseId") Long destinationWarehouseId);
IPage<DistributionStockArticleVO> pageListOweTransfer(IPage page,@Param("param")DistributionStockArticleOweDTO stockArticleEntity,@Param("warehouseIds")List<Long> warehouseIds);
List<Long> findStockArticleIds(@Param("orderCodes") Set<String> orderCodes);
}

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml

@ -2242,5 +2242,13 @@
order by ldsa.warehouse_entry_time desc
</select>
<select id="findStockArticleIds" resultType="java.lang.Long">
select id
from logpm_distribution_stock_article
where order_code in
<foreach collection="orderCodes" item="orderCode" open="(" close=")" separator=",">
#{orderCode}
</foreach>
</select>
</mapper>

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

@ -302,4 +302,6 @@ public interface IDistributionParcelListService extends BaseService<Distribution
List<DistributionOrderZeroPackafeVO> pageOweZeroListTransfer(String orderCode, String waybillNumber);
List<DistributionParcelListEntity> findIdAndWarehouseIdListByAdvanceIds(List<Long> advanceIds);
}

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

@ -1454,10 +1454,7 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
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);
List<DistributionParcelListEntity> listEntityList = baseMapper.selectParcelListListByAdvanceIds(advanceIds);
Set<String> orderCodes = new TreeSet<>();
for (DistributionParcelListEntity parcelListEntity : listEntityList) {
Long packageWarehouseId = parcelListEntity.getWarehouseId();
@ -1483,15 +1480,15 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
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);
if(CollUtil.isNotEmpty(orderCodes)){
List<Long> stockArticleIds = distributionStockArticleMapper.findStockArticleIds(orderCodes);
List<DistributionStockArticleEntity> updateList = new ArrayList<>();
stockArticleIds.forEach(stockArticleId -> {
DistributionStockArticleEntity stockArticleEntity = new DistributionStockArticleEntity();
stockArticleEntity.setId(stockArticleId);
stockArticleEntity.setWaybillNumber(waybillNo);
stockArticleEntity.setMallId(consigneeId);
stockArticleEntity.setMallCode(basicdataClientEntity.getClientCode());
stockArticleEntity.setMallName(basicdataClientEntity.getClientName());
@ -1499,9 +1496,14 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
stockArticleEntity.setConsigneeMobile(waybillEntity.getConsigneeMobile());
stockArticleEntity.setConsigneeAddress(waybillEntity.getConsigneeAddress());
stockArticleEntity.setConsigneeUnit(basicdataClientEntity.getClientName());
updateList.add(stockArticleEntity);
});
if(CollUtil.isNotEmpty(updateList)){
distributionStockArticleService.updateBatchById(updateList);
}
distributionStockArticleService.updateBatchById(stockArticleEntities);
}
}
@Override
@ -1555,4 +1557,9 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
public List<DistributionOrderZeroPackafeVO> pageOweZeroListTransfer(String orderCode, String waybillNumber) {
return baseMapper.pageOweZeroListTransfer(orderCode,waybillNumber);
}
@Override
public List<DistributionParcelListEntity> findIdAndWarehouseIdListByAdvanceIds(List<Long> advanceIds) {
return baseMapper.selectParcelListListByAdvanceIds(advanceIds);
}
}

14
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java

@ -1318,13 +1318,13 @@ public class OpenOrderController {
try{
//当前登录人选择的仓库
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse);
return R.fail(403,"多仓权限无法操作,请选择仓库");
}
openOrderDTO.setWarehouseId(myCurrentWarehouse.getId());
openOrderDTO.setWarehouseName(myCurrentWarehouse.getName());
// BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
// if(Objects.isNull(myCurrentWarehouse)){
// log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse);
// return R.fail(403,"多仓权限无法操作,请选择仓库");
// }
// openOrderDTO.setWarehouseId(myCurrentWarehouse.getId());
// openOrderDTO.setWarehouseName(myCurrentWarehouse.getName());
if (Objects.isNull(waybillId)){
log.warn(method+"运单号id为空 waybillId={}",waybillId);

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

@ -690,6 +690,57 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
updateOrderDTO.setAdvanceIds(advanceIds);
updateOrderDTO.setWaybillId(waybillId);
distributionParcelListClient.updateEntityByOpenOrderByAdvanceIds(updateOrderDTO);
String departureWarehouseName = waybillEntity.getDepartureWarehouseName();
String destinationWarehouseName = waybillEntity.getDestinationWarehouseName();
Long consigneeId1 = waybillEntity.getConsigneeId();
BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findEntityById(consigneeId1);
List<DistributionParcelListEntity> parcelListEntities = distributionParcelListClient.findIdAndWarehouseIdListByAdvanceIds(advanceIds);
Set<Long> stockArticleIds = new TreeSet<>();
String finalWaybillNo = waybillNo;
parcelListEntities.forEach(parcelListEntity -> {
Long packageWarehouseId = parcelListEntity.getWarehouseId();
parcelListEntity.setWaybillId(waybillId);
parcelListEntity.setWaybillNumber(finalWaybillNo);
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);
}
}
stockArticleIds.add(parcelListEntity.getStockArticleId());
});
distributionParcelListClient.updateList(parcelListEntities);
List<DistributionStockArticleEntity> updateList = new ArrayList<>();
stockArticleIds.forEach(stockArticleId -> {
DistributionStockArticleEntity stockArticleEntity = new DistributionStockArticleEntity();
stockArticleEntity.setId(stockArticleId);
stockArticleEntity.setWaybillNumber(finalWaybillNo);
stockArticleEntity.setMallId(consigneeId1);
stockArticleEntity.setMallCode(basicdataClientEntity.getClientCode());
stockArticleEntity.setMallName(basicdataClientEntity.getClientName());
stockArticleEntity.setConsigneePerson(waybillEntity.getConsigneeName());
stockArticleEntity.setConsigneeMobile(waybillEntity.getConsigneeMobile());
stockArticleEntity.setConsigneeAddress(waybillEntity.getConsigneeAddress());
stockArticleEntity.setConsigneeUnit(basicdataClientEntity.getClientName());
updateList.add(stockArticleEntity);
});
if(CollUtil.isNotEmpty(updateList)){
distributionStockArticleClient.updateByBatchId(updateList);
}
}
trunklineWaybillPackageService.updateWaybillStatus(waybillEntity);
@ -3330,6 +3381,9 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
}
Integer checkStatus = warehouseWaybillEntity.getCheckStatus();
if(Objects.isNull(checkStatus)){
checkStatus = 0;
}
if(checkStatus.equals(1)){
log.warn("##############checkWaybill: 运单已经审核 waybillId={}",waybillId);
return R.fail(405, "运单已经审核");

7
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml

@ -840,7 +840,6 @@
<select id="exportWaybillList" resultType="com.logpm.warehouse.vo.ExportWarehouseWaybillVO">
select lww.*
from logpm_warehouse_waybill lww
left join (select ltwt.waybill_id,GROUP_CONCAT(DISTINCT ltwt.warehouse_id) warehouse_ids from logpm_trunkline_waybill_track ltwt group by ltwt.waybill_id) t on t.waybill_id = lww.id
where lww.is_deleted = 0
<if test="param.waybillNoList != null">
and lww.waybill_no not in
@ -942,10 +941,10 @@
and lww.create_time &lt;= #{param.createTimeEndDate}
</if>
<if test="param.agent != null and param.agent != ''">
and lww.Locate(#{param.agent},agent) > 0
and Locate(#{param.agent},lww.agent) > 0
</if>
<if test="param.goodsName != null and param.goodsName != ''">
and lww.Locate(#{param.goodsName},goods_name) > 0
and Locate(#{param.goodsName},lww.goods_name) > 0
</if>
<if test="param.freezeStatus != null">
and lww.freeze_status = #{param.freezeStatus}
@ -953,7 +952,7 @@
<if test="param.abolishStatus != null">
and lww.abolish_status = #{param.abolishStatus}
</if>
<if test="param.remark != null and param.reamrk != ''">
<if test="param.remark != null and param.remark != ''">
and Locate(#{param.remark},lww.remark) > 0
</if>
<if test="param.consigneeAddress != null and param.consigneeAddress != ''">

Loading…
Cancel
Save