From f27520d890b22535ee18e52d3b85296d7823183f Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Thu, 16 May 2024 14:54:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=90=E8=B8=AA=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/QueryTraceAfterPortResultDto.cs | 2 +- .../EmbedTraceProductService.cs | 37 +++++++++++++------ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/Myshipping.Application/Service/EmbedProjectGoodsStatus/Dtos/QueryTraceAfterPortResultDto.cs b/Myshipping.Application/Service/EmbedProjectGoodsStatus/Dtos/QueryTraceAfterPortResultDto.cs index 8cb025cb..effd0df9 100644 --- a/Myshipping.Application/Service/EmbedProjectGoodsStatus/Dtos/QueryTraceAfterPortResultDto.cs +++ b/Myshipping.Application/Service/EmbedProjectGoodsStatus/Dtos/QueryTraceAfterPortResultDto.cs @@ -16,7 +16,7 @@ namespace Myshipping.Application /// /// 回执消息 /// - public string msg { get; set; } + public string message { get; set; } /// /// 查询详情列表 diff --git a/Myshipping.Application/Service/EmbedProjectGoodsStatus/EmbedTraceProductService.cs b/Myshipping.Application/Service/EmbedProjectGoodsStatus/EmbedTraceProductService.cs index ea95f233..2a5dc9ad 100644 --- a/Myshipping.Application/Service/EmbedProjectGoodsStatus/EmbedTraceProductService.cs +++ b/Myshipping.Application/Service/EmbedProjectGoodsStatus/EmbedTraceProductService.cs @@ -92,10 +92,10 @@ namespace Myshipping.Application .Where(t => t.TypeCode.Equals("after_port_trace_ctn_status", StringComparison.OrdinalIgnoreCase)).ToList(); //按顺序取状态配置字典 - Dictionary> statusEnumDict = statusDict.Select(a => new { Key = a.Code, Val = new Tuple(a.Value,a.Remark, a.Sort), Sort = a.Sort }) + Dictionary> statusEnumDict = statusDict.Select(a => new { Key = a.Code, Val = new Tuple(a.Value, a.Remark, 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", "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" }; @@ -121,7 +121,7 @@ namespace Myshipping.Application { string ctnSize = s.size; - if(!string.IsNullOrWhiteSpace(s.size)) + if (!string.IsNullOrWhiteSpace(s.size)) { ctnSize = $"{Regex.Match(s.size, "[0-9]{2}")}{Regex.Match(s.size, "[a-zA-Z]{1,3}([0-9]{1})?")}"; } @@ -216,9 +216,9 @@ namespace Myshipping.Application return currStatus; }).ToList(); - foreach (KeyValuePair> kvp in statusEnumDict) + foreach (KeyValuePair> kvp in statusEnumDict) { - if(!skipStatus.Contains(kvp.Key)) + if (!skipStatus.Contains(kvp.Key)) { //不是中转的需要把状态节点去掉 if (isTransfer || (!isTransfer && !transferStatus.Contains(kvp.Key))) @@ -230,7 +230,7 @@ namespace Myshipping.Application currStatus = new EmbedTraceFlowStatusInfo { 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, statusCtnStatic = $"0/{referToCtnDict.Count}", }; @@ -241,11 +241,11 @@ namespace Myshipping.Application currStatus.statusCnName = kvp.Value.Item2; } - if(currStatus.statusCd.Equals("DPOL", StringComparison.OrdinalIgnoreCase)) - currStatus.isSplitStart = true; + if (currStatus.statusCd.Equals("DPOL", StringComparison.OrdinalIgnoreCase)) + currStatus.isSplitStart = true; if (currStatus.statusCd.Equals("APOD", StringComparison.OrdinalIgnoreCase)) - currStatus.isSplitEnd = true; + currStatus.isSplitEnd = true; if (!string.IsNullOrWhiteSpace(longContainerStatus.currentNodeCd) && longContainerStatus.currentNodeCd.Equals(kvp.Key, StringComparison.OrdinalIgnoreCase)) { @@ -260,11 +260,11 @@ namespace Myshipping.Application result.resultData.containerInfoList.ForEach(b => { - if(statusEnumDict.Any(k=> !string.IsNullOrWhiteSpace(b.currentNodeCd) && k.Key.Equals(b.currentNodeCd, StringComparison.OrdinalIgnoreCase))) + 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.ForEach(c => { if (!string.IsNullOrWhiteSpace(b.currentNodeCd) && b.currentNodeCd.Equals(c.statusCd, StringComparison.OrdinalIgnoreCase)) { @@ -273,7 +273,22 @@ namespace Myshipping.Application }); }); + + _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;