From 31162146329207a83a186290da2270a1188e3778 Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Mon, 15 May 2023 18:01:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=9C=BA=E7=AB=99=E5=BC=95=E5=85=A5?= =?UTF-8?q?=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingOrder/BookingOrderService.cs | 26 ++++++++++++++++++- Myshipping.Core/Extension/JsonExtension.cs | 17 ++++++++++++ Myshipping.Core/Myshipping.Core.xml | 8 ++++++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 736cc621..79975161 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -5347,7 +5347,31 @@ namespace Myshipping.Application throw Oops.Bah(rtn.Value); } - return rtn.Value; + //场站引入的数据,转换为订舱箱型,且带上箱型代码 + var ctnList = await _cache.GetAllCodeCtn(); + var mapCtn = await _cache.GetAllMappingCtn(); + + var jData = JArray.Parse(rtn.Value); + foreach (JObject item in jData) + { + var ctnall = item.GetStringValue("CTNALL"); + var findMap = mapCtn.FirstOrDefault(x => x.Module == "YardData" && x.MapCode == ctnall); + var findCtn = ctnList.FirstOrDefault(x => x.Name == ctnall); + if (findMap != null) + { + item.Add("CtnCode", findMap.Code); + } + else if (findCtn != null) + { + item.Add("CtnCode", findCtn.Code); + } + else + { + throw Oops.Bah($"未找到箱型{ctnall}的场站引入配置"); + } + } + + return jData.ToString(); } /// diff --git a/Myshipping.Core/Extension/JsonExtension.cs b/Myshipping.Core/Extension/JsonExtension.cs index 1628f0a9..5c6accc1 100644 --- a/Myshipping.Core/Extension/JsonExtension.cs +++ b/Myshipping.Core/Extension/JsonExtension.cs @@ -26,6 +26,23 @@ namespace Myshipping.Core return jt as JObject; } + /// + /// 获取JArray + /// + /// + /// + /// + public static JArray GetJArrayValue(this JObject jobj, string prop) + { + var jt = jobj[prop]; + if (jt == null) + { + return null; + } + + return jt as JArray; + } + /// /// 获取字符串值 /// diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index 058e069b..42bcd889 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -5350,6 +5350,14 @@ + + + 获取JArray + + + + + 获取字符串值 From 1925c02b29187e31d44ced48269a4723f1ce1302 Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Tue, 16 May 2023 09:23:48 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=BC=95=E5=85=A5=E5=9C=BA=E7=AB=99?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=98=BE=E7=A4=BActnall?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingOrder/BookingOrderService.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 79694f50..093300b5 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -5368,10 +5368,14 @@ namespace Myshipping.Application if (findMap != null) { item.Add("CtnCode", findMap.Code); + + findCtn = ctnList.First(c => c.Code == findMap.Code); + item["CTNALL"] = findCtn.Name; //名称显示维护的箱型 } else if (findCtn != null) { item.Add("CtnCode", findCtn.Code); + item["CTNALL"] = findCtn.Name; //名称显示维护的箱型 } else {