diff --git a/ds-wms-service/DS.Module.Core/ServiceExtensions/DsAppWebInstall.cs b/ds-wms-service/DS.Module.Core/ServiceExtensions/DsAppWebInstall.cs
index 27a23668..b1e4620d 100644
--- a/ds-wms-service/DS.Module.Core/ServiceExtensions/DsAppWebInstall.cs
+++ b/ds-wms-service/DS.Module.Core/ServiceExtensions/DsAppWebInstall.cs
@@ -68,7 +68,7 @@ public static class DsAppWebInstall
// 忽略循环引用
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
// 忽略空值
- // options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
+ options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
})
;
//添加FluentValidation验证
diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingAI/BookingAIReq.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingAI/BookingAIReq.cs
new file mode 100644
index 00000000..83c5d99e
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingAI/BookingAIReq.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DS.WMS.Core.Op.Dtos.BookingAI
+{
+ public class BookingAIReq
+ {
+ ///
+ /// 平台代码
+ ///
+ public string Platform { get; set; } = "QWEN";
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingAI/ContainersItemRes.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingAI/ContainersItemRes.cs
new file mode 100644
index 00000000..689486fb
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingAI/ContainersItemRes.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DS.WMS.Core.Op.Dtos.BookingAI
+{
+ ///
+ ///
+ ///
+ public class ContainersItemRes
+ {
+ ///
+ /// 箱量
+ ///
+ public string CartonQuantity { get; set; }
+ ///
+ /// 箱型
+ ///
+ public string BoxPile { get; set; }
+ ///
+ /// 尺寸
+ ///
+ public string Size { get; set; }
+ ///
+ /// 毛重
+ ///
+ public string GrossWeight { get; set; }
+ ///
+ /// 箱皮重
+ ///
+ public string TareWeight { get; set; }
+ ///
+ /// 危品票标示
+ ///
+ public string IODGT { get; set; }
+ ///
+ /// 危品票:等级
+ ///
+ public string IODGTLevel { get; set; }
+ ///
+ /// 冷柜:温度
+ ///
+ public string Temperature { get; set; }
+ ///
+ /// 冷柜:通风
+ ///
+ public string Ventilate { get; set; }
+ ///
+ /// 特殊装载需求
+ ///
+ public string SpecialLoadingRequirement { get; set; }
+ ///
+ /// 提箱场站
+ ///
+ public string SuitcaseTterminal { get; set; }
+ ///
+ /// 提箱时间
+ ///
+ public string SuitcaseTime { get; set; }
+ ///
+ /// 还箱场站
+ ///
+ public string ReturnDepot { get; set; }
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingAI/ParseItemRes.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingAI/ParseItemRes.cs
new file mode 100644
index 00000000..eb2dc69a
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingAI/ParseItemRes.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DS.WMS.Core.Op.Dtos.BookingAI
+{
+ ///
+ /// AI识别返回结果
+ ///
+ public class ParseItemRes
+ {
+ ///
+ /// 响应码
+ ///
+ public int Code { get; set; }
+
+ ///
+ /// 提示信息
+ ///
+ public string Msg { get; set; }
+
+ public List Data { get; set; }
+ }
+
+
+}
diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingAI/ParseItemRes_List.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingAI/ParseItemRes_List.cs
new file mode 100644
index 00000000..30443fc3
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingAI/ParseItemRes_List.cs
@@ -0,0 +1,186 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DS.WMS.Core.Op.Dtos.BookingAI
+{
+ ///
+ ///
+ ///
+ public class ParseItemRes_List
+ {
+
+ ///
+ /// 订舱单位
+ ///
+ public string BookingParty { get; set; }
+
+ ///
+ /// 业务类型
+ ///
+ public string BusinessType { get; set; }
+ ///
+ /// 发货人
+ ///
+ public string Shipper { get; set; }
+ ///
+ /// 收货人
+ ///
+ public string Consigner { get; set; }
+ ///
+ /// 通知人
+ ///
+ public string NotifyParty { get; set; }
+ ///
+ /// BC更新次数
+ ///
+ public string BCUpdateTimes { get; set; }
+ ///
+ /// BC更新时间
+ ///
+ public string BCUpdateTime { get; set; }
+ ///
+ /// 提单号
+ ///
+ public string BLNo { get; set; }
+ ///
+ /// 参考号
+ ///
+ public string ReferenceNo { get; set; }
+ ///
+ /// 船名
+ ///
+ public string Vessel { get; set; }
+ ///
+ /// 航次
+ ///
+ public string Voyage { get; set; }
+ ///
+ /// 船公司
+ ///
+ public string ShippingCompany { get; set; }
+ ///
+ /// 收货地
+ ///
+ public string PlaceOfReceipt { get; set; }
+ ///
+ /// 装货港
+ ///
+ public string LoadingPort { get; set; }
+ ///
+ /// 截关时间
+ ///
+ public string ClosingDate { get; set; }
+ ///
+ /// 截VGM时间
+ ///
+ public string VGMCutOffTime { get; set; }
+ ///
+ /// ETA
+ ///
+ public string ETA { get; set; }
+ ///
+ /// ETD
+ ///
+ public string ETD { get; set; }
+ ///
+ /// 卸货港
+ ///
+ public string DischargingPort { get; set; }
+ ///
+ /// 交货地
+ ///
+ public string DeliveryPlace { get; set; }
+ ///
+ /// 目的港ETA
+ ///
+ public string PortOfDestinationETA { get; set; }
+ ///
+ /// 装运方式
+ ///
+ public string ShippingWay { get; set; }
+ ///
+ /// 运输条款
+ ///
+ public string ShippingTerms { get; set; }
+ ///
+ /// 港前运输形态
+ ///
+ public string PreportTransportationMode { get; set; }
+ ///
+ /// 品名
+ ///
+ public string OfTheGoods { get; set; }
+ ///
+ /// 签单地点
+ ///
+ public string SignTheBillLocation { get; set; }
+ ///
+ /// 集港码头
+ ///
+ public string CollectionTerminal { get; set; }
+ ///
+ /// 约号
+ ///
+ public string AboutNo { get; set; }
+ ///
+ /// 预付地点
+ ///
+ public string PlaceInAdvance { get; set; }
+
+ ///
+ /// 船代
+ ///
+ public string ShipAgency { get; set; }
+
+ ///
+ /// 货代
+ ///
+ public string FreightForwarder { get; set; }
+
+ ///
+ /// 场站
+ ///
+ public string Station { get; set; }
+ ///
+ /// 场站联系人
+ ///
+ public string StationContact { get; set; }
+ ///
+ /// 场站联系电话
+ ///
+ public string StationContactNumber { get; set; }
+ ///
+ /// 截单时间
+ ///
+ public string CutSingleTime { get; set; }
+ ///
+ /// 一代客服姓名
+ ///
+ public string FirstCustomerServiceName { get; set; }
+ ///
+ /// 一代客服电话
+ ///
+ public string FirstCustomerServiceNumber { get; set; }
+ ///
+ /// 一代客服邮箱
+ ///
+ public string FirstCustomerServiceEmail { get; set; }
+ ///
+ /// 订舱单位
+ ///
+ public string CYCutOffTime { get; set; }
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+
+ ///
+ /// 箱信息
+ ///
+ public List Containers { get; set; }
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingAI/SeaExportAIRes.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingAI/SeaExportAIRes.cs
new file mode 100644
index 00000000..0ff3d0b1
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingAI/SeaExportAIRes.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DS.WMS.Core.Op.Dtos.BookingAI
+{
+ public class SeaExportAIRes : SeaExportRes
+ {
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportRes.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportRes.cs
index 9a1bf9fc..73fd6123 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportRes.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportRes.cs
@@ -297,7 +297,7 @@ public class SeaExportRes
public string ReceiptPlace { get; set; }
///
- /// 装货港Id
+ /// 收货地Id
///
public long ReceiptPlaceId { get; set; }
diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportAIService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportAIService.cs
new file mode 100644
index 00000000..cc7aaf98
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportAIService.cs
@@ -0,0 +1,21 @@
+using DS.Module.Core;
+using DS.WMS.Core.Op.Dtos.BookingAI;
+using Microsoft.AspNetCore.Http;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DS.WMS.Core.Op.Interface
+{
+ public interface ISeaExportAIService
+ {
+ ///
+ /// 获取AI文件解析内容
+ ///
+ ///
+ ///
+ public Task> GetBookingAIResultAsync(IFormFile file);
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportAIService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportAIService.cs
new file mode 100644
index 00000000..b82297f3
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportAIService.cs
@@ -0,0 +1,430 @@
+using DS.Module.Core;
+using DS.Module.Core.Extensions;
+using DS.Module.SqlSugar;
+using DS.Module.UserModule;
+using DS.WMS.Core.Code.Entity;
+using DS.WMS.Core.Info.Entity;
+using DS.WMS.Core.Invoice.Dtos;
+using DS.WMS.Core.Op.Dtos;
+using DS.WMS.Core.Op.Dtos.BookingAI;
+using DS.WMS.Core.Op.Interface;
+using DS.WMS.Core.Sys.Entity;
+using LanguageExt.Pipes;
+using MathNet.Numerics;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.DependencyInjection;
+using Newtonsoft.Json;
+using NPOI.OpenXmlFormats.Dml.Diagram;
+using SqlSugar;
+
+namespace DS.WMS.Core.Op.Method
+{
+ public class SeaExportAIService: ISeaExportAIService
+ {
+ private readonly IServiceProvider _serviceProvider;
+ private readonly ISqlSugarClient db;
+ private readonly IUser user;
+ private readonly ISaasDbService saasService;
+
+
+ ///
+ ///
+ ///
+ ///
+ public SeaExportAIService(IServiceProvider serviceProvider)
+ {
+ _serviceProvider = serviceProvider;
+ db = _serviceProvider.GetRequiredService();
+ user = _serviceProvider.GetRequiredService();
+ saasService = _serviceProvider.GetRequiredService();
+ }
+
+
+ public async Task> GetBookingAIResultAsync(IFormFile file)
+ {
+ var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
+ //未上传文件
+ if (file == null || file.Length == 0)
+ {
+ return await Task.FromResult(DataResult.Failed("上传文件不存在!"));
+ }
+
+ var config = await db.Queryable().Filter(null, true).Where(x => x.Code == "booking_ai_api_url" && x.Status == StatusEnum.Enable).FirstAsync();
+ if (config.IsNull())
+ {
+ return await Task.FromResult(DataResult.Failed("booking_ai_api_url接口地址未配置!"));
+ }
+ var url = config.Value;
+ var originalFilename = file.FileName; // 文件原始名称
+ var ms = new MemoryStream();
+ await file.CopyToAsync(ms);
+ //使用HttpClient方式上传文件
+ ms.Position = 0;
+ var formData = new MultipartFormDataContent();
+ formData.Add(new StreamContent(ms, (int)ms.Length), "file", originalFilename);
+ formData.Add(new StringContent("QWEN"), "platform");
+ var _httpclient = new HttpClient();
+ var response = await _httpclient.PostAsync(url, formData);
+ if (response.IsSuccessStatusCode)
+ {
+ var strRtn = response.Content.ReadAsStringAsync().Result;
+ var res = JsonConvert.DeserializeObject(strRtn);
+ if (res.Code == 200)
+ {
+ Console.WriteLine(res.Data);
+ var result = await DealAIData(res,tenantDb);
+ //return await Task.FromResult(DataResult.Success(newFile.FileName));
+ return await Task.FromResult(DataResult.Success(result));
+ }
+ else
+ {
+ return await Task.FromResult(DataResult.Failed(res.Msg));
+ }
+ }
+ else
+ {
+ return await Task.FromResult(DataResult.Failed("请求AI文件解析接口错误,请联系管理员!"));
+ }
+ }
+
+ public async Task DealAIData(ParseItemRes req,SqlSugarScopeProvider tenantDb) {
+ var aiInfo = req.Data[0];
+ var info = new SeaExportAIRes() {
+
+ Id = 0,
+ ParentId = 0,
+ BusinessStatus = "Uncommitted",
+ BusinessStatusName = "未提交",
+ CustomerNo = "",
+ MBLNO = aiInfo.BLNo,
+ BookingNo = aiInfo.ReferenceNo,
+ Voyno = aiInfo.Voyage,
+ ClosingDate = String.IsNullOrEmpty(aiInfo.ClosingDate)? null : DateTime.Parse(aiInfo.ClosingDate),
+ VGMCloseDate = String.IsNullOrEmpty(aiInfo.VGMCutOffTime) ? null : DateTime.Parse(aiInfo.VGMCutOffTime),
+ ETA = String.IsNullOrEmpty(aiInfo.ETA) ? null : DateTime.Parse(aiInfo.ETA),
+ ETD = String.IsNullOrEmpty(aiInfo.ETD) ? null : DateTime.Parse(aiInfo.ETD),
+ CloseDocDate = String.IsNullOrEmpty(aiInfo.CutSingleTime) ? null : DateTime.Parse(aiInfo.CutSingleTime),
+ Remark = aiInfo.Remark,
+ Service = aiInfo.ShippingTerms,
+ ServiceContractNo =aiInfo.AboutNo,
+ YardATTN = aiInfo.StationContact,
+ YardTel = aiInfo.StationContactNumber,
+ //PortOfDestinationETA ShippingWay PreportTransportationMode CollectionTerminal CYCutOffTime
+ };
+ //委托单位
+ if (!String.IsNullOrEmpty(aiInfo.BookingParty))
+ {
+ var client = await tenantDb.Queryable().Where(a => a.Description.Contains(aiInfo.BookingParty) && SqlFunc.Subqueryable().Where(
+ b => b.ClientId == a.Id && b.Value == "isController").Any()).FirstAsync();
+
+ if (client.IsNotNull())
+ {
+ info.CustomerId = client.Id;
+ info.CustomerName = client.ShortName;
+ }
+ else
+ {
+ info.CustomerName = aiInfo.BookingParty;
+ }
+ }
+
+ //发货人
+ if (!String.IsNullOrEmpty(aiInfo.Shipper))
+ {
+ var client = await tenantDb.Queryable().Where(a => a.Description.Contains(aiInfo.Shipper) && SqlFunc.Subqueryable().Where(
+ b => b.ClientId == a.Id && b.Value == "isShipper").Any()).FirstAsync();
+
+ if (client.IsNotNull())
+ {
+ info.ShipperId = client.Id;
+ info.Shipper = client.ShortName;
+ }
+ else
+ {
+ info.Shipper = aiInfo.Shipper;
+ }
+ }
+ //收货人
+ if (!String.IsNullOrEmpty(aiInfo.Consigner))
+ {
+ var client = await tenantDb.Queryable().Where(a => a.Description.Contains(aiInfo.Consigner) && SqlFunc.Subqueryable().Where(
+ b => b.ClientId == a.Id && b.Value == "isConsigner").Any()).FirstAsync();
+
+ if (client.IsNotNull())
+ {
+ info.ConsigneeId = client.Id;
+ info.Consignee = client.ShortName;
+ }
+ else
+ {
+ info.Consignee = aiInfo.Consigner;
+ }
+ }
+ //通知人
+ if (!String.IsNullOrEmpty(aiInfo.NotifyParty))
+ {
+ var client = await tenantDb.Queryable().Where(a => a.Description.Contains(aiInfo.NotifyParty) && SqlFunc.Subqueryable().Where(
+ b => b.ClientId == a.Id && b.Value == "isNotifyParty").Any()).FirstAsync();
+
+ if (client.IsNotNull())
+ {
+ info.NotifyPartyId = client.Id;
+ info.NotifyParty = client.ShortName;
+ }
+ else
+ {
+ info.NotifyParty = aiInfo.NotifyParty;
+ }
+ }
+ //船名
+ if (!String.IsNullOrEmpty(aiInfo.Vessel))
+ {
+ var vessel = await tenantDb.Queryable().Where(a => a.VesselName.Contains(aiInfo.Vessel)).FirstAsync();
+
+ if (vessel.IsNotNull())
+ {
+ info.VesselId = vessel.Id;
+ info.Vessel = vessel.VesselName;
+ }
+ else
+ {
+ info.Vessel = aiInfo.Vessel;
+ }
+ }
+ //船公司
+ if (!String.IsNullOrEmpty(aiInfo.ShippingCompany))
+ {
+ var client = await tenantDb.Queryable().Where(a => a.EnName.Contains(aiInfo.ShippingCompany) ).FirstAsync();
+
+ if (client.IsNotNull())
+ {
+ info.CarrierId = client.Id;
+ info.Carrier = client.EdiCode;
+ }
+ else
+ {
+ info.Carrier = aiInfo.ShippingCompany;
+ }
+ }
+ //收货地
+ if (!String.IsNullOrEmpty(aiInfo.PlaceOfReceipt))
+ {
+ var port = await tenantDb.Queryable().Where(a => a.PortName.Contains(aiInfo.PlaceOfReceipt)).FirstAsync();
+
+ if (port.IsNotNull())
+ {
+ info.ReceiptPlaceId = port.Id;
+ info.ReceiptPlace = port.PortName;
+ info.ReceiptPlaceCode = port.EdiCode;
+ }
+ else
+ {
+ info.ReceiptPlace = aiInfo.PlaceOfReceipt;
+ }
+ }
+ //装货港
+ if (!String.IsNullOrEmpty(aiInfo.LoadingPort))
+ {
+ var port = await tenantDb.Queryable().Where(a => a.PortName.Contains(aiInfo.LoadingPort)).FirstAsync();
+
+ if (port.IsNotNull())
+ {
+ info.LoadPortId = port.Id;
+ info.LoadPort = port.PortName;
+ info.LoadPortCode = port.EdiCode;
+ }
+ else
+ {
+ info.LoadPort = aiInfo.LoadingPort;
+ }
+ }
+ //卸货港
+ if (!String.IsNullOrEmpty(aiInfo.DischargingPort))
+ {
+ var port = await tenantDb.Queryable().Where(a => a.PortName.Contains(aiInfo.DischargingPort)).FirstAsync();
+
+ if (port.IsNotNull())
+ {
+ info.DischargePortId = port.Id;
+ info.DischargePort = port.PortName;
+ info.DischargePortCode = port.EdiCode;
+ }
+ else
+ {
+ info.DischargePort = aiInfo.DischargingPort;
+ }
+ }
+ //交货地
+ if (!String.IsNullOrEmpty(aiInfo.DeliveryPlace))
+ {
+ var port = await tenantDb.Queryable().Where(a => a.PortName.Contains(aiInfo.DeliveryPlace)).FirstAsync();
+
+ if (port.IsNotNull())
+ {
+ info.DeliveryPlaceId = port.Id;
+ info.DeliveryPlace = port.PortName;
+ info.DeliveryPlaceCode = port.EdiCode;
+ }
+ else
+ {
+ info.DeliveryPlace = aiInfo.DeliveryPlace;
+ }
+ }
+ //品名
+ if (!String.IsNullOrEmpty(aiInfo.OfTheGoods))
+ {
+ var good = await tenantDb.Queryable().Where(a => a.GoodName.Contains(aiInfo.OfTheGoods)).FirstAsync();
+
+ if (good.IsNotNull())
+ {
+ info.GoodsId = good.Id;
+ info.GoodsName = good.GoodName;
+ info.HSCode = good.HSCode;
+ }
+ else
+ {
+ info.GoodsName = aiInfo.OfTheGoods;
+ }
+ }
+ //签单地
+ if (!String.IsNullOrEmpty(aiInfo.SignTheBillLocation))
+ {
+ var port = await tenantDb.Queryable().Where(a => a.PortName.Contains(aiInfo.SignTheBillLocation)).FirstAsync();
+
+ if (port.IsNotNull())
+ {
+ info.IssuePlaceId = port.Id;
+ info.IssuePlace = port.PortName;
+ info.IssuePlaceCode = port.EdiCode;
+ }
+ else
+ {
+ info.IssuePlace = aiInfo.SignTheBillLocation;
+ }
+ }
+ //预付地
+ if (!String.IsNullOrEmpty(aiInfo.PlaceInAdvance))
+ {
+ var port = await tenantDb.Queryable().Where(a => a.PortName.Contains(aiInfo.PlaceInAdvance)).FirstAsync();
+
+ if (port.IsNotNull())
+ {
+ info.PayableAtId = port.Id;
+ info.PayableAt = port.PortName;
+ info.PayableAtCode = port.EdiCode;
+ }
+ else
+ {
+ info.PayableAt = aiInfo.PlaceInAdvance;
+ }
+ }
+ //船代
+ if (!String.IsNullOrEmpty(aiInfo.ShipAgency))
+ {
+ var client = await tenantDb.Queryable().Where(a => a.Description.Contains(aiInfo.ShipAgency) && SqlFunc.Subqueryable().Where(
+ b => b.ClientId == a.Id && b.Value == "isShipAgency").Any()).FirstAsync();
+
+ if (client.IsNotNull())
+ {
+ info.ShipAgencyId = client.Id;
+ info.ShipAgency = client.ShortName;
+ }
+ else
+ {
+ info.ShipAgency = aiInfo.ShipAgency;
+ }
+ }
+ //货代
+ if (!String.IsNullOrEmpty(aiInfo.FreightForwarder))
+ {
+ var client = await tenantDb.Queryable().Where(a => a.Description.Contains(aiInfo.ShipAgency) && SqlFunc.Subqueryable().Where(
+ b => b.ClientId == a.Id && b.Value == "isBooking").Any()).FirstAsync();
+
+ if (client.IsNotNull())
+ {
+ info.ForwarderId = client.Id;
+ info.Forwarder = client.ShortName;
+ }
+ else
+ {
+ info.Forwarder = aiInfo.FreightForwarder;
+ }
+ }
+
+ //场站
+ if (!String.IsNullOrEmpty(aiInfo.Station))
+ {
+ var client = await tenantDb.Queryable().Where(a => a.Description.Contains(aiInfo.Station) && SqlFunc.Subqueryable().Where(
+ b => b.ClientId == a.Id && b.Value == "isYard").Any()).FirstAsync();
+
+ if (client.IsNotNull())
+ {
+ info.YardId = client.Id;
+ info.Yard = client.ShortName;
+ }
+ else
+ {
+ info.Yard = aiInfo.Station;
+ }
+ }
+ //客服
+ if (!String.IsNullOrEmpty(aiInfo.FirstCustomerServiceName))
+ {
+ var service = await db.Queryable().Where(a => a.UserEnName.Contains(aiInfo.FirstCustomerServiceName) ).FirstAsync();
+
+ if (service.IsNotNull())
+ {
+ info.CustomerService = service.Id;
+ info.CustomerServiceName = service.UserEnName;
+ }
+ else
+ {
+ info.CustomerServiceName = aiInfo.FirstCustomerServiceName;
+ }
+ }
+ //集装箱信息
+ if (aiInfo.Containers.IsNotNull() && aiInfo.Containers.Count>0)
+ {
+ var ctnList = new List();
+ var ctns = await tenantDb.Queryable().ToListAsync();
+ foreach (var item in aiInfo.Containers)
+ {
+ var ctnInfo = ctns.FirstOrDefault(x => x.CtnName == item.BoxPile.Replace("'", ""));
+ if (ctnInfo.IsNotNull()) {
+
+ ctnList.Add(new OpCtnRes()
+ {
+ Id = 0,
+ BSNO ="",
+ CtnId = ctnInfo.Id,
+ CtnCode = ctnInfo.EdiCode,
+ Ctn = ctnInfo.CtnName,
+ CtnNum = int.Parse(item.CartonQuantity),
+ Size = item.Size,
+ KGS = !String.IsNullOrEmpty(item.GrossWeight) ? decimal.Parse(item.GrossWeight.Replace(" KGM", "")) :0,
+ TareWeight = !String.IsNullOrEmpty(item.TareWeight) ? decimal.Parse(item.TareWeight.Replace(" KGM", "")) : 0,
+ });
+ }
+ else
+ {
+ ctnList.Add(new OpCtnRes()
+ {
+ Id = 0,
+ BSNO = "",
+ Ctn = item.BoxPile.Replace("'", ""),
+ CtnNum = int.Parse(item.CartonQuantity),
+ Size = item.Size,
+ KGS = !String.IsNullOrEmpty(item.GrossWeight) ? decimal.Parse(item.GrossWeight.Replace(" KGM", "")) : 0,
+ TareWeight = !String.IsNullOrEmpty(item.TareWeight) ? decimal.Parse(item.TareWeight.Replace(" KGM", "")) : 0,
+ });
+ }
+ }
+ info.CtnInfo = ctnList;
+ }
+
+ return info;
+
+ }
+ }
+}
diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportAIController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportAIController.cs
new file mode 100644
index 00000000..83f549d2
--- /dev/null
+++ b/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportAIController.cs
@@ -0,0 +1,38 @@
+using DS.Module.Core;
+using DS.WMS.Core.Op.Dtos;
+using DS.WMS.Core.Op.Dtos.BookingAI;
+using DS.WMS.Core.Op.Interface;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+
+namespace DS.WMS.OpApi.Controllers
+{
+ ///
+ /// AI文件解析-服务
+ ///
+ public class SeaExportAIController : ApiController
+ {
+ private readonly ISeaExportAIService _invokeService;
+
+ ///
+ /// 构造函数
+ ///
+ ///
+ public SeaExportAIController(ISeaExportAIService invokeService)
+ {
+ _invokeService = invokeService;
+ }
+
+ ///
+ /// 获取AI文件解析内容
+ ///
+ /// 文件信息
+ ///
+ [HttpPost]
+ [Route("GetBookingAIResult")]
+ public async Task> GetBookingAIResultAsync(IFormFile file)
+ {
+ return await _invokeService.GetBookingAIResultAsync(file);
+ }
+ }
+}