diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/DistributionSignforVO.java b/blade-biz-common/src/main/java/org/springblade/common/model/DistributionSignforVO.java index a882f5fd8..664ef0644 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/model/DistributionSignforVO.java +++ b/blade-biz-common/src/main/java/org/springblade/common/model/DistributionSignforVO.java @@ -19,6 +19,11 @@ public class DistributionSignforVO implements Serializable { */ private String vehicleName; + /** + * 车辆类型 + */ + private String carType; + /** * 签收车次 */ 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 1560e947b..87a73a13b 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 @@ -6,7 +6,9 @@ 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.BasicdataFactoryCategoryEntity; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; +import com.logpm.basicdata.feign.IBasicdataFactoryCategoryClient; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.distribution.dto.ReportQualityDeliverDTO; import com.logpm.distribution.entity.DistributionParcelListEntity; @@ -23,6 +25,7 @@ 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.BizOperationEnums; import org.springblade.common.enums.PackageTypeEnums; import org.springframework.amqp.core.ExchangeTypes; import org.springframework.amqp.rabbit.annotation.Exchange; @@ -64,6 +67,9 @@ public class QualityDeliverListener { @Resource private IDistributionStockListService stockListService; + @Resource + private IBasicdataFactoryCategoryClient factoryCategoryClient; + @RabbitListener(bindings = @QueueBinding( value = @Queue(name = ReportConstants.REPORT_QUALITY_DELIVER_QUEUE, durable = "true"), exchange = @Exchange(name = ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE, type = ExchangeTypes.TOPIC), @@ -77,37 +83,39 @@ public class QualityDeliverListener { ReportQualityDeliverDTO bean = JSONUtil.toBean(msg, ReportQualityDeliverDTO.class); String data = bean.getData(); QualityDeliverEntity qualityDeliverEntity = JSONUtil.toBean(data, QualityDeliverEntity.class); - switch (bean.getOperation()) { - case MODIFY: - Integer conditions = qualityDeliverEntity.getConditions(); - if (ObjectUtil.equals(PackageTypeEnums.CMP.getCode(), conditions)) { - // 定制品 - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() - .eq(QualityDeliverEntity::getOrderPackageCode, qualityDeliverEntity.getOrderPackageCode()) - .lt(QualityDeliverEntity::getBizStatus, 110); - saveOrUpdate(wrapper, qualityDeliverEntity); - } else if (ObjectUtil.equals(PackageTypeEnums.INV.getCode(), conditions)) { - // 库存品 - LambdaQueryWrapper wrapper = buildInvWrapper(qualityDeliverEntity); - if (wrapper == null) { - return; - } - // 查询不存在时更新,存在时修改 - saveOrUpdate(wrapper, qualityDeliverEntity); - } else if (ObjectUtil.equals(PackageTypeEnums.LTL.getCode(), conditions)) { - // 零担 - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() - .eq(QualityDeliverEntity::getOrderCode, qualityDeliverEntity.getOrderCode()) - .eq(QualityDeliverEntity::getCostCategory, qualityDeliverEntity.getCostCategory()) - .lt(QualityDeliverEntity::getBizStatus, 110); - if (StrUtil.isNotEmpty(qualityDeliverEntity.getPlanReservationCode())) { - wrapper.eq(QualityDeliverEntity::getPlanReservationCode, qualityDeliverEntity.getPlanReservationCode()); - } - saveOrUpdate(wrapper, qualityDeliverEntity); + Integer conditions = qualityDeliverEntity.getConditions(); + if(ObjectUtil.equals(bean.getOperation(), BizOperationEnums.MODIFY)){ + if (ObjectUtil.equals(PackageTypeEnums.CMP.getCode(), conditions)) { + // 定制品 + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() + .eq(QualityDeliverEntity::getOrderPackageCode, qualityDeliverEntity.getOrderPackageCode()) + .lt(QualityDeliverEntity::getBizStatus, 110); + saveOrUpdate(wrapper, qualityDeliverEntity); + } else if (ObjectUtil.equals(PackageTypeEnums.INV.getCode(), conditions)) { + // 库存品 + LambdaQueryWrapper wrapper = buildInvWrapper(qualityDeliverEntity); + if (wrapper == null) { + return; } - break; - default: - return; + // 查询不存在时更新,存在时修改 + saveOrUpdate(wrapper, qualityDeliverEntity); + } else if (ObjectUtil.equals(PackageTypeEnums.LTL.getCode(), conditions)) { + // 零担 + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() + .eq(QualityDeliverEntity::getOrderCode, qualityDeliverEntity.getOrderCode()) + .eq(QualityDeliverEntity::getCostCategory, qualityDeliverEntity.getCostCategory()) + .lt(QualityDeliverEntity::getBizStatus, 110); + if (StrUtil.isNotEmpty(qualityDeliverEntity.getPlanReservationCode())) { + wrapper.eq(QualityDeliverEntity::getPlanReservationCode, qualityDeliverEntity.getPlanReservationCode()); + } + saveOrUpdate(wrapper, qualityDeliverEntity); + } + } + if(ObjectUtil.equals(bean.getOperation(), BizOperationEnums.ADD)){ + if (ObjectUtil.equals(PackageTypeEnums.INV.getCode(), conditions)) { + // 查询不存在时更新,存在时修改 + saveOrUpdate(null, qualityDeliverEntity); + } } } @@ -165,7 +173,10 @@ public class QualityDeliverListener { * @Author zqb 2024/9/10 **/ private void saveOrUpdate(LambdaQueryWrapper wrapper, QualityDeliverEntity qualityDeliverEntity) { - QualityDeliverEntity entity = qualityDeliverService.getOne(wrapper); + QualityDeliverEntity entity = null; + if (ObjectUtil.isNotEmpty(wrapper)) { + entity = qualityDeliverService.getOne(wrapper); + } if (ObjectUtil.isNotEmpty(entity)) { // 修改 qualityDeliverService.update(qualityDeliverEntity, wrapper); @@ -197,25 +208,41 @@ public class QualityDeliverListener { } private void buildInvBasicInfo(QualityDeliverEntity qualityDeliverEntity) { + String materielName = qualityDeliverEntity.getMaterielName(); DistributionStockListEntity stockListEntity = new DistributionStockListEntity(); stockListEntity.setIncomingBatch(qualityDeliverEntity.getIncomingBatch()); stockListEntity.setMallName(qualityDeliverEntity.getMallName()); stockListEntity.setCargoNumber((qualityDeliverEntity.getMaterielCode())); - stockListEntity.setDescriptionGoods(qualityDeliverEntity.getMaterielName()); + stockListEntity.setDescriptionGoods(materielName); stockListEntity.setWarehouseId(qualityDeliverEntity.getWarehouseId()); DistributionStockListEntity stockList = stockListService.findStockListByAttrAndWarehouseId(stockListEntity); if (ObjectUtil.isNotEmpty(stockList)) { + String brandName = stockList.getBrandName(); String sourceType = stockList.getSourceType(); if (StrUtil.equals(sourceType, "1")) { buildCmpBasicInfo(qualityDeliverEntity); } else { - qualityDeliverEntity.setBrandName(stockList.getBrandName()); + qualityDeliverEntity.setBrandName(brandName); qualityDeliverEntity.setMallCode(stockList.getMarketCode()); qualityDeliverEntity.setStoreCode(stockList.getStoreCode()); qualityDeliverEntity.setStoreName(stockList.getStoreName()); qualityDeliverEntity.setEndWarehouseInTime(stockList.getWarehousingTime()); } + // 品类 + if(StrUtil.isNotEmpty(materielName) && StrUtil.isNotEmpty(brandName)){ + BasicdataFactoryCategoryEntity factoryCategoryEntity = new BasicdataFactoryCategoryEntity(); + factoryCategoryEntity.setMaterielName(materielName); + factoryCategoryEntity.setBrand(brandName); + BasicdataFactoryCategoryEntity categoryEntity = factoryCategoryClient.findEntityByMaterielName(factoryCategoryEntity); + if(ObjectUtil.isNotEmpty(categoryEntity)){ + // TODO 存id + qualityDeliverEntity.setCostCategory(categoryEntity.getCategory()); + qualityDeliverEntity.setRevenueCategory(categoryEntity.getCategory()); + } + // TODO 从入库单上查询入库时间 + } } + } private void buildCmpBasicInfo(QualityDeliverEntity qualityDeliverEntity) { @@ -269,7 +296,7 @@ public class QualityDeliverListener { qualityDeliverEntity.setCustomAddress(stockArticleEntity.getCustomerAddress()); // 商场信息 qualityDeliverEntity.setMallName(stockArticleEntity.getMallName()); - qualityDeliverEntity.setMallCode(stockArticleEntity.getMallName()); + qualityDeliverEntity.setMallCode(stockArticleEntity.getMallCode()); // 服务号 qualityDeliverEntity.setServiceNumber(stockArticleEntity.getServiceNumber()); // 经销商信息 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 5924373d7..ac8bac123 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 @@ -101,14 +101,14 @@ public class ReservationPlanReportListener { if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) { qualityDeliverEntity.setConditions(1); qualityDeliverEntity.setPlanNum(1); - sendReport(bizOperation, qualityDeliverEntity); + sendReport(bizOperation, qualityDeliverEntity,BizOperationEnums.MODIFY); } if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.LTL)) { qualityDeliverEntity.setOrderCode(detail.getOrderCode()); qualityDeliverEntity.setCostCategory(detail.getProductName()); qualityDeliverEntity.setRevenueCategory(detail.getProductName()); qualityDeliverEntity.setConditions(2); - sendReport(bizOperation, qualityDeliverEntity); + sendReport(bizOperation, qualityDeliverEntity,BizOperationEnums.MODIFY); } if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) { qualityDeliverEntity.setIncomingBatch(detail.getPickupBatch()); @@ -121,7 +121,7 @@ public class ReservationPlanReportListener { QualityDeliverEntity entity = new QualityDeliverEntity(); BeanUtil.copyProperties(qualityDeliverEntity, entity); entity.setPlanNum(1); - sendReport(bizOperation, entity); + sendReport(bizOperation, entity, BizOperationEnums.ADD); } } @@ -129,9 +129,9 @@ public class ReservationPlanReportListener { } } - private void sendReport(BizOperationEnums bizOperation, QualityDeliverEntity qualityDeliverEntity) { + private void sendReport(BizOperationEnums bizOperation, QualityDeliverEntity qualityDeliverEntity, BizOperationEnums bizOperationEnums) { if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { - ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); + ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(bizOperationEnums).build(); factoryDataClient.sendMessage(SendMsg.builder() .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java index eea2274ed..ceee352ff 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java @@ -1872,15 +1872,18 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl packageLockIds = new ArrayList<>(); //根据传递进来的库存品条码进行库存品的校验 @@ -1905,17 +1908,23 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImplupdate().lambda() - .eq(DistributionParcelListEntity::getOrderPackageCode, disStockListDetailEntity.getStockPackageCode()) - .eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId()) - .eq(DistributionParcelListEntity::getMaterialCode, disStockListDetailEntity.getSku()) - .set(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.yizhuangche.getValue()) - .set(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.yiyueyue.getValue()) - .set(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yichuku.getValue()) - ); + DistributionStockListEntity byId = distributionStockListService.getById(disStockListDetailEntity.getStockListId()); + + if(byId!=null &&"1".equals(byId.getSourceType())){ + //维护包件装车状态 + boolean update = distributionParcelListService.update( + Wrappers.update().lambda() + .eq(DistributionParcelListEntity::getOrderPackageCode, disStockListDetailEntity.getStockPackageCode()) + .eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId()) + .eq(DistributionParcelListEntity::getMaterialCode, disStockListDetailEntity.getSku()) + .set(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.yizhuangche.getValue()) + .set(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.yiyueyue.getValue()) + .set(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yichuku.getValue()) + + ); + } + log.info(">>>>>>>>>>>>>>>>>>>装车修改库存品包件>装车包件码:{},", disStockListDetailEntity.getStockPackageCode()); DistributionLoadscaninvnEntity distributionLoadscaninvnEntity = getDistributionLoadscaninvnEntity(distrilbutionloadingscanDTO, distributionDeliverySelfEntity, disStockListDetailEntities, myCurrentWarehouse); packageLockIds.add(distributionLoadscaninvnEntity.getInventoryPackageId()); @@ -1964,9 +1973,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl nodeFanoutMsg = buildNodeFanoutMsgByStock(deliveryListEntity, reservationEntity, ts); + NodeFanoutMsg nodeFanoutMsg = buildNodeFanoutMsgByStock(distributionDeliveryListEntity, reservationEntity, ts); distributionNodeWorkService.nodeLoading(nodeFanoutMsg, AuthUtil.getUser()); String msg = getLoadingMsg(distrilbutionloadingscanDTO); return Resp.scanSuccess("扫描成功", msg); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java index be4c6a55a..cc4ce0969 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java @@ -2940,6 +2940,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl