Compare commits

...

1 Commits

Author SHA1 Message Date
zhenghaoyu aac0149271 1.dev-老系统推送数据逻辑优化 12 months ago
  1. 2
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataBrandClient.java
  2. 2
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/feign/IOldSystemWaybillClient.java
  3. 3
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineAdvanceDetailClient.java
  4. 5
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataBrandClient.java
  5. 1
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataBrandService.java
  6. 8
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataBrandServiceImpl.java
  7. 8
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/FactoryCommonServiceImpl.java
  8. 6
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/OrderPackageStatusPushFailLogServiceImpl.java
  9. 19
      blade-service/logpm-factory/src/main/java/com/logpm/factory/feign/OldSystemWaybillClient.java
  10. 3
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpReceivingDataHandler.java
  11. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/IPanFactoryDataService.java
  12. 270
      blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java
  13. 8
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java
  14. 8
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OldWaybillClient.java
  15. 5
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/TrunklineAdvanceDetailClient.java
  16. 3
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java

2
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataBrandClient.java

@ -53,4 +53,6 @@ public interface IBasicdataBrandClient {
@GetMapping(API_PREFIX+"/findAllList")
List<JSONObject> findAllList();
@GetMapping(API_PREFIX+"/findEntityByNames")
BasicdataBrandEntity findEntityByName(@RequestParam("brand") String brand);
}

2
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/feign/IOldSystemWaybillClient.java

@ -20,7 +20,7 @@ public interface IOldSystemWaybillClient {
* @param operationTime
*/
@GetMapping(HANDLEDATATOPLATFORM)
void handleDataToPlatform(@RequestParam("unitNo") String unitNo, @RequestParam("operationTime") String operationTime);
void handleDataToPlatform(@RequestParam("unitNo") String unitNo, @RequestParam("operationTime") String operationTime,@RequestParam("oldWarehouseId") Integer oldWarehouseId);

3
blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineAdvanceDetailClient.java

@ -18,4 +18,7 @@ public interface ITrunklineAdvanceDetailClient {
@PostMapping(API_PREFIX+"/addAdvanceBatch")
void addAdvanceBatch(@RequestBody List<TrunklineAdvanceDetailEntity> advanceDetailEntities);
@GetMapping(API_PREFIX+"/findEntityByOrderPackageCode")
TrunklineAdvanceDetailEntity findEntityByOrderPackageCode(@RequestParam String unitNo);
}

5
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataBrandClient.java

@ -58,4 +58,9 @@ public class BasicdataBrandClient implements IBasicdataBrandClient {
return basicdataBrandService.findAllList();
}
@Override
public BasicdataBrandEntity findEntityByName(String brand) {
return basicdataBrandService.findEntityByName(brand);
}
}

1
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataBrandService.java

@ -53,4 +53,5 @@ public interface IBasicdataBrandService extends BaseService<BasicdataBrandEntity
List<JSONObject> findAllList();
BasicdataBrandEntity findEntityByName(String brand);
}

8
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataBrandServiceImpl.java

@ -18,6 +18,7 @@ package com.logpm.basicdata.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.basicdata.entity.BasicdataBrandEntity;
import com.logpm.basicdata.excel.BasicdataBrandExcel;
@ -62,4 +63,11 @@ public class BasicdataBrandServiceImpl extends BaseServiceImpl<BasicdataBrandMap
return allList;
}
@Override
public BasicdataBrandEntity findEntityByName(String brand) {
QueryWrapper<BasicdataBrandEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("brand_name",brand);
return baseMapper.selectOne(queryWrapper);
}
}

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

