From ddd75f85fcb02badd60324f5abc101282282bf7e Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Mon, 25 Dec 2023 11:01:22 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=BA=93=E5=86=85=E4=B8=8A=E6=9E=B6=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E9=80=BB=E8=BE=91=E6=9B=B4=E6=96=B0=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feign/DistributionParcelListClient.java | 12 +++++ .../OrderPackageStatusDataHandler.java | 54 +++++++++---------- .../DistributionParcelListServiceImpl.java | 31 ++++++----- .../DistributionStockArticleServiceImpl.java | 34 +++++++++++- 4 files changed, 86 insertions(+), 45 deletions(-) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java index 34d8d5e75..3c83c5ccf 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java @@ -29,6 +29,7 @@ import com.logpm.distribution.service.IDistributionStockArticleService; import com.logpm.distribution.vo.DistributionParcelListVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.common.exception.CustomerException; import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; @@ -40,6 +41,7 @@ import springfox.documentation.annotations.ApiIgnore; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; /** * 在库订单包件清单 Feign实现类 @@ -156,6 +158,16 @@ public class DistributionParcelListClient implements IDistributionParcelListClie @Override public void updatePackageGroundingStatus(String orderPackageCode, String groundingStatus,Long warehouseId) { distributionParcelListService.updateGroundingStatus(orderPackageCode,groundingStatus,warehouseId); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("order_package_code",orderPackageCode) + .eq("warehouse_id",warehouseId); + DistributionParcelListEntity parcelListEntity = distributionParcelListService.getOne(queryWrapper); + if(Objects.isNull(parcelListEntity)){ + log.error("##################updatePackageGroundingStatus: 包件不存在 orderPackageCode={} warehouseId={}",orderPackageCode,warehouseId); + throw new CustomerException(405,"包件不存在"); + } + String orderCode = parcelListEntity.getOrderCode(); + distributionStockArticleService.updateOrderInfo(orderCode,warehouseId); } @Override diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/OrderPackageStatusDataHandler.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/OrderPackageStatusDataHandler.java index 787fc2583..ae8c12592 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/OrderPackageStatusDataHandler.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/OrderPackageStatusDataHandler.java @@ -4,7 +4,6 @@ package com.logpm.distribution.receiver; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.logpm.distribution.entity.DistributionParcelListEntity; -import com.logpm.distribution.entity.DistributionStockArticleEntity; import com.logpm.distribution.mapper.DistributionParcelListMapper; import com.logpm.distribution.mapper.DistributionStockArticleMapper; import com.rabbitmq.client.Channel; @@ -16,7 +15,6 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.List; import java.util.Map; @Slf4j @@ -46,7 +44,7 @@ public class OrderPackageStatusDataHandler { .eq("is_deleted",0); DistributionParcelListEntity parcelListEntity = baseMapper.selectOne(queryWrapper); parcelListEntity.setOrderPackageGroundingStatus(groundingStatus); -// int i = baseMapper.updateById(parcelListEntity); + int i = baseMapper.updateById(parcelListEntity); try{ // 更新状态 @@ -55,31 +53,31 @@ public class OrderPackageStatusDataHandler { // log.info(">>>> 更新包间状态 >> 包件ID {} 状态 {}",parcelListEntity.getId(),groundingStatus); - String orderCode = parcelListEntity.getOrderCode(); - - QueryWrapper stockArticleEntityQueryWrapper = new QueryWrapper<>(); - stockArticleEntityQueryWrapper.eq("order_code",orderCode) - .eq("is_deleted",0); - DistributionStockArticleEntity one = distributionStockArticleMapper.selectOne(stockArticleEntityQueryWrapper); - Integer totalNumber = one.getTotalNumber(); - - QueryWrapper queryWrapperList = new QueryWrapper<>(); - queryWrapperList.eq("order_code",orderCode) - .eq("order_package_grounding_status","20") - .eq("warehouse_id",warehouseId) - .eq("is_deleted",0); - List listEntityList = baseMapper.selectList(queryWrapperList); - int size = listEntityList.size(); - if(size == 0){ - //更新订单上架状态 - baseMapper.updateOrderGroundingStatus(orderCode,"10",warehouseId); - }else if(size >= totalNumber){ - //更新订单上架状态 - baseMapper.updateOrderGroundingStatus(orderCode,"30",warehouseId); - }else{ - //更新订单上架状态 - baseMapper.updateOrderGroundingStatus(orderCode,"20",warehouseId); - } +// String orderCode = parcelListEntity.getOrderCode(); +// +// QueryWrapper stockArticleEntityQueryWrapper = new QueryWrapper<>(); +// stockArticleEntityQueryWrapper.eq("order_code",orderCode) +// .eq("is_deleted",0); +// DistributionStockArticleEntity one = distributionStockArticleMapper.selectOne(stockArticleEntityQueryWrapper); +// Integer totalNumber = one.getTotalNumber(); +// +// QueryWrapper queryWrapperList = new QueryWrapper<>(); +// queryWrapperList.eq("order_code",orderCode) +// .eq("order_package_grounding_status","20") +// .eq("warehouse_id",warehouseId) +// .eq("is_deleted",0); +// List listEntityList = baseMapper.selectList(queryWrapperList); +// int size = listEntityList.size(); +// if(size == 0){ +// //更新订单上架状态 +// baseMapper.updateOrderGroundingStatus(orderCode,"10",warehouseId); +// }else if(size >= totalNumber){ +// //更新订单上架状态 +// baseMapper.updateOrderGroundingStatus(orderCode,"30",warehouseId); +// }else{ +// //更新订单上架状态 +// baseMapper.updateOrderGroundingStatus(orderCode,"20",warehouseId); +// } }catch (Exception e){ diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java index 9067fedee..708fd1ee9 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java @@ -44,7 +44,6 @@ import com.logpm.warehouse.feign.IWarehouseUpdownGoodsClient; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.common.constant.DictBizConstant; -import org.springblade.common.constant.RabbitConstant; import org.springblade.common.constant.order.OrderStockupStatusConstant; import org.springblade.common.utils.CommonUtil; import org.springblade.core.log.exception.ServiceException; @@ -185,23 +184,23 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl>>>> 发送消息给MQ start 包件{}",orderPackageCode); - - Map map = new HashMap(); - map.put("messageId", CommonUtil.getUUID()); - map.put("orderPackageCode", orderPackageCode); - map.put("groundingStatus", groundingStatus); - map.put("warehouseId", warehouseId); -//将消息携带绑定键值 - rabbitTemplate.convertAndSend(RabbitConstant.ORDER_PACKAGE_STATUS_INFO_EXCHANGE, RabbitConstant.ORDER_PACKAGE_STATUS_INFO_ROUTING, map); - - log.info(">>>>> 发送消息给MQ end 包件{}",orderPackageCode); - - - - +// log.info(">>>>> 发送消息给MQ start 包件{}",orderPackageCode); +// +// Map map = new HashMap(); +// map.put("messageId", CommonUtil.getUUID()); +// map.put("orderPackageCode", orderPackageCode); +// map.put("groundingStatus", groundingStatus); +// map.put("warehouseId", warehouseId); + //将消息携带绑定键值 +// rabbitTemplate.convertAndSend(RabbitConstant.ORDER_PACKAGE_STATUS_INFO_EXCHANGE, RabbitConstant.ORDER_PACKAGE_STATUS_INFO_ROUTING, map); +// log.info(">>>>> 发送消息给MQ end 包件{}",orderPackageCode); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java index 248763ec2..2f8d1568c 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java @@ -1296,14 +1296,21 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl waybillNoSet = new TreeSet<>(); for (DistributionParcelListEntity parcelListEntity : list) { incomingNum = incomingNum + 1; String orderPackageStatus = parcelListEntity.getOrderPackageStatus(); String orderPackageReservationStatus = parcelListEntity.getOrderPackageReservationStatus(); + String orderPackageGroundingStatus = parcelListEntity.getOrderPackageGroundingStatus(); + waybillNoSet.add(parcelListEntity.getWaybillNumber()); + + if("20".equals(orderPackageGroundingStatus)){ + groundingNum = groundingNum + 1; + } if("20".equals(orderPackageReservationStatus)){ reservationNum = reservationNum + 1; @@ -1340,6 +1347,16 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl 0 && groundingNum < totalNumber){ + stockArticleEntity.setGroundingStatus("20"); + }else{ + stockArticleEntity.setGroundingStatus("30"); + } } stockArticleEntity.setIncomingNum(incomingNum);