|
|
|
@ -5,17 +5,14 @@ import cn.hutool.http.HttpResponse;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
|
import com.logpm.factory.comfac.service.IAsyncDataService; |
|
|
|
|
import com.logpm.factory.oupai.entity.*; |
|
|
|
|
import com.logpm.factory.oupai.mapper.ReceivingOrderMapper; |
|
|
|
|
import com.logpm.factory.oupai.service.*; |
|
|
|
|
import com.logpm.factory.oupai.vo.OpOrderStatusLogVO; |
|
|
|
|
import com.logpm.factory.props.OuPaiProperties; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.fileupload.FileItem; |
|
|
|
|
import org.apache.commons.fileupload.disk.DiskFileItem; |
|
|
|
|
import org.apache.commons.fileupload.disk.DiskFileItemFactory; |
|
|
|
|
import org.apache.commons.io.IOUtils; |
|
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
@ -27,7 +24,6 @@ import org.springblade.core.oss.model.BladeFile;
|
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.resource.feign.IOssClient; |
|
|
|
|
import org.springframework.amqp.rabbit.core.RabbitTemplate; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.http.MediaType; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
@ -89,25 +85,50 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
@Override |
|
|
|
|
public String saveOuPaiPackageStatusByCode(String orderCode, Integer event) { |
|
|
|
|
//
|
|
|
|
|
String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/ReceivingOrder?$filter=Code eq '" + orderCode + "'&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,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=" + |
|
|
|
|
"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=Store($select=Name,Code))" + |
|
|
|
|
"&$expand=PackageDetails($select=Code,Name,Type,Unit,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)"; |
|
|
|
|
// String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/ReceivingOrder?$filter=Code eq '" + orderCode + "'&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,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=" +
|
|
|
|
|
// "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=Store($select=Name,Code))" +
|
|
|
|
|
// "&$expand=PackageDetails($select=Code,Name,Type,Unit,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)";
|
|
|
|
|
//
|
|
|
|
|
// handlePackageData(url, event);
|
|
|
|
|
//orderCode现在是包件码
|
|
|
|
|
QueryWrapper<FactoryPackageEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("oid",orderCode); |
|
|
|
|
FactoryPackageEntity packageEntity = factoryPackageService.getOne(queryWrapper); |
|
|
|
|
packageEntity.setPackageStatus(5); |
|
|
|
|
factoryPackageService.updateById(packageEntity); |
|
|
|
|
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
jo.put("orderPackageCode",orderCode); |
|
|
|
|
jo.put("receivingTime",CommonUtil.dateToString(packageEntity.getUpdateTime())); |
|
|
|
|
|
|
|
|
|
//真正的处理需要的数据
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put("messageId", CommonUtil.getUUID()); |
|
|
|
|
map.put("type", "Push"); |
|
|
|
|
map.put("messageData", jo.toJSONString()); |
|
|
|
|
map.put("createTime", new Date().getTime()); |
|
|
|
|
try { |
|
|
|
|
rabbitTemplate.convertAndSend(RabbitConstant.OUPAI_RECEIVING_EXCHANGE, RabbitConstant.OUPAI_RECEIVING_ROUTING, map); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("############saveOuPaiPackageStatusByCode: {}", e.getMessage()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
log.info("############saveOuPaiPackageStatusByCode: 数据处理结束"); |
|
|
|
|
|
|
|
|
|
handlePackageData(url, event); |
|
|
|
|
return orderCode; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String saveOuPaiOutGoingOrderByCode(String orderCode, Integer event) { |
|
|
|
|
//
|
|
|
|
|
String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/OutGoingOrder?$filter=Code eq 'PS20230802-6'" + |
|
|
|
|
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)" + |
|
|
|
@ -459,6 +480,7 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
factoryPackageEntity = new FactoryPackageEntity(); |
|
|
|
|
factoryPackageEntity.setOrderId(orderId); |
|
|
|
|
factoryPackageEntity.setCode(packageCode); |
|
|
|
|
factoryPackageEntity.setOid(packageEntity.getString("Oid")); |
|
|
|
|
factoryPackageEntity.setFirstClassCode(packageEntity.getString("FirstClassCode")); |
|
|
|
|
factoryPackageEntity.setFirstClassName(packageEntity.getString("FirstClassName")); |
|
|
|
|
factoryPackageEntity.setSecondClassCode(packageEntity.getString("SecondClassCode")); |
|
|
|
@ -577,7 +599,7 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
|
|
|
|
|
|
|
|
|
|
String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/ReceivingOrder?$filter=Code eq '" + code + "'&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,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;" + |
|
|
|
|
"Packages($select=Oid,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=" + |
|
|
|
|
"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=Store($select=Name,Code;$expand=Shop))" + |
|
|
|
|