|
|
|
@ -141,22 +141,49 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
FactoryPackageEntity packageEntity = factoryPackageService.getOne(queryWrapper); |
|
|
|
|
String code=null; |
|
|
|
|
String endWarehouseName = null; |
|
|
|
|
String opShipNo=null; |
|
|
|
|
String orderSelfNum =null; |
|
|
|
|
String carNumber=null; |
|
|
|
|
String siteName = null; |
|
|
|
|
String packageDetailNames = null; |
|
|
|
|
String firstPackName,secondPackName,thirdPackName = null; |
|
|
|
|
if (Objects.isNull(packageEntity)) { |
|
|
|
|
log.error("############oid 查询数据失败: {}", key); |
|
|
|
|
// 查询欧派系统的的数据
|
|
|
|
|
String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/Package(" + key + ")?select=Code,PackageStatus,FirstClassCode,FirstClassName,SecondClassCode,SecondClassName,ThirdClassCode,ThirdClassName,BuyIn,CosourcingCode,CosourcingUnit,Length,Width,Height,Weight,IsInventory,SendTime,ReceivingTime,CreateTime,ShipTime,CarNumber,DeliveryMethod&$expand=ReceivingOrders($select=Code,Type,Status,Plate,PackagesCount,ReceivePackageCount,PlateNum,CarNumber,CarrierCode,SendTime,ArrivalTime,ReceiveTime,CreateTime,ReturnNumber;$expand=EndWarehouse($select=Name,Code))"; |
|
|
|
|
OpOrderStatusLogEntity opOrderStatusLogEntity = sendRequestData(url, event); |
|
|
|
|
String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/Package(" + key + ")?select=Code,PackageStatus,FirstClassCode,FirstClassName,SecondClassCode,SecondClassName,ThirdClassCode,ThirdClassName,BuyIn,CosourcingCode,CosourcingUnit,Length,Width,Height,Weight,IsInventory,SendTime,ReceivingTime,CreateTime,ShipTime,CarNumber,DeliveryMethod&$expand=ReceivingOrders($select=Code,Type,Status,Plate,PackagesCount,ReceivePackageCount,PlateNum,CarNumber,CarrierCode,SendTime,ArrivalTime,ReceiveTime,CreateTime,ReturnNumber;$expand=EndWarehouse($select=Name,Code))&$expand=Order($select=SelfCode,Code)"; OpOrderStatusLogEntity opOrderStatusLogEntity = sendRequestData(url, event); |
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(opOrderStatusLogEntity.getResponseBody()); |
|
|
|
|
|
|
|
|
|
code = jsonObject.getString("Code"); |
|
|
|
|
Boolean isInventory = jsonObject.getBoolean("IsInventory"); |
|
|
|
|
carNumber = jsonObject.getString("CarNumber"); |
|
|
|
|
packageDetailNames = jsonObject.getString("PackageDetailNames"); |
|
|
|
|
firstPackName = jsonObject.getString("FirstPackName"); |
|
|
|
|
secondPackName = jsonObject.getString("SecondPackName"); |
|
|
|
|
thirdPackName = jsonObject.getString("ThirdPackName"); |
|
|
|
|
|
|
|
|
|
if(isInventory){ |
|
|
|
|
log.error("############库存品数据 不进行推送: {}", code); |
|
|
|
|
return key; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
JSONObject order = jsonObject.getJSONObject("Order"); |
|
|
|
|
if (order != null){ |
|
|
|
|
orderSelfNum = order.getString("SelfCode"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
JSONArray ls = jsonObject.getJSONArray("ReceivingOrders"); |
|
|
|
|
if(ls!=null&& !ls.isEmpty()){ |
|
|
|
|
JSONObject t = ls.getJSONObject(0); |
|
|
|
|
if(t!=null){ |
|
|
|
|
opShipNo = t.getString("Code"); |
|
|
|
|
JSONObject endWarehouse = t.getJSONObject("EndWarehouse"); |
|
|
|
|
endWarehouseName = endWarehouse.getString("Name"); |
|
|
|
|
|
|
|
|
|
JSONObject fromWarehouse = t.getJSONObject("FromWarehouse"); |
|
|
|
|
siteName = fromWarehouse.getString("Name"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
log.error("############没有收货单oid:{}", key); |
|
|
|
|
return key; |
|
|
|
@ -166,18 +193,28 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
packageEntity.setPackageStatus(5); |
|
|
|
|
factoryPackageService.updateById(packageEntity); |
|
|
|
|
code = packageEntity.getCode(); |
|
|
|
|
packageDetailNames =packageEntity.getPackageDetailNames(); |
|
|
|
|
|
|
|
|
|
firstPackName = packageEntity.getFirstClassName(); |
|
|
|
|
secondPackName = packageEntity.getSecondClassName(); |
|
|
|
|
thirdPackName = packageEntity.getThirdClassName(); |
|
|
|
|
|
|
|
|
|
Long orderId = packageEntity.getOrderId(); |
|
|
|
|
// 查询 订单
|
|
|
|
|
QueryWrapper<FactoryOrderEntity> queryWrapperFactoryOrderEntity = new QueryWrapper<>(); |
|
|
|
|
queryWrapperFactoryOrderEntity.eq("id", orderId); |
|
|
|
|
FactoryOrderEntity orderEntity = factoryOrderService.getOne(queryWrapperFactoryOrderEntity); |
|
|
|
|
orderSelfNum = orderEntity.getSelfCode(); |
|
|
|
|
// 查询 发货单
|
|
|
|
|
Long receivingId = orderEntity.getReceivingId(); |
|
|
|
|
ReceivingOrderEntity receivingEntity = receivingOrderMapper.selectById(receivingId); |
|
|
|
|
endWarehouseName = receivingEntity.getEndWarehouseName(); |
|
|
|
|
} |
|
|
|
|
opShipNo = receivingEntity.getCode(); |
|
|
|
|
carNumber = receivingEntity.getCarNumber(); |
|
|
|
|
// 发货基地
|
|
|
|
|
siteName = receivingEntity.getFromWarehouseName(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 判断 作业仓库 和 收货仓库 是否一致
|
|
|
|
|
log.info(" >>>> 判断作业仓库 和 收货仓库 是否一致 >>>> 作业仓库:{},收货仓库:{}", warehouseName, endWarehouseName); |
|
|
|
@ -189,6 +226,14 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
jo.put("orderPackageCode", code); |
|
|
|
|
jo.put("warehouse_name", warehouseName); |
|
|
|
|
jo.put("opShipNo", opShipNo); |
|
|
|
|
jo.put("orderSelfNum", orderSelfNum); |
|
|
|
|
jo.put("carNumber", carNumber); |
|
|
|
|
jo.put("siteName", siteName); |
|
|
|
|
jo.put("packageDetailNames", packageDetailNames); |
|
|
|
|
jo.put("firstPackName", firstPackName); |
|
|
|
|
jo.put("secondPackName", secondPackName); |
|
|
|
|
jo.put("thirdPackName", thirdPackName); |
|
|
|
|
|
|
|
|
|
//真正的处理需要的数据
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|