Browse Source

1.库内上架状态逻辑更新优化

single_db
zhenghaoyu 1 year ago
parent
commit
ddd75f85fc
  1. 12
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java
  2. 54
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/OrderPackageStatusDataHandler.java
  3. 31
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java
  4. 34
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

12
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<DistributionParcelListEntity> 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

54
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<DistributionStockArticleEntity> stockArticleEntityQueryWrapper = new QueryWrapper<>();
stockArticleEntityQueryWrapper.eq("order_code",orderCode)
.eq("is_deleted",0);
DistributionStockArticleEntity one = distributionStockArticleMapper.selectOne(stockArticleEntityQueryWrapper);
Integer totalNumber = one.getTotalNumber();
QueryWrapper<DistributionParcelListEntity> queryWrapperList = new QueryWrapper<>();
queryWrapperList.eq("order_code",orderCode)
.eq("order_package_grounding_status","20")
.eq("warehouse_id",warehouseId)
.eq("is_deleted",0);
List<DistributionParcelListEntity> 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<DistributionStockArticleEntity> stockArticleEntityQueryWrapper = new QueryWrapper<>();
// stockArticleEntityQueryWrapper.eq("order_code",orderCode)
// .eq("is_deleted",0);
// DistributionStockArticleEntity one = distributionStockArticleMapper.selectOne(stockArticleEntityQueryWrapper);
// Integer totalNumber = one.getTotalNumber();
//
// QueryWrapper<DistributionParcelListEntity> queryWrapperList = new QueryWrapper<>();
// queryWrapperList.eq("order_code",orderCode)
// .eq("order_package_grounding_status","20")
// .eq("warehouse_id",warehouseId)
// .eq("is_deleted",0);
// List<DistributionParcelListEntity> 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){

31
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<Distribut
@Override
public void updateGroundingStatus(String orderPackageCode, String groundingStatus,Long warehouseId) {
try{
updateGroundingStatus(orderPackageCode,groundingStatus,warehouseId);
}catch (Exception e){
log.error("###############updateGroundingStatus: 更新上架状态失败 orderPackageCode={} warehouseId={} groundingStatus={}",orderPackageCode,warehouseId,groundingStatus);
}
log.info(">>>>> 发送消息给MQ start 包件{}",orderPackageCode);
Map<String,Object> 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<String,Object> 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);
}

34
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

@ -1296,14 +1296,21 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
Integer outNum = 0;
Integer signNum = 0;
Integer reservationNum = 0;
Integer groundingNum = 0;
Long firstEntryTime = 0L;
Long lastEntryTime = 0L;
String reservationStatus = "10";
Set<String> 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<Distrib
}
}
String orderWaybillNo = null;
for (String waybillNo : waybillNoSet) {
if(StringUtils.isBlank(orderWaybillNo)){
orderWaybillNo = waybillNo;
}else{
orderWaybillNo = orderWaybillNo + "," + waybillNo;
}
}
stockArticleEntity.setWaybillNumber(orderWaybillNo);
stockArticleEntity.setWarehouseEntryTime(new Date(firstEntryTime));
stockArticleEntity.setWarehouseEntryTimeEnd(new Date(lastEntryTime));
@ -1348,6 +1365,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
stockArticleEntity.setCompleteSet(1);
stockArticleEntity.setOrderStatus("0");
stockArticleEntity.setReservationStatus("10");
stockArticleEntity.setGroundingStatus("10");
}else if (0 < incomingNum && incomingNum < totalNumber){
stockArticleEntity.setOrderReceiveStatus("20");
stockArticleEntity.setCompleteSet(1);
@ -1368,6 +1386,12 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
}else{
stockArticleEntity.setReservationStatus("20");
}
if(groundingNum == 0){
stockArticleEntity.setGroundingStatus("10");
}else{
stockArticleEntity.setGroundingStatus("20");
}
}else{
stockArticleEntity.setOrderReceiveStatus("30");
stockArticleEntity.setCompleteSet(2);
@ -1394,6 +1418,14 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
}else{
stockArticleEntity.setReservationStatus("30");
}
if(groundingNum == 0){
stockArticleEntity.setGroundingStatus("10");
}else if(groundingNum > 0 && groundingNum < totalNumber){
stockArticleEntity.setGroundingStatus("20");
}else{
stockArticleEntity.setGroundingStatus("30");
}
}
stockArticleEntity.setIncomingNum(incomingNum);

Loading…
Cancel
Save