Browse Source

Merge branch 'fix-bug-20231206' into dev

newStockUp
pref_mail@163.com 1 year ago
parent
commit
fe3a9d59c9
  1. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java
  2. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml
  3. 18
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryDataServiceImpl.java
  4. 107
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java

@ -1395,13 +1395,13 @@ public class DistributionStockupAppController extends BladeController {
R r = warehouseUpdownTypeClient.downStock(list);
if (r.getCode() != 200) {
log.debug("##########" + r.getMsg());
return Resp.scanFail("下架失败,请联系管理员!!", "下架失败,请联系管理员!!");
// return Resp.scanFail("下架失败,请联系管理员!!", "下架失败,请联系管理员!!");
}
} else {
R r = warehouseUpdownTypeClient.downPackage(packetBarCode, byId.getWarehouseId());
if (r.getCode() != 200) {
log.debug("##########" + r.getMsg());
return Resp.scanFail("下架失败,请联系管理员!!", "下架失败,请联系管理员!!");
// return Resp.scanFail("下架失败,请联系管理员!!", "下架失败,请联系管理员!!");
}
}
} else {

1
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml

@ -326,6 +326,7 @@
LEFT JOIN logpm_distribution_stock_list ldsl ON ldrs.stocklist_id = ldsl.id
WHERE
ldrs.reservation_id = #{reservationId}
group by ldsl.cargo_number
) t
LEFT JOIN logpm_distribution_stock_list ldslNew ON t.cargo_number = ldslNew.cargo_number
LEFT JOIN logpm_distribution_stock ldss ON ldss.stock_list_id = t.id where ldslNew.is_deleted = 0

18
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryDataServiceImpl.java

