|
|
|
@ -73,7 +73,6 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
private IOssClient ossClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String saveOuPaiFactoryOrderDTOByCarCarNumber(String code) { |
|
|
|
|
|
|
|
|
@ -104,18 +103,18 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
// handlePackageData(url, event);
|
|
|
|
|
//orderCode现在是包件码
|
|
|
|
|
QueryWrapper<FactoryPackageEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("oid",orderPackageCode); |
|
|
|
|
queryWrapper.eq("oid", orderPackageCode); |
|
|
|
|
FactoryPackageEntity packageEntity = factoryPackageService.getOne(queryWrapper); |
|
|
|
|
if(Objects.isNull(packageEntity)) { |
|
|
|
|
log.error("############oid 查询数据失败: {}",orderPackageCode); |
|
|
|
|
if (Objects.isNull(packageEntity)) { |
|
|
|
|
log.error("############oid 查询数据失败: {}", orderPackageCode); |
|
|
|
|
return orderPackageCode; |
|
|
|
|
} |
|
|
|
|
packageEntity.setPackageStatus(5); |
|
|
|
|
factoryPackageService.updateById(packageEntity); |
|
|
|
|
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
jo.put("orderPackageCode",packageEntity.getCode()); |
|
|
|
|
jo.put("receivingTime",CommonUtil.dateToString(packageEntity.getUpdateTime())); |
|
|
|
|
jo.put("orderPackageCode", packageEntity.getCode()); |
|
|
|
|
jo.put("receivingTime", CommonUtil.dateToString(packageEntity.getUpdateTime())); |
|
|
|
|
|
|
|
|
|
//真正的处理需要的数据
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
@ -135,33 +134,61 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String saveOuPaiPackageStatusByCodeByOld(String key, Integer event, String warehouseName) { |
|
|
|
|
QueryWrapper<FactoryPackageEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("oid",key); |
|
|
|
|
queryWrapper.eq("oid", key); |
|
|
|
|
FactoryPackageEntity packageEntity = factoryPackageService.getOne(queryWrapper); |
|
|
|
|
String code; |
|
|
|
|
if(Objects.isNull(packageEntity)) { |
|
|
|
|
log.error("############oid 查询数据失败: {}",key); |
|
|
|
|
String code=null; |
|
|
|
|
String endWarehouseName = 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)"; |
|
|
|
|
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); |
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(opOrderStatusLogEntity.getResponseBody()); |
|
|
|
|
|
|
|
|
|
code= jsonObject.getString("Code"); |
|
|
|
|
code = jsonObject.getString("Code"); |
|
|
|
|
JSONArray ls = jsonObject.getJSONArray("ReceivingOrders"); |
|
|
|
|
if(ls!=null&& !ls.isEmpty()){ |
|
|
|
|
JSONObject t = ls.getJSONObject(0); |
|
|
|
|
if(t!=null){ |
|
|
|
|
JSONObject endWarehouse = t.getJSONObject("EndWarehouse"); |
|
|
|
|
endWarehouseName = endWarehouse.getString("Name"); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
log.error("############没有收货单oid:{}", key); |
|
|
|
|
return key; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
packageEntity.setPackageStatus(5); |
|
|
|
|
factoryPackageService.updateById(packageEntity); |
|
|
|
|
code =packageEntity.getCode(); |
|
|
|
|
code = packageEntity.getCode(); |
|
|
|
|
|
|
|
|
|
Long orderId = packageEntity.getOrderId(); |
|
|
|
|
// 查询 订单
|
|
|
|
|
QueryWrapper<FactoryOrderEntity> queryWrapperFactoryOrderEntity = new QueryWrapper<>(); |
|
|
|
|
queryWrapperFactoryOrderEntity.eq("id", orderId); |
|
|
|
|
FactoryOrderEntity orderEntity = factoryOrderService.getOne(queryWrapperFactoryOrderEntity); |
|
|
|
|
// 查询 发货单
|
|
|
|
|
Long receivingId = orderEntity.getReceivingId(); |
|
|
|
|
ReceivingOrderEntity receivingEntity = receivingOrderMapper.selectById(receivingId); |
|
|
|
|
endWarehouseName = receivingEntity.getEndWarehouseName(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 判断 作业仓库 和 收货仓库 是否一致
|
|
|
|
|
log.info(" >>>> 判断作业仓库 和 收货仓库 是否一致 >>>> 作业仓库:{},收货仓库:{}", warehouseName, endWarehouseName); |
|
|
|
|
if (!warehouseName.equals(endWarehouseName)) { |
|
|
|
|
return key; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
jo.put("orderPackageCode",code); |
|
|
|
|
jo.put("warehouse_name",warehouseName); |
|
|
|
|
jo.put("orderPackageCode", code); |
|
|
|
|
jo.put("warehouse_name", warehouseName); |
|
|
|
|
|
|
|
|
|
//真正的处理需要的数据
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
@ -181,14 +208,10 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String saveOuPaiOutGoingOrderByCode(String orderCode, Integer event) { |
|
|
|
|
//
|
|
|
|
|
String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/OutGoingOrder?$filter=Code eq '"+orderCode+"'" + |
|
|
|
|
String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/OutGoingOrder?$filter=Code eq '" + orderCode + "'" + |
|
|
|
|
"&$select=Code,Status,Truck,DriverPhone,Platform,DeliveryDate,Creator,CreateTime,IsAdjust,SendTime," + |
|
|
|
|
"Customers,Volume" + |
|
|
|
|
"&$expand=Warehouse($select=Code,Name)" + |
|
|
|
@ -341,11 +364,7 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
log.info("############handleData: 数据处理开始"); |
|
|
|
|
analyzeData(resultArray); |
|
|
|
|
opOrderStatusLogEntity.setDataStatus(1); |
|
|
|
|
} catch (CustomerException e) { |
|
|
|
|
log.error(">>>> error {}", e.getMessage()); |
|
|
|
|
opOrderStatusLogEntity.setDataStatus(2); |
|
|
|
|
|
|
|
|
|
}catch (Exception e) { |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error(">>>> error {}", e.getMessage()); |
|
|
|
|
opOrderStatusLogEntity.setDataStatus(2); |
|
|
|
|
|
|
|
|
@ -358,7 +377,7 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
* |
|
|
|
|
* @param resultArray |
|
|
|
|
*/ |
|
|
|
|
private void analyzeData(JSONArray resultArray) { |
|
|
|
|
public void analyzeData(JSONArray resultArray) { |
|
|
|
|
Date start = new Date(); |
|
|
|
|
for (int i = 0; i < resultArray.size(); i++) { |
|
|
|
|
JSONObject valueObject = resultArray.getJSONObject(i); |
|
|
|
@ -376,8 +395,8 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
String type = valueObject.getString("Type"); |
|
|
|
|
if ("中转".equals(type)) { |
|
|
|
|
receivingOrderEntity.setType(1); |
|
|
|
|
log.warn("############handleData: 中转到货暂不接收"); |
|
|
|
|
throw new CustomerException(403,"中转到货暂不接收"); |
|
|
|
|
// log.warn("############handleData: 中转到货暂不接收");
|
|
|
|
|
// throw new CustomerException(403, "中转到货暂不接收");
|
|
|
|
|
} else if ("配送".equals(type)) { |
|
|
|
|
receivingOrderEntity.setType(2); |
|
|
|
|
} else { |
|
|
|
|