|
|
@ -1,16 +1,29 @@ |
|
|
|
package com.logpm.distribution.receiver.report; |
|
|
|
package com.logpm.distribution.receiver.report; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
|
|
|
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; |
|
|
|
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; |
|
|
|
import com.logpm.distribution.dto.ReportQualityDeliverDTO; |
|
|
|
import com.logpm.distribution.dto.ReportQualityDeliverDTO; |
|
|
|
|
|
|
|
import com.logpm.distribution.entity.DistributionParcelListEntity; |
|
|
|
|
|
|
|
import com.logpm.distribution.entity.DistributionStockArticleEntity; |
|
|
|
|
|
|
|
import com.logpm.distribution.entity.DistributionStockListEntity; |
|
|
|
import com.logpm.distribution.entity.QualityDeliverEntity; |
|
|
|
import com.logpm.distribution.entity.QualityDeliverEntity; |
|
|
|
|
|
|
|
import com.logpm.distribution.service.IDistributionParcelListService; |
|
|
|
|
|
|
|
import com.logpm.distribution.service.IDistributionStockArticleService; |
|
|
|
|
|
|
|
import com.logpm.distribution.service.IDistributionStockListService; |
|
|
|
import com.logpm.distribution.service.IQualityDeliverService; |
|
|
|
import com.logpm.distribution.service.IQualityDeliverService; |
|
|
|
|
|
|
|
import com.logpm.warehouse.entity.WarehouseWaybillEntity; |
|
|
|
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseWaybillClient; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
import org.jetbrains.annotations.Nullable; |
|
|
|
import org.springblade.common.constant.report.ReportConstants; |
|
|
|
import org.springblade.common.constant.report.ReportConstants; |
|
|
|
|
|
|
|
import org.springblade.common.enums.PackageTypeEnums; |
|
|
|
import org.springframework.amqp.core.ExchangeTypes; |
|
|
|
import org.springframework.amqp.core.ExchangeTypes; |
|
|
|
import org.springframework.amqp.rabbit.annotation.Exchange; |
|
|
|
import org.springframework.amqp.rabbit.annotation.Exchange; |
|
|
|
import org.springframework.amqp.rabbit.annotation.Queue; |
|
|
|
import org.springframework.amqp.rabbit.annotation.Queue; |
|
|
@ -19,6 +32,8 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 配送明细基础表处理类 |
|
|
|
* 配送明细基础表处理类 |
|
|
@ -34,6 +49,21 @@ public class QualityDeliverListener { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private IQualityDeliverService qualityDeliverService; |
|
|
|
private IQualityDeliverService qualityDeliverService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private IBasicdataWarehouseClient warehouseClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private IDistributionParcelListService parcelListService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private IDistributionStockArticleService stockArticleService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private IWarehouseWaybillClient warehouseWaybillClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private IDistributionStockListService stockListService; |
|
|
|
|
|
|
|
|
|
|
|
@RabbitListener(bindings = @QueueBinding( |
|
|
|
@RabbitListener(bindings = @QueueBinding( |
|
|
|
value = @Queue(name = ReportConstants.REPORT_QUALITY_DELIVER_QUEUE, durable = "true"), |
|
|
|
value = @Queue(name = ReportConstants.REPORT_QUALITY_DELIVER_QUEUE, durable = "true"), |
|
|
|
exchange = @Exchange(name = ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE, type = ExchangeTypes.TOPIC), |
|
|
|
exchange = @Exchange(name = ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE, type = ExchangeTypes.TOPIC), |
|
|
@ -50,64 +80,21 @@ public class QualityDeliverListener { |
|
|
|
switch (bean.getOperation()) { |
|
|
|
switch (bean.getOperation()) { |
|
|
|
case MODIFY: |
|
|
|
case MODIFY: |
|
|
|
Integer conditions = qualityDeliverEntity.getConditions(); |
|
|
|
Integer conditions = qualityDeliverEntity.getConditions(); |
|
|
|
if (1 == conditions) { |
|
|
|
if (ObjectUtil.equals(PackageTypeEnums.CMP.getCode(), conditions)) { |
|
|
|
// 定制品
|
|
|
|
// 定制品
|
|
|
|
QualityDeliverEntity entity = qualityDeliverService.getOne(Wrappers.<QualityDeliverEntity>lambdaQuery() |
|
|
|
|
|
|
|
.eq(QualityDeliverEntity::getOrderPackageCode, qualityDeliverEntity.getOrderPackageCode()) |
|
|
|
|
|
|
|
.lt(QualityDeliverEntity::getBizStatus, 110)); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(entity)) { |
|
|
|
|
|
|
|
qualityDeliverService.update(qualityDeliverEntity, Wrappers.<QualityDeliverEntity>lambdaUpdate() |
|
|
|
|
|
|
|
.eq(QualityDeliverEntity::getOrderPackageCode, qualityDeliverEntity.getOrderPackageCode()) |
|
|
|
|
|
|
|
.lt(QualityDeliverEntity::getBizStatus, 110)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 获取基础数据赋值
|
|
|
|
|
|
|
|
qualityDeliverService.save(qualityDeliverEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (3 == conditions) { |
|
|
|
|
|
|
|
// 库存品
|
|
|
|
|
|
|
|
LambdaQueryWrapper<QualityDeliverEntity> wrapper = Wrappers.<QualityDeliverEntity>lambdaQuery() |
|
|
|
LambdaQueryWrapper<QualityDeliverEntity> wrapper = Wrappers.<QualityDeliverEntity>lambdaQuery() |
|
|
|
|
|
|
|
.eq(QualityDeliverEntity::getOrderPackageCode, qualityDeliverEntity.getOrderPackageCode()) |
|
|
|
.lt(QualityDeliverEntity::getBizStatus, 110); |
|
|
|
.lt(QualityDeliverEntity::getBizStatus, 110); |
|
|
|
if (ObjectUtil.isNotEmpty(qualityDeliverEntity.getId())) { |
|
|
|
saveOrUpdate(wrapper, qualityDeliverEntity); |
|
|
|
// 库存品更新优先按id更新
|
|
|
|
} else if (ObjectUtil.equals(PackageTypeEnums.INV.getCode(), conditions)) { |
|
|
|
wrapper.eq(QualityDeliverEntity::getId, qualityDeliverEntity.getId()); |
|
|
|
// 库存品
|
|
|
|
} else { |
|
|
|
LambdaQueryWrapper<QualityDeliverEntity> wrapper = buildInvWrapper(qualityDeliverEntity); |
|
|
|
if (StrUtil.isNotEmpty(qualityDeliverEntity.getOrderPackageCode())) { |
|
|
|
if (wrapper == null) { |
|
|
|
// 没有id,按包条码更新
|
|
|
|
return; |
|
|
|
wrapper.eq(QualityDeliverEntity::getOrderPackageCode, qualityDeliverEntity.getOrderPackageCode()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (StrUtil.isEmpty(qualityDeliverEntity.getMallName())) { |
|
|
|
|
|
|
|
// 没有id,没有包条码。没有商场,不处理。
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 否则加上商场过滤
|
|
|
|
|
|
|
|
wrapper.eq(QualityDeliverEntity::getMallName, qualityDeliverEntity.getMallName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StrUtil.isEmpty(qualityDeliverEntity.getMaterielCode()) && StrUtil.isEmpty(qualityDeliverEntity.getMaterielName())) { |
|
|
|
|
|
|
|
// 没有id,没有包条码,没有商场,没有物料,不处理。
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(qualityDeliverEntity.getMaterielCode())) { |
|
|
|
|
|
|
|
// 优先按物料编码更新
|
|
|
|
|
|
|
|
wrapper.eq(QualityDeliverEntity::getMaterielCode, qualityDeliverEntity.getMaterielCode()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 按物料名称更新
|
|
|
|
|
|
|
|
wrapper.eq(QualityDeliverEntity::getMaterielName, qualityDeliverEntity.getMaterielName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(qualityDeliverEntity.getPlanReservationCode())) { |
|
|
|
|
|
|
|
// 有预约单号时加上预约单号过滤:存在同一个库存品在多个预约单中,只根据库存品本身的信息无法查询出对应的数据的情况。
|
|
|
|
|
|
|
|
wrapper.eq(QualityDeliverEntity::getPlanReservationCode, qualityDeliverEntity.getPlanReservationCode()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// 查询不存在时更新,存在时修改
|
|
|
|
// 查询不存在时更新,存在时修改
|
|
|
|
QualityDeliverEntity entity = qualityDeliverService.getOne(wrapper); |
|
|
|
saveOrUpdate(wrapper, qualityDeliverEntity); |
|
|
|
if (ObjectUtil.isNotEmpty(entity)) { |
|
|
|
} else if (ObjectUtil.equals(PackageTypeEnums.LTL.getCode(), conditions)) { |
|
|
|
qualityDeliverService.update(qualityDeliverEntity, wrapper); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 获取基础数据赋值
|
|
|
|
|
|
|
|
qualityDeliverService.save(qualityDeliverEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (2 == conditions) { |
|
|
|
|
|
|
|
// 零担
|
|
|
|
// 零担
|
|
|
|
LambdaQueryWrapper<QualityDeliverEntity> wrapper = Wrappers.<QualityDeliverEntity>lambdaQuery() |
|
|
|
LambdaQueryWrapper<QualityDeliverEntity> wrapper = Wrappers.<QualityDeliverEntity>lambdaQuery() |
|
|
|
.eq(QualityDeliverEntity::getOrderCode, qualityDeliverEntity.getOrderCode()) |
|
|
|
.eq(QualityDeliverEntity::getOrderCode, qualityDeliverEntity.getOrderCode()) |
|
|
@ -116,13 +103,7 @@ public class QualityDeliverListener { |
|
|
|
if (StrUtil.isNotEmpty(qualityDeliverEntity.getPlanReservationCode())) { |
|
|
|
if (StrUtil.isNotEmpty(qualityDeliverEntity.getPlanReservationCode())) { |
|
|
|
wrapper.eq(QualityDeliverEntity::getPlanReservationCode, qualityDeliverEntity.getPlanReservationCode()); |
|
|
|
wrapper.eq(QualityDeliverEntity::getPlanReservationCode, qualityDeliverEntity.getPlanReservationCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
QualityDeliverEntity entity = qualityDeliverService.getOne(wrapper); |
|
|
|
saveOrUpdate(wrapper, qualityDeliverEntity); |
|
|
|
if (ObjectUtil.isNotEmpty(entity)) { |
|
|
|
|
|
|
|
qualityDeliverService.update(qualityDeliverEntity, wrapper); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 获取基础数据赋值
|
|
|
|
|
|
|
|
qualityDeliverService.save(qualityDeliverEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
@ -130,4 +111,206 @@ public class QualityDeliverListener { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 构建库存品查询Wrapper |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param qualityDeliverEntity |
|
|
|
|
|
|
|
* @Return com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<com.logpm.distribution.entity.QualityDeliverEntity> |
|
|
|
|
|
|
|
* @Author zqb 2024/9/10 |
|
|
|
|
|
|
|
**/ |
|
|
|
|
|
|
|
private static @Nullable LambdaQueryWrapper<QualityDeliverEntity> buildInvWrapper(QualityDeliverEntity qualityDeliverEntity) { |
|
|
|
|
|
|
|
LambdaQueryWrapper<QualityDeliverEntity> wrapper = Wrappers.<QualityDeliverEntity>lambdaQuery() |
|
|
|
|
|
|
|
.lt(QualityDeliverEntity::getBizStatus, 110); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(qualityDeliverEntity.getId())) { |
|
|
|
|
|
|
|
// 库存品更新优先按id更新
|
|
|
|
|
|
|
|
wrapper.eq(QualityDeliverEntity::getId, qualityDeliverEntity.getId()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(qualityDeliverEntity.getOrderPackageCode())) { |
|
|
|
|
|
|
|
// 没有id,按包条码更新
|
|
|
|
|
|
|
|
wrapper.eq(QualityDeliverEntity::getOrderPackageCode, qualityDeliverEntity.getOrderPackageCode()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (StrUtil.isEmpty(qualityDeliverEntity.getMallName())) { |
|
|
|
|
|
|
|
// 没有id,没有包条码。没有商场,不处理。
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 否则加上商场过滤
|
|
|
|
|
|
|
|
wrapper.eq(QualityDeliverEntity::getMallName, qualityDeliverEntity.getMallName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StrUtil.isEmpty(qualityDeliverEntity.getMaterielCode()) && StrUtil.isEmpty(qualityDeliverEntity.getMaterielName())) { |
|
|
|
|
|
|
|
// 没有id,没有包条码,没有商场,没有物料,不处理。
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(qualityDeliverEntity.getMaterielCode())) { |
|
|
|
|
|
|
|
// 优先按物料编码更新
|
|
|
|
|
|
|
|
wrapper.eq(QualityDeliverEntity::getMaterielCode, qualityDeliverEntity.getMaterielCode()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 按物料名称更新
|
|
|
|
|
|
|
|
wrapper.eq(QualityDeliverEntity::getMaterielName, qualityDeliverEntity.getMaterielName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(qualityDeliverEntity.getPlanReservationCode())) { |
|
|
|
|
|
|
|
// 有预约单号时加上预约单号过滤:存在同一个库存品在多个预约单中,只根据库存品本身的信息无法查询出对应的数据的情况。
|
|
|
|
|
|
|
|
wrapper.eq(QualityDeliverEntity::getPlanReservationCode, qualityDeliverEntity.getPlanReservationCode()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return wrapper; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 修改或者新增 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param wrapper |
|
|
|
|
|
|
|
* @param qualityDeliverEntity |
|
|
|
|
|
|
|
* @Return void |
|
|
|
|
|
|
|
* @Author zqb 2024/9/10 |
|
|
|
|
|
|
|
**/ |
|
|
|
|
|
|
|
private void saveOrUpdate(LambdaQueryWrapper<QualityDeliverEntity> wrapper, QualityDeliverEntity qualityDeliverEntity) { |
|
|
|
|
|
|
|
QualityDeliverEntity entity = qualityDeliverService.getOne(wrapper); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(entity)) { |
|
|
|
|
|
|
|
// 修改
|
|
|
|
|
|
|
|
qualityDeliverService.update(qualityDeliverEntity, wrapper); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 新增
|
|
|
|
|
|
|
|
// 初始化基础数据
|
|
|
|
|
|
|
|
initBasicData(qualityDeliverEntity); |
|
|
|
|
|
|
|
qualityDeliverService.save(qualityDeliverEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initBasicData(QualityDeliverEntity qualityDeliverEntity) { |
|
|
|
|
|
|
|
// 事业线 businessUnit
|
|
|
|
|
|
|
|
businessUnit(qualityDeliverEntity); |
|
|
|
|
|
|
|
Integer conditions = qualityDeliverEntity.getConditions(); |
|
|
|
|
|
|
|
if (ObjectUtil.equals(PackageTypeEnums.CMP.getCode(), conditions)) { |
|
|
|
|
|
|
|
// 订制品
|
|
|
|
|
|
|
|
// 构建订制品基础信息
|
|
|
|
|
|
|
|
buildCmpBasicInfo(qualityDeliverEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ObjectUtil.equals(PackageTypeEnums.INV.getCode(), conditions)) { |
|
|
|
|
|
|
|
// 库存品
|
|
|
|
|
|
|
|
buildInvBasicInfo(qualityDeliverEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ObjectUtil.equals(PackageTypeEnums.LTL.getCode(), conditions)) { |
|
|
|
|
|
|
|
// 零担
|
|
|
|
|
|
|
|
buildOrderInfo(qualityDeliverEntity, qualityDeliverEntity.getWarehouseId(), qualityDeliverEntity.getOrderCode()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void buildInvBasicInfo(QualityDeliverEntity qualityDeliverEntity) { |
|
|
|
|
|
|
|
DistributionStockListEntity stockListEntity = new DistributionStockListEntity(); |
|
|
|
|
|
|
|
stockListEntity.setIncomingBatch(qualityDeliverEntity.getIncomingBatch()); |
|
|
|
|
|
|
|
stockListEntity.setMallName(qualityDeliverEntity.getMallName()); |
|
|
|
|
|
|
|
stockListEntity.setCargoNumber((qualityDeliverEntity.getMaterielCode())); |
|
|
|
|
|
|
|
stockListEntity.setDescriptionGoods(qualityDeliverEntity.getMaterielName()); |
|
|
|
|
|
|
|
stockListEntity.setWarehouseId(qualityDeliverEntity.getWarehouseId()); |
|
|
|
|
|
|
|
DistributionStockListEntity stockList = stockListService.findStockListByAttrAndWarehouseId(stockListEntity); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(stockList)) { |
|
|
|
|
|
|
|
String sourceType = stockList.getSourceType(); |
|
|
|
|
|
|
|
if (StrUtil.equals(sourceType, "1")) { |
|
|
|
|
|
|
|
buildCmpBasicInfo(qualityDeliverEntity); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
qualityDeliverEntity.setBrandName(stockList.getBrandName()); |
|
|
|
|
|
|
|
qualityDeliverEntity.setMallCode(stockList.getMarketCode()); |
|
|
|
|
|
|
|
qualityDeliverEntity.setStoreCode(stockList.getStoreCode()); |
|
|
|
|
|
|
|
qualityDeliverEntity.setStoreName(stockList.getStoreName()); |
|
|
|
|
|
|
|
qualityDeliverEntity.setEndWarehouseInTime(stockList.getWarehousingTime()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void buildCmpBasicInfo(QualityDeliverEntity qualityDeliverEntity) { |
|
|
|
|
|
|
|
DistributionParcelListEntity parcelListEntity = parcelListService.selectByOrderPackageCode(qualityDeliverEntity.getOrderPackageCode(), qualityDeliverEntity.getWarehouseId()); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(parcelListEntity)) { |
|
|
|
|
|
|
|
// 品牌
|
|
|
|
|
|
|
|
qualityDeliverEntity.setBrandName(parcelListEntity.getBrandName()); |
|
|
|
|
|
|
|
// 商场id
|
|
|
|
|
|
|
|
// qualityDeliverEntity.setMallId(parcelListEntity.getMallId());
|
|
|
|
|
|
|
|
// 订制品的物料从包件上取
|
|
|
|
|
|
|
|
if (ObjectUtil.equals(PackageTypeEnums.CMP.getCode(), qualityDeliverEntity.getConditions())) { |
|
|
|
|
|
|
|
// 物料名称
|
|
|
|
|
|
|
|
qualityDeliverEntity.setMaterielName(parcelListEntity.getMaterialName()); |
|
|
|
|
|
|
|
// 物料编码
|
|
|
|
|
|
|
|
qualityDeliverEntity.setMaterielCode(parcelListEntity.getMaterialCode()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 订单号
|
|
|
|
|
|
|
|
qualityDeliverEntity.setOrderCode(parcelListEntity.getOrderCode()); |
|
|
|
|
|
|
|
// 工厂车次号
|
|
|
|
|
|
|
|
qualityDeliverEntity.setTrainNumber(parcelListEntity.getTrainNumber()); |
|
|
|
|
|
|
|
// 一级品
|
|
|
|
|
|
|
|
qualityDeliverEntity.setFirstsProduct(parcelListEntity.getFirsts()); |
|
|
|
|
|
|
|
// 二级品
|
|
|
|
|
|
|
|
qualityDeliverEntity.setSecondProduct(parcelListEntity.getSecond()); |
|
|
|
|
|
|
|
// 三级品
|
|
|
|
|
|
|
|
qualityDeliverEntity.setThirdProduct(parcelListEntity.getThirdProduct()); |
|
|
|
|
|
|
|
// 体积
|
|
|
|
|
|
|
|
qualityDeliverEntity.setVolume(parcelListEntity.getVolume()); |
|
|
|
|
|
|
|
// 重量
|
|
|
|
|
|
|
|
qualityDeliverEntity.setWeight(parcelListEntity.getWeight()); |
|
|
|
|
|
|
|
// 运单号
|
|
|
|
|
|
|
|
String waybillNumber = parcelListEntity.getWaybillNumber(); |
|
|
|
|
|
|
|
qualityDeliverEntity.setWaybillNumber(parcelListEntity.getWaybillNumber()); |
|
|
|
|
|
|
|
// 始发仓
|
|
|
|
|
|
|
|
qualityDeliverEntity.setBeginWarehouseName(parcelListEntity.getSendWarehouseName()); |
|
|
|
|
|
|
|
// 当前仓入库时间
|
|
|
|
|
|
|
|
qualityDeliverEntity.setEndWarehouseInTime(parcelListEntity.getWarehouseEntryTimeEnd()); |
|
|
|
|
|
|
|
// 构建运单相关信息
|
|
|
|
|
|
|
|
buildWaybillInfo(qualityDeliverEntity, waybillNumber); |
|
|
|
|
|
|
|
// 构建订单相关信息
|
|
|
|
|
|
|
|
buildOrderInfo(qualityDeliverEntity, qualityDeliverEntity.getWarehouseId(), parcelListEntity.getOrderCode()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void buildOrderInfo(QualityDeliverEntity qualityDeliverEntity, Long warehouseId, String orderCode) { |
|
|
|
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = stockArticleService.findStockArticleByOrderCodeAndWarehouseId(orderCode, warehouseId); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(stockArticleEntity)) { |
|
|
|
|
|
|
|
// 客户信息
|
|
|
|
|
|
|
|
qualityDeliverEntity.setCustomName(stockArticleEntity.getCustomerName()); |
|
|
|
|
|
|
|
qualityDeliverEntity.setCustomPhone(stockArticleEntity.getCustomerTelephone()); |
|
|
|
|
|
|
|
qualityDeliverEntity.setCustomAddress(stockArticleEntity.getCustomerAddress()); |
|
|
|
|
|
|
|
// 商场信息
|
|
|
|
|
|
|
|
qualityDeliverEntity.setMallName(stockArticleEntity.getMallName()); |
|
|
|
|
|
|
|
qualityDeliverEntity.setMallCode(stockArticleEntity.getMallName()); |
|
|
|
|
|
|
|
// 服务号
|
|
|
|
|
|
|
|
qualityDeliverEntity.setServiceNumber(stockArticleEntity.getServiceNumber()); |
|
|
|
|
|
|
|
// 经销商信息
|
|
|
|
|
|
|
|
qualityDeliverEntity.setDealerName(stockArticleEntity.getDealerName()); |
|
|
|
|
|
|
|
qualityDeliverEntity.setDealerCode(stockArticleEntity.getDealerCode()); |
|
|
|
|
|
|
|
// 门店信息
|
|
|
|
|
|
|
|
qualityDeliverEntity.setStoreCode(stockArticleEntity.getStoreCode()); |
|
|
|
|
|
|
|
qualityDeliverEntity.setStoreName(stockArticleEntity.getStoreName()); |
|
|
|
|
|
|
|
// 品牌
|
|
|
|
|
|
|
|
qualityDeliverEntity.setBrandName(stockArticleEntity.getBrand()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void buildWaybillInfo(QualityDeliverEntity qualityDeliverEntity, String waybillNumber) { |
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(waybillNumber)) { |
|
|
|
|
|
|
|
WarehouseWaybillEntity byWaybillNo = warehouseWaybillClient.findByWaybillNo(waybillNumber); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(byWaybillNo)) { |
|
|
|
|
|
|
|
// 运单发货信息
|
|
|
|
|
|
|
|
qualityDeliverEntity.setShipperUnitId(byWaybillNo.getShipperId()); |
|
|
|
|
|
|
|
qualityDeliverEntity.setShipperUnit(byWaybillNo.getShipper()); |
|
|
|
|
|
|
|
qualityDeliverEntity.setShipperPerson(byWaybillNo.getShipperName()); |
|
|
|
|
|
|
|
qualityDeliverEntity.setShipperMobile(byWaybillNo.getShipperMobile()); |
|
|
|
|
|
|
|
qualityDeliverEntity.setShipperAddress(byWaybillNo.getShipperAddress()); |
|
|
|
|
|
|
|
// 运单收货信息
|
|
|
|
|
|
|
|
qualityDeliverEntity.setConsigneeUnitId(byWaybillNo.getConsigneeId()); |
|
|
|
|
|
|
|
qualityDeliverEntity.setConsigneeUnit(byWaybillNo.getConsignee()); |
|
|
|
|
|
|
|
qualityDeliverEntity.setConsigneePerson(byWaybillNo.getConsigneeName()); |
|
|
|
|
|
|
|
qualityDeliverEntity.setConsigneeMobile(byWaybillNo.getConsigneeMobile()); |
|
|
|
|
|
|
|
qualityDeliverEntity.setConsigneeAddress(byWaybillNo.getConsigneeAddress()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void businessUnit(QualityDeliverEntity qualityDeliverEntity) { |
|
|
|
|
|
|
|
List<BasicdataWarehouseEntity> warehouseEntities = warehouseClient.findWarehousesByIds(Arrays.asList(qualityDeliverEntity.getWarehouseId())); |
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(warehouseEntities)) { |
|
|
|
|
|
|
|
BasicdataWarehouseEntity warehouseEntity = warehouseEntities.get(0); |
|
|
|
|
|
|
|
// 事业线
|
|
|
|
|
|
|
|
qualityDeliverEntity.setBusinessUnit(warehouseEntity.getBusinessLine()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|