Browse Source

1.维护信息异步处理

single_db
pref_mail@163.com 1 year ago
parent
commit
a49bd9c7ac
  1. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionDeliveryAppController.java
  2. 60
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/OrderPackageStatusDataHandler.java
  3. 66
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

1
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionDeliveryAppController.java

@ -135,6 +135,7 @@ public class DistributionDeliveryAppController {
@ApiOperation(value = "装车扫描", notes = "传入DistrilbutionloadingscanDTO")
public R loadingscan(@Valid @RequestBody DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) {
R msg = distributionDeliveryListService.loadingscan(distrilbutionloadingscanDTO);
return msg;
}

60
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/OrderPackageStatusDataHandler.java

@ -2,10 +2,17 @@
package com.logpm.distribution.receiver;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.distribution.dto.app.DistrilbutionloadingscanDTO;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionReservationEntity;
import com.logpm.distribution.mapper.DistributionParcelListMapper;
import com.logpm.distribution.mapper.DistributionStockArticleMapper;
import com.logpm.distribution.service.IDistributionDeliveryListService;
import com.logpm.distribution.service.IDistributionReservationService;
import com.logpm.distribution.service.IDistributionStockArticleService;
import com.logpm.warehouse.feign.IWarehouseUpdownTypeClient;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.RabbitConstant;
@ -13,6 +20,7 @@ import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import java.util.Map;
@ -24,39 +32,49 @@ public class OrderPackageStatusDataHandler {
@Autowired
private DistributionParcelListMapper baseMapper;
@Autowired
private IWarehouseUpdownTypeClient warehouseUpdownTypeClient;
@Autowired
private DistributionStockArticleMapper distributionStockArticleMapper;
@Autowired
private IDistributionStockArticleService distributionStockArticleService;
@RabbitHandler
public void orderPackageStatusChange(Map map, Message message, Channel channel){
@Autowired
private IDistributionReservationService distributionReservationService;
@Autowired
private IDistributionDeliveryListService distributionDeliveryListService;
Object orderPackageCode1 = map.get("orderPackageCode");
String orderPackageCode= (String) orderPackageCode1;
String groundingStatus=(String)map.get("groundingStatus");
Long warehouseId = (Long)map.get("warehouseId");
@RabbitHandler
public void orderPackageStatusChange(Map map, Message message, Channel channel){
// 处理包件状态
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("order_package_code",orderPackageCode)
.eq("warehouse_id",warehouseId)
.eq("is_deleted",0);
DistributionParcelListEntity parcelListEntity = baseMapper.selectOne(queryWrapper);
parcelListEntity.setOrderPackageGroundingStatus(groundingStatus);
int i = baseMapper.updateById(parcelListEntity);
try{
// 更新状态
baseMapper.updateOrderPackageCodeById(parcelListEntity.getId(),groundingStatus);
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>处理状态>>>>>>>>>>>>>>>>>>>>>>>>>>");
Long myCurrentWarehouseId = Long.parseLong(map.get("myCurrentWarehouseId").toString());
String distrilbutionloadingscanDTOJson = (String)map.get("distrilbutionloadingscanDTO");
DistrilbutionloadingscanDTO distrilbutionloadingscanDTO = JSONObject.parseObject(distrilbutionloadingscanDTOJson,DistrilbutionloadingscanDTO.class);
String parcelListEntityJSon = (String)map.get("parcelListEntity");
DistributionParcelListEntity parcelListEntity = JSONObject.parseObject(parcelListEntityJSon,DistributionParcelListEntity.class);
String reservationEntityJson = (String)map.get("reservationEntity");
DistributionReservationEntity reservationEntity = JSONObject.parseObject(reservationEntityJson,DistributionReservationEntity.class);
//包件配送下架
warehouseUpdownTypeClient.downDeliveryPackage(parcelListEntity.getOrderPackageCode(), myCurrentWarehouseId);
//维护订单的信息
distributionStockArticleService.maintenanceOrderInfo(parcelListEntity.getOrderCode(), myCurrentWarehouseId);
//维护预约的信息
distributionReservationService.maintenanceReservationInfo(reservationEntity.getId());
//维护配送任务信息
distributionDeliveryListService.maintenanceDeliveryInfo(distrilbutionloadingscanDTO.getDeliveryId());
}catch (Exception e){
// 更新状态报错
log.error(">>>>>> updateGroundingStatus 异常信息",e);
log.error(">>>>>> 维护包件信息 报错",e);
}
}
}

66
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

@ -17,6 +17,7 @@
package com.logpm.distribution.service.impl;
import cn.hutool.core.date.DateUtil;
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.UpdateWrapper;
@ -58,6 +59,7 @@ import org.jetbrains.annotations.NotNull;
import org.springblade.common.constant.DictBizConstant;
import org.springblade.common.constant.DistributionTypeConstant;
import org.springblade.common.constant.Inventory.InventoryLoadingStatusConstant;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.common.constant.common.IsOrNoConstant;
import org.springblade.common.constant.delivery.DeliveryLoadingStatusConstant;
import org.springblade.common.constant.delivery.DeliveryStatusConstant;
@ -90,6 +92,7 @@ import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.cache.DictBizCache;
import org.springblade.system.feign.IDictBizClient;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
@ -223,6 +226,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
@Lazy
private IDistributionDeliveryListService distributionDeliveryListService;
@Autowired
private RabbitTemplate rabbitTemplate;
// private final IWarehouseRetentionScanClient warehouseRetentionScanClient;
// @Lazy
@ -540,9 +545,11 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
@Override
@Transactional(isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class)
// synchronized
public R loadingscan(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) {
//查询该包件是否能够从库存品包件表中查到
String now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if (Objects.isNull(myCurrentWarehouse)) {
@ -553,7 +560,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
// 属于该配送任务需要进行是否属于该客户进行判断
// 如果属于该客户则进行装车扫描
//
String now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
List<DisStockListDetailEntity> list = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda()
.eq(DisStockListDetailEntity::getStockPackageCode, distrilbutionloadingscanDTO.getBarcode())
.ne(DisStockListDetailEntity::getStockPackageStatus, ReservationPackageStatusConstant.quxiao.getValue())
@ -572,8 +578,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//异步确认包条扫描信息
// distributionAsyncService.changeOrderSignforStatus(distrilbutionloadingscanDTO.getBarcode());
AtomicInteger loadingNum = new AtomicInteger();
AtomicInteger abnormalLoadingNum = new AtomicInteger();
DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfEntity();
if (distributionDeliveryListEntity.getKind().equals("1")) {
if (!Objects.isNull(distrilbutionloadingscanDTO.getLoadingId())) {
@ -646,17 +650,33 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionParcelListService.updateById(parcelListEntity);
//更新装车时间
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId());
//更新签收表的装车数量
Integer j = distributionSignforMapper.updateloadByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub());
//包件配送下架
warehouseUpdownTypeClient.downDeliveryPackage(parcelListEntity.getOrderPackageCode(),myCurrentWarehouse.getId());
//维护订单的信息
distributionStockArticleService.maintenanceOrderInfo(parcelListEntity.getOrderCode(),myCurrentWarehouse.getId());
//维护预约的信息
distributionReservationService.maintenanceReservationInfo(reservationEntity.getId());
//维护配送任务信息
distributionDeliveryListService.maintenanceDeliveryInfo(distrilbutionloadingscanDTO.getDeliveryId());
} else if (parcelListEntityList.size() == 0) {
Map<String,Object> map = new HashMap();
String distrilbutionloadingscanDTOJson = JSONObject.toJSONString(distrilbutionloadingscanDTO);
map.put("distrilbutionloadingscanDTO",distrilbutionloadingscanDTOJson);
String parcelListEntityJson = JSONObject.toJSONString(parcelListEntity);
map.put("parcelListEntity",parcelListEntityJson);
map.put("myCurrentWarehouseId",myCurrentWarehouse.getId());
String reservationEntityJson = JSONObject.toJSONString(reservationEntity);
map.put("reservationEntity",reservationEntityJson);
log.info(">>>>>>>>>>>>> 进入延迟队列处理包件相关信息状态");
rabbitTemplate.convertAndSend(RabbitConstant.ORDER_PACKAGE_STATUS_INFO_EXCHANGE, RabbitConstant.ORDER_PACKAGE_STATUS_INFO_ROUTING, map, message -> {
message.getMessageProperties()
.setHeader("x-delay", 3000);
return message;
});
extracteOrderPackageStatus(distrilbutionloadingscanDTO, parcelListEntity, myCurrentWarehouse, reservationEntity);
} else if (parcelListEntityList.isEmpty()) {
//查找出该包件信息
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getOne(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()));
List<DistributionReservationEntity> reservationEntityList = distributionDeliveryListMapper.selectReservationByDeliveryListId(distrilbutionloadingscanDTO.getDeliveryId());
@ -842,6 +862,17 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
return Resp.scanSuccessWithData("装车成功", str.toString(), carLaodNum);
}
private void extracteOrderPackageStatus(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO, DistributionParcelListEntity parcelListEntity, BasicdataWarehouseEntity myCurrentWarehouse, DistributionReservationEntity reservationEntity) {
//包件配送下架
warehouseUpdownTypeClient.downDeliveryPackage(parcelListEntity.getOrderPackageCode(), myCurrentWarehouse.getId());
//维护订单的信息
distributionStockArticleService.maintenanceOrderInfo(parcelListEntity.getOrderCode(), myCurrentWarehouse.getId());
//维护预约的信息
distributionReservationService.maintenanceReservationInfo(reservationEntity.getId());
//维护配送任务信息
distributionDeliveryListService.maintenanceDeliveryInfo(distrilbutionloadingscanDTO.getDeliveryId());
}
// List<Long> trayGoodIds = voGoodsLsit.stream().filter(v -> v.getAssociationType().equals("3")).map(WarehouseTrayGoodsEntity::getAssociationId).collect(Collectors.toList());
//此时经过过滤后的包件ID和托盘上的所有包件ID数量一致,视为该托盘上的均为包件
@ -994,8 +1025,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
// }
private Integer getCarLaodNum(Long deliveryId) {
AtomicInteger loadingNum = new AtomicInteger();
Integer contNum_a = distributionLoadscanMapper.getLoadCountNum(deliveryId);
@ -1804,8 +1833,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
@Transactional(isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class)
@Override
public R oneack(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) {
@ -4203,8 +4230,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
// for (DistributionReservationStockarticleEntity reservationStockarticleEntity : reservationStockarticleEntityList) {
// if (reservationStockarticleEntity.getIsZero().equals(IsOrNoConstant.no.getValue())) {
// List<DistributionParcelListEntity> parcelListEntityList = distributionReservationMapper.getReservationPackage(reservationStockarticleEntity.getReservationId(), reservationStockarticleEntity.getStockArticleId(),distributionDeliveryInfoDTO);
@ -4311,8 +4336,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
@Override
public IPage<DistributionStockArticleVO> selectDiscussStockArticleInfoList(Map<String, Object> params, Query query, Long deliveryListId) {
IPage<DistributionStockArticleVO> page = Condition.getPage(query);
@ -6529,7 +6552,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
private String bianMa() {
// String code ="BH";
StringBuilder sb = new StringBuilder();
@ -6597,8 +6619,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
/**
*
* 工单查询配送数据
*
* @param page
* @param distributionDeliveryInfoDTO
* @return

Loading…
Cancel
Save