|
|
|
@ -5,6 +5,7 @@ using Furion.DynamicApiController;
|
|
|
|
|
using Furion.FriendlyException;
|
|
|
|
|
using Furion.JsonSerialization;
|
|
|
|
|
using Furion.RemoteRequest.Extensions;
|
|
|
|
|
using Mapster;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
@ -51,7 +52,7 @@ namespace Myshipping.Application
|
|
|
|
|
/// <param name="model">查询单票运踪流程详情</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
[AllowAnonymous, HttpPost("/EmbedTraceProduct/GetTraceFlowInfo"), ApiUser(ApiCode = "EmbedServiceTraceShow")]
|
|
|
|
|
public async Task<QueryTraceAfterPortResultDataDto> GetTraceFlowInfo(EmbedQueryTraceFlowDto model)
|
|
|
|
|
public async Task<EmbedTraceFlowResultDto> GetTraceFlowInfo(EmbedQueryTraceFlowDto model)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
1、调取运踪接口。 embed_trace_flow_url
|
|
|
|
@ -59,7 +60,7 @@ namespace Myshipping.Application
|
|
|
|
|
3、返回结果
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
QueryTraceAfterPortResultDataDto result = null;
|
|
|
|
|
EmbedTraceFlowResultDto result = null;
|
|
|
|
|
|
|
|
|
|
string batchNo = IDGen.NextID().ToString();
|
|
|
|
|
|
|
|
|
@ -89,27 +90,113 @@ namespace Myshipping.Application
|
|
|
|
|
var statusDict = _cache.GetAllDictData().GetAwaiter().GetResult()
|
|
|
|
|
.Where(t => t.TypeCode.Equals("after_port_trace_ctn_status", StringComparison.OrdinalIgnoreCase)).ToList();
|
|
|
|
|
|
|
|
|
|
if(queryRlt.code == 200)
|
|
|
|
|
//按顺序取状态配置字典
|
|
|
|
|
Dictionary<string, Tuple<string, int>> statusEnumDict = statusDict.Select(a => new { Key = a.Code, Val = new Tuple<string, int>(a.Value, a.Sort), Sort = a.Sort })
|
|
|
|
|
.OrderBy(a => a.Sort).ToDictionary(a => a.Key, b => b.Val);
|
|
|
|
|
|
|
|
|
|
string[] skipStatus = new string[] { "GIOI", "LOFV", "FVD", "FVA", "DFFV" };
|
|
|
|
|
|
|
|
|
|
if (queryRlt.code == 200)
|
|
|
|
|
{
|
|
|
|
|
result = queryRlt.data.FirstOrDefault();
|
|
|
|
|
var queryResult = queryRlt.data.FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
result = queryResult.Adapt<EmbedTraceFlowResultDto>();
|
|
|
|
|
|
|
|
|
|
if (result != null && result.resultData != null)
|
|
|
|
|
{
|
|
|
|
|
Dictionary<string, int> referToCtnDict = new Dictionary<string, int>();
|
|
|
|
|
|
|
|
|
|
if (result.resultData.containerInfoList != null && result.resultData.containerInfoList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
result.resultData.containerInfoList.ForEach(s =>
|
|
|
|
|
{
|
|
|
|
|
if(s.containerStatusInfoList != null && s.containerStatusInfoList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
referToCtnDict.Add(s.containerNo, s.containerStatusInfoList.Count);
|
|
|
|
|
|
|
|
|
|
s.containerStatusInfoList = s.containerStatusInfoList.Select((a, idx) =>
|
|
|
|
|
{
|
|
|
|
|
a.sortNo = idx + 1;
|
|
|
|
|
|
|
|
|
|
if (statusEnumDict.Any(p => p.Key.Equals(a.statusCd, StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
{
|
|
|
|
|
a.statusCnName = statusEnumDict[a.statusCd].Item1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
a.statusCnName = a.statusCd;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return a;
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.embedTraceFlowStatusList = new List<EmbedTraceFlowStatusInfo>();
|
|
|
|
|
|
|
|
|
|
var ctnNo = referToCtnDict.OrderByDescending(a => a.Value).FirstOrDefault().Key;
|
|
|
|
|
|
|
|
|
|
var longContainerStatusList = result.resultData.containerInfoList.FirstOrDefault(a => a.containerNo.Equals(ctnNo, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
.containerStatusInfoList;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var takeList = result.resultData.containerInfoList.SelectMany(p => p.containerStatusInfoList).GroupBy(a => a.statusCd).Select(a =>
|
|
|
|
|
{
|
|
|
|
|
var currArg = a.ToList();
|
|
|
|
|
|
|
|
|
|
EmbedTraceFlowStatusInfo currStatus = new EmbedTraceFlowStatusInfo
|
|
|
|
|
{
|
|
|
|
|
voy = a.FirstOrDefault().voy,
|
|
|
|
|
statusDescription = a.FirstOrDefault().statusDescription,
|
|
|
|
|
statusTime = a.FirstOrDefault().statusTime,
|
|
|
|
|
vslName = a.FirstOrDefault().vslName,
|
|
|
|
|
statusCd = a.FirstOrDefault().statusCd,
|
|
|
|
|
statusPlace = a.FirstOrDefault().statusPlace,
|
|
|
|
|
statusTerminal = a.FirstOrDefault().statusTerminal,
|
|
|
|
|
statusCnName = a.FirstOrDefault().statusCnName,
|
|
|
|
|
sortNo = a.FirstOrDefault().sortNo,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (!currArg.Any(a => !a.isEst.Equals("N", StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
{
|
|
|
|
|
currStatus.isComplete = true;
|
|
|
|
|
currStatus.hasStatusCtnNum = currArg.Count;
|
|
|
|
|
currStatus.noStatusCtnNum = 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
currStatus.isComplete = true;
|
|
|
|
|
currStatus.hasStatusCtnNum = currArg.Count(a => a.isEst.Equals("N", StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
currStatus.noStatusCtnNum = currArg.Count(a => !a.isEst.Equals("N", StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
currStatus.statusCtnStatic = $"{currStatus.hasStatusCtnNum}/{(currStatus.hasStatusCtnNum + currStatus.noStatusCtnNum)}";
|
|
|
|
|
|
|
|
|
|
return currStatus;
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
foreach (KeyValuePair<string, Tuple<string, int>> kvp in statusEnumDict)
|
|
|
|
|
{
|
|
|
|
|
if(!skipStatus.Contains(kvp.Key))
|
|
|
|
|
{
|
|
|
|
|
var currStatus = takeList.FirstOrDefault(p => p.statusCd.Equals(kvp.Key, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
|
|
if(currStatus == null)
|
|
|
|
|
{
|
|
|
|
|
currStatus = new EmbedTraceFlowStatusInfo
|
|
|
|
|
{
|
|
|
|
|
statusCd = kvp.Key,
|
|
|
|
|
statusCnName = kvp.Value.Item1,
|
|
|
|
|
sortNo = kvp.Value.Item2,
|
|
|
|
|
statusCtnStatic = $"0/{referToCtnDict.Count}",
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.embedTraceFlowStatusList.Add(currStatus);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -124,7 +211,7 @@ namespace Myshipping.Application
|
|
|
|
|
/// <param name="model">查询单票运踪流程详情</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
[AllowAnonymous, HttpPost("/EmbedTraceProduct/GetTraceVerticalInfo"), ApiUser(ApiCode = "EmbedServiceTraceShow")]
|
|
|
|
|
public async Task<QueryTraceAfterPortResultDataDto> GetTraceVerticalInfo(EmbedQueryTraceFlowDto model)
|
|
|
|
|
public async Task<EmbedTraceFlowResultDto> GetTraceVerticalInfo(EmbedQueryTraceFlowDto model)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
1、调取运踪接口。 embed_trace_flow_url
|
|
|
|
@ -132,7 +219,7 @@ namespace Myshipping.Application
|
|
|
|
|
3、返回结果
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
QueryTraceAfterPortResultDataDto result = null;
|
|
|
|
|
EmbedTraceFlowResultDto result = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|