jianghaiqing 2 years ago
commit 0e67062d16

@ -5355,7 +5355,35 @@ namespace Myshipping.Application
throw Oops.Bah(rtn.Value); 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);
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
{
throw Oops.Bah($"未找到箱型{ctnall}的场站引入配置");
}
}
return jData.ToString();
} }
/// <summary> /// <summary>

@ -26,6 +26,23 @@ namespace Myshipping.Core
return jt as JObject; return jt as JObject;
} }
/// <summary>
/// 获取JArray
/// </summary>
/// <param name="jobj"></param>
/// <param name="prop"></param>
/// <returns></returns>
public static JArray GetJArrayValue(this JObject jobj, string prop)
{
var jt = jobj[prop];
if (jt == null)
{
return null;
}
return jt as JArray;
}
/// <summary> /// <summary>
/// 获取字符串值 /// 获取字符串值
/// </summary> /// </summary>

@ -5350,6 +5350,14 @@
<param name="prop"></param> <param name="prop"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Myshipping.Core.JsonExtension.GetJArrayValue(Newtonsoft.Json.Linq.JObject,System.String)">
<summary>
获取JArray
</summary>
<param name="jobj"></param>
<param name="prop"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.JsonExtension.GetStringValue(Newtonsoft.Json.Linq.JObject,System.String)"> <member name="M:Myshipping.Core.JsonExtension.GetStringValue(Newtonsoft.Json.Linq.JObject,System.String)">
<summary> <summary>
获取字符串值 获取字符串值

Loading…
Cancel
Save