|
|
|
@ -8,10 +8,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
|
import com.logpm.factory.oupai.entity.FactoryOrderEntity; |
|
|
|
|
import com.logpm.factory.oupai.entity.FactoryPackageEntity; |
|
|
|
|
import com.logpm.factory.oupai.entity.OpOrderStatusLogEntity; |
|
|
|
|
import com.logpm.factory.oupai.entity.ReceivingOrderEntity; |
|
|
|
|
import com.logpm.factory.oupai.mapper.ReceivingOrderMapper; |
|
|
|
|
import com.logpm.factory.oupai.service.IFactoryOrderService; |
|
|
|
|
import com.logpm.factory.oupai.service.IFactoryPackageService; |
|
|
|
|
import com.logpm.factory.oupai.service.IOpOrderStatusLogService; |
|
|
|
|
import com.logpm.factory.oupai.service.IOuPaiFactoryService; |
|
|
|
|
import com.logpm.factory.props.OuPaiProperties; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
@ -38,31 +40,57 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
@Autowired |
|
|
|
|
private IFactoryPackageService factoryPackageService; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void findOuPaiFactoryOrderDTOByCarCarNumber(String carNumber) { |
|
|
|
|
|
|
|
|
|
// 查询工厂数据
|
|
|
|
|
@Autowired |
|
|
|
|
private IOpOrderStatusLogService opOrderStatusLogService; |
|
|
|
|
|
|
|
|
|
JSONArray ourPaiDataByCarNumber = findOurPaiDataByCarNumber(carNumber); |
|
|
|
|
@Override |
|
|
|
|
public String saveOuPaiFactoryOrderDTOByCarCarNumber(String carNumber) { |
|
|
|
|
|
|
|
|
|
// 对返回i的数据进行处理 按照 发车单-->订单-->包件 完成保存
|
|
|
|
|
handleData(ourPaiDataByCarNumber); |
|
|
|
|
handleData(carNumber); |
|
|
|
|
|
|
|
|
|
return carNumber; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 处理返回的JSON数据 |
|
|
|
|
* @param ourPaiDataByCarNumber |
|
|
|
|
* |
|
|
|
|
* @param carNumber |
|
|
|
|
*/ |
|
|
|
|
private void handleData(JSONArray ourPaiDataByCarNumber) { |
|
|
|
|
log.info("############handleData: 数据处理开始"); |
|
|
|
|
private void handleData(String carNumber) { |
|
|
|
|
|
|
|
|
|
OpOrderStatusLogEntity opOrderStatusLogEntity = findOurPaiDataByCarNumber(carNumber); |
|
|
|
|
|
|
|
|
|
// 保存需要解析的数据
|
|
|
|
|
// 获取返回内容
|
|
|
|
|
try { |
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(opOrderStatusLogEntity.getArgs()); |
|
|
|
|
JSONArray resultArray = jsonObject.getJSONArray("value"); |
|
|
|
|
log.info("############handleData: 数据处理开始"); |
|
|
|
|
analyzeData(resultArray); |
|
|
|
|
opOrderStatusLogEntity.setDataStatus(1); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error(">>>> error {}", e.getMessage()); |
|
|
|
|
opOrderStatusLogEntity.setDataStatus(2); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
opOrderStatusLogService.saveOrUpdate(opOrderStatusLogEntity); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 解析数据 |
|
|
|
|
* |
|
|
|
|
* @param resultArray |
|
|
|
|
*/ |
|
|
|
|
private void analyzeData(JSONArray resultArray) { |
|
|
|
|
Date start = new Date(); |
|
|
|
|
//循环出来jsonArray
|
|
|
|
|
for (int i=0;i<ourPaiDataByCarNumber.size();i++){ |
|
|
|
|
JSONObject valueObject = ourPaiDataByCarNumber.getJSONObject(i); |
|
|
|
|
if(Objects.isNull(valueObject)){ |
|
|
|
|
for (int i = 0; i < resultArray.size(); i++) { |
|
|
|
|
JSONObject valueObject = resultArray.getJSONObject(i); |
|
|
|
|
if (Objects.isNull(valueObject)) { |
|
|
|
|
log.warn("############handleData: value中没有数据"); |
|
|
|
|
throw new CustomerException(403,"value中没有数据"); |
|
|
|
|
throw new CustomerException(403, "value中没有数据"); |
|
|
|
|
} |
|
|
|
|
JSONObject fromWarehouse = valueObject.getJSONObject("FromWarehouse"); |
|
|
|
|
JSONObject currentWarehouse = valueObject.getJSONObject("CurrentWarehouse"); |
|
|
|
@ -72,22 +100,22 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
ReceivingOrderEntity receivingOrderEntity = new ReceivingOrderEntity(); |
|
|
|
|
receivingOrderEntity.setCode(code); |
|
|
|
|
String type = valueObject.getString("Type"); |
|
|
|
|
if("中转".equals(type)){ |
|
|
|
|
if ("中转".equals(type)) { |
|
|
|
|
receivingOrderEntity.setType(1); |
|
|
|
|
}else if("配送".equals(type)){ |
|
|
|
|
} else if ("配送".equals(type)) { |
|
|
|
|
receivingOrderEntity.setType(2); |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
receivingOrderEntity.setType(0); |
|
|
|
|
} |
|
|
|
|
if(!Objects.isNull(currentWarehouse)){ |
|
|
|
|
if (!Objects.isNull(currentWarehouse)) { |
|
|
|
|
receivingOrderEntity.setCurrentWarehouseCode(currentWarehouse.getString("Code")); |
|
|
|
|
receivingOrderEntity.setCurrentWarehouseName(currentWarehouse.getString("Name")); |
|
|
|
|
} |
|
|
|
|
if(!Objects.isNull(fromWarehouse)){ |
|
|
|
|
if (!Objects.isNull(fromWarehouse)) { |
|
|
|
|
receivingOrderEntity.setFromWarehouseCode(fromWarehouse.getString("Code")); |
|
|
|
|
receivingOrderEntity.setCurrentWarehouseName(fromWarehouse.getString("Name")); |
|
|
|
|
} |
|
|
|
|
if(!Objects.isNull(endWarehouse)){ |
|
|
|
|
if (!Objects.isNull(endWarehouse)) { |
|
|
|
|
receivingOrderEntity.setEndWarehouseCode(endWarehouse.getString("Code")); |
|
|
|
|
receivingOrderEntity.setEndWarehouseName(endWarehouse.getString("Name")); |
|
|
|
|
} |
|
|
|
@ -95,13 +123,13 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
receivingOrderEntity.setPackagesCount(valueObject.getInteger("PackagesCount")); |
|
|
|
|
receivingOrderEntity.setReceivePackageCount(valueObject.getInteger("ReceivePackageCount")); |
|
|
|
|
String status = valueObject.getString("Status"); |
|
|
|
|
if("待收货".equals(status)){ |
|
|
|
|
if ("待收货".equals(status)) { |
|
|
|
|
receivingOrderEntity.setFactoryStatus("0"); |
|
|
|
|
}else if("已收货".equals(status)){ |
|
|
|
|
} else if ("已收货".equals(status)) { |
|
|
|
|
receivingOrderEntity.setFactoryStatus("1"); |
|
|
|
|
}else if("收货中".equals(status)){ |
|
|
|
|
} else if ("收货中".equals(status)) { |
|
|
|
|
receivingOrderEntity.setFactoryStatus("2"); |
|
|
|
|
}else if("已跳过".equals(status)){ |
|
|
|
|
} else if ("已跳过".equals(status)) { |
|
|
|
|
receivingOrderEntity.setFactoryStatus("3"); |
|
|
|
|
} |
|
|
|
|
receivingOrderEntity.setPlate(valueObject.getString("Plate")); |
|
|
|
@ -116,9 +144,11 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
receivingOrderEntity.setReceiptStatus(0); |
|
|
|
|
receivingOrderEntity.setPushStatus(0); |
|
|
|
|
receivingOrderEntity.setTurnStatus(0); |
|
|
|
|
receivingOrderEntity.setIsDeleted(0); |
|
|
|
|
receivingOrderEntity.setCreateTime(new Date()); |
|
|
|
|
int row = receivingOrderMapper.insert(receivingOrderEntity); |
|
|
|
|
if(row == 1){ |
|
|
|
|
log.info("############handleData: 保存发货单数据 成功成功成功成功 code={}",code); |
|
|
|
|
if (row == 1) { |
|
|
|
|
log.info("############handleData: 保存发货单数据 成功成功成功成功 code={}", code); |
|
|
|
|
Long receivingId = receivingOrderEntity.getId();//发货单id
|
|
|
|
|
JSONArray packages = valueObject.getJSONArray("Packages"); |
|
|
|
|
for (int j = 0; j < packages.size(); j++) { |
|
|
|
@ -127,7 +157,8 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
String selfCode = orderEntity.getString("SelfCode");//订单自编码
|
|
|
|
|
//先查询是否存在订单自编码
|
|
|
|
|
FactoryOrderEntity factoryOrderEntity = factoryOrderService.selectEntityBySelfCode(selfCode); |
|
|
|
|
if(Objects.isNull(factoryOrderEntity)){ |
|
|
|
|
|
|
|
|
|
if (Objects.isNull(factoryOrderEntity)) { |
|
|
|
|
factoryOrderEntity = new FactoryOrderEntity(); |
|
|
|
|
factoryOrderEntity.setCode(orderEntity.getString("Code")); |
|
|
|
|
factoryOrderEntity.setSelfCode(selfCode); |
|
|
|
@ -136,58 +167,58 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
factoryOrderEntity.setOrderClass(orderEntity.getString("OrderClass")); |
|
|
|
|
factoryOrderEntity.setOrderType(orderEntity.getString("OrderType")); |
|
|
|
|
String factoryStatus = orderEntity.getString("Status"); |
|
|
|
|
if("待送货".equals(factoryStatus)){ |
|
|
|
|
if ("待送货".equals(factoryStatus)) { |
|
|
|
|
factoryOrderEntity.setFactoryStatus(0); |
|
|
|
|
}else if("已签收".equals(factoryStatus)){ |
|
|
|
|
} else if ("已签收".equals(factoryStatus)) { |
|
|
|
|
factoryOrderEntity.setFactoryStatus(2); |
|
|
|
|
}else if("已取消".equals(factoryStatus)){ |
|
|
|
|
} else if ("已取消".equals(factoryStatus)) { |
|
|
|
|
factoryOrderEntity.setFactoryStatus(3); |
|
|
|
|
}else if("部分签收".equals(factoryStatus)){ |
|
|
|
|
} else if ("部分签收".equals(factoryStatus)) { |
|
|
|
|
factoryOrderEntity.setFactoryStatus(6); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String factoryShipStatus = orderEntity.getString("FactoryShipStatus"); |
|
|
|
|
if("工厂未发货".equals(factoryShipStatus)){ |
|
|
|
|
if ("工厂未发货".equals(factoryShipStatus)) { |
|
|
|
|
factoryOrderEntity.setFactoryShipStatus(0); |
|
|
|
|
}else if("工厂部分发货".equals(factoryShipStatus)){ |
|
|
|
|
} else if ("工厂部分发货".equals(factoryShipStatus)) { |
|
|
|
|
factoryOrderEntity.setFactoryShipStatus(1); |
|
|
|
|
}else if("工厂齐套发货".equals(factoryShipStatus)){ |
|
|
|
|
} else if ("工厂齐套发货".equals(factoryShipStatus)) { |
|
|
|
|
factoryOrderEntity.setFactoryShipStatus(2); |
|
|
|
|
} |
|
|
|
|
factoryOrderEntity.setFactorySendQty(orderEntity.getInteger("FactorySendQty")); |
|
|
|
|
|
|
|
|
|
String warehouseReceiveStatus = orderEntity.getString("WarehouseReceiveStatus"); |
|
|
|
|
if("仓库未收货".equals(warehouseReceiveStatus)){ |
|
|
|
|
if ("仓库未收货".equals(warehouseReceiveStatus)) { |
|
|
|
|
factoryOrderEntity.setWarehouseReceiveStatus(0); |
|
|
|
|
}else if("仓库部分收货".equals(warehouseReceiveStatus)){ |
|
|
|
|
} else if ("仓库部分收货".equals(warehouseReceiveStatus)) { |
|
|
|
|
factoryOrderEntity.setWarehouseReceiveStatus(1); |
|
|
|
|
}else if("仓库全部收货".equals(warehouseReceiveStatus)){ |
|
|
|
|
} else if ("仓库全部收货".equals(warehouseReceiveStatus)) { |
|
|
|
|
factoryOrderEntity.setWarehouseReceiveStatus(2); |
|
|
|
|
} |
|
|
|
|
factoryOrderEntity.setWarehouseReceiveQty(orderEntity.getInteger("WarehouseReceiveQty")); |
|
|
|
|
|
|
|
|
|
String reservationStatus = orderEntity.getString("ReservationStatus"); |
|
|
|
|
if("不可预约".equals(reservationStatus)){ |
|
|
|
|
if ("不可预约".equals(reservationStatus)) { |
|
|
|
|
factoryOrderEntity.setReservationStatus(0); |
|
|
|
|
}else if("可预约".equals(reservationStatus)){ |
|
|
|
|
} else if ("可预约".equals(reservationStatus)) { |
|
|
|
|
factoryOrderEntity.setReservationStatus(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
factoryOrderEntity.setStore("");//TODO 没有找到门店字段
|
|
|
|
|
factoryOrderEntity.setStoreName("");//TODO 没有找到门店字段
|
|
|
|
|
|
|
|
|
|
factoryOrderEntity.setMatingCode(orderEntity.getString("MatingCode")); |
|
|
|
|
Boolean isMating = orderEntity.getBoolean("IsMating"); |
|
|
|
|
if(isMating){ |
|
|
|
|
if (isMating) { |
|
|
|
|
factoryOrderEntity.setIsMating(1); |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
factoryOrderEntity.setIsMating(0); |
|
|
|
|
} |
|
|
|
|
factoryOrderEntity.setFirstClassCode(orderEntity.getString("FirstClassCode")); |
|
|
|
|
Boolean leave = orderEntity.getBoolean("Leave"); |
|
|
|
|
if(leave){ |
|
|
|
|
factoryOrderEntity.setLeave(1); |
|
|
|
|
}else{ |
|
|
|
|
factoryOrderEntity.setLeave(0); |
|
|
|
|
if (leave) { |
|
|
|
|
factoryOrderEntity.setLeaveStatus(1); |
|
|
|
|
} else { |
|
|
|
|
factoryOrderEntity.setLeaveStatus(0); |
|
|
|
|
} |
|
|
|
|
factoryOrderEntity.setCustomer(orderEntity.getString("Customer")); |
|
|
|
|
factoryOrderEntity.setProvince(orderEntity.getString("Province")); |
|
|
|
@ -202,9 +233,9 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
factoryOrderEntity.setFirstReceiveTime(orderEntity.getDate("FirstReceiveTime")); |
|
|
|
|
factoryOrderEntity.setMatingReceiveTime(orderEntity.getDate("MatingReceiveTime")); |
|
|
|
|
Boolean freeze = orderEntity.getBoolean("Freeze"); |
|
|
|
|
if(freeze){ |
|
|
|
|
if (freeze) { |
|
|
|
|
factoryOrderEntity.setFreeze(1); |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
factoryOrderEntity.setFreeze(0); |
|
|
|
|
} |
|
|
|
|
factoryOrderEntity.setOutGoingTime(orderEntity.getDate("OutGoingTime")); |
|
|
|
@ -214,117 +245,119 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
factoryOrderEntity.setPushStatus(0); |
|
|
|
|
factoryOrderEntity.setTurnStatus(0); |
|
|
|
|
boolean save = factoryOrderService.save(factoryOrderEntity); |
|
|
|
|
if(save){ |
|
|
|
|
//保存订单成功,继续保存包件
|
|
|
|
|
Long orderId = factoryOrderEntity.getId(); |
|
|
|
|
String packageCode = packageEntity.getString("Code"); |
|
|
|
|
QueryWrapper<FactoryPackageEntity> packageEntityQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
packageEntityQueryWrapper.eq("code",packageCode); |
|
|
|
|
FactoryPackageEntity factoryPackageEntity = factoryPackageService.getOne(packageEntityQueryWrapper); |
|
|
|
|
if(Objects.isNull(factoryPackageEntity)){ |
|
|
|
|
factoryPackageEntity = new FactoryPackageEntity(); |
|
|
|
|
factoryPackageEntity.setOrderId(orderId); |
|
|
|
|
factoryPackageEntity.setCode(packageCode); |
|
|
|
|
factoryPackageEntity.setFirstClassCode(packageEntity.getString("FirstClassCode")); |
|
|
|
|
factoryPackageEntity.setFirstClassCode(packageEntity.getString("FirstClassName")); |
|
|
|
|
factoryPackageEntity.setSecondClassCode(packageEntity.getString("SecondClassCode")); |
|
|
|
|
factoryPackageEntity.setSecondClassName(packageEntity.getString("secondClassName")); |
|
|
|
|
factoryPackageEntity.setThirdClassCode(packageEntity.getString("ThirdClassCode")); |
|
|
|
|
factoryPackageEntity.setThirdClassName(packageEntity.getString("ThirdClassName")); |
|
|
|
|
Boolean buyIn = packageEntity.getBoolean("BuyIn"); |
|
|
|
|
if(buyIn){ |
|
|
|
|
factoryPackageEntity.setBuyin(1); |
|
|
|
|
}else{ |
|
|
|
|
factoryPackageEntity.setBuyin(0); |
|
|
|
|
} |
|
|
|
|
factoryPackageEntity.setCosourcingCode(packageEntity.getString("CosourcingCode")); |
|
|
|
|
factoryPackageEntity.setCosourcingUnit(packageEntity.getString("CosourcingUnit")); |
|
|
|
|
String packageStatus = packageEntity.getString("PackageStatus"); |
|
|
|
|
//未知:0 已调度:1 已装车:2 待收货:3 已收货:4 已在库:5 待理货:6 待上架:7 已上架:8 已下架:9 已发运:10 已签收:11 待返货:12 已提件:13 已拒收:14 异常:-1
|
|
|
|
|
if("已调度".equals(packageStatus)){ |
|
|
|
|
factoryPackageEntity.setPackageStatus(1); |
|
|
|
|
}else if("已装车".equals(packageStatus)){ |
|
|
|
|
factoryPackageEntity.setPackageStatus(2); |
|
|
|
|
}else if("待收货".equals(packageStatus)){ |
|
|
|
|
factoryPackageEntity.setPackageStatus(3); |
|
|
|
|
}else if("已收货".equals(packageStatus)){ |
|
|
|
|
factoryPackageEntity.setPackageStatus(4); |
|
|
|
|
}else if("已在库".equals(packageStatus)){ |
|
|
|
|
factoryPackageEntity.setPackageStatus(5); |
|
|
|
|
}else if("待理货".equals(packageStatus)){ |
|
|
|
|
factoryPackageEntity.setPackageStatus(6); |
|
|
|
|
}else if("待上架".equals(packageStatus)){ |
|
|
|
|
factoryPackageEntity.setPackageStatus(7); |
|
|
|
|
}else if("已上架".equals(packageStatus)){ |
|
|
|
|
factoryPackageEntity.setPackageStatus(8); |
|
|
|
|
}else if("已下架".equals(packageStatus)){ |
|
|
|
|
factoryPackageEntity.setPackageStatus(9); |
|
|
|
|
}else if("已发运".equals(packageStatus)){ |
|
|
|
|
factoryPackageEntity.setPackageStatus(10); |
|
|
|
|
}else if("已签收".equals(packageStatus)){ |
|
|
|
|
factoryPackageEntity.setPackageStatus(11); |
|
|
|
|
}else if("待返货".equals(packageStatus)){ |
|
|
|
|
factoryPackageEntity.setPackageStatus(12); |
|
|
|
|
}else if("已提件".equals(packageStatus)){ |
|
|
|
|
factoryPackageEntity.setPackageStatus(13); |
|
|
|
|
}else if("已拒收".equals(packageStatus)){ |
|
|
|
|
factoryPackageEntity.setPackageStatus(14); |
|
|
|
|
}else if("异常".equals(packageStatus)){ |
|
|
|
|
factoryPackageEntity.setPackageStatus(-1); |
|
|
|
|
}else{ |
|
|
|
|
factoryPackageEntity.setPackageStatus(0); |
|
|
|
|
} |
|
|
|
|
factoryPackageEntity.setLength(packageEntity.getBigDecimal("Length")); |
|
|
|
|
factoryPackageEntity.setWidth(packageEntity.getBigDecimal("Width")); |
|
|
|
|
factoryPackageEntity.setHeight(packageEntity.getBigDecimal("Height")); |
|
|
|
|
factoryPackageEntity.setWeight(packageEntity.getBigDecimal("Weight")); |
|
|
|
|
Boolean isInventory = packageEntity.getBoolean("IsInventory"); |
|
|
|
|
if(isInventory){ |
|
|
|
|
factoryPackageEntity.setIsInventory(1); |
|
|
|
|
}else{ |
|
|
|
|
factoryPackageEntity.setIsInventory(0); |
|
|
|
|
} |
|
|
|
|
Boolean packageFreeze = packageEntity.getBoolean("Freeze"); |
|
|
|
|
if(packageFreeze){ |
|
|
|
|
factoryPackageEntity.setFreeze(1); |
|
|
|
|
}else{ |
|
|
|
|
factoryPackageEntity.setFreeze(0); |
|
|
|
|
} |
|
|
|
|
//保存包件信息
|
|
|
|
|
factoryPackageService.save(factoryPackageEntity); |
|
|
|
|
}else{ |
|
|
|
|
log.warn("############handleData: 包件码已存在 packageCode={}",packageCode); |
|
|
|
|
throw new CustomerException(403,"包件码已存在"); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
log.warn("############handleData: 保存订单失败 selfCode={}",selfCode); |
|
|
|
|
throw new CustomerException(403,"保存订单失败"); |
|
|
|
|
if (!save) { |
|
|
|
|
log.warn("############handleData: 保存订单失败 selfCode={}", selfCode); |
|
|
|
|
throw new CustomerException(403, "保存订单失败"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//保存订单成功,继续保存包件
|
|
|
|
|
Long orderId = factoryOrderEntity.getId(); |
|
|
|
|
String packageCode = packageEntity.getString("Code"); |
|
|
|
|
QueryWrapper<FactoryPackageEntity> packageEntityQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
packageEntityQueryWrapper.eq("code", packageCode); |
|
|
|
|
FactoryPackageEntity factoryPackageEntity = factoryPackageService.getOne(packageEntityQueryWrapper); |
|
|
|
|
if (Objects.isNull(factoryPackageEntity)) { |
|
|
|
|
factoryPackageEntity = new FactoryPackageEntity(); |
|
|
|
|
factoryPackageEntity.setOrderId(orderId); |
|
|
|
|
factoryPackageEntity.setCode(packageCode); |
|
|
|
|
factoryPackageEntity.setFirstClassCode(packageEntity.getString("FirstClassCode")); |
|
|
|
|
factoryPackageEntity.setFirstClassCode(packageEntity.getString("FirstClassName")); |
|
|
|
|
factoryPackageEntity.setSecondClassCode(packageEntity.getString("SecondClassCode")); |
|
|
|
|
factoryPackageEntity.setSecondClassName(packageEntity.getString("secondClassName")); |
|
|
|
|
factoryPackageEntity.setThirdClassCode(packageEntity.getString("ThirdClassCode")); |
|
|
|
|
factoryPackageEntity.setThirdClassName(packageEntity.getString("ThirdClassName")); |
|
|
|
|
Boolean buyIn = packageEntity.getBoolean("BuyIn"); |
|
|
|
|
if (buyIn) { |
|
|
|
|
factoryPackageEntity.setBuyin(1); |
|
|
|
|
} else { |
|
|
|
|
factoryPackageEntity.setBuyin(0); |
|
|
|
|
} |
|
|
|
|
factoryPackageEntity.setCosourcingCode(packageEntity.getString("CosourcingCode")); |
|
|
|
|
factoryPackageEntity.setCosourcingUnit(packageEntity.getString("CosourcingUnit")); |
|
|
|
|
String packageStatus = packageEntity.getString("PackageStatus"); |
|
|
|
|
//未知:0 已调度:1 已装车:2 待收货:3 已收货:4 已在库:5 待理货:6 待上架:7 已上架:8 已下架:9 已发运:10 已签收:11 待返货:12 已提件:13 已拒收:14 异常:-1
|
|
|
|
|
if ("已调度".equals(packageStatus)) { |
|
|
|
|
factoryPackageEntity.setPackageStatus(1); |
|
|
|
|
} else if ("已装车".equals(packageStatus)) { |
|
|
|
|
factoryPackageEntity.setPackageStatus(2); |
|
|
|
|
} else if ("待收货".equals(packageStatus)) { |
|
|
|
|
factoryPackageEntity.setPackageStatus(3); |
|
|
|
|
} else if ("已收货".equals(packageStatus)) { |
|
|
|
|
factoryPackageEntity.setPackageStatus(4); |
|
|
|
|
} else if ("已在库".equals(packageStatus)) { |
|
|
|
|
factoryPackageEntity.setPackageStatus(5); |
|
|
|
|
} else if ("待理货".equals(packageStatus)) { |
|
|
|
|
factoryPackageEntity.setPackageStatus(6); |
|
|
|
|
} else if ("待上架".equals(packageStatus)) { |
|
|
|
|
factoryPackageEntity.setPackageStatus(7); |
|
|
|
|
} else if ("已上架".equals(packageStatus)) { |
|
|
|
|
factoryPackageEntity.setPackageStatus(8); |
|
|
|
|
} else if ("已下架".equals(packageStatus)) { |
|
|
|
|
factoryPackageEntity.setPackageStatus(9); |
|
|
|
|
} else if ("已发运".equals(packageStatus)) { |
|
|
|
|
factoryPackageEntity.setPackageStatus(10); |
|
|
|
|
} else if ("已签收".equals(packageStatus)) { |
|
|
|
|
factoryPackageEntity.setPackageStatus(11); |
|
|
|
|
} else if ("待返货".equals(packageStatus)) { |
|
|
|
|
factoryPackageEntity.setPackageStatus(12); |
|
|
|
|
} else if ("已提件".equals(packageStatus)) { |
|
|
|
|
factoryPackageEntity.setPackageStatus(13); |
|
|
|
|
} else if ("已拒收".equals(packageStatus)) { |
|
|
|
|
factoryPackageEntity.setPackageStatus(14); |
|
|
|
|
} else if ("异常".equals(packageStatus)) { |
|
|
|
|
factoryPackageEntity.setPackageStatus(-1); |
|
|
|
|
} else { |
|
|
|
|
factoryPackageEntity.setPackageStatus(0); |
|
|
|
|
} |
|
|
|
|
factoryPackageEntity.setLength(packageEntity.getBigDecimal("Length")); |
|
|
|
|
factoryPackageEntity.setWidth(packageEntity.getBigDecimal("Width")); |
|
|
|
|
factoryPackageEntity.setHeight(packageEntity.getBigDecimal("Height")); |
|
|
|
|
factoryPackageEntity.setWeight(packageEntity.getBigDecimal("Weight")); |
|
|
|
|
Boolean isInventory = packageEntity.getBoolean("IsInventory"); |
|
|
|
|
if (isInventory) { |
|
|
|
|
factoryPackageEntity.setIsInventory(1); |
|
|
|
|
} else { |
|
|
|
|
factoryPackageEntity.setIsInventory(0); |
|
|
|
|
} |
|
|
|
|
Boolean packageFreeze = packageEntity.getBoolean("Freeze"); |
|
|
|
|
if (packageFreeze) { |
|
|
|
|
factoryPackageEntity.setFreeze(1); |
|
|
|
|
} else { |
|
|
|
|
factoryPackageEntity.setFreeze(0); |
|
|
|
|
} |
|
|
|
|
//保存包件信息
|
|
|
|
|
factoryPackageEntity.setReceiptStatus(0); |
|
|
|
|
factoryPackageEntity.setPushStatus(0); |
|
|
|
|
factoryPackageEntity.setTurnStatus(0); |
|
|
|
|
factoryPackageService.save(factoryPackageEntity); |
|
|
|
|
} else { |
|
|
|
|
log.warn("############handleData: 包件码已存在 packageCode={}", packageCode); |
|
|
|
|
throw new CustomerException(403, "包件码已存在"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
log.warn("############handleData: 保存发货单数据失败 code={}",code); |
|
|
|
|
throw new CustomerException(403,"保存发货单数据失败"); |
|
|
|
|
} else { |
|
|
|
|
log.warn("############handleData: 保存发货单数据失败 code={}", code); |
|
|
|
|
throw new CustomerException(403, "保存发货单数据失败"); |
|
|
|
|
} |
|
|
|
|
Date end = new Date(); |
|
|
|
|
long startLong = start.getTime(); |
|
|
|
|
long endLong = end.getTime(); |
|
|
|
|
long l = endLong - startLong; |
|
|
|
|
log.info("############handleData: 数据处理完成 耗时 {} 毫秒",l); |
|
|
|
|
log.info("############handleData: 数据处理完成 耗时 {} 毫秒", l); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 请求工厂返回的的数据 |
|
|
|
|
* |
|
|
|
|
* @param carNumber |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private JSONArray findOurPaiDataByCarNumber(String carNumber) { |
|
|
|
|
private OpOrderStatusLogEntity findOurPaiDataByCarNumber(String carNumber) { |
|
|
|
|
|
|
|
|
|
String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/ReceivingOrder?$filter=CarNumber eq '"+carNumber+"'&select=Code,Type,Status,Plate,PlateNum,CarNumber,CarrierCode,PackagesCount,ReceivePackageCount,SendTime,ArrivalTime,ReceiveTime,CreateTime,ReturnNumber\n" + |
|
|
|
|
String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/ReceivingOrder?$filter=CarNumber eq '" + carNumber + "'&select=Code,Type,Status,Plate,PlateNum,CarNumber,CarrierCode,PackagesCount,ReceivePackageCount,SendTime,ArrivalTime,ReceiveTime,CreateTime,ReturnNumber\n" + |
|
|
|
|
"&$expand=Packages($select=Code,PdaNumber,FirstClassCode,FirstClassName,SecondClassCode,SecondClassName,ThirdClassCode,ThirdClassName,BuyIn,CosourcingCode,CosourcingUnit,SortingCenter,DistributionCenter,Length,Width,Height,Weight,PackageDetails,OrderDetail,Order,PathIndex,PathDetail,DeliveryOrders,ReceivingOrders,LPN,LpnSerialNum,IsEntruck,ReservationOrder,OutGoingOrderDetail,SignBill,IsInventory,Inventories,InventoryInDetails,Freeze,OutGoingOrderDetailInventoryDetail,From,Creator,CreateTime,ShipTime,CarNumber,DeliveryMethod,DeliveryReceiver,DeliveryReceiverPhone,ReturnNumber,GroupType,CarrierCode,CarrierName,PackageDetailNames,ReceivingTime,SendTime,ExceptionSignRemark,Descript,SignTime,OutOrder,IsReceiveByHand,PackageStatus;\n" + |
|
|
|
|
"$expand=Order($select=" + |
|
|
|
|
"Code,SelfCode,ContractNumber,ServiceNumber,OrderClass,OrderType,Status,FactoryShipStatus,FactorySendQty,WarehouseReceiveStatus,WarehouseReceiveQty,ReservationStatus,Store,MatingCode,IsMating,FirstClassCode,Leave,Customer,Province,City,CustomerAddress,CustomerPhone,ShopReceiver,BrandCode,BrandName,From,OutGoingTime,CreateTime,Freeze,FirstShipTime,MatingShipTime,FirstReceiveTime,MatingReceiveTime\n" + |
|
|
|
@ -339,10 +372,17 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
|
|
|
|
|
String result = httpResponse.body(); |
|
|
|
|
log.info(">>> findOurPaiDataByCarNumber result {}", result); |
|
|
|
|
// 获取返回内容
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result); |
|
|
|
|
JSONArray resultArray = jsonObject.getJSONArray("value"); |
|
|
|
|
return resultArray; |
|
|
|
|
|
|
|
|
|
OpOrderStatusLogEntity orderStatusLog = new OpOrderStatusLogEntity(); |
|
|
|
|
orderStatusLog.setArgs(result); |
|
|
|
|
orderStatusLog.setStatus(1); |
|
|
|
|
orderStatusLog.setType(1); |
|
|
|
|
orderStatusLog.setDataStatus(0); |
|
|
|
|
orderStatusLog.setBrand("欧派"); |
|
|
|
|
opOrderStatusLogService.save(orderStatusLog); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return orderStatusLog; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|