Browse Source

增加方法 待完成

single_db
pref_mail@163.com 1 year ago
parent
commit
4fce3fda1a
  1. 2
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageEntity.java
  2. 100
      blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/FactoryXxlJob.java
  3. 64
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java

2
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageEntity.java

@ -98,7 +98,7 @@ public class FactoryPackageEntity extends BaseEntity {
/** 入库单状态 0正常 1作废 */
@ApiModelProperty(name = "入库单状态 0正常 1作废",notes = "")
private Integer receiptStatus ;
/** 推送状态 1推送 0未推送 */
/** 推送欧派 推送状态 1推送 0未推送 3 收货推送完成 4 出库推送完成*/
@ApiModelProperty(name = "推送状态 1推送 0未推送",notes = "")
private Integer pushStatus ;
@ApiModelProperty(name = "老系统推送状态 1推送 0未推送 2 推送失败",notes = "")

100
blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/FactoryXxlJob.java

@ -1,8 +1,13 @@
package com.logpm.factory.jobhandler;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.factory.comfac.dto.OrderStatusDTO;
import com.logpm.factory.oupai.service.IOuPaiFactoryService;
import com.logpm.factory.snm.dto.GroupByPackagesDTO;
import com.logpm.factory.snm.entity.OrderLogEntity;
import com.logpm.factory.snm.entity.StaorderPackagesEntity;
@ -23,6 +28,7 @@ import org.slf4j.LoggerFactory;
import org.springblade.common.constant.LogpmDataStatusEnum;
import org.springblade.common.constant.PackagesTypeEnum;
import org.springblade.common.utils.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
@ -48,20 +54,22 @@ public class FactoryXxlJob {
private static final Logger logger = LoggerFactory.getLogger(FactoryXxlJob.class);
private IStationlinenumService stationlinenumService;
private final IStationlinenumService stationlinenumService;
private IOrderService orderService;
private final IOrderService orderService;
private IOrderLogService orderLogService;
private final IOrderLogService orderLogService;
private IStationOrderService stationOrderService;
private final IStationOrderService stationOrderService;
private IStaorderPackagesService staorderPackagesService;
private IAdvanceClient iAdvanceClient;
private IAdvanceDetailClient advanceDetailClient;
private IDetailProductClient detailProductClient;
private IServiceNumClient serviceNumClient;
private IWarehouseClient warehouseClient;
private final IStaorderPackagesService staorderPackagesService;
private final IAdvanceClient iAdvanceClient;
private final IAdvanceDetailClient advanceDetailClient;
private final IDetailProductClient detailProductClient;
private final IServiceNumClient serviceNumClient;
private final IWarehouseClient warehouseClient;
private final IOuPaiFactoryService ouPaiFactoryService;
/**
@ -403,4 +411,76 @@ public class FactoryXxlJob {
}
// 还需要增加根据欧派收货单获取数据的方法
/**
* 欧派工程数据回推
* 启动参数格式
* [{"codes":[包条码...],"type":4},{"codes":[包条码...],"type":7}]
*/
@XxlJob("factoryByOpOrderPackageCodeJobHandler")
public ReturnT<String> factoryByOpOrderPackageCodeJobHandler(String param) throws Exception {
// todo 需要拆分方法
// 获取执行参数的中参数
JSONArray jsonArray;
try {
jsonArray = JSON.parseArray(param);
// 入库的数据请求
JSONObject inArgs =null;
// 出库的数据请求
JSONObject outArgs =null;
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject t = jsonArray.getJSONObject(i);
if (t.get("type").equals(4)){
inArgs= t;
}
if (t.get("type").equals(7)){
outArgs= t;
}
}
JSONArray codes = inArgs.getJSONArray("codes");
extractedJsonArray(codes,"4");
}catch (Exception e){
return ReturnT.FAIL;
}
return ReturnT.SUCCESS;
}
private void extractedJsonArray(JSONArray codes,String status) {
if(codes !=null&& !codes.isEmpty()){
for (int i = 0; i < codes.size(); i++) {
// 得到包件码
String o = (String) codes.get(i);
// 还需要查询老系统的数据 得到这个包件的操作人
// 补充推送欧派的推送数据
OrderStatusDTO orderStatusDTO = new OrderStatusDTO() ;
orderStatusDTO.setUnitNo(o);
orderStatusDTO.setStatus(status);
orderStatusDTO.setUsername();// 操作人
ouPaiFactoryService.handleStatusData(orderStatusDTO);
}
}
}
}

64
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java

