diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java index 04dc4ea1d..971df1726 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java @@ -27,6 +27,7 @@ import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.io.IOUtils; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.springblade.common.constant.RabbitConstant; import org.springblade.common.constant.RedisKeyConstant; import org.springblade.common.exception.CustomerException; @@ -520,20 +521,24 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { detailObject.put("WarehouseBelong", "oppein"); detailObject.put("Creator", orderStatusDTO.getUsername()); detailObject.put("PackageCode", unitNo); + + // 查询系统的包件对象 + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(FactoryPackageEntity::getCode, unitNo); + FactoryPackageEntity factoryPackageEntity = factoryPackageService.getOne(lambdaQueryWrapper); + // 增加当仓直接入库的 就没有卸车收货的状态 直接 进行入库 入库就表示货物进入当前仓库 if ("4".equals(status) || "1".equals(status)) { detailObject.put("Operate", "收货"); } else if ("7".equals(status)) { + // 检查当前包件有没有推送入库 detailObject.put("Operate", "发货"); } else { log.info(" 该包件的状态不正确 status={} ", status); return Resp.fail(400, "该包件的状态不正确"); } - // 查询系统的包件对象 - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(FactoryPackageEntity::getCode, unitNo); - FactoryPackageEntity factoryPackageEntity = factoryPackageService.getOne(lambdaQueryWrapper); + if (ObjectUtils.isNotNull(factoryPackageEntity)) { // 推送数据 String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/PackageFeedbackRecord"; @@ -542,6 +547,16 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { if (opPackagePushLogEntity == null) { log.info(" >>>>>>>>>>>>>>>>>>>>>>> 包件 {} 已推送欧派 状态 {}", unitNo, detailObject.get("Operate")); } else { + if(opPackagePushLogEntity.getId().equals(-1L)){ + // 保存异常 + // 不是重试的时候,记录对应数据 + if (!isRetry) { + log.info(">>> 保存没有查询到欧派订单包件推送 的记录 {}" ,unitNo); + opPushFailedPackageRecordService.record(unitNo, orderStatusDTO); + } + } + + String resp = opPackagePushLogEntity.getResp(); // 转换为json // JSONObject respJson = JSONObject.parseObject(resp); @@ -624,7 +639,11 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { FactoryOrderEntity factoryOrder = factoryOrderService.selectEntityByOrderPackageCode(unitNo); if (Objects.isNull(factoryOrder)) { - log.info("》》》》》》》》》》》》 未查询到该单据推送订单信息 {}", orderStatusDTO.getUnitNo()); + + // 不是重试的时候,记录对应数据 + log.info(">>> new保存没有查询到欧派订单包件推送 的记录 {}" ,unitNo); + opPushFailedPackageRecordService.record(unitNo, orderStatusDTO); + return Resp.fail(400, "未查询到该单据推送订单信息"); } // 如何判断这个包间是非干仓配的数据 @@ -685,10 +704,15 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { if (opPackagePushLogEntity == null) { log.info(" >>>>>>>>>>>>>>>>>>>>>>> 包件 {} 已推送欧派 状态 {}", unitNo, detailObject.get("Operate")); } else { + + if(opPackagePushLogEntity.getId().equals(-1L)){ + log.info(">>> new保存没有查询到欧派订单包件推送 的记录 {}" ,unitNo); + opPushFailedPackageRecordService.record(unitNo, orderStatusDTO); + } + // 需要盘点这个对象的 String resp = opPackagePushLogEntity.getResp(); - // 转换为json - // JSONObject respJson = JSONObject.parseObject(resp); + log.info(" >>>>>>>>>>>>>>>>>>>>>>> 推送欧派返回数据 {}", resp); // TODO: 2023/10/25 不知道返回成功的状态是多少 // 需要修改包件对应的状态 @@ -843,8 +867,6 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { */ private OpPackagePushLogEntity sendPushOuPaiData(Long refId, String url, Integer pushType, JSONObject data) { - - // 需要判断出库节点是否已经回传了入库节点 String o = data.getString("Operate"); if ("发货".equals(o)) { @@ -858,10 +880,22 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { if(list.isEmpty()){ data.put("Operate","收货"); OpPackagePushLogEntity opPackagePushLogEntity = sendPushOuPaiDataNew(refId, url, 1, data); - data.put("Operate","发货"); - } + + log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 由于欧派数据延迟推送作业,作业上没有进行入库作业回传,在出库回传欧派 再次进行补传入库数据, 包条ID:{}",refId); + // 由于现在无法进行异步任务的绑定,所以对于没有入库数据的说发,导致无法进行延迟 再加上欧派现在没有进行发货数据的考核 所以在检查到没有收货数据的发货推送的时间只传收货 + // 将当前的发货的原始数据保存在定时任务 晚上再次执行该原始数据 + opPackagePushLogEntity.setId(-1L); + return opPackagePushLogEntity; + }else{ + return sendOupaiDataAndSaveLogs(refId, url, pushType, data); + } + }else { + return sendOupaiDataAndSaveLogs(refId, url, pushType, data); } + } + @Nullable + private OpPackagePushLogEntity sendOupaiDataAndSaveLogs(Long refId, String url, Integer pushType, JSONObject data) { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(OpPackagePushLogEntity::getRefId, refId); lambdaQueryWrapper.eq(OpPackagePushLogEntity::getPushOupaiNode, data.getString("Operate")); @@ -885,12 +919,6 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { } else { return null; } - - - - - - }