Browse Source

feat(all): 干线始发仓入库

1 修改干线始发仓入库时,增加发站到站信息
fix-sign
zhaoqiaobo 4 months ago
parent
commit
3167ae6208
  1. 125
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java

125
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java

@ -2,6 +2,7 @@ package com.logpm.trunkline.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -11,6 +12,8 @@ import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataStorageServicesClient;
import com.logpm.basicdata.feign.IBasicdataTripartiteMallClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.feign.IDistributionParcelListClient;
import com.logpm.factorydata.enums.BrandEnums;
import com.logpm.factorydata.util.FactoryDataMessageSender;
import com.logpm.factorydata.vo.NodePushMsg;
@ -21,7 +24,12 @@ import com.logpm.trunkline.dto.OrderStatusDTO;
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity;
import com.logpm.trunkline.entity.TrunklineAdvanceEntity;
import com.logpm.trunkline.entity.TrunklineBillladingPackageEntity;
import com.logpm.trunkline.service.*;
import com.logpm.trunkline.service.IInComingService;
import com.logpm.trunkline.service.IOpenOrderAsyncService;
import com.logpm.trunkline.service.IPackageTrackLogAsyncService;
import com.logpm.trunkline.service.ITrunklineAdvanceDetailService;
import com.logpm.trunkline.service.ITrunklineAdvanceService;
import com.logpm.trunkline.service.ITrunklineBillladingPackageServicie;
import com.logpm.trunkline.vo.TrunklineAdvanceVO;
import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import com.logpm.warehouse.feign.IWarehouseTrayTypeClient;
@ -36,6 +44,7 @@ import org.springblade.common.utils.CommonUtil;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.Tenant;
import org.springblade.system.feign.ISysClient;
@ -43,7 +52,16 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -66,6 +84,7 @@ public class InComingServiceImpl implements IInComingService {
private final IOpenOrderAsyncService openOrderAsyncService;
private final IBasicdataTripartiteMallClient tripartiteMallClient;
private final IBasicdataStorageServicesClient storageServicesClient;
private final IDistributionParcelListClient parcelListClient;
@Override
@ -170,16 +189,36 @@ public class InComingServiceImpl implements IInComingService {
Map<String, Object> map = new HashMap<>();
map.put("messageData", JSONUtil.toJsonStr(orderStatusDTO));
rabbitTemplate.convertAndSend(RabbitConstant.HWY_ORDER_STATUS_EXCHANGE, RabbitConstant.HWY_ORDER_STATUS_ROUTING, map);
// 获取运单发站仓,到站仓
String sendWarehouse = null;
String endWarehouse = null;
List<DistributionParcelListEntity> byPacketBarCode = parcelListClient.findByPacketBarCode(packageCode);
if(CollUtil.isNotEmpty(byPacketBarCode)){
DistributionParcelListEntity parcelListEntity = byPacketBarCode.get(0);
if(ObjectUtil.isNotEmpty(parcelListEntity)){
if(StrUtil.isNotEmpty(parcelListEntity.getSendWarehouseName())){
sendWarehouse = parcelListEntity.getSendWarehouseName();
}
if(StrUtil.isNotEmpty(parcelListEntity.getAcceptWarehouseName())){
endWarehouse = parcelListEntity.getAcceptWarehouseName();
}
}
}
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
jsonObject.put("departureWarehouseName", sendWarehouse);
jsonObject.put("destinationWarehouseName", endWarehouse);
NodePushMsg nodePushMsg = NodePushMsg.builder()
.operator(AuthUtil.getNickName())
.operatorTime(new Date())
.address("在【" + warehouseName + "】入库")
.brand(BrandEnums.getByValue(advanceDetailEntity.getBrand()))
.node(WorkNodeEnums.INITIAL_WAREHOUSE_ENTRY)
.main(jsonObject)
.content(Collections.singletonList(PushData.builder()
.packageCode(packageCode)
.waybillStartWarehouse(sendWarehouse)
.warehouseName(warehouseName)
.destinationWarehouse(endWarehouse)
.orderCode(advanceDetailEntity.getOrderCode())
.build()))
.build();
@ -379,17 +418,36 @@ public class InComingServiceImpl implements IInComingService {
Map<String, Object> map = new HashMap<>();
map.put("messageData", JSONUtil.toJsonStr(orderStatusDTO));
rabbitTemplate.convertAndSend(RabbitConstant.HWY_ORDER_STATUS_EXCHANGE, RabbitConstant.HWY_ORDER_STATUS_ROUTING, map);
String sendWarehouse = null;
String endWarehouse = null;
List<DistributionParcelListEntity> byPacketBarCode = parcelListClient.findByPacketBarCode(advanceDetailEntity.getOrderPackageCode());
if(CollUtil.isNotEmpty(byPacketBarCode)){
DistributionParcelListEntity parcelListEntity = byPacketBarCode.get(0);
if(ObjectUtil.isNotEmpty(parcelListEntity)){
if(StrUtil.isNotEmpty(parcelListEntity.getSendWarehouseName())){
sendWarehouse = parcelListEntity.getSendWarehouseName();
}
if(StrUtil.isNotEmpty(parcelListEntity.getAcceptWarehouseName())){
endWarehouse = parcelListEntity.getAcceptWarehouseName();
}
}
}
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
jsonObject.put("departureWarehouseName", sendWarehouse);
jsonObject.put("destinationWarehouseName", endWarehouse);
NodePushMsg nodePushMsg = NodePushMsg.builder()
.operator(AuthUtil.getNickName())
.operatorTime(new Date())
.address("在【" + finalWarehouseName + "】入库")
.brand(BrandEnums.getByValue(advanceDetailEntity.getBrand()))
.node(WorkNodeEnums.INITIAL_WAREHOUSE_ENTRY)
.main(jsonObject)
.content(Collections.singletonList(PushData.builder()
.packageCode(advanceDetailEntity.getOrderPackageCode())
.orderCode(advanceDetailEntity.getOrderCode())
.waybillStartWarehouse(sendWarehouse)
.warehouseName(finalWarehouseName)
.destinationWarehouse(endWarehouse)
.build()))
.build();
factoryDataMessageSender.sendNodeDataByBrand(nodePushMsg);
@ -796,8 +854,44 @@ public class InComingServiceImpl implements IInComingService {
//存入日志
packageTrackLogAsyncService.addPackageTrackLog(tenantId, userId, deptId, nickName, orderPackageCodes, warehouseId, warehouseName, WorkNodeEnums.INITIAL_WAREHOUSE_ENTRY.getCode(), "包件" + IncomingTypeEnum.getValue(incomingType));
total = total + detailList.size();
if (CollUtil.isNotEmpty(detailList)) {
for (TrunklineAdvanceDetailEntity advanceDetailEntity : detailList) {
}
Map<String, WarehouseWaybillEntity> waybillEntityMap = new HashMap<>();
if (CollUtil.isNotEmpty(waybillIdSet)) {
List<WarehouseWaybillEntity> waybillEntityList = warehouseWaybillClient.findListByWaybillIds(new ArrayList<>(waybillIdSet));
waybillEntityList.forEach(wb -> {
Integer totalCount = wb.getTotalCount();
Integer stockCount = wb.getStockCount();
openOrderAsyncService.saveLog(wb.getId(), wb.getWaybillNo(), "20", "已入库", "运单入库:" + stockCount + "/" + totalCount + ",入库类型:【" + IncomingTypeEnum.getValue(incomingType) + "】,入库时间:" + CommonUtil.dateToStringGeneral(new Date()), AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName);
waybillEntityMap.put(wb.getWaybillNo(), wb);
});
}
if(CollUtil.isNotEmpty(sendAdvanceDetailEntityList)){
try {
if (CollUtil.isNotEmpty(sendAdvanceDetailEntityList)) {
for (TrunklineAdvanceDetailEntity advanceDetailEntity : sendAdvanceDetailEntityList) {
String waybillNo = advanceDetailEntity.getWaybillNo();
String sendWarehouse = null;
String endWarehouse = null;
if(StrUtil.isNotEmpty(waybillNo)){
if(waybillEntityMap.containsKey(waybillNo)){
WarehouseWaybillEntity warehouseWaybillEntity = waybillEntityMap.get(waybillNo);
if(ObjectUtil.isNotEmpty(warehouseWaybillEntity)){
if(StrUtil.isNotEmpty(warehouseWaybillEntity.getDepartureWarehouseName())){
sendWarehouse = warehouseWaybillEntity.getDepartureWarehouseName();
}
if(StrUtil.isNotEmpty(warehouseWaybillEntity.getDestinationWarehouseName())){
endWarehouse = warehouseWaybillEntity.getDestinationWarehouseName();
}
}
}
}
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
jsonObject.put("departureWarehouseName", sendWarehouse);
jsonObject.put("destinationWarehouseName", endWarehouse);
NodePushMsg nodePushMsg = NodePushMsg.builder()
.operator(AuthUtil.getNickName())
.operatorTime(new Date())
@ -805,30 +899,21 @@ public class InComingServiceImpl implements IInComingService {
.address("在【" + warehouseName + "】入库")
.brand(BrandEnums.getByValue(advanceDetailEntity.getBrand()))
.node(WorkNodeEnums.INITIAL_WAREHOUSE_ENTRY)
.main(jsonObject)
.content(Collections.singletonList(PushData.builder()
.packageCode(advanceDetailEntity.getOrderPackageCode())
.orderCode(advanceDetailEntity.getOrderCode())
.waybillStartWarehouse(sendWarehouse)
.warehouseName(warehouseName)
.destinationWarehouse(endWarehouse)
.build()))
.build();
factoryDataMessageSender.sendNodeDataByBrand(nodePushMsg);
}
}
}
if (CollUtil.isNotEmpty(waybillIdSet)) {
List<WarehouseWaybillEntity> waybillEntityList = warehouseWaybillClient.findListByWaybillIds(new ArrayList<>(waybillIdSet));
waybillEntityList.forEach(wb -> {
Integer totalCount = wb.getTotalCount();
Integer stockCount = wb.getStockCount();
openOrderAsyncService.saveLog(wb.getId(), wb.getWaybillNo(), "20", "已入库", "运单入库:" + stockCount + "/" + totalCount + ",入库类型:【" + IncomingTypeEnum.getValue(incomingType) + "】,入库时间:" + CommonUtil.dateToStringGeneral(new Date()), AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName);
});
}catch (Exception e){
log.error("始发仓入库推送工厂消息异常",e);
}
if(CollUtil.isNotEmpty(sendAdvanceDetailEntityList)){
advanceDetailService.sendReportIncomingData(AuthUtil.getUserId(),AuthUtil.getNickName(),sendAdvanceDetailEntityList,warehouseId,warehouseName,incomingType);
}

Loading…
Cancel
Save