@ -372,20 +372,20 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
String currentWarehouseId = orderStatusDTO.getCurrentWarehouse();//当前仓Id
//查询destinationWarehouse logiBillNo plantId数据
log.info("oupai-handleStatusData >>> unitNo={}", unitNo);
Map<String, String> supplyData = advanceDetailClient.getSupplyData(unitNo);
if (ObjectUtils.isEmpty(supplyData)) {
return Resp.fail(400, "未查询到该单据信息");
}
String destinationWarehouseId = supplyData.get("destinationWarehouseId");//目的仓id
if (StringUtil.isBlank(currentWarehouseId) || StringUtil.isBlank(destinationWarehouseId)) {
log.warn("##############oupai-handleStatusData: 仓库数据有问题currentWarehouseId={} destinationWarehouseId={}", currentWarehouseId, destinationWarehouseId);
return Resp.fail(400, "仓库数据有误");
}
if (!currentWarehouseId.equals(destinationWarehouseId)) {
log.info("##############oupai-handleStatusData: 不用处理的状态 currentWarehouseId={} destinationWarehouseId={}", currentWarehouseId, destinationWarehouseId);
return Resp.fail(400, "不是目的仓");
}
// Map<String, String> supplyData = advanceDetailClient.getSupplyData(unitNo);
// if (ObjectUtils.isEmpty(supplyData)) {
// return Resp.fail(400, "未查询到该单据信息");
// }
// String destinationWarehouseId = supplyData.get("destinationWarehouseId");//目的仓id
// if (StringUtil.isBlank(currentWarehouseId) || StringUtil.isBlank(destinationWarehouseId)) {
// log.warn("##############oupai-handleStatusData: 仓库数据有问题currentWarehouseId={} destinationWarehouseId={}", currentWarehouseId, destinationWarehouseId);
// return Resp.fail(400, "仓库数据有误");
// }
//
// if (!currentWarehouseId.equals(destinationWarehouseId)) {
// log.info("##############oupai-handleStatusData: 不用处理的状态 currentWarehouseId={} destinationWarehouseId={}", currentWarehouseId, destinationWarehouseId);
// return Resp.fail(400, "不是目的仓");
// }
// 查询这个包件对应到新系统的订单
FactoryOrderEntity factoryOrder = factoryOrderService.selectEntityByOrderPackageCode(unitNo);
@ -451,21 +451,50 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
if (opPackagePushLogEntity == null) {
log.info(" >>>>>>>>>>>>>>>>>>>>>>> 包件 {} 已推送欧派 状态 {}", unitNo, detailObject.get("Operate"));
} else {
// 需要盘点这个对象的
String resp = opPackagePushLogEntity.getResp();
// 转换为json
// JSONObject respJson = JSONObject.parseObject(resp);
log.info(" >>>>>>>>>>>>>>>>>>>>>>> 推送欧派返回数据 {}", resp);
// TODO: 2023/10/25 不知道返回成功的状态是多少
// 需要修改包件对应的状态
factoryPackageEntity.setPushStatus(1);
factoryPackageService.updateById(factoryPackageEntity);
checkOpFactoryPackagePushStatus(factoryPackageEntity);
}
}
return Resp.success("物流状态传递成功");
}
/**
* 根据推送类型修改包件上的状态
* @param factoryPackageEntity
*/
void checkOpFactoryPackagePushStatus(FactoryPackageEntity factoryPackageEntity){
// 查询推送记录 师傅包含 已收货 已出库
LambdaQueryWrapper<OpPackagePushLogEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(OpPackagePushLogEntity::getRefId, factoryPackageEntity.getId());
lambdaQueryWrapper.eq(OpPackagePushLogEntity::getPushType,1);// 查询包件
List<OpPackagePushLogEntity> list = opPackagePushLogService.list(lambdaQueryWrapper);
if(list!=null&&!list.isEmpty()){
for (OpPackagePushLogEntity opPackagePushLogEntity : list) {
if("收货".equals(opPackagePushLogEntity.getPushOupaiNode())){
factoryPackageEntity.setPushStatus(3);
}
if("发货".equals(opPackagePushLogEntity.getPushOupaiNode())){
factoryPackageEntity.setPushStatus(4);
}
}
factoryPackageService.updateById(factoryPackageEntity);
}else{
log.info("包件推送记录未null 包条码{}",factoryPackageEntity.getCode());
}
}
/**
* 根据汇通业务提供是否操作欧派系统的商场 来决定是否会推数据
* 如果需要使用欧派系统 这里就需要不进行回传
@ -594,6 +623,7 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
LambdaQueryWrapper<OpPackagePushLogEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(OpPackagePushLogEntity::getRefId, refId);
lambdaQueryWrapper.eq(OpPackagePushLogEntity::getPushOupaiNode, data.getString("Operate"));
lambdaQueryWrapper.eq(OpPackagePushLogEntity::getPushType,pushType);// 查询包件
List<OpPackagePushLogEntity> list = opPackagePushLogService.list(lambdaQueryWrapper);
if (ObjectUtils.isNull(list) || list.isEmpty()) {
OpPackagePushLogEntity opPackagePushLogEntity = new OpPackagePushLogEntity();

Loading…
Cancel
Save