Browse Source

1.修改签收扫描的作业节点,采用广播方式进行处理

2.取消了之前签收扫描推送商家端的操作
3.修改开单的推送商家端的数据方式
master
pref_mail@163.com 9 months ago
parent
commit
f837998bd4
  1. 8
      blade-biz-common/src/main/java/org/springblade/common/constant/RabbitConstant.java
  2. 21
      blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java
  3. 60
      blade-biz-common/src/main/java/org/springblade/common/model/BroadcastNodeData.java
  4. 76
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionNodeWorkService.java
  5. 125
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionNodeWorkServiceImpl.java
  6. 69
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java
  7. 102
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java
  8. 57
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/NodeWorkHandler.java
  9. 28
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/RabbitMqConfiguration.java
  10. 65
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/OpenWaybillToBusinessListener.java
  11. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderAsyncService.java
  12. 3
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderAsyncServiceImpl.java
  13. 36
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java

8
blade-biz-common/src/main/java/org/springblade/common/constant/RabbitConstant.java

@ -171,14 +171,6 @@ public interface RabbitConstant {
String OPEN_ORDER_LOAD_SCAN_ROUTING = "open_order_load_scan_routing" + ModuleNameConstant.DEVAUTH;
/****************运单创建推送商家数据start *************************/
String OPEN_WAYBILL_TO_BUSINESS_DATA_QUEUE = "open_waybill_to_business_data_queue" + ModuleNameConstant.DEVAUTH;
String OPEN_WAYBILL_TO_BUSINESS_DATA_EXCHANGE = "open_waybill_to_business_data_exchange" + ModuleNameConstant.DEVAUTH;
String OPEN_WAYBILL_TO_BUSINESS_DATA_ROUTING = "open_waybill_to_business_data_routing" + ModuleNameConstant.DEVAUTH;
/****************运单创建推送商家数据end *************************/
/****************库内入库推送商家数据start *************************/

21
blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java

@ -19,7 +19,10 @@ public abstract class FanoutConstants {
interface QUEUE {
String STATISTICSDATA_CREATEPACKAGEINFO = "fanout.trunkline.openWaybill.statisticsdata.createPackageinfo" + ModuleNameConstant.DEVAUTH;
// 开单检测数据 --商家端
String SEND_BUSINESS_DATA_BY_OPENWAYBILL_DATA = "fanout.trunkline.openWaybill.send_business_data.open" + ModuleNameConstant.DEVAUTH;
// 改单数据 --商家端
String SEND_BUSINESS_DATA_BY_UPDATEWAYBILL_DATA = "fanout.trunkline.openWaybill.send_business_data.update" + ModuleNameConstant.DEVAUTH;
}
}
@ -155,4 +158,20 @@ public abstract class FanoutConstants {
}
/**
* 配送
*/
public interface distribution {
interface signfor{
String EXCHANGE = "fanout.distribution.signfor" + ModuleNameConstant.DEVAUTH;
interface QUEUE {
String FACTORY_NODE_WORK_DISTRIBUTION_SIGNFOR_QUERY = "fanout.factory.node_work.distribution.signfor_query"+ ModuleNameConstant.DEVAUTH;
}
}
}
}

60
blade-biz-common/src/main/java/org/springblade/common/model/BroadcastNodeData.java

@ -0,0 +1,60 @@
package org.springblade.common.model;
import com.alibaba.fastjson.JSONObject;
/**
* 节点作业数据传输对象
*/
public class BroadcastNodeData extends JSONObject {
/**
* 当前作业租户ID
*/
private String tenantId;
/**
* 作业人名称
*/
private String userName;
/**
* 操作时间
*/
private String operationTime;
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getOperationTime() {
return operationTime;
}
public void setOperationTime(String operationTime) {
this.operationTime = operationTime;
}
@Override
public String toJSONString() {
// 需要 将当前类的属性增加的到json的输出
this.put("tenantId", tenantId);
this.put("userName", userName);
this.put("operationTime", operationTime);
return super.toJSONString();
}
}

76
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionNodeWorkService.java

@ -0,0 +1,76 @@
package com.logpm.distribution.service;
import com.logpm.distribution.entity.DistributionParcelListEntity;
/**
* <p>
* 配送作业节点 推送给服务
* </p>
*/
public interface IDistributionNodeWorkService {
// 签收作业节点
/**
* 装车
*/
void nodeLoad();
/**
* 异常装车
*/
void abnormalLoading();
/**
* 取消装车
*/
void cancelLoading();
/**
* 发车
*/
void carStart();
/**
* 配送到达
*/
void carArrived();
/**
* 签收
*/
void signFor(DistributionParcelListEntity parcelListEntity, Long taskId, String operationTime, String destinationWarehouse);
/**
* 签收复核
*/
void signForCheck();
/**
* 自提签收扫描
*/
void billofladingSignfor(DistributionParcelListEntity parcelListEntity,Long taskId,String operationTime, String destinationWarehouse);
/**
* 自提签收复核
*/
void billofladingSignforCheck();
/**
* 滞留
*/
void retention();
/**
* 异常签收
*/
void abnormalSignfor();
/**
* 配送失败
*/
void fail();
}

125
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionNodeWorkServiceImpl.java

@ -0,0 +1,125 @@
package com.logpm.distribution.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionReservationEntity;
import com.logpm.distribution.service.IDistributionNodeWorkService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.broadcast.FanoutConstants;
import org.springblade.common.model.BroadcastNodeData;
import org.springblade.common.model.FanoutMsg;
import org.springblade.core.secure.utils.AuthUtil;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
@Service
@AllArgsConstructor
@Slf4j
public class DistributionNodeWorkServiceImpl implements IDistributionNodeWorkService {
private final RabbitTemplate rabbitTemplate;
@Override
public void nodeLoad() {
}
@Override
public void abnormalLoading() {
}
@Override
public void cancelLoading() {
}
@Override
public void carStart() {
}
@Override
public void carArrived() {
}
@Override
public void signFor(DistributionParcelListEntity parcelListEntity, Long taskId, String operationTime, String destinationWarehouse) {
log.info(">>>>>>>>>> signFor 签收扫描 {}", parcelListEntity.getOrderPackageCode());
BroadcastNodeData broadcastNodeData = new BroadcastNodeData();
broadcastNodeData.put("orderPackageCode", parcelListEntity.getOrderPackageCode());
broadcastNodeData.put("distributionContactId", taskId);
// broadcastNodeData.put("distributionContactCode", distributionReservationEntity.getReservationCode());
broadcastNodeData.put("destinationWarehouse", destinationWarehouse);
broadcastNodeData.put("brand", parcelListEntity.getBrandName());
broadcastNodeData.setOperationTime(operationTime);
broadcastNodeData.setUserName(AuthUtil.getUserName());
broadcastNodeData.setTenantId(AuthUtil.getTenantId());
FanoutMsg build = FanoutMsg.builder().msg(broadcastNodeData.toJSONString())
.exchange(FanoutConstants.distribution.signfor.EXCHANGE).build();
sendFanoutMsg(build);
}
@Override
public void signForCheck() {
}
@Override
public void billofladingSignfor(DistributionParcelListEntity parcelListEntity,Long taskId,String operationTime, String destinationWarehouse) {
log.info(">>>>>>>>>> billofladingSignfor 自提扫描 {}", parcelListEntity.getOrderPackageCode());
BroadcastNodeData broadcastNodeData = new BroadcastNodeData();
broadcastNodeData.put("orderPackageCode", parcelListEntity.getOrderPackageCode());
broadcastNodeData.put("distributionContactId", taskId);
// broadcastNodeData.put("distributionContactCode", distributionReservationEntity.getReservationCode());
broadcastNodeData.put("destinationWarehouse", destinationWarehouse);
broadcastNodeData.put("brand", parcelListEntity.getBrandName());
broadcastNodeData.setOperationTime(operationTime);
broadcastNodeData.setUserName(AuthUtil.getUserName());
broadcastNodeData.setTenantId(AuthUtil.getTenantId());
FanoutMsg build = FanoutMsg.builder().msg(broadcastNodeData.toJSONString())
.exchange(FanoutConstants.distribution.signfor.EXCHANGE).build();
sendFanoutMsg(build);
}
@Override
public void billofladingSignforCheck() {
}
@Override
public void retention() {
}
@Override
public void abnormalSignfor() {
}
@Override
public void fail() {
}
@Retryable(value = Exception.class, maxAttempts = 3, backoff = @Backoff(value = 3000, multiplier = 1.5))
private void sendFanoutMsg(FanoutMsg fanoutMsg) {
rabbitTemplate.convertAndSend(fanoutMsg.getExchange(), null, fanoutMsg.getMsg());
}
}

69
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

@ -242,6 +242,9 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
@Autowired
private ITrunklinePackageTrackLogClient trunklinePackageTrackLogClient;
@Autowired
private IDistributionNodeWorkService iDistributionNodeWorkService;
@Override
public IPage<DistributionSignforVO> selectDistributionSignforPage(IPage<DistributionSignforVO> page, DistributionSignforVO distributionSignfor) {
@ -2490,6 +2493,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
@Override
@Transactional(rollbackFor = Exception.class)
public R signfor(DistrilbutionAppsignforDTO distrilbutionloadingscanDTO) {
String nickName = null;
Long userId = null;
//思路: 在于一个客户下不会出现重复的包条码
@ -2498,9 +2503,6 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
return R.fail(403, "仓库信息不能为空");
}
DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListService.getById(distrilbutionloadingscanDTO.getDeliveryId());
if (Objects.isNull(myCurrentWarehouse)) {
return R.fail(403, "配送任务错误");
}
//查询是否完成复核
DistributionSignforEntity signforEntity = this.getOne(Wrappers.<DistributionSignforEntity>query().lambda()
.eq(DistributionSignforEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId())
@ -2523,13 +2525,13 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
// ---------------------------------2023-09-09 包件签收调整---------------------------------------------------------------
String singleTime = simpleDateFormat.format(new Date());
DistributionParcelListEntity parcelListEntity = distributionParcelListService.selectByOrderPackageCode(distrilbutionloadingscanDTO.getBarcode(), myCurrentWarehouse.getId());
if (Func.isEmpty(parcelListEntity)) {
return Resp.scanFail("系统无编码", "系统无编码");
}
if (parcelListEntity.equals(OrderPackageStatusConstant.yiqianshou.getValue())) {
if (parcelListEntity.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) {
return Resp.scanFail("包件已签收", "包件已签收");
}
DistributionReservationEntity distributionReservationEntity = distributionReservationMapper.selectById(distrilbutionloadingscanDTO.getReservationId());
@ -2591,7 +2593,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
//存在装车记录,进行修改即可
//进行签收记录数据的维护
loadscanEntity.setSigningTime(simpleDateFormat.format(new Date()));
loadscanEntity.setSigningTime(singleTime);
loadscanEntity.setSignforState(2);
loadscanEntity.setOneClick(1);
loadscanEntity.setOneQclick(1);
@ -2704,8 +2706,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
distributionParcelListService.updateById(updatePackage);
//维护签收包件状态
distributionStockArticleService.maintenanceOrderInfo(collect.get(0).getOrderCode(), myCurrentWarehouse.getId());
//推送信息至工厂
distributionAsyncService.sendFactory(collect.get(0), simpleDateFormat.format(new Date()), distributionReservationEntity.getId(), distributionReservationEntity.getReservationCode(), myCurrentWarehouse.getName(), nickName);
orderPackageCodes.add(updatePackage.getOrderPackageCode());
//进行备货库位下架
List<JSONObject> jsonObjects = new ArrayList<>();
@ -2722,12 +2723,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
} else if (Func.isEmpty(collect)) {
//这里就需要对该包件信息是否属于该配送计划进行判定。如果属于该配送计划则是串货。不是那么则需要提示是否异常签收或者返回的操作
//查询配送计划中是否存在该包件
DistributionParcelListEntity one = distributionParcelListService.getOne(Wrappers.<DistributionParcelListEntity>query().lambda()
.eq(DistributionParcelListEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode())
.eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId())
);
if (Func.isNotEmpty(one) && one.getConditions() == 2) {
log.warn("#####################此包件不是定制品 {}", one.getConditions());
if (Func.isNotEmpty(parcelListEntity) && parcelListEntity.getConditions() == 2) {
log.warn("#####################此包件不是定制品 {}", parcelListEntity.getConditions());
return Resp.scanFail("此包件不是定制品", "此包件不是定制品");
}
List<DistributionParcelListEntity> parcelListEntities = distributionDeliveryListMapper.selectPackageListByDeliveryListId(distrilbutionloadingscanDTO.getDeliveryId());
@ -2796,15 +2793,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
trunklinePackageTrackLogClient.addPackageTrackLog(aaa);
// 推送
try {
sendMessage(distrilbutionloadingscanDTO.getBarcode(), distributionReservationEntity.getReservationCode(),
deliveryListEntity.getTrainNumber(), deliveryListEntity.getVehicleName(), deliveryListEntity.getDriverName(),
AuthUtil.getUserName(), myCurrentWarehouse.getId(), AuthUtil.getTenantId());
} catch (Exception e) {
// throw new RuntimeException(e);
log.error(">>>> 签收推送报错", e);
}
// 节点作业推送
sendNodeWorkDataBroadcast(parcelListEntity, distributionReservationEntity, singleTime, myCurrentWarehouse);
return Resp.scanSuccessWithData("签收成功", str, orderPackageCodes);
@ -2814,6 +2804,20 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
}
}
private void sendNodeWorkDataBroadcast(DistributionParcelListEntity parcelListEntity, DistributionReservationEntity distributionReservationEntity, String singleTime, BasicdataWarehouseEntity myCurrentWarehouse) {
try {
//推送信息至工厂
// distributionAsyncService.sendFactory(parcelListEntity, singleTime, distributionReservationEntity.getId(), distributionReservationEntity.getReservationCode(), myCurrentWarehouse.getName(), nickName);
// sendMessage(distrilbutionloadingscanDTO.getBarcode(), distributionReservationEntity.getReservationCode(),
// deliveryListEntity.getTrainNumber(), deliveryListEntity.getVehicleName(), deliveryListEntity.getDriverName(),
// AuthUtil.getUserName(), myCurrentWarehouse.getId(), AuthUtil.getTenantId());
iDistributionNodeWorkService.signFor(parcelListEntity, distributionReservationEntity.getId(), singleTime, myCurrentWarehouse.getName());
} catch (Exception e) {
// throw new RuntimeException(e);
log.error(">>>> 签收作业节点广播报错", e);
}
}
/**
* @param orderPackageCode
* @param reservationCode
@ -3074,7 +3078,9 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
//维护签收包件状态
distributionStockArticleService.maintenanceOrderInfo(parcelListEntity.getOrderCode(), myCurrentWarehouse.getId());
//推送信息至工厂
distributionAsyncService.sendFactory(parcelListEntity, simpleDateFormat.format(new Date()), distributionReservationEntity.getId(), distributionReservationEntity.getReservationCode(), myCurrentWarehouse.getName(), nickName);
// distributionAsyncService.sendFactory(parcelListEntity, simpleDateFormat.format(new Date()), distributionReservationEntity.getId(), distributionReservationEntity.getReservationCode(), myCurrentWarehouse.getName(), nickName);
sendNodeWorkDataBroadcast(parcelListEntity, distributionReservationEntity, loadscanEntity.getSigningTime(), myCurrentWarehouse);
//收集包件
orderpackages.add(updatePackage.getOrderPackageCode());
@ -4843,9 +4849,11 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
distributionAsyncService.checkSignStatus(loadscanEntities.getPackageId(), loadscanEntities.getReservationId(), loadscanEntities.getDeliveryId());
}
}
distributionAsyncService.sendFactory(parcelListEntity, simpleDateFormat.format(new Date()), reservationEntity.getId(), reservationEntity.getReservationCode(), myCurrentWarehouse.getName(), user.getNickName());
packageIds.add(parcelListEntity.getId());
orderCodes.add(parcelListEntity.getOrderCode());
//distributionAsyncService.sendFactory(parcelListEntity, simpleDateFormat.format(new Date()), reservationEntity.getId(), reservationEntity.getReservationCode(), myCurrentWarehouse.getName(), user.getNickName());
sendNodeWorkDataBroadcast(parcelListEntity, reservationEntity, signingTime, myCurrentWarehouse);
}
//批量维护订单信息
if (Func.isNotEmpty(orderCodes)) {
@ -4980,7 +4988,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
//处理库存品
//查询出该客户下的库存品信息
List<DisStockListDetailEntity> detailEntities = distributionReservationMapper.selectInventoryListByReservation(distributionSignforEntity.getReservationId());
if (detailEntities.size() > 0 && Func.isNotEmpty(detailEntities)) {
if (!detailEntities.isEmpty() && Func.isNotEmpty(detailEntities)) {
loadingInventoryNum += detailEntities.stream().mapToInt(DisStockListDetailEntity::getNum).sum();
signingInventoryNum += detailEntities.stream().mapToInt(DisStockListDetailEntity::getNum).sum();
boolean flag = detailEntities.stream().allMatch(s -> Func.isNotEmpty(s.getStockPackageCode()));
@ -5310,7 +5318,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
jsonObjects.add(jsonObject);
content = "包件在" + myCurrentWarehouse.getName() + "由" + loadscanEntity.getSigningUser() + "司机司机批量签收,装车方式:扫描装车,配送车次号:" + distributionDeliveryListEntity.getTrainNumber() + "预约任务号:" + reservationEntity.getReservationCode();
trunklinePackageTrackLog = handleLogJSONObject(myCurrentWarehouse, AuthUtil.getUser(), parcelListEntity.getOrderPackageCode(), content, WorkNodeEnums.DISTRIBUTION_ABNORMAL_SIGN_FOR.getCode(), distributionDeliveryListEntity.getTrainNumber(), parcelListEntity.getWarehouseEntryTimeEnd());
distributionAsyncService.sendFactory(parcelListEntity, loadscanEntity.getSigningTime(), reservationEntity.getId(), reservationEntity.getReservationCode(), myCurrentWarehouse.getName(), user.getNickName());
//distributionAsyncService.sendFactory(parcelListEntity, loadscanEntity.getSigningTime(), reservationEntity.getId(), reservationEntity.getReservationCode(), myCurrentWarehouse.getName(), user.getNickName());
sendNodeWorkDataBroadcast(parcelListEntity, reservationEntity, loadscanEntity.getSigningTime(), myCurrentWarehouse);
} else {
loadscanEntities.setMsg("司机一键签收数据补录");
@ -5329,8 +5338,10 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
packageLockIds.add(loadscanEntities.getPackageId());
content = "包件在" + myCurrentWarehouse.getName() + "由" + loadscanEntities.getSigningUser() + "司机批量签收,装车方式:补录装车,配送车次号:" + distributionDeliveryListEntity.getTrainNumber() + "预约任务号:" + reservationEntity.getReservationCode();
trunklinePackageTrackLog = handleLogJSONObject(myCurrentWarehouse, AuthUtil.getUser(), parcelListEntity.getOrderPackageCode(), content, WorkNodeEnums.DISTRIBUTION_ABNORMAL_SIGN_FOR.getCode(), distributionDeliveryListEntity.getTrainNumber(), parcelListEntity.getWarehouseEntryTimeEnd());
//推送扫描记录
distributionAsyncService.sendFactory(parcelListEntity, loadscanEntities.getSigningTime(), reservationEntity.getId(), reservationEntity.getReservationCode(), myCurrentWarehouse.getName(), user.getNickName());
// distributionAsyncService.sendFactory(parcelListEntity, loadscanEntities.getSigningTime(), reservationEntity.getId(), reservationEntity.getReservationCode(), myCurrentWarehouse.getName(), user.getNickName());
// 节点作业推送
sendNodeWorkDataBroadcast(parcelListEntity, reservationEntity, loadscanEntities.getSigningTime(), myCurrentWarehouse);
}
}

102
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java

@ -38,48 +38,14 @@ import com.logpm.distribution.dto.DistributionStockListDTO;
import com.logpm.distribution.dto.DistrilbutionBillLadingDTO;
import com.logpm.distribution.dto.OrderStatusDTO;
import com.logpm.distribution.dto.app.BillLadingAppDTO;
import com.logpm.distribution.entity.DisStockListDetailEntity;
import com.logpm.distribution.entity.DistributionBillLadingScanEntity;
import com.logpm.distribution.entity.DistributionDeliveryChargeEntity;
import com.logpm.distribution.entity.DistributionDeliveryDetailsEntity;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionParcelNumberEntity;
import com.logpm.distribution.entity.DistributionPrintEntity;
import com.logpm.distribution.entity.DistributionReservationZeroPackageEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.entity.DistributionStockEntity;
import com.logpm.distribution.entity.DistributionStockListEntity;
import com.logpm.distribution.entity.DistributionStockupEntity;
import com.logpm.distribution.entity.DistributionStockupInfoEntity;
import com.logpm.distribution.entity.DistributionStockupScanEntity;
import com.logpm.distribution.entity.DistrilbutionBillLadingEntity;
import com.logpm.distribution.entity.DistrilbutionBillPackageEntity;
import com.logpm.distribution.entity.DistrilbutionBillStockEntity;
import com.logpm.distribution.entity.*;
import com.logpm.distribution.excel.DistributionBillInventoryExcel;
import com.logpm.distribution.excel.DistributionBillOrderExcel;
import com.logpm.distribution.excel.DistributionBillOrderPackExcel;
import com.logpm.distribution.excel.DistrilbutionBillLadingExcel;
import com.logpm.distribution.mapper.DistributionStockListMapper;
import com.logpm.distribution.mapper.DistrilbutionBillLadingMapper;
import com.logpm.distribution.service.IDisStockListDetailService;
import com.logpm.distribution.service.IDistributionAsyncService;
import com.logpm.distribution.service.IDistributionBillLadingScanService;
import com.logpm.distribution.service.IDistributionDeliveryChargeService;
import com.logpm.distribution.service.IDistributionDeliveryDetailsService;
import com.logpm.distribution.service.IDistributionParcelListService;
import com.logpm.distribution.service.IDistributionParcelNumberService;
import com.logpm.distribution.service.IDistributionPrintService;
import com.logpm.distribution.service.IDistributionReservationService;
import com.logpm.distribution.service.IDistributionReservationZeroPackageService;
import com.logpm.distribution.service.IDistributionStockArticleService;
import com.logpm.distribution.service.IDistributionStockListService;
import com.logpm.distribution.service.IDistributionStockService;
import com.logpm.distribution.service.IDistributionStockupInfoService;
import com.logpm.distribution.service.IDistributionStockupScanService;
import com.logpm.distribution.service.IDistributionStockupService;
import com.logpm.distribution.service.IDistrilbutionBillLadingService;
import com.logpm.distribution.service.IDistrilbutionBillPackageService;
import com.logpm.distribution.service.IDistrilbutionBillStockService;
import com.logpm.distribution.service.*;
import com.logpm.distribution.vo.DistributionDeliveryDetailsVO;
import com.logpm.distribution.vo.DistributionParcelNumberVO;
import com.logpm.distribution.vo.DistributionStockArticleVO;
@ -247,6 +213,9 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
@Autowired
private ITrunklinePackageTrackLogClient trunklinePackageTrackLogClient;
@Autowired
private IDistributionNodeWorkService iDistributionNodeWorkService;
@Override
@ -1159,7 +1128,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
Map<Integer, List<DistributionParcelListEntity>> packageMap = distributionParcelListEntities.stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getConditions));
List<DistributionBillLadingScanEntity> ladingScanEntities = new ArrayList<>();
if (!packageMap.isEmpty()) {
ladingScanEntities = handleSignPackage(packageMap, distrilbutionBillLading.getId(), myCurrentWarehouse.getId());
ladingScanEntities = handleSignPackage(packageMap, distrilbutionBillLading.getId(), myCurrentWarehouse);
if (!ladingScanEntities.isEmpty()) {
// 进行签收扫描数据补录
distributionBillLadingScanService.saveBatch(ladingScanEntities);
@ -1382,7 +1351,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}
public List<DistributionBillLadingScanEntity> handleSignPackage(Map<Integer, List<DistributionParcelListEntity>> packageMap, Long id, Long warehouseId) {
public List<DistributionBillLadingScanEntity> handleSignPackage(Map<Integer, List<DistributionParcelListEntity>> packageMap, Long id, BasicdataWarehouseEntity myCurrentWarehouse) {
String method = "###################DistributionBillLadingServiceImpl.handleSignPackage";
List<DistributionBillLadingScanEntity> ladingScanEntities = new ArrayList<>();
List<String> orderCodes = new ArrayList<>();
@ -1402,7 +1371,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
distributionBillLadingScanEntity.setOrderSelfNumbering(parcelListEntity.getOrderCode());
distributionBillLadingScanEntity.setStockArticleId(parcelListEntity.getStockArticleId());
distributionBillLadingScanEntity.setBillLadingId(id);
distributionBillLadingScanEntity.setWarehouseId(warehouseId);
distributionBillLadingScanEntity.setWarehouseId(myCurrentWarehouse.getId());
distributionBillLadingScanEntity.setMaterialType("2");
distributionBillLadingScanEntity.setQuantity(parcelListEntity.getQuantity());
ladingScanEntities.add(distributionBillLadingScanEntity);
@ -1415,6 +1384,12 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
);
//维护订单
orderCodes.add(parcelListEntity.getOrderCode());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
// ---------------------------------2023-09-09 包件签收调整---------------------------------------------------------------
String singleTime = simpleDateFormat.format(new Date());
// 推送自提作业节点数据
sendNodeWorkDataBroadcast(parcelListEntity,id,singleTime,myCurrentWarehouse);
}
break;
case 2:
@ -1440,7 +1415,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
DistributionBillLadingScanEntity distributionBillLadingScanEntity = new DistributionBillLadingScanEntity();
distributionBillLadingScanEntity.setPacketBarCode(parcelListEntity.getOrderPackageCode());
distributionBillLadingScanEntity.setScanType(3);
distributionBillLadingScanEntity.setWarehouseId(warehouseId);
distributionBillLadingScanEntity.setWarehouseId(myCurrentWarehouse.getId());
distributionBillLadingScanEntity.setParcelListId(parcelListEntity.getId());
distributionBillLadingScanEntity.setOrderSelfNumbering(parcelListEntity.getOrderCode());
distributionBillLadingScanEntity.setStockArticleId(parcelListEntity.getStockArticleId());
@ -1490,7 +1465,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
if (!orderCodes.isEmpty()) {
String collect = orderCodes.stream().distinct().collect(Collectors.joining(","));
log.info(method + "维护订单,orderCodes:{}", collect);
distributionStockArticleService.maintenanceOrderInfo(collect, warehouseId);
distributionStockArticleService.maintenanceOrderInfo(collect, myCurrentWarehouse.getId());
}
return ladingScanEntities;
}
@ -3295,20 +3270,24 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
distributionBillLadingScan.setQuantity(1);
distributionBillLadingScan.setBillLadingId( billLadingId);
String signTime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date());
sendNodeWorkDataBroadcast(distributionParcelListEntity,billLadingId,signTime, myCurrentWarehouse);
//推送梦天
if (distributionParcelListEntity.getBrandName().equals("梦天")){
Map<String, Object> pushMap = new HashMap<>();
pushMap.put("orderPackageCode", coding);
pushMap.put("operationTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
pushMap.put("distributionContactId", billLadingId);
pushMap.put("destinationWarehouse", myCurrentWarehouse.getName());
rabbitTemplate.convertAndSend(RabbitConstant.MT_BUSINESS_DATA_2_FACTORY_EXCHANGE, RabbitConstant.MT_BUSINESS_DATA_2_FACTORY_ROUTING, pushMap, message -> {
message.getMessageProperties()
.setHeader("x-delay", 3000);
return message;
});
}
// if (distributionParcelListEntity.getBrandName().equals("梦天")){
// Map<String, Object> pushMap = new HashMap<>();
// pushMap.put("orderPackageCode", coding);
// pushMap.put("operationTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
// pushMap.put("distributionContactId", billLadingId);
// pushMap.put("destinationWarehouse", myCurrentWarehouse.getName());
//
// rabbitTemplate.convertAndSend(RabbitConstant.MT_BUSINESS_DATA_2_FACTORY_EXCHANGE, RabbitConstant.MT_BUSINESS_DATA_2_FACTORY_ROUTING, pushMap, message -> {
// message.getMessageProperties()
// .setHeader("x-delay", 3000);
// return message;
// });
// }
}
@ -3335,6 +3314,21 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
return Resp.scanSuccess("签收成功", "签收成功");
}
/**
* 自提签收节点作业推送
* @param parcelListEntity
* @param billLadingId
* @param singleTime
* @param myCurrentWarehouse
*/
private void sendNodeWorkDataBroadcast(DistributionParcelListEntity parcelListEntity, Long billLadingId, String singleTime, BasicdataWarehouseEntity myCurrentWarehouse) {
try {
iDistributionNodeWorkService.billofladingSignfor(parcelListEntity, billLadingId, singleTime, myCurrentWarehouse.getName());
} catch (Exception e) {
// throw new RuntimeException(e);
log.error(">>>> 自提签收作业节点广播报错", e);
}
}
/**
* pda扫描

57
blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/NodeWorkHandler.java

@ -0,0 +1,57 @@
package com.logpm.factory.receiver;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.logpm.factory.mt.service.IMtFactoryDataService;
import com.logpm.factorydata.enums.BrandEnums;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.broadcast.FanoutConstants;
import org.springblade.common.model.BroadcastNodeData;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
/**
* 作业节点数据监听
*/
@Slf4j
@AllArgsConstructor
@Component
public class NodeWorkHandler {
private final IMtFactoryDataService mtFactoryDataService;
@RabbitListener(bindings = @QueueBinding(
value = @Queue(name = FanoutConstants.distribution.signfor.QUEUE.FACTORY_NODE_WORK_DISTRIBUTION_SIGNFOR_QUERY),
exchange = @Exchange(name = FanoutConstants.distribution.signfor.EXCHANGE, type = ExchangeTypes.FANOUT)
))
public void distributionSignforQuery(String message) {
try {
JSONObject jsonObject = JSONUtil.parseObj(message);
String orderPackageCode = jsonObject.getStr("orderPackageCode");
String operationTime = jsonObject.getStr("operationTime");
String distributionContactId = jsonObject.getStr("distributionContactId");
String destinationWarehouse = jsonObject.getStr("destinationWarehouse");
// 获取品牌BrandEnums.MTMM.getValue()
String o = jsonObject.getStr("brand");
switch (o) {
case "梦天" :
log.info("工厂节点数据监听:1");
mtFactoryDataService.qianshouScanForNewSystem(orderPackageCode, operationTime, distributionContactId, destinationWarehouse);
break;
default:
log.info("签收扫描没有找到品牌: {}",o);
}
}catch (Exception e){
log.error("工厂节点数据监听异常", e);
}
}
}

28
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/RabbitMqConfiguration.java

@ -104,32 +104,4 @@ public class RabbitMqConfiguration {
return BindingBuilder.bind(hwyOpenOrderLoadScanQueue).to(hwyOpenOrderLoadScanExchange).with(RabbitConstant.HWY_ORDER_STATUS_ROUTING).noargs();
}
@Bean
public Queue openWaybillToBusinessQueue() {
return new Queue(RabbitConstant.OPEN_WAYBILL_TO_BUSINESS_DATA_QUEUE, true);
}
@Bean
public CustomExchange openWaybillToBusinessExchange() {
Map<String, Object> args = Maps.newHashMap();
args.put("x-delayed-type", "direct");
return new CustomExchange(RabbitConstant.OPEN_WAYBILL_TO_BUSINESS_DATA_EXCHANGE, "x-delayed-message", true, false, args);
}
@Bean
public Binding openWaybillToBusinessBinding(Queue openWaybillToBusinessQueue, CustomExchange openWaybillToBusinessExchange) {
return BindingBuilder.bind(openWaybillToBusinessQueue).to(openWaybillToBusinessExchange).with(RabbitConstant.OPEN_WAYBILL_TO_BUSINESS_DATA_ROUTING).noargs();
}
}

65
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/OpenWaybillToBusinessListener.java

@ -1,5 +1,7 @@
package com.logpm.trunkline.mq;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.trunkline.entity.TrunklineAdvanceEntity;
@ -22,15 +24,17 @@ import jodd.util.ArraysUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.common.constant.broadcast.FanoutConstants;
import org.springblade.core.tool.api.R;
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;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
@ -51,9 +55,8 @@ import java.util.stream.Collectors;
@Slf4j
@AllArgsConstructor
@Component
@RabbitListener(queues = RabbitConstant.OPEN_WAYBILL_TO_BUSINESS_DATA_QUEUE)
public class
OpenWaybillToBusinessListener {
//@RabbitListener(queues = RabbitConstant.OPEN_WAYBILL_TO_BUSINESS_DATA_QUEUE)
public class OpenWaybillToBusinessListener {
private final IWarehouseWaybillClient warehouseWaybillClient;
@ -73,18 +76,58 @@ OpenWaybillToBusinessListener {
private ITrunklineWaybillTrackService trunklineWaybillTrackService;
@RabbitHandler
public void openWaybillToBusinessDataHandler(Map map, Message message, Channel channel) {
@RabbitListener(bindings = @QueueBinding(
value = @Queue(name = FanoutConstants.trunkline.OPENWAYBILL.QUEUE.SEND_BUSINESS_DATA_BY_OPENWAYBILL_DATA),
exchange = @Exchange(name = FanoutConstants.trunkline.OPENWAYBILL.EXCHANGE, type = ExchangeTypes.FANOUT)
))
@Transactional(rollbackFor = Exception.class)
public void openWaybillToBusinessDataHandler(String message) {
Long waybillId = (Long) map.get("messageData");
JSONObject jsonObject = JSONUtil.parseObj(message);
Long waybillId = jsonObject.getLong("waybillId");
if (ObjectUtil.isEmpty(waybillId)) {
log.warn("运单ID为null");
return;
}
WarehouseWaybillEntity byWaybillId = warehouseWaybillClient.findByWaybillId(waybillId);
R<List<Tenant>> tenantList = sysClient.getTenantList();
Tenant tenant = null;
if (tenantList.isSuccess()) {
List<Tenant> data = tenantList.getData();
for (Tenant datum : data) {
if (datum.getTenantType() == 2 && datum.getTenantName().equals(byWaybillId.getConsignee().trim())) {
tenant = datum;
break;
}
}
}
if (tenant != null) {
extractedTenant(tenant, byWaybillId);
}
}
@RabbitListener(bindings = @QueueBinding(
value = @Queue(name = FanoutConstants.trunkline.OPENWAYBILL.QUEUE.SEND_BUSINESS_DATA_BY_UPDATEWAYBILL_DATA),
exchange = @Exchange(name = FanoutConstants.trunkline.OPENWAYBILL.EXCHANGE, type = ExchangeTypes.FANOUT)
))
@Transactional(rollbackFor = Exception.class)
public void updateWaybillToBusinessDataHandler(String message) {
JSONObject jsonObject = JSONUtil.parseObj(message);
Long waybillId = jsonObject.getLong("waybillId");
if (ObjectUtil.isEmpty(waybillId)) {
log.warn("运单ID为null");
return;
}
WarehouseWaybillEntity byWaybillId = warehouseWaybillClient.findByWaybillId(waybillId);
String oldConsignee = (String) map.get("oldConsignee");
String oldConsignee = (String) jsonObject.get("oldConsignee");
R<List<Tenant>> tenantList = sysClient.getTenantList();
Tenant tenant = null;
@ -96,7 +139,7 @@ OpenWaybillToBusinessListener {
tenant = datum;
}
if (datum.getTenantType() == 2 && datum.getTenantName().equals(oldConsignee.trim())) {
if (oldConsignee!=null && datum.getTenantType() == 2 && datum.getTenantName().equals(oldConsignee.trim())) {
oldTenant = datum;
}
@ -124,6 +167,8 @@ OpenWaybillToBusinessListener {
}
private void extractedTenant(Tenant tenant, WarehouseWaybillEntity byWaybillId) {
List<Long> waybillIds = new ArrayList<>();

2
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderAsyncService.java

@ -25,7 +25,7 @@ public interface IOpenOrderAsyncService {
void sendOpenWaybillFanout(WarehouseWaybillEntity waybillEntity, List<WarehouseWayBillDetail> details, List<Long> advanceIds);
void sendUpdateWaybillFanout(WarehouseWaybillEntity waybillEntity, List<WarehouseWayBillDetail> details, List<Long> advanceIds);
void sendUpdateWaybillFanout(WarehouseWaybillEntity waybillEntity, List<WarehouseWayBillDetail> details, List<Long> advanceIds,String oldConsignee);
void dealwithBillladingInfo(List<Long> advanceIds,Long warehouseId,String warehouseName,Long waybillId,String waybillNo);
}

3
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderAsyncServiceImpl.java

@ -609,7 +609,7 @@ public class OpenOrderAsyncServiceImpl implements IOpenOrderAsyncService {
@LogpmAsync("asyncExecutor")
@Override
public void sendUpdateWaybillFanout(WarehouseWaybillEntity waybillEntity, List<WarehouseWayBillDetail> details,List<Long> advanceIds) {
public void sendUpdateWaybillFanout(WarehouseWaybillEntity waybillEntity, List<WarehouseWayBillDetail> details,List<Long> advanceIds,String oldConsignee) {
Integer waybillType = waybillEntity.getWaybillType();
String waybillNo = waybillEntity.getWaybillNo();
@ -620,6 +620,7 @@ public class OpenOrderAsyncServiceImpl implements IOpenOrderAsyncService {
jsonObject.put("waybillId",waybillEntity.getId());
jsonObject.put("waybillNo",waybillNo);
jsonObject.put("waybillType",waybillType);
jsonObject.put("oldConsignee",oldConsignee);
Long consigneeId = waybillEntity.getConsigneeId();
BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findEntityById(consigneeId);
if(Objects.isNull(basicdataClientEntity)){

36
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java

@ -616,22 +616,6 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
openOrderAsyncService.sendOpenWaybillFanout(waybillEntity, details, advanceIds);
Map mapState = new HashMap();
mapState.put("messageId", CommonUtil.getUUID());
mapState.put("messageData", waybillId);
mapState.put("createTime", System.currentTimeMillis());
try {
rabbitTemplate.convertAndSend(RabbitConstant.OPEN_WAYBILL_TO_BUSINESS_DATA_EXCHANGE, RabbitConstant.OPEN_WAYBILL_TO_BUSINESS_DATA_ROUTING, mapState, message -> {
message.getMessageProperties()
.setHeader("x-delay", 5000);
return message;
});
} catch (Exception customerException) {
log.error(">>>>>>>>>>>>>>>>>>>>>>>>>> 消息推送失败~ 请联系管理员! ", customerException);
}
Map<String, Object> map = new HashMap<>();
map.put("waybillId", waybillId);
return R.data(map);
@ -2144,13 +2128,11 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
//异步存入日志
openOrderAsyncService.saveUpdateLog(waybillId, waybillNo, "888", editReson, "备注:"+refer+" 修改内容:"+updateMsg, AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName,waybillEntity);
List<WarehouseWayBillDetail> wayBillDetailList = warehouseWaybillDetailClient.findListByWaybillNo(waybillNo);
List<Long> waybillIds = new ArrayList<>();
waybillIds.add(waybillId);
List<Long> advanceIds = trunklineWaybillOrderService.findAdvanceIdsByWaybillIds(waybillIds);
openOrderAsyncService.sendUpdateWaybillFanout(waybillEntity,wayBillDetailList,advanceIds);
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findAllParcelListByAdvanceIds(advanceIds);
@ -2206,23 +2188,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
}
}
Map mapState = new HashMap();
mapState.put("messageId", CommonUtil.getUUID());
mapState.put("messageData", waybillId);
mapState.put("oldConsignee", oldConsignee);
mapState.put("createTime", System.currentTimeMillis());
try {
rabbitTemplate.convertAndSend(RabbitConstant.OPEN_WAYBILL_TO_BUSINESS_DATA_EXCHANGE, RabbitConstant.OPEN_WAYBILL_TO_BUSINESS_DATA_ROUTING, mapState, message -> {
message.getMessageProperties()
.setHeader("x-delay", 5000);
return message;
});
} catch (Exception customerException) {
log.error(">>>>>>>>>>>>>>>>>>>>>>>>>> 消息推送失败~ 请联系管理员! ", customerException);
}
openOrderAsyncService.sendUpdateWaybillFanout(waybillEntity,wayBillDetailList,advanceIds,oldConsignee);
return R.success("改单成功");
}

Loading…
Cancel
Save