diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java index 8159af4c4..71d94e570 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java @@ -68,6 +68,11 @@ public class QualityDeliverEntity extends TenantEntity { */ @ApiModelProperty(value = "客户地址") private String customAddress; + /** + * 运单发货单位id + */ + @ApiModelProperty(value = "运单发货单位id") + private Long shipperUnitId; /** * 运单发货单位 */ @@ -88,6 +93,11 @@ public class QualityDeliverEntity extends TenantEntity { */ @ApiModelProperty(value = "运单发货地址") private String shipperAddress; + /** + * 运单收货单位id + */ + @ApiModelProperty(value = "运单收货单位id") + private Long consigneeUnitId; /** * 运单收货单位 */ @@ -123,6 +133,36 @@ public class QualityDeliverEntity extends TenantEntity { */ @ApiModelProperty(value = "商场ID") private Long mallId; + /** + * 商场编号 + */ + @ApiModelProperty(value = "商场编码") + private String mallCode; + /** + * 门店编号 + */ + @ApiModelProperty(value = "门店编码") + private String storeCode; + /** + * 门店名称 + */ + @ApiModelProperty(value = "门店名称") + private String storeName; + /** + * 服务号 + */ + @ApiModelProperty(value = "服务号") + private String serviceNumber; + /** + * 经销商名称 + */ + @ApiModelProperty(value = "经销商名称") + private String dealerName; + /** + * 经销商编码 + */ + @ApiModelProperty(value = "经销商编码") + private String dealerCode; /** * 入库批次号 */ @@ -212,12 +252,27 @@ public class QualityDeliverEntity extends TenantEntity { * 末端仓入库时间 */ @ApiModelProperty(value = "末端仓入库时间") - private String endWarehouseInTime; + private Date endWarehouseInTime; /** * 计划预约单号 只有商市配,自提采用自提车次号 三方中转采用三方中转车次号 */ @ApiModelProperty(value = "计划预约单号 只有商市配,自提采用自提车次号 三方中转采用三方中转车次号") private String planReservationCode; + /** + * 预约收货人 + */ + @ApiModelProperty(value = "预约收货人") + private String reservationConsignee; + /** + * 预约收货人电话 + */ + @ApiModelProperty(value = "预约收货人电话") + private String reservationConsigneePhone; + /** + * 预约收货人地址 + */ + @ApiModelProperty(value = "预约收货人地址") + private String reservationConsigneeAddr; /** * 计划预约人 */ @@ -244,6 +299,11 @@ public class QualityDeliverEntity extends TenantEntity { */ @ApiModelProperty(value = "计划配送单号 包含配送车次和自提车次 直发商家 对应干线车次 三方中转 三方中转车次号") private String planTrainNumber; + /** + * 服务类型 + */ + @ApiModelProperty(value = "服务类型") + private String serviceType; /** * 配送日期 */ diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java index 9a441f25f..1560e947b 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java @@ -1,16 +1,29 @@ package com.logpm.distribution.receiver.report; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.entity.DistributionParcelListEntity; +import com.logpm.distribution.entity.DistributionStockArticleEntity; +import com.logpm.distribution.entity.DistributionStockListEntity; 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.warehouse.entity.WarehouseWaybillEntity; +import com.logpm.warehouse.feign.IWarehouseWaybillClient; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.jetbrains.annotations.Nullable; import org.springblade.common.constant.report.ReportConstants; +import org.springblade.common.enums.PackageTypeEnums; import org.springframework.amqp.core.ExchangeTypes; import org.springframework.amqp.rabbit.annotation.Exchange; import org.springframework.amqp.rabbit.annotation.Queue; @@ -19,6 +32,8 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Component; import javax.annotation.Resource; +import java.util.Arrays; +import java.util.List; /** * 配送明细基础表处理类 @@ -34,6 +49,21 @@ public class QualityDeliverListener { @Resource 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( value = @Queue(name = ReportConstants.REPORT_QUALITY_DELIVER_QUEUE, durable = "true"), exchange = @Exchange(name = ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE, type = ExchangeTypes.TOPIC), @@ -50,64 +80,21 @@ public class QualityDeliverListener { switch (bean.getOperation()) { case MODIFY: Integer conditions = qualityDeliverEntity.getConditions(); - if (1 == conditions) { + if (ObjectUtil.equals(PackageTypeEnums.CMP.getCode(), conditions)) { // 定制品 - QualityDeliverEntity entity = qualityDeliverService.getOne(Wrappers.lambdaQuery() - .eq(QualityDeliverEntity::getOrderPackageCode, qualityDeliverEntity.getOrderPackageCode()) - .lt(QualityDeliverEntity::getBizStatus, 110)); - if (ObjectUtil.isNotEmpty(entity)) { - qualityDeliverService.update(qualityDeliverEntity, Wrappers.lambdaUpdate() - .eq(QualityDeliverEntity::getOrderPackageCode, qualityDeliverEntity.getOrderPackageCode()) - .lt(QualityDeliverEntity::getBizStatus, 110)); - } else { - // 获取基础数据赋值 - qualityDeliverService.save(qualityDeliverEntity); - } - } else if (3 == conditions) { - // 库存品 LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() + .eq(QualityDeliverEntity::getOrderPackageCode, qualityDeliverEntity.getOrderPackageCode()) .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; - } 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()); + saveOrUpdate(wrapper, qualityDeliverEntity); + } else if (ObjectUtil.equals(PackageTypeEnums.INV.getCode(), conditions)) { + // 库存品 + LambdaQueryWrapper wrapper = buildInvWrapper(qualityDeliverEntity); + if (wrapper == null) { + return; } // 查询不存在时更新,存在时修改 - QualityDeliverEntity entity = qualityDeliverService.getOne(wrapper); - if (ObjectUtil.isNotEmpty(entity)) { - qualityDeliverService.update(qualityDeliverEntity, wrapper); - } else { - // 获取基础数据赋值 - qualityDeliverService.save(qualityDeliverEntity); - } - } else if (2 == conditions) { + saveOrUpdate(wrapper, qualityDeliverEntity); + } else if (ObjectUtil.equals(PackageTypeEnums.LTL.getCode(), conditions)) { // 零担 LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() .eq(QualityDeliverEntity::getOrderCode, qualityDeliverEntity.getOrderCode()) @@ -116,13 +103,7 @@ public class QualityDeliverListener { if (StrUtil.isNotEmpty(qualityDeliverEntity.getPlanReservationCode())) { wrapper.eq(QualityDeliverEntity::getPlanReservationCode, qualityDeliverEntity.getPlanReservationCode()); } - QualityDeliverEntity entity = qualityDeliverService.getOne(wrapper); - if (ObjectUtil.isNotEmpty(entity)) { - qualityDeliverService.update(qualityDeliverEntity, wrapper); - } else { - // 获取基础数据赋值 - qualityDeliverService.save(qualityDeliverEntity); - } + saveOrUpdate(wrapper, qualityDeliverEntity); } break; default: @@ -130,4 +111,206 @@ public class QualityDeliverListener { } } + /** + * 构建库存品查询Wrapper + * + * @param qualityDeliverEntity + * @Return com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper + * @Author zqb 2024/9/10 + **/ + private static @Nullable LambdaQueryWrapper buildInvWrapper(QualityDeliverEntity qualityDeliverEntity) { + LambdaQueryWrapper wrapper = Wrappers.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 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 warehouseEntities = warehouseClient.findWarehousesByIds(Arrays.asList(qualityDeliverEntity.getWarehouseId())); + if (CollUtil.isNotEmpty(warehouseEntities)) { + BasicdataWarehouseEntity warehouseEntity = warehouseEntities.get(0); + // 事业线 + qualityDeliverEntity.setBusinessUnit(warehouseEntity.getBusinessLine()); + } + } + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReservationPlanReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReservationPlanReportListener.java index 272dd1082..5924373d7 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReservationPlanReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReservationPlanReportListener.java @@ -74,6 +74,10 @@ public class ReservationPlanReportListener { .set(QualityDeliverEntity::getPlanReservationTime, null) .set(QualityDeliverEntity::getPlanReservationUser, null) .set(QualityDeliverEntity::getPlanNum, null) + .set(QualityDeliverEntity::getServiceType, null) + .set(QualityDeliverEntity::getReservationConsignee, null) + .set(QualityDeliverEntity::getReservationConsigneePhone, null) + .set(QualityDeliverEntity::getReservationConsigneeAddr, null) .eq(QualityDeliverEntity::getPlanReservationCode, vo.getReservationCode()) .ne(QualityDeliverEntity::getBizStatus, 110); qualityDeliverService.update(wrapper); @@ -89,6 +93,10 @@ public class ReservationPlanReportListener { .planReservationTime(vo.getReservationDate()) .planReservationUser(bean.getOperator()) .planNum(detail.getNumber()) + .serviceType(vo.getDeliveryType()) + .reservationConsignee(vo.getConsignee()) + .reservationConsigneePhone(vo.getDeliveryPhone()) + .reservationConsigneeAddr(vo.getDeliveryAddress()) .build(); if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) { qualityDeliverEntity.setConditions(1); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java index 29b33d037..c814d14c5 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java @@ -214,6 +214,13 @@ public interface IDistributionStockListService extends BaseService exportStock(Map distributionStockList); + /** + * 根据属性查询库存品 + * @param stockListEntity + * @Return com.logpm.distribution.entity.DistributionStockListEntity + * @Author zqb 2024/9/11 + **/ + DistributionStockListEntity findStockListByAttrAndWarehouseId(DistributionStockListEntity stockListEntity); // /** diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java index 2f0bfe5a9..f9486a165 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java @@ -16,7 +16,10 @@ */ package com.logpm.distribution.service.impl; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; @@ -32,12 +35,26 @@ import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.feign.IBasicdataClientClient; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.distribution.dto.DistributionStockListDTO; -import com.logpm.distribution.entity.*; +import com.logpm.distribution.entity.DisStockListDetailEntity; +import com.logpm.distribution.entity.DistributionParcelListEntity; +import com.logpm.distribution.entity.DistributionReservationEntity; +import com.logpm.distribution.entity.DistributionStockListEntity; +import com.logpm.distribution.entity.DistributionStockListInfoEntity; +import com.logpm.distribution.entity.DistributionUnpackingDetailsEntity; import com.logpm.distribution.excel.DistributionStockListExcel; import com.logpm.distribution.mapper.DistributionReservationMapper; import com.logpm.distribution.mapper.DistributionStockListMapper; -import com.logpm.distribution.service.*; -import com.logpm.distribution.vo.*; +import com.logpm.distribution.service.IDisStockListDetailService; +import com.logpm.distribution.service.IDistributionParcelListService; +import com.logpm.distribution.service.IDistributionStockArticleService; +import com.logpm.distribution.service.IDistributionStockListInfoService; +import com.logpm.distribution.service.IDistributionStockListService; +import com.logpm.distribution.service.IDistributionUnpackingDetailsService; +import com.logpm.distribution.vo.DistributionStockListAllocationVO; +import com.logpm.distribution.vo.DistributionStockListVO; +import com.logpm.distribution.vo.DistributionStockupStockListInfoVO; +import com.logpm.distribution.vo.OrderPackgeCodeDataVO; +import com.logpm.distribution.vo.StockListInfoListVO; import com.logpm.distribution.vo.app.DistributionMerchantStockListVO; import com.logpm.distribution.vo.app.StockMallVO; import com.logpm.trunkline.feign.ITrunklinePackageTrackLogClient; @@ -72,7 +89,13 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @@ -258,6 +281,32 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl wrapper = Wrappers.lambdaQuery() + .eq(DistributionStockListEntity::getWarehouseId, stockListEntity.getWarehouseId()); + if (StrUtil.isNotEmpty(stockListEntity.getIncomingBatch())) { + wrapper.eq(DistributionStockListEntity::getIncomingBatch, stockListEntity.getIncomingBatch()); + } + if (StrUtil.isNotEmpty(stockListEntity.getMallName())) { + wrapper.eq(DistributionStockListEntity::getMarketName, stockListEntity.getMallName()); + } else { + return null; + } + if (StrUtil.isEmpty(stockListEntity.getCargoNumber()) && StrUtil.isEmpty(stockListEntity.getDescriptionGoods())) { + return null; + } + if (StrUtil.isNotEmpty(stockListEntity.getCargoNumber())) { + wrapper.eq(DistributionStockListEntity::getCargoNumber, stockListEntity.getCargoNumber()); + } else { + wrapper.eq(DistributionStockListEntity::getDescriptionGoods, stockListEntity.getDescriptionGoods()); + } + List list = this.list(wrapper); + if (CollUtil.isNotEmpty(list)){ + return list.get(0); + } + return null; + } @Override