@ -42,13 +42,19 @@ public class OuPaiFactoryDataServiceImpl implements IOuPaiFactoryDataService {
// 老系统的
// 包件收货需要验证 收货单是否在系统中存在
boolean isUpdate = ouPaiFactoryService.checkReceivingOrder(orderCode);
if (!isUpdate) {
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>重新获取收货单信息 start>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
code = ouPaiFactoryService.saveOuPaiFactoryOrderDTOByCarCarNumber(orderCode);
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>重新获取收货单信息 end>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
try{
boolean isUpdate = ouPaiFactoryService.checkReceivingOrder(orderCode);
if (!isUpdate) {
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>重新获取收货单信息 start>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
code = ouPaiFactoryService.saveOuPaiFactoryOrderDTOByCarCarNumber(orderCode);
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>重新获取收货单信息 end>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
}
code = ouPaiFactoryService.saveOuPaiPackageStatusByCodeByOld(key, event, warehouseName);
}catch ( Exception e){
e.printStackTrace();
log.error(">>>>>>>>>>>>>>>>>>> 欧派收获错误 {}",ouPaiDataPushVO);
}
code = ouPaiFactoryService.saveOuPaiPackageStatusByCodeByOld(key, event, warehouseName);
} else if (event == 3) {
// 收货单创建
// 获取需要处理的数据并存入数据库

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

@ -94,6 +94,13 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
@Override
public String saveOuPaiFactoryOrderDTOByCarCarNumber(String code) {
String key = bladeRedis.get(RedisKeyConstant.cache_oupai_key + code);
if (ObjectUtils.isNull(key)) {
bladeRedis.setEx(RedisKeyConstant.cache_oupai_key + key, key, 60 * 60L);
} else {
log.info(">>>>>> 收货单 已存在 {}", code);
return code;
}
// 对返回i的数据进行处理 按照 发车单-->订单-->包件 完成保存
handleData(code);
if (ObjectUtils.isNotNull(code)) {
@ -162,9 +169,10 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
// saveOuPaiFactoryOrderDTOByCarCarNumber(orderCode);
// }
QueryWrapper<FactoryPackageEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("oid", key);
FactoryPackageEntity packageEntity = factoryPackageService.getOne(queryWrapper);
LambdaQueryWrapper<FactoryPackageEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(FactoryPackageEntity::getOid, key);
List<FactoryPackageEntity> list = factoryPackageService.list(queryWrapper);
String code = null;
String endWarehouseName = null;
String opShipNo = null;
@ -173,7 +181,7 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
String siteName = null;
String packageDetailNames = null;
String firstPackName, secondPackName, thirdPackName = null;
if (Objects.isNull(packageEntity)) {
if (Objects.isNull(list) || list.isEmpty()) {
// 需要对
log.warn("############oid 查询数据失败: {}", key);
@ -221,6 +229,7 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
}
} else {
FactoryPackageEntity packageEntity = list.get(0);
packageEntity.setPackageStatus(5);
factoryPackageService.updateById(packageEntity);
code = packageEntity.getCode();
@ -294,19 +303,11 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
Boolean isUpdate = false;
String o = bladeRedis.get(RedisKeyConstant.cache_oupai_key + code);
if(code.equals(o)){
return true;
}
LambdaQueryWrapper<ReceivingOrderEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ReceivingOrderEntity::getCode, code);
List<ReceivingOrderEntity> receivingOrderEntities = receivingOrderMapper.selectList(lambdaQueryWrapper);
if (ObjectUtils.isNotNull(receivingOrderEntities)) {
isUpdate = true;
// 加入缓存
bladeRedis.setEx(RedisKeyConstant.cache_oupai_key+code,code,60*60*60L);
}
return isUpdate;
}
@ -361,7 +362,7 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
String unitNo = orderStatusDTO.getUnitNo();
String operationTime = orderStatusDTO.getOperationTime();
// || "7".equals(status) 增加签收状态推送
if ("1".equals(status) || "2".equals(status) || "3".equals(status) || "5".equals(status) || "6".equals(status) || "8".equals(status) || "9".equals(status)) {
if ("2".equals(status) || "3".equals(status) || "5".equals(status) || "6".equals(status) || "8".equals(status) || "9".equals(status)) {
log.warn("#############oupai-handleStatusData: 当前数据的状态不推送 status={}", status);
return Resp.fail(400, "当前数据的状态不推送");
}
@ -427,7 +428,8 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
detailObject.put("WarehouseBelong", "oppein");
detailObject.put("Creator", orderStatusDTO.getUsername());
detailObject.put("PackageCode", unitNo);
if ("4".equals(status)) {
// 增加当仓直接入库的 就没有卸车收货的状态 直接 进行入库 入库就表示货物进入当前仓库
if ("4".equals(status) || "1".equals(status)) {
detailObject.put("Operate", "收货");
} else if ("7".equals(status)) {
detailObject.put("Operate", "发货");
@ -444,17 +446,20 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
// 推送数据
String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/PackageFeedbackRecord";
OpPackagePushLogEntity opPackagePushLogEntity = sendPushOuPaiData(factoryPackageEntity.getId(), url, 1, detailObject);
// 需要盘点这个对象的
String resp = opPackagePushLogEntity.getResp();
// 转换为json
// JSONObject respJson = JSONObject.parseObject(resp);
log.info(" >>>>>>>>>>>>>>>>>>>>>>> 推送欧派返回数据 {}", resp);
// TODO: 2023/10/25 不知道返回成功的状态是多少
// 需要修改包件对应的状态
factoryPackageEntity.setPushStatus(1);
factoryPackageService.updateById(factoryPackageEntity);
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);
}
}
return Resp.success("物流状态传递成功");
@ -583,20 +588,32 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
* @return
*/
private OpPackagePushLogEntity sendPushOuPaiData(Long refId, String url, Integer pushType, JSONObject data) {
OpPackagePushLogEntity opPackagePushLogEntity = new OpPackagePushLogEntity();
opPackagePushLogEntity.setArgs(data.toJSONString());
opPackagePushLogEntity.setPushType(pushType);
opPackagePushLogEntity.setUrl(url);
opPackagePushLogEntity.setRefId(refId);
opPackagePushLogEntity.setPushOupaiNode(data.getString("Operate"));
String token = buildToken();
HttpResponse httpResponse = HttpRequest.post(url).header("Authorization", token).body(data.toJSONString()).execute();
String result = httpResponse.body();
opPackagePushLogEntity.setResp(result);
opPackagePushLogService.save(opPackagePushLogEntity);
return opPackagePushLogEntity;
LambdaQueryWrapper<OpPackagePushLogEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(OpPackagePushLogEntity::getRefId, refId);
lambdaQueryWrapper.eq(OpPackagePushLogEntity::getPushOupaiNode, data.getString("Operate"));
List<OpPackagePushLogEntity> list = opPackagePushLogService.list(lambdaQueryWrapper);
if (ObjectUtils.isNull(list) || list.isEmpty()) {
OpPackagePushLogEntity opPackagePushLogEntity = new OpPackagePushLogEntity();
opPackagePushLogEntity.setArgs(data.toJSONString());
opPackagePushLogEntity.setPushType(pushType);
opPackagePushLogEntity.setUrl(url);
opPackagePushLogEntity.setRefId(refId);
opPackagePushLogEntity.setPushOupaiNode(data.getString("Operate"));
String token = buildToken();
HttpResponse httpResponse = HttpRequest.post(url).header("Authorization", token).body(data.toJSONString()).execute();
String result = httpResponse.body();
opPackagePushLogEntity.setResp(result);
opPackagePushLogService.save(opPackagePushLogEntity);
return opPackagePushLogEntity;
} else {
return null;
}
}
@ -607,6 +624,7 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
*/
private void handleData(String code) {
OpOrderStatusLogEntity opOrderStatusLogEntity = findOurPaiDataByCarNumber(code);
// 保存需要解析的数据
@ -618,6 +636,7 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
analyzeData(resultArray);
opOrderStatusLogEntity.setDataStatus(1);
} catch (Exception e) {
e.printStackTrace();
log.error(">>>> TAG {} error {}", FactoryConstant.OUPAI, e.getMessage());
opOrderStatusLogEntity.setDataStatus(2);
@ -647,13 +666,11 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
receivingOrderEntity.setCode(code);
LambdaQueryWrapper<ReceivingOrderEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ReceivingOrderEntity::getCode,code);
lambdaQueryWrapper.eq(ReceivingOrderEntity::getCode, code);
List<ReceivingOrderEntity> receivingOrderEntities = receivingOrderMapper.selectList(lambdaQueryWrapper);
if(ObjectUtils.isNotNull(receivingOrderEntities)){
log.info(">>>>>>>>>>>>>>>>>>>>>>> 收货单已存在 {} ",code);
return ;
if (ObjectUtils.isNotNull(receivingOrderEntities)) {
log.info(">>>>>>>>>>>>>>>>>>>>>>> 收货单已存在 {} ", code);
return;
}
String type = valueObject.getString("Type");
@ -823,7 +840,6 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
factoryOrderEntity.setTurnStatus(0);
//
@ -836,9 +852,8 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
//保存订单成功,继续保存包件
Long orderId = factoryOrderEntity.getId();
String packageCode = packageEntity.getString("Code");
QueryWrapper<FactoryPackageEntity> packageEntityQueryWrapper = new QueryWrapper<>();
packageEntityQueryWrapper.eq("code", packageCode);
LambdaQueryWrapper<FactoryPackageEntity> packageEntityQueryWrapper = new LambdaQueryWrapper<>();
packageEntityQueryWrapper.eq(FactoryPackageEntity::getCode, packageCode);
FactoryPackageEntity factoryPackageEntity = factoryPackageService.getOne(packageEntityQueryWrapper);

Loading…
Cancel
Save