|
|
@ -6,6 +6,7 @@ using Furion.FriendlyException;
|
|
|
|
using Furion.JsonSerialization;
|
|
|
|
using Furion.JsonSerialization;
|
|
|
|
using Furion.RemoteRequest.Extensions;
|
|
|
|
using Furion.RemoteRequest.Extensions;
|
|
|
|
using Mapster;
|
|
|
|
using Mapster;
|
|
|
|
|
|
|
|
using MathNet.Numerics.Distributions;
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
@ -18,6 +19,7 @@ using System.Linq;
|
|
|
|
using System.Net.Http;
|
|
|
|
using System.Net.Http;
|
|
|
|
using System.Reflection.Emit;
|
|
|
|
using System.Reflection.Emit;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using Yitter.IdGenerator;
|
|
|
|
using Yitter.IdGenerator;
|
|
|
|
|
|
|
|
|
|
|
@ -91,12 +93,13 @@ namespace Myshipping.Application
|
|
|
|
.Where(t => t.TypeCode.Equals("after_port_trace_ctn_status", StringComparison.OrdinalIgnoreCase)).ToList();
|
|
|
|
.Where(t => t.TypeCode.Equals("after_port_trace_ctn_status", StringComparison.OrdinalIgnoreCase)).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
//按顺序取状态配置字典
|
|
|
|
//按顺序取状态配置字典
|
|
|
|
Dictionary<string, Tuple<string, string, int>> statusEnumDict = statusDict.Select(a => new { Key = a.Code, Val = new Tuple<string, string,int>(a.Value,a.Remark, a.Sort), Sort = a.Sort })
|
|
|
|
Dictionary<string, Tuple<string, string, int>> statusEnumDict = statusDict.Select(a => new { Key = a.Code, Val = new Tuple<string, string, int>(a.Value, a.Remark, a.Sort), Sort = a.Sort })
|
|
|
|
.OrderBy(a => a.Sort).ToDictionary(a => a.Key, b => b.Val);
|
|
|
|
.OrderBy(a => a.Sort).ToDictionary(a => a.Key, b => b.Val);
|
|
|
|
|
|
|
|
|
|
|
|
string[] skipStatus = new string[] { "GIOI", "LOFV", "FVD", "FVA", "DFFV", "LOR", "DFR", "RA", "DIFR", "LOT", "DIFT", "ADI", "DIDI", "CGRL", "RFP","ETD","ETA", "LDI", "CDPOD", "BPOD" };
|
|
|
|
string[] skipStatus = new string[] { "GIOI", "LOFV", "FVD", "FVA", "DFFV", "LOR", "DFR", "RA", "DIFR", "LOT", "DIFT", "ADI", "DIDI", "CGRL", "RFP", "ETD", "ETA", "LDI", "CDPOD", "BPOD" };
|
|
|
|
string[] transferStatus = new string[] { "AIP", "BIP", "ETDIP", "DIIP", "GOIP", "GIIP", "LIP", "EDIP", "DEIP", "EAIP" };
|
|
|
|
string[] transferStatus = new string[] { "AIP", "BIP", "ETDIP", "DIIP", "GOIP", "GIIP", "LIP", "EDIP", "DEIP", "EAIP" };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (queryRlt.code == 200)
|
|
|
|
if (queryRlt.code == 200)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var queryResult = queryRlt.data.FirstOrDefault();
|
|
|
|
var queryResult = queryRlt.data.FirstOrDefault();
|
|
|
@ -107,6 +110,7 @@ namespace Myshipping.Application
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//这里需要翻译一下箱型
|
|
|
|
//这里需要翻译一下箱型
|
|
|
|
var ctnCodeMappingList = _cache.GetAllMappingCtn().GetAwaiter().GetResult().ToList();
|
|
|
|
var ctnCodeMappingList = _cache.GetAllMappingCtn().GetAwaiter().GetResult().ToList();
|
|
|
|
|
|
|
|
var ctnCodeList = _cache.GetAllCodeCtn().GetAwaiter().GetResult().ToList();
|
|
|
|
|
|
|
|
|
|
|
|
Dictionary<string, int> referToCtnDict = new Dictionary<string, int>();
|
|
|
|
Dictionary<string, int> referToCtnDict = new Dictionary<string, int>();
|
|
|
|
|
|
|
|
|
|
|
@ -116,11 +120,27 @@ namespace Myshipping.Application
|
|
|
|
{
|
|
|
|
{
|
|
|
|
result.resultData.containerInfoList.ForEach(s =>
|
|
|
|
result.resultData.containerInfoList.ForEach(s =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var ctnMapping = ctnCodeMappingList.FirstOrDefault(t => t.MapCode.Equals(s.size));
|
|
|
|
string ctnSize = s.size;
|
|
|
|
|
|
|
|
|
|
|
|
if(ctnMapping != null)
|
|
|
|
if (!string.IsNullOrWhiteSpace(s.size))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
s.sizeName = ctnMapping.MapName?.Trim();
|
|
|
|
ctnSize = $"{Regex.Match(s.size, "[0-9]{2}")}{Regex.Match(s.size, "[a-zA-Z]{1,3}([0-9]{1})?")}";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ctnCode = ctnCodeList.FirstOrDefault(t => !string.IsNullOrWhiteSpace(t.EdiCode) && t.EdiCode.Equals(ctnSize));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ctnCode != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
s.sizeName = ctnCode.Name?.Trim();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var ctnMapping = ctnCodeMappingList.FirstOrDefault(t => !string.IsNullOrWhiteSpace(t.MapCode) && t.MapCode.Equals(ctnSize));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ctnMapping != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
s.sizeName = ctnMapping.MapName?.Trim();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (s.containerStatusInfoList != null && s.containerStatusInfoList.Count > 0)
|
|
|
|
if (s.containerStatusInfoList != null && s.containerStatusInfoList.Count > 0)
|
|
|
@ -157,8 +177,9 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
var ctnNo = referToCtnDict.OrderByDescending(a => a.Value).FirstOrDefault().Key;
|
|
|
|
var ctnNo = referToCtnDict.OrderByDescending(a => a.Value).FirstOrDefault().Key;
|
|
|
|
|
|
|
|
|
|
|
|
var longContainerStatusList = result.resultData.containerInfoList.FirstOrDefault(a => a.containerNo.Equals(ctnNo, StringComparison.OrdinalIgnoreCase))
|
|
|
|
var longContainerStatus = result.resultData.containerInfoList.FirstOrDefault(a => a.containerNo.Equals(ctnNo, StringComparison.OrdinalIgnoreCase));
|
|
|
|
.containerStatusInfoList;
|
|
|
|
|
|
|
|
|
|
|
|
var longContainerStatusList = longContainerStatus.containerStatusInfoList;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var takeList = result.resultData.containerInfoList.SelectMany(p => p.containerStatusInfoList).GroupBy(a => a.statusCd).Select(a =>
|
|
|
|
var takeList = result.resultData.containerInfoList.SelectMany(p => p.containerStatusInfoList).GroupBy(a => a.statusCd).Select(a =>
|
|
|
@ -186,7 +207,7 @@ namespace Myshipping.Application
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
currStatus.isComplete = true;
|
|
|
|
currStatus.isComplete = false;
|
|
|
|
currStatus.hasStatusCtnNum = currArg.Count(a => a.isEst.Equals("N", StringComparison.OrdinalIgnoreCase));
|
|
|
|
currStatus.hasStatusCtnNum = currArg.Count(a => a.isEst.Equals("N", StringComparison.OrdinalIgnoreCase));
|
|
|
|
currStatus.noStatusCtnNum = currArg.Count(a => !a.isEst.Equals("N", StringComparison.OrdinalIgnoreCase));
|
|
|
|
currStatus.noStatusCtnNum = currArg.Count(a => !a.isEst.Equals("N", StringComparison.OrdinalIgnoreCase));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -196,9 +217,22 @@ namespace Myshipping.Application
|
|
|
|
return currStatus;
|
|
|
|
return currStatus;
|
|
|
|
}).ToList();
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
foreach (KeyValuePair<string, Tuple<string,string, int>> kvp in statusEnumDict)
|
|
|
|
var APODtotal = takeList.Where(p => p.statusCd.Equals("APOD", StringComparison.OrdinalIgnoreCase)).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (APODtotal.Count > 1 && APODtotal.Any(p => p.isComplete))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!skipStatus.Contains(kvp.Key))
|
|
|
|
takeList = takeList.Select(a =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (a.statusCd.Equals("APOD", StringComparison.OrdinalIgnoreCase) && !a.isComplete)
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return a;
|
|
|
|
|
|
|
|
}).Where(a => a != null).ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (KeyValuePair<string, Tuple<string, string, int>> kvp in statusEnumDict)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!skipStatus.Contains(kvp.Key))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//不是中转的需要把状态节点去掉
|
|
|
|
//不是中转的需要把状态节点去掉
|
|
|
|
if (isTransfer || (!isTransfer && !transferStatus.Contains(kvp.Key)))
|
|
|
|
if (isTransfer || (!isTransfer && !transferStatus.Contains(kvp.Key)))
|
|
|
@ -210,7 +244,7 @@ namespace Myshipping.Application
|
|
|
|
currStatus = new EmbedTraceFlowStatusInfo
|
|
|
|
currStatus = new EmbedTraceFlowStatusInfo
|
|
|
|
{
|
|
|
|
{
|
|
|
|
statusCd = kvp.Key,
|
|
|
|
statusCd = kvp.Key,
|
|
|
|
statusCnName = !string.IsNullOrWhiteSpace(kvp.Value.Item2)? kvp.Value.Item2 : kvp.Value.Item1,
|
|
|
|
statusCnName = !string.IsNullOrWhiteSpace(kvp.Value.Item2) ? kvp.Value.Item2 : kvp.Value.Item1,
|
|
|
|
sortNo = kvp.Value.Item3,
|
|
|
|
sortNo = kvp.Value.Item3,
|
|
|
|
statusCtnStatic = $"0/{referToCtnDict.Count}",
|
|
|
|
statusCtnStatic = $"0/{referToCtnDict.Count}",
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -221,11 +255,72 @@ namespace Myshipping.Application
|
|
|
|
currStatus.statusCnName = kvp.Value.Item2;
|
|
|
|
currStatus.statusCnName = kvp.Value.Item2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (currStatus.statusCd.Equals("DPOL", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
currStatus.isSplitStart = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (currStatus.statusCd.Equals("APOD", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
currStatus.isSplitEnd = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(longContainerStatus.currentNodeCd) && longContainerStatus.currentNodeCd.Equals(kvp.Key, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
currStatus.isCurrentStatus = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
result.embedTraceFlowStatusList.Add(currStatus);
|
|
|
|
result.embedTraceFlowStatusList.Add(currStatus);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.resultData.containerInfoList.ForEach(b =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (statusEnumDict.Any(k => !string.IsNullOrWhiteSpace(b.currentNodeCd) && k.Key.Equals(b.currentNodeCd, StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
b.currentNodeCnName = !string.IsNullOrWhiteSpace(statusEnumDict[b.currentNodeCd].Item2) ? statusEnumDict[b.currentNodeCd].Item2 : statusEnumDict[b.currentNodeCd].Item1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
b.containerStatusInfoList = b.containerStatusInfoList.Select(c =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(b.currentNodeCd) && b.currentNodeCd.Equals(c.statusCd, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
c.isCurrentStatus = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(c.statusPlace))
|
|
|
|
|
|
|
|
c.statusPlace = c.statusPlace.ToUpper();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(c.statusCd) && c.statusCd.Equals("ETA", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(c.statusCd) && c.statusCd.Equals("APOD", StringComparison.OrdinalIgnoreCase) && !c.isEst.Equals("N", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return c;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).Where(a => a != null).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"{JSON.Serialize(queryDto)} 查询成功");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation($"{JSON.Serialize(queryDto)} 查询失败,{result.resultMessage}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw Oops.Oh(result.resultMessage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation($"{JSON.Serialize(queryDto)} 查询失败,{queryRlt.message}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw Oops.Oh(result.resultMessage.Contains("官网查询无数据") ? "无查询结果" : "查询失败");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|