|
|
@ -6,15 +6,9 @@ import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
import com.logpm.factory.oupai.entity.FactoryOrderEntity; |
|
|
|
import com.logpm.factory.oupai.entity.*; |
|
|
|
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.mapper.ReceivingOrderMapper; |
|
|
|
import com.logpm.factory.oupai.service.IFactoryOrderService; |
|
|
|
import com.logpm.factory.oupai.service.*; |
|
|
|
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 com.logpm.factory.props.OuPaiProperties; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springblade.common.exception.CustomerException; |
|
|
|
import org.springblade.common.exception.CustomerException; |
|
|
@ -43,6 +37,9 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private IOpOrderStatusLogService opOrderStatusLogService; |
|
|
|
private IOpOrderStatusLogService opOrderStatusLogService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IFactoryPackageDetailService factoryPackageDetailService; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public String saveOuPaiFactoryOrderDTOByCarCarNumber(String carNumber) { |
|
|
|
public String saveOuPaiFactoryOrderDTOByCarCarNumber(String carNumber) { |
|
|
|
|
|
|
|
|
|
|
@ -204,7 +201,11 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { |
|
|
|
factoryOrderEntity.setReservationStatus(1); |
|
|
|
factoryOrderEntity.setReservationStatus(1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
factoryOrderEntity.setStoreName("");//TODO 没有找到门店字段
|
|
|
|
JSONObject store = orderEntity.getJSONObject("Store"); |
|
|
|
|
|
|
|
if(!Objects.isNull(store)){ |
|
|
|
|
|
|
|
factoryOrderEntity.setStoreCode(store.getString("Code")); |
|
|
|
|
|
|
|
factoryOrderEntity.setStoreName(store.getString("Name")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
factoryOrderEntity.setMatingCode(orderEntity.getString("MatingCode")); |
|
|
|
factoryOrderEntity.setMatingCode(orderEntity.getString("MatingCode")); |
|
|
|
Boolean isMating = orderEntity.getBoolean("IsMating"); |
|
|
|
Boolean isMating = orderEntity.getBoolean("IsMating"); |
|
|
@ -325,11 +326,30 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
factoryPackageEntity.setFreeze(0); |
|
|
|
factoryPackageEntity.setFreeze(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//保存包件信息
|
|
|
|
//保存包件信息
|
|
|
|
factoryPackageEntity.setReceiptStatus(0); |
|
|
|
factoryPackageEntity.setReceiptStatus(0); |
|
|
|
factoryPackageEntity.setPushStatus(0); |
|
|
|
factoryPackageEntity.setPushStatus(0); |
|
|
|
factoryPackageEntity.setTurnStatus(0); |
|
|
|
factoryPackageEntity.setTurnStatus(0); |
|
|
|
factoryPackageService.save(factoryPackageEntity); |
|
|
|
boolean save = factoryPackageService.save(factoryPackageEntity); |
|
|
|
|
|
|
|
if(save){ |
|
|
|
|
|
|
|
Long packageId = factoryPackageEntity.getId(); |
|
|
|
|
|
|
|
//保存物料信息
|
|
|
|
|
|
|
|
JSONArray packageDetails = packageEntity.getJSONArray("PackageDetails"); |
|
|
|
|
|
|
|
if(!Objects.isNull(packageDetails)){ |
|
|
|
|
|
|
|
for (int k = 0; k < packageDetails.size(); k++) { |
|
|
|
|
|
|
|
JSONObject packageDetailsJSONObject = packageDetails.getJSONObject(k); |
|
|
|
|
|
|
|
FactoryPackageDetailEntity factoryPackageDetailEntity = new FactoryPackageDetailEntity(); |
|
|
|
|
|
|
|
factoryPackageDetailEntity.setPackageId(packageId); |
|
|
|
|
|
|
|
factoryPackageDetailEntity.setCode(packageDetailsJSONObject.getString("Code")); |
|
|
|
|
|
|
|
factoryPackageDetailEntity.setName(packageDetailsJSONObject.getString("Name")); |
|
|
|
|
|
|
|
factoryPackageDetailEntity.setType(packageDetailsJSONObject.getString("Type")); |
|
|
|
|
|
|
|
factoryPackageDetailEntity.setUnit(packageDetailsJSONObject.getString("Unit")); |
|
|
|
|
|
|
|
factoryPackageDetailEntity.setOrgCode(packageDetailsJSONObject.getString("OrgCode")); |
|
|
|
|
|
|
|
factoryPackageDetailService.save(factoryPackageDetailEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
log.warn("############handleData: 包件码已存在 packageCode={}", packageCode); |
|
|
|
log.warn("############handleData: 包件码已存在 packageCode={}", packageCode); |
|
|
|
throw new CustomerException(403, "包件码已存在"); |
|
|
|
throw new CustomerException(403, "包件码已存在"); |
|
|
@ -357,11 +377,16 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private OpOrderStatusLogEntity 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,PackagesCount,ReceivePackageCount,PlateNum,CarNumber,CarrierCode,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=" + |
|
|
|
|
|
|
|
"Packages($select=Code,PdaNumber,FirstClassCode,FirstClassName,SecondClassCode,SecondClassName,ThirdClassCode,ThirdClassName,BuyIn,CosourcingCode,CosourcingUnit,SortingCenter,DistributionCenter,Length,Width,Height,Weight,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,PackageDetailNames;" + |
|
|
|
"$expand=Order($select=" + |
|
|
|
"$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" + |
|
|
|
"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" + |
|
|
|
"))&$expand=FromWarehouse($select=Name,Code)&$expand=CurrentWarehouse($select=Name,Code)&$expand=EndWarehouse($select=Name,Code)"; |
|
|
|
"$expand=Store($select=Name,Code))" + |
|
|
|
|
|
|
|
"&$expand=PackageDetails($select=Code,Name,OrgCode,OrgCode)" + |
|
|
|
|
|
|
|
"&$expand=CurrentWarehouse($select=Name,Code)" + |
|
|
|
|
|
|
|
"&$expand=SendWarehouse($select=Name,Code)" + |
|
|
|
|
|
|
|
")&$expand=FromWarehouse($select=Name,Code)&$expand=CurrentWarehouse($select=Name,Code)&$expand=EndWarehouse($select=Name,Code)"; |
|
|
|
|
|
|
|
|
|
|
|
log.info(">>> findOurPaiDataByCarNumber url {}", url); |
|
|
|
log.info(">>> findOurPaiDataByCarNumber url {}", url); |
|
|
|
|
|
|
|
|
|
|
|