@ -152,8 +152,14 @@ public class FactoryCommonServiceImpl implements IFactoryCommonService {
if (OldSystemDataPushConfig.getWarehourseIdList().contains(currentWarehouseId)) {
try {
if ("1".equals(status) || "4".equals(status)) {
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient.getWarehouseByOldId(Integer.parseInt(currentWarehouseId));
if(Objects.isNull(warehouseEntity)){
log.warn("##############dealWithDataHandler: 仓库数据不存在 currentWarehouseId={}", currentWarehouseId);
throw new CustomerException(405, "仓库数据不存在");
}
Long newWarehouseId = warehouseEntity.getId();
// 始发仓和目的仓入库
panFactoryDataService.handleDataToPlatform(unitNo, operationTime);
panFactoryDataService.handleDataToPlatform(unitNo, operationTime,newWarehouseId);
} else {
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>> 错误的状态");
}

6
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/OrderPackageStatusPushFailLogServiceImpl.java

@ -5,8 +5,6 @@ import com.logpm.factory.comfac.mapper.OrderPackageStatusPushFailLogMapper;
import com.logpm.factory.comfac.service.IOrderPackageStatusPushFailLogService;
import com.logpm.factory.entity.OrderPackageStatusPushFailLogEntity;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
@ -18,7 +16,7 @@ public class OrderPackageStatusPushFailLogServiceImpl extends BaseServiceImpl<Or
@Override
public void saveOrderPackageStatusFaleLog(String unitNo, String currentWarehouseId, String status,String operationTime, Integer trayId) {
log.info("##############dealWithDataHandler: unitNo={} 没有查询到数据 保存到待处理数据库", unitNo);
log.info("##############saveOrderPackageStatusFaleLog: unitNo={} 没有查询到数据 保存到待处理数据库", unitNo);
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("unit_no", unitNo);
@ -39,7 +37,7 @@ public class OrderPackageStatusPushFailLogServiceImpl extends BaseServiceImpl<Or
log.info(">>>>>>>>>>>>>>>> 保存到定时任务队列");
baseMapper.insert(orderPackageStatusPushFailLogEntity);
}else{
throw new CustomerException(405, "失败的包件数据状态记录已存在");
log.warn("################saveOrderPackageStatusFaleLog: 失败的包件数据状态记录已存在");
}
}
}

19
blade-service/logpm-factory/src/main/java/com/logpm/factory/feign/OldSystemWaybillClient.java

@ -1,13 +1,17 @@
package com.logpm.factory.feign;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.factory.pan.service.IPanFactoryDataService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springblade.common.exception.CustomerException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Objects;
@Slf4j
@ApiIgnore()
@RestController
@ -18,10 +22,19 @@ public class OldSystemWaybillClient implements IOldSystemWaybillClient{
private final IPanFactoryDataService panFactoryDataService;
private final IBasicdataWarehouseClient basicdataWarehouseClient;
@GetMapping(HANDLEDATATOPLATFORM)
@Override
public void handleDataToPlatform(String unitNo, String operationTime) {
public void handleDataToPlatform(String unitNo, String operationTime,Integer oldWarehouseId) {
log.info(">>>>>>>>> 运单开单 保存包件数据 {}",unitNo);
panFactoryDataService.handleDataToPlatform(unitNo,operationTime);
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient.getWarehouseByOldId(oldWarehouseId);
if(Objects.isNull(warehouseEntity)){
log.warn("##############handleDataToPlatform: 仓库信息不存在");
throw new CustomerException(405,"仓库信息不存在");
}
Long newWarehouseId = warehouseEntity.getId();
panFactoryDataService.handleDataToPlatform(unitNo,operationTime,newWarehouseId);
}
}

3
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpReceivingDataHandler.java

@ -38,7 +38,8 @@ public class OpReceivingDataHandler {
String receivingTime = object.getString("receivingTime");
//真正处理需要的数据
try {
panFactoryDataService.handleDataToPlatform(orderPackageCode, receivingTime);
//TODO 这里需要配置当前仓库
panFactoryDataService.handleDataToPlatform(orderPackageCode, receivingTime,null);
} catch (CustomerException e) {
log.error("##################opReceivingDataHandler: 处理欧派收货数据到新系统,orderPackageCode:{},receivingTime:{},msg:{}",

2
blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/IPanFactoryDataService.java

@ -16,7 +16,7 @@ public interface IPanFactoryDataService {
R handleStatusData(OrderStatusDTO orderStatusDTO);
void handleDataToPlatform(String unitNo,String operationTime);
void handleDataToPlatform(String unitNo,String operationTime,Long newWarehouseId);
Long saveData(PanFactoryOrderDTO factoryOrderDTO);
}

270
blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java

@ -9,9 +9,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.logpm.basic.entity.BasicMaterialEntity;
import com.logpm.basic.feign.IBasicMaterialClient;
import com.logpm.basicdata.entity.BasicdataBrandEntity;
import com.logpm.basicdata.entity.BasicdataClientEntity;
import com.logpm.basicdata.entity.BasicdataStoreBusinessEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataBrandClient;
import com.logpm.basicdata.feign.IBasicdataClientClient;
import com.logpm.basicdata.feign.IBasicdataStoreBusinessClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
@ -37,7 +39,6 @@ import com.logpm.factory.snm.entity.PanPackageInfo;
import com.logpm.factory.snm.entity.PanPackageList;
import com.logpm.oldproject.entity.*;
import com.logpm.oldproject.feign.*;
import com.logpm.oldproject.vo.DistributionParcelListEntityVO;
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity;
import com.logpm.trunkline.entity.TrunklineAdvanceEntity;
import com.logpm.trunkline.entity.TrunklineDetailProductEntity;
@ -111,6 +112,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
private final IDetailProductClient detailProductClient;
private final ITrunklineDetailProductClient trunklineDetailProductClient;
private final ITrunklineAdvanceDetailClient trunklineAdvanceDetailClient;
private final IBasicdataBrandClient basicdataBrandClient;
private final IOrderCountClient orderCountClient;
private final BladeRedis redis;
@ -356,10 +358,19 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
@Transactional
@Override
public void handleDataToPlatform(String unitNo, String operationTime) {
logger.info("############handleDataToPlatform: 处理数据到platform unitNo={}", unitNo);
public void handleDataToPlatform(String unitNo, String operationTime,Long newWarehouseId) {
logger.info("############handleDataToPlatform: 处理数据到platform unitNo={} currentWarehouseId={}", unitNo,newWarehouseId);
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(newWarehouseId);
if(Objects.isNull(warehouseEntity)){
log.warn("##############handleDataToPlatform: 当前仓库信息不存在");
throw new CustomerException(405,"当前仓库信息不存在");
}
int oldWarehouseId = warehouseEntity.getOldId();
//先查询包件是否已存入到新系统数据库
DistributionParcelListEntity distributionParcelListEntity = distributionParcelListClient.findByPacketBarCode(unitNo);
DistributionParcelListEntity distributionParcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(unitNo,newWarehouseId);
if (Objects.isNull(distributionParcelListEntity)) {
//未找到包件信息那就去新增
//1.根据包条码去老系统数据库找到对应的包条信息
@ -385,57 +396,53 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
}
Map<String, String> supplyData = advanceDetailClient.getSupplyData(unitNo);
String destinationWarehouse= "";
String takeCompany= "";
if(ObjectUtil.isNotEmpty(supplyData)){
destinationWarehouse = supplyData.get("destinationWarehouse");//目的仓名称
takeCompany = supplyData.get("takeCompany");
}
// OrderDetailEntity orderDetailEntity = orderDetailClient.findByUnitNo(unitNo);
// if(Objects.isNull(orderDetailEntity)){
// logger.warn("############handleDataToPlatform: 包条信息不存在 unitNo={}",unitNo);
// throw new CustomerException(405, "包条信息不存在");
// Map<String, String> supplyData = advanceDetailClient.getSupplyData(unitNo);
// String destinationWarehouse= "";
// String takeCompany= "";
// if(ObjectUtil.isNotEmpty(supplyData)){
// destinationWarehouse = supplyData.get("destinationWarehouse");//目的仓名称
// takeCompany = supplyData.get("takeCompany");
// }
// Integer oldId = orderDetailEntity.getNowWarehouseId();
// 查询数据对应的仓库名称
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.findByName(destinationWarehouse);
if(Objects.isNull(basicdataWarehouseEntity)){
logger.warn("############handleDataToPlatform: 仓库信息不存在 destinationWarehouse={}",destinationWarehouse);
throw new CustomerException(405, "仓库信息不存在");
OrderDetailEntity orderDetailEntity = orderDetailClient.findByUnitNo(unitNo);
if(Objects.isNull(orderDetailEntity)){
logger.warn("############handleDataToPlatform: 包条信息不存在 unitNo={}",unitNo);
throw new CustomerException(405, "包条信息不存在");
}
Long warehouseId = basicdataWarehouseEntity.getId();
// OrderCountEntity orderCountEntity = orderCountClient.getEntityByOrderCode(orderSelfNum,oldId);
// if(Objects.isNull(orderCountEntity)){
// log.warn("#################handleDataToPlatform: 未查询单订单信息 orderCode={}",orderSelfNum);
// throw new CustomerException(403,"未查询单订单信息");
// 查询数据对应的仓库名称
// BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.findByName(destinationWarehouse);
// if(Objects.isNull(basicdataWarehouseEntity)){
// logger.warn("############handleDataToPlatform: 仓库信息不存在 destinationWarehouse={}",destinationWarehouse);
// throw new CustomerException(405, "仓库信息不存在");
// }
// Long warehouseId = basicdataWarehouseEntity.getId();
OrderCountEntity orderCountEntity = orderCountClient.getEntityByOrderCode(orderSelfNum,oldWarehouseId);
if(Objects.isNull(orderCountEntity)){
log.warn("#################handleDataToPlatform: 未查询单订单信息 orderCode={}",orderSelfNum);
throw new CustomerException(403,"未查询单订单信息");
}
//判断新系统是否有这条订单数据
DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(orderSelfNum,warehouseId);
DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(orderSelfNum,newWarehouseId);
Long id;
String waybillNoNum = advanceEntity.getWaybillNo();
String waybillNo = advanceEntity.getWaybillNo();
if (Objects.isNull(distributionStockArticleEntity)) {
Date date = new Date();
if(StringUtil.isNoneBlank(operationTime)){
if(StringUtil.isNotBlank(operationTime)){
date = CommonUtil.StringToDate(operationTime);
}
logger.info("#################handleDataToPlatform.waybillNoNum: {}", waybillNoNum);
logger.info("#################handleDataToPlatform.waybillNo: {}", waybillNo);
distributionStockArticleEntity = new DistributionStockArticleEntity();
distributionStockArticleEntity.setOrderCode(orderSelfNum);
distributionStockArticleEntity.setWaybillNumber(waybillNoNum);
distributionStockArticleEntity.setWarehouse(basicdataWarehouseEntity.getName());
distributionStockArticleEntity.setWarehouseId(warehouseId);
// 其实是客户
distributionStockArticleEntity.setMallName(takeCompany);
distributionStockArticleEntity.setWaybillNumber(waybillNo);
distributionStockArticleEntity.setWarehouse(warehouseEntity.getName());
distributionStockArticleEntity.setWarehouseId(newWarehouseId);
distributionStockArticleEntity.setWarehouseEntryTime(date);
distributionStockArticleEntity.setWarehouseEntryTimeEnd(date);
@ -445,31 +452,29 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
// distributionStockArticleEntity.setWaybillNumber();// 运单号
distributionStockArticleEntity.setMallName(advanceEntity.getDealerName());
distributionStockArticleEntity.setMallCode(advanceEntity.getDealerCode());
distributionStockArticleEntity.setCompleteSet(1);
//判断是否齐套 查询该订单自编号下面的包件是都全部都交由汇通了
Integer allNum = advanceDetailClient.getAllNumByOrderNo(orderSelfNum);
if (total.equals(allNum)) {
//如果数据库中的数据和订单上的数量相等就是齐套
distributionStockArticleEntity.setCompleteSet(1);
} else {
distributionStockArticleEntity.setCompleteSet(0);
}
logger.info("############basicdataWarehouseEntity {}", basicdataWarehouseEntity);
if (!Objects.isNull(basicdataWarehouseEntity)) {
distributionStockArticleEntity.setCreateDept(basicdataWarehouseEntity.getDepartment());
}
WayBillEntity wayBillEntity = wayBillClient.getByWayBillByOrderCode(orderSelfNum);
if(Objects.isNull(wayBillEntity)){
logger.error("包条同步失败 ----> 数据异常 包条对应的运单不存在 包件 {} 运单对象 {},",unitNo,wayBillEntity);
return ;
// Integer allNum = advanceDetailClient.getAllNumByOrderNo(orderSelfNum);
// if (total.equals(allNum)) {
// //如果数据库中的数据和订单上的数量相等就是齐套
// distributionStockArticleEntity.setCompleteSet(1);
// } else {
// distributionStockArticleEntity.setCompleteSet(0);
// }
// logger.info("############basicdataWarehouseEntity {}", basicdataWarehouseEntity);
// if (!Objects.isNull(basicdataWarehouseEntity)) {
// distributionStockArticleEntity.setCreateDept(basicdataWarehouseEntity.getDepartment());
// }
}
if (ObjectUtils.isNotNull(wayBillEntity)) {
WayBillEntity wayBillEntity = wayBillClient.getByWaybillNo(waybillNo);
// if(Objects.isNull(wayBillEntity)){
// logger.error("包条同步失败 ----> 数据异常 包条对应的运单不存在 包件 {} 运单对象 {},",unitNo,wayBillEntity);
// return ;
// }
distributionStockArticleEntity.setTypeService("1");//默认商配
if (!Objects.isNull(wayBillEntity)) {
distributionStockArticleEntity.setConsigneeUnit(wayBillEntity.getTakeCompany());//收货单位(经销商)
distributionStockArticleEntity.setConsigneePerson(wayBillEntity.getTakePerson());//收货人
@ -493,37 +498,34 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
distributionStockArticleEntity.setAcceptWarehouseName(t.getName());
distributionStockArticleEntity.setAcceptWarehouseId(t.getId());
}
}
String customerName = wayBillEntity.getTakeCompany();//客户名称
//通过客户名称去查询客户的服务类型、
distributionStockArticleEntity.setTypeService("1");//默认商配
BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findByName(customerName);
logger.info("订单同步出现的客户编号{} 匹配的客户", basicdataClientEntity);
if (!Objects.isNull(basicdataClientEntity)) {
//商城
distributionStockArticleEntity.setMallId(basicdataClientEntity.getId());
distributionStockArticleEntity.setMallName(basicdataClientEntity.getClientName());
distributionStockArticleEntity.setMallCode(basicdataClientEntity.getClientCode());
// todo 这里需要去查询门店 和新系统的门店ID 进行绑定
String peisongType = getPeisongTypeByClientId(basicdataClientEntity.getId());
logger.info("订单同步peisongType {} ", peisongType);
if (StringUtil.isNoneBlank(peisongType)) {
distributionStockArticleEntity.setTypeService(peisongType);
BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findByName(wayBillEntity.getTakeCompany());
logger.info("订单同步出现的客户编号{} 匹配的客户", basicdataClientEntity);
if (!Objects.isNull(basicdataClientEntity)) {
//商城
distributionStockArticleEntity.setMallId(basicdataClientEntity.getId());
distributionStockArticleEntity.setMallName(basicdataClientEntity.getClientName());
distributionStockArticleEntity.setMallCode(basicdataClientEntity.getClientCode());
// todo 这里需要去查询门店 和新系统的门店ID 进行绑定
String peisongType = getPeisongTypeByClientId(basicdataClientEntity.getId());
logger.info("订单同步peisongType {} ", peisongType);
if (StringUtil.isNotBlank(peisongType)) {
distributionStockArticleEntity.setTypeService(peisongType);
}
}
}
distributionStockArticleEntity.setGenre(1);
distributionStockArticleEntity.setAdvanceId(advanceId);
//--------------2023-07-06 新增字段处理
//查询包条码对应的运单信息
waybillNoNum = supplyData.get("logiBillNo");
//存入运单信息
saveWaybillEntity(waybillNoNum );
saveWaybillEntity(waybillNo);
// 增加订单 经销商信息 和门店信息
buildDealerAndStore(distributionStockArticleEntity, advanceEntity);
@ -559,7 +561,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
}
//保存包件信息
saveOrderPackage(unitNo, distributionStockArticleEntity, basicdataWarehouseEntity, waybillNoNum,operationTime,basicdataWarehouseEntity.getOldId());
saveOrderPackage(unitNo, distributionStockArticleEntity, warehouseEntity, waybillNo,operationTime,oldWarehouseId);
logger.info("#################handleDataToPlatform: 数据处理完成");
} else {
@ -567,8 +569,8 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
logger.info("#################handleDataToPlatform: 包件信息已存在,不用处理 unitNo={}", unitNo);
}
//存入包条缓存
bladeRedis.setEx("arrive-"+unitNo,unitNo,30L);
// //存入包条缓存
// bladeRedis.setEx("arrive-"+unitNo,unitNo,30L);
}
@ -665,33 +667,37 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
*/
private void saveOrderPackage(String unitNo, DistributionStockArticleEntity distributionStockArticleEntity, BasicdataWarehouseEntity basicdataWarehouseEntity, String waybillNo,String operationTime,Integer oldWarehouseId) {
DistributionParcelListEntityVO vo = advanceDetailClient.getByUnitNo(unitNo);;
// 判断当前查询包件不是否为皮阿落
// // todo 这里不合理 需要优化
// if("皮阿诺".equals(distributionStockArticleEntity.getBrand())){
// vo = advanceDetailClient.getByUnitNoByPyl(unitNo);
// }else{
// vo = advanceDetailClient.getByUnitNo(unitNo);
//
// }
//
// DistributionParcelListEntityVO vo = advanceDetailClient.getByUnitNo(unitNo);
//// WarehouseWaybillEntity warehouseWaybill = warehouseWaybillClient.findByWaybillNo(waybillNo);
if(Objects.isNull(vo)){
logger.warn("##############saveOrderPackage: 未在老系统查询到包件数据 unitNo={}",unitNo);
throw new CustomerException(405,"未在老系统查询到包件数据");
Long newWarehouseId = basicdataWarehouseEntity.getId();
String newWarehosueName = basicdataWarehouseEntity.getName();
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(unitNo, newWarehouseId);
if(!Objects.isNull(parcelListEntity)){
logger.warn("##############saveOrderPackage: 新系统存在包件数据 unitNo={}",unitNo);
throw new CustomerException(405,"新系统存在包件数据");
}else{
TrunklineAdvanceDetailEntity trunklineAdvanceDetailEntity = trunklineAdvanceDetailClient.findEntityByOrderPackageCode(unitNo);
if(Objects.isNull(trunklineAdvanceDetailEntity)){
logger.warn("##############saveOrderPackage: 暂存单包件信息不存在 unitNo={}",unitNo);
throw new CustomerException(405,"暂存单包件信息不存在");
}
OrderDetailEntity orderDetailEntity = orderDetailClient.findEntityByUnitNoAndOldWarehosueId(unitNo,oldWarehouseId);
List<DetailProductEntity> productEntityList = detailProductClient.findListByUnitNo(unitNo);
DetailProductEntity detailProductEntity = productEntityList.get(0);
DistributionParcelListEntity entity = new DistributionParcelListEntity();
BeanUtil.copyProperties(vo, entity);
entity.setWarehouseId(newWarehouseId);
entity.setWarehouse(newWarehosueName);
entity.setWarehouseEntryTimeEnd(CommonUtil.StringToDate(operationTime));
entity.setFirsts(trunklineAdvanceDetailEntity.getFirstPackName());
entity.setSecond(trunklineAdvanceDetailEntity.getSecondPackName());
entity.setThirdProduct(trunklineAdvanceDetailEntity.getThirdPackName());
entity.setTrainNumber(trunklineAdvanceDetailEntity.getTrainNumber());
entity.setQuantity(1);
entity.setOrderPackageCode(vo.getPacketBarCode());
entity.setOrderPackageCode(unitNo);
entity.setConditions(1);
entity.setWarehouse(distributionStockArticleEntity.getWarehouse());
entity.setWarehouseId(distributionStockArticleEntity.getWarehouseId());
entity.setStockArticleId(distributionStockArticleEntity.getId());
entity.setOrderPackageStatus(OrderPackageStatusConstant.yiruku.getValue());
entity.setOrderPackageFreezeStatus(OrderPackageFreezeStatusConstant.weidongjie.getValue());
@ -702,6 +708,9 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
entity.setServiceNumber(distributionStockArticleEntity.getServiceNumber());
entity.setWaybillNumber(waybillNo);
entity.setBrandName(distributionStockArticleEntity.getBrand());
entity.setAdvanceId(trunklineAdvanceDetailEntity.getAdvanceId());
entity.setWarehouseEntryTimeEnd(CommonUtil.StringToDate(operationTime));
// if(ObjectUtil.isNotEmpty(warehouseWaybill)){
// entity.setWarehouseId(warehouseWaybill.getId());
// }
@ -719,34 +728,22 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
entity.setDealerCode(distributionStockArticleEntity.getDealerCode());
entity.setDealerName(distributionStockArticleEntity.getDealerName());
if(!Objects.isNull(orderDetailEntity)){
entity.setWarehouseEntryTimeEnd(orderDetailEntity.getUpdateTime());
}
// 绑定部门--仓库
if (!Objects.isNull(basicdataWarehouseEntity)) {
entity.setCreateDept(basicdataWarehouseEntity.getDepartment());
}
entity.setCreateUser(1714696768639311873L);
entity.setUpdateUser(1714696768639311873L);
entity.setCreateDept(1649331096241836033L);
entity.setTenantId(TenantNum.HUITONGCODE);
if (StringUtil.isNoneBlank(entity.getMaterialName()) && StringUtil.isNoneBlank(entity.getMaterialCode())) {
// 查询物料信息
String sku = "";
BasicMaterialEntity basicMaterialEntity = basicMaterialClient.getMaterialOwn(entity.getMaterialCode(), entity.getMaterialName(), sku);
if (ObjectUtils.isNotNull(basicMaterialEntity)) {
entity.setMaterialId(basicMaterialEntity.getId());
entity.setMaterialCode(basicMaterialEntity.getProductCode());
entity.setMaterialUnit(basicMaterialEntity.getLogpmUnit());
}
}
String materialCode = trunklineAdvanceDetailEntity.getMaterialCode();
String materialName = trunklineAdvanceDetailEntity.getMaterialName();
Long materialId = trunklineAdvanceDetailEntity.getMaterialId();
entity.setMaterialId(materialId);
entity.setMaterialCode(materialCode);
entity.setMaterialName(materialName);
boolean b = distributionParcelListClient.add(entity);
if (!b) {
logger.warn("#################handleDataToPlatform: 保存包件信息失败 orderCode={}", entity.getOrderCode());
throw new CustomerException(405, "保存包件信息失败");
}else{
logger.info("################handleDataToPlatform: 保存包件成功 OrderPackageCode={}",vo.getPacketBarCode());
logger.info("################handleDataToPlatform: 保存包件成功 OrderPackageCode={}",unitNo);
// Integer handQuantity = distributionStockArticleEntity.getHandQuantity();
// Integer totalNumber = distributionStockArticleEntity.getTotalNumber();
//
@ -799,6 +796,9 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
String agent = wayBillEntity.getAgent();
warehouseWaybill = new WarehouseWaybillEntity();
warehouseWaybill.setCreateUser(1714696768639311873L);
warehouseWaybill.setUpdateUser(1714696768639311873L);
warehouseWaybill.setCreateDept(1649331096241836033L);
warehouseWaybill.setWaybillNo(waybillNo);
warehouseWaybill.setDestinationWarehouseName(warehouseName);
warehouseWaybill.setDestinationWarehouseId(Objects.isNull(endhouse) ? null : endhouse.getId());
@ -1006,6 +1006,8 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
List<TrunklineAdvanceDetailEntity> newPackageList = new ArrayList<>();
for (AdvanceDetailEntity advanceDetailEntity : detailList) {
String unitNo = advanceDetailEntity.getUnitNo();
List<DetailProductEntity> detailProductList = detailProductClient.findListByUnitNo(unitNo);
DetailProductEntity productEntity = detailProductList.get(0);
TrunklineAdvanceDetailEntity trunklineAdvanceDetailEntity = new TrunklineAdvanceDetailEntity();
trunklineAdvanceDetailEntity.setTenantId(TenantNum.HUITONGCODE);
trunklineAdvanceDetailEntity.setCreateUser(1714696768639311873L);
@ -1035,10 +1037,34 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
trunklineAdvanceDetailEntity.setWaybillNo(waybillNo);
trunklineAdvanceDetailEntity.setPackageStatus("1");
trunklineAdvanceDetailEntity.setChargeType(1);
String productcode = productEntity.getProductcode();
String productname = productEntity.getProductname();
BasicMaterialEntity basicMaterialEntity = basicMaterialClient.findEntityByCodeAndName(productcode, productname);
if(Objects.isNull(basicMaterialEntity)){
BasicdataBrandEntity basicdataBrandEntity = basicdataBrandClient.findEntityByName(brand);
basicMaterialEntity = new BasicMaterialEntity();
basicMaterialEntity.setProductCode(productcode);
basicMaterialEntity.setName(productname);
if(!Objects.isNull(basicdataBrandEntity)){
basicMaterialEntity.setBrandId(basicdataBrandEntity.getId()+"");
}
basicMaterialEntity.setProperty("家配");
basicMaterialEntity.setSpecification("件");
basicMaterialEntity.setPackingSpecification(advanceDetailEntity.getMscsNum()+"件/箱");
basicMaterialEntity.setLogpmUnit("箱");
basicMaterialEntity.setSku(productcode);
basicMaterialEntity.setPackageNum(advanceDetailEntity.getMscsNum());
basicMaterialEntity.setHide(1);
Long aLong = basicMaterialClient.addMaterial(basicMaterialEntity);
basicMaterialEntity.setId(aLong);
}
trunklineAdvanceDetailEntity.setMaterialId(basicMaterialEntity.getId());
trunklineAdvanceDetailEntity.setMaterialCode(basicMaterialEntity.getProductCode());
trunklineAdvanceDetailEntity.setMaterialName(basicMaterialEntity.getName());
newPackageList.add(trunklineAdvanceDetailEntity);
//同步包内明细
List<DetailProductEntity> detailProductList = detailProductClient.findListByUnitNo(unitNo);
List<TrunklineDetailProductEntity> trunklineDetailProductEntities = new ArrayList<>();
for (DetailProductEntity detailProductEntity : detailProductList) {
TrunklineDetailProductEntity trunklineDetailProductEntity = new TrunklineDetailProductEntity();

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

@ -1,10 +1,7 @@
package com.logpm.factory.receiver;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.factory.comfac.dto.OrderStatusDTO;
import com.logpm.factory.comfac.mapper.OrderPackageStatusPushFailLogMapper;
import com.logpm.factory.comfac.service.IFactoryCommonService;
import com.logpm.factory.entity.OrderPackageStatusPushFailLogEntity;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.RabbitConstant;
@ -15,7 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@ -33,10 +29,6 @@ public class DealWithDataHandler {
@Autowired
private IFactoryCommonService factoryCommonService;
@Autowired
private OrderPackageStatusPushFailLogMapper orderPackageStatusPushFailLogMapper;
@RabbitHandler
public void dealWithDataHandler(Map map, Message message, Channel channel) throws IOException {

8
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OldWaybillClient.java

@ -54,11 +54,11 @@ public class OldWaybillClient implements IOldWaybillClient {
log.info(">>>>>>>>>>>>>>>>> 运单信息 {}", byWaybillId);
log.info(">>>>>>>>>>>>>>>>> 旧仓库ID 集合 {}", OldSystemDataPushConfig.getWarehourseIdList());
Integer oldWarehouseId = byWaybillId.getWarehouseId();
// 需要验证当前需要开启的数据推送仓库 null+""
if (!OldSystemDataPushConfig.getWarehourseIdList().contains(byWaybillId.getWarehouseId() + "")) {
log.info(">>> waybillDataHandler 当前开单仓库不是目前系统上线运行仓库 {}", byWaybillId.getWarehouseId());
if (!OldSystemDataPushConfig.getWarehourseIdList().contains(oldWarehouseId + "")) {
log.info(">>> waybillDataHandler 当前开单仓库不是目前系统上线运行仓库 {}", oldWarehouseId);
return R.fail(405,"当前仓不处理");
}
@ -84,7 +84,7 @@ public class OldWaybillClient implements IOldWaybillClient {
String unitNo = unitNos.getString(i1);
log.info(">>>>>>>> 保存开单推送的已入库包件 {} 保存到新系统", unitNo);
String operationTime = DateUtil.format(new Date(), "yyyy-MM-dd hh:mm:ss");
oldSystemWaybillClient.handleDataToPlatform(unitNo, operationTime);
oldSystemWaybillClient.handleDataToPlatform(unitNo, operationTime,oldWarehouseId);
}
}
} else {

5
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/TrunklineAdvanceDetailClient.java

@ -21,4 +21,9 @@ public class TrunklineAdvanceDetailClient implements ITrunklineAdvanceDetailClie
public void addAdvanceBatch(List<TrunklineAdvanceDetailEntity> advanceDetailEntities) {
advanceDetailService.saveBatch(advanceDetailEntities);
}
@Override
public TrunklineAdvanceDetailEntity findEntityByOrderPackageCode(String unitNo) {
return advanceDetailService.findEntityByOrderPackageCode(unitNo);
}
}

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

@ -92,7 +92,8 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
@Override
public TrunklineAdvanceDetailEntity findEntityByOrderPackageCode(String orderPackageCode) {
QueryWrapper<TrunklineAdvanceDetailEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("order_package_code",orderPackageCode);
queryWrapper.eq("order_package_code",orderPackageCode)
.eq("is_deleted",0);
return baseMapper.selectOne(queryWrapper);
}

Loading…
Cancel
Save