Browse Source

修复尝试

single_db
pref_mail@163.com 1 year ago
parent
commit
9c158702c4
  1. 38
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/entity/OrderPackageStatusPushFailLogEntity.java
  2. 30
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/mapper/OrderPackageStatusPushFailLogMapper.java
  3. 20
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/mapper/OrderPackageStatusPushFailLogMapper.xml
  4. 10
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IFactoryCommonService.java
  5. 87
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/FactoryCommonServiceImpl.java
  6. 58
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java

38
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/entity/OrderPackageStatusPushFailLogEntity.java

@ -0,0 +1,38 @@
package com.logpm.factory.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
@Data
@TableName("order_package_status_push_fail_log")
@ApiModel(value = "老系统推送失败的包件状态", description = "老系统推送失败的包件状态")
@EqualsAndHashCode(callSuper = true)
public class OrderPackageStatusPushFailLogEntity extends BaseEntity {
@ApiModelProperty(value = "包件码")
private String unitNo;
@ApiModelProperty(value = "仓库ID")
private String warehouseId;
@ApiModelProperty(value = "操作时间")
private String operationTime;
@ApiModelProperty(value = "托盘ID")
private Integer trayId;
@ApiModelProperty(value = "包件数据状态1=到货,2=分拣,3=装车,4=卸车,5=出库,6=配送,7=签收,8=滞留,9=备货")
private String status;
@ApiModelProperty(value = "数据状态 0 待解析 1 解析成功 2 超过执行查询次数")
private Integer dataStatus;
}

30
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/mapper/OrderPackageStatusPushFailLogMapper.java

@ -0,0 +1,30 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.factory.comfac.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.factory.entity.OrderPackageStatusPushFailLogEntity;
/**
* 老系统推送包件状态失败的记录表
* @author zhy
* @since 2023-03-28
*/
public interface OrderPackageStatusPushFailLogMapper extends BaseMapper<OrderPackageStatusPushFailLogEntity> {
}

20
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/mapper/OrderPackageStatusPushFailLogMapper.xml

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.logpm.factory.comfac.mapper.OrderPackageStatusPushFailLogMapper">
<!-- 通用查询映射结果 -->
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">-->
<!-- <result column="id" property="id"/>-->
<!-- <result column="req_args" property="reqArgs"/>-->
<!-- <result column="res_body" property="resBody"/>-->
<!-- <result column="type" property="type"/>-->
<!-- <result column="create_user" property="createUser"/>-->
<!-- <result column="create_time" property="createTime"/>-->
<!-- <result column="update_user" property="updateUser"/>-->
<!-- <result column="update_time" property="updateTime"/>-->
<!-- <result column="status" property="status"/>-->
<!-- <result column="is_deleted" property="isDeleted"/>-->
<!-- <result column="create_dept" property="createDept"/>-->
<!-- </resultMap>-->
</mapper>

10
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IFactoryCommonService.java

@ -5,4 +5,14 @@ public interface IFactoryCommonService {
void syncTrayTypeData(String unitNo, Integer trayId, String currentWarehouseId);
/**
* 出来老系统推送的包间数据
* @param status
* @param unitNo
* @param currentWarehouseId
* @param operationTime
* @param trayId
*/
void extracted(String status, String unitNo, String currentWarehouseId, String operationTime, Integer trayId);
}

87
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/FactoryCommonServiceImpl.java

@ -5,17 +5,23 @@ import com.logpm.basicdata.entity.BasicdataTrayEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataTrayClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.factory.comfac.mapper.OrderPackageStatusPushFailLogMapper;
import com.logpm.factory.comfac.service.IFactoryCommonService;
import com.logpm.factory.entity.OrderPackageStatusPushFailLogEntity;
import com.logpm.factory.pan.service.IPanFactoryDataService;
import com.logpm.oldproject.entity.TrayEntity;
import com.logpm.oldproject.entity.TrayScanEntity;
import com.logpm.oldproject.feign.IAdvanceDetailClient;
import com.logpm.oldproject.feign.ITrayClient;
import com.logpm.oldproject.feign.ITrayScanClient;
import com.logpm.warehouse.feign.IWarehouseTrayTypeClient;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.OldSystemDataPushConfig;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
@ -31,6 +37,11 @@ public class FactoryCommonServiceImpl implements IFactoryCommonService {
private final IBasicdataTrayClient basicdataTrayClient;
private final IWarehouseTrayTypeClient warehouseTrayTypeClient;
private final IAdvanceDetailClient advanceDetailClient;
private final IPanFactoryDataService panFactoryDataService;
private final OrderPackageStatusPushFailLogMapper orderPackageStatusPushFailLogMapper;
private final ITrayClient trayClient;
private final ITrayScanClient trayScanClient;
private final BladeRedis bladeRedis;
@ -114,4 +125,80 @@ public class FactoryCommonServiceImpl implements IFactoryCommonService {
log.info("################syncTrayTypeData: 包件打托成功 unitNo={}",unitNo);
}
@Override
public void extracted(String status, String unitNo, String currentWarehouseId, String operationTime, Integer trayId) {
if ("4".equals(status) || "2".equals(status) || "1".equals(status)) {
//继续判断是否到达目的仓
//查询destinationWarehouse logiBillNo plantId数据
Map<String, String> supplyData = advanceDetailClient.getSupplyData(unitNo);
if (supplyData == null) {
log.error("##############dealWithDataHandler: unitNo={} 没有查询到数据", unitNo);
// 保存到数据库
// orderPackageStatusPushFailLogMapper.selectList()
OrderPackageStatusPushFailLogEntity orderPackageStatusPushFailLogEntity=new OrderPackageStatusPushFailLogEntity();
orderPackageStatusPushFailLogEntity.setStatus(status);
orderPackageStatusPushFailLogEntity.setUnitNo(unitNo);
orderPackageStatusPushFailLogEntity.setWarehouseId(currentWarehouseId);
orderPackageStatusPushFailLogEntity.setOperationTime(operationTime);
orderPackageStatusPushFailLogEntity.setTrayId(trayId);
orderPackageStatusPushFailLogEntity.setDataStatus(0);
// 插入之前判断这条数据是否存在系统中
orderPackageStatusPushFailLogMapper.insert(orderPackageStatusPushFailLogEntity);
// 执行定时任务
return;
}
String destinationWarehouseId = supplyData.get("destinationWarehouseId");//目的仓id
if (StringUtil.isBlank(currentWarehouseId) || StringUtil.isBlank(destinationWarehouseId)) {
log.warn("##############dealWithDataHandler: 仓库数据有问题currentWarehouseId={} destinationWarehouseId={}", currentWarehouseId, destinationWarehouseId);
throw new CustomerException(405, "仓库数据有误");
} else {
if (!currentWarehouseId.equals(destinationWarehouseId)) {
log.info("##############dealWithDataHandler: 不用处理的状态 currentWarehouseId={} destinationWarehouseId={}", currentWarehouseId, destinationWarehouseId);
// channel.basicAck(deliveryTag,false);
} else {
//真正的处理需要的数据
if(OldSystemDataPushConfig.getWarehourseIdList().contains(currentWarehouseId)){
try {
if ("1".equals(status)) {
// 始发仓和目的仓入库
panFactoryDataService.handleDataToPlatform(unitNo, operationTime);
bladeRedis.setEx("tray-" + unitNo, trayId, 30L);
} else if ("4".equals(status)) {
panFactoryDataService.handleDataToPlatform(unitNo, operationTime);
} else if ("2".equals(status)) {
bladeRedis.setEx("tray-" + unitNo, trayId, 30L);
} else {
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>> 错误的状态");
}
//同步打托数据
syncTrayTypeData(unitNo, trayId, currentWarehouseId);
} catch (Exception e) {
log.error(e.getMessage());
}
}
}
}
} else {
log.info("##############dealWithDataHandler: 不用处理的状态 status={}", status);
}
}
}

58
blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java

@ -31,16 +31,10 @@ import java.util.Map;
@Component
public class DealWithDataHandler {
@Autowired
private IAdvanceDetailClient advanceDetailClient;
@Autowired
private IPanFactoryDataService panFactoryDataService;
@Autowired
private IFactoryCommonService factoryCommonService;
@Autowired
private BladeRedis bladeRedis;
private Integer retryCount = 1;
@RabbitHandler
public void dealWithDataHandler(Map map, Message message, Channel channel) throws IOException {
@ -51,54 +45,10 @@ public class DealWithDataHandler {
String unitNo = orderStatusDTO.getUnitNo();
String operationTime = orderStatusDTO.getOperationTime();
Integer trayId = orderStatusDTO.getTrayId();
if ("4".equals(status) || "2".equals(status) || "1".equals(status)) {
//继续判断是否到达目的仓
String currentWarehouseId = orderStatusDTO.getCurrentWarehouse();//当前仓Id
//查询destinationWarehouse logiBillNo plantId数据
Map<String, String> supplyData = advanceDetailClient.getSupplyData(unitNo);
if (supplyData == null) {
log.error("##############dealWithDataHandler: unitNo={} 没有查询到数据", unitNo);
return;
}
String destinationWarehouseId = supplyData.get("destinationWarehouseId");//目的仓id
if (StringUtil.isBlank(currentWarehouseId) || StringUtil.isBlank(destinationWarehouseId)) {
log.warn("##############dealWithDataHandler: 仓库数据有问题currentWarehouseId={} destinationWarehouseId={}", currentWarehouseId, destinationWarehouseId);
throw new CustomerException(405, "仓库数据有误");
} else {
if (!currentWarehouseId.equals(destinationWarehouseId)) {
log.info("##############dealWithDataHandler: 不用处理的状态 currentWarehouseId={} destinationWarehouseId={}", currentWarehouseId, destinationWarehouseId);
// channel.basicAck(deliveryTag,false);
} else {
//真正的处理需要的数据
if(OldSystemDataPushConfig.getWarehourseIdList().contains(currentWarehouseId)){
String currentWarehouseId = orderStatusDTO.getCurrentWarehouse();//当前仓Id
try {
if ("1".equals(status)) {
// 始发仓和目的仓入库
panFactoryDataService.handleDataToPlatform(unitNo, operationTime);
bladeRedis.setEx("tray-" + unitNo, trayId, 30L);
} else if ("4".equals(status)) {
panFactoryDataService.handleDataToPlatform(unitNo, operationTime);
} else if ("2".equals(status)) {
bladeRedis.setEx("tray-" + unitNo, trayId, 30L);
} else {
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>> 错误的状态");
}
factoryCommonService.extracted(status, unitNo, currentWarehouseId, operationTime, trayId);
}
//同步打托数据
factoryCommonService.syncTrayTypeData(unitNo, trayId, currentWarehouseId);
} catch (Exception e) {
log.error(e.getMessage());
}
}
}
}
} else {
log.info("##############dealWithDataHandler: 不用处理的状态 status={}", status);
}
}
}

Loading…
Cancel
Save