From a854e6cec7406b62adba243432eb54ef4a30e6f9 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 3 Jan 2023 18:09:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9EDI=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0ESL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Myshipping.Application/Enum/EDIRouteEnum.cs | 6 ++- .../BookingOrder/BookingOrderService.cs | 39 +++++++++++++++++-- .../TaskManagePlat/TaskManageService.cs | 13 ++++++- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/Myshipping.Application/Enum/EDIRouteEnum.cs b/Myshipping.Application/Enum/EDIRouteEnum.cs index 43359531..4bb649e1 100644 --- a/Myshipping.Application/Enum/EDIRouteEnum.cs +++ b/Myshipping.Application/Enum/EDIRouteEnum.cs @@ -34,6 +34,10 @@ namespace Myshipping.Application /// /// 未指定 /// - NULL + NULL, + /// + /// 阿联酋航运 + /// + ESL, } } diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 8821a13f..1d4d5b30 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -3018,7 +3018,7 @@ namespace Myshipping.Application { strCheck = Regex.Replace(strCheck, "\\", "\n"); } - throw Oops.Bah($"发送{EDIRouteEnum.PIL.ToString()}校验失败,{strCheck}"); + throw Oops.Bah($"发送{EDIRouteEnum.WY.ToString()}校验失败,{strCheck}"); } var currRlt = WYEdiHelper.CreateEdiWY(ediModel); @@ -3041,7 +3041,7 @@ namespace Myshipping.Application strCheck = Regex.Replace(strCheck, "\\", "\n"); } - throw Oops.Bah($"发送{EDIRouteEnum.PIL.ToString()}校验失败,{strCheck}"); + throw Oops.Bah($"发送{EDIRouteEnum.YML.ToString()}校验失败,{strCheck}"); } CommonWebApiResult currRlt = new CommonWebApiResult(); @@ -3073,13 +3073,46 @@ namespace Myshipping.Application strCheck = Regex.Replace(strCheck, "\\", "\n"); } - throw Oops.Bah($"发送{EDIRouteEnum.PIL.ToString()}校验失败,{strCheck}"); + throw Oops.Bah($"发送{EDIRouteEnum.YT.ToString()}校验失败,{strCheck}"); } CommonWebApiResult currRlt = YTEdiHelper.CreateEdiYT(ediModel); #endregion + result.succ = currRlt.succ; + result.extra = currRlt.succ ? currRlt.extra.ToString() : ""; + } + else if (ediRouteEnum == EDIRouteEnum.ESL) + { + #region YT + string strCheck = TSLEdiHelper.IsCreateTSL(ediModel); + + _logger.LogInformation($"调用SO(SI),校验:{strCheck},数据对象:{JsonConvert.SerializeObject(ediModel)}"); + + if (!string.IsNullOrWhiteSpace(strCheck)) + { + if (Regex.IsMatch(strCheck, "\\")) + { + strCheck = Regex.Replace(strCheck, "\\", "\n"); + } + + throw Oops.Bah($"发送{EDIRouteEnum.ESL.ToString()}校验失败,{strCheck}"); + } + + + CommonWebApiResult currRlt = new CommonWebApiResult(); + + if (model.sendType == "B") + { + currRlt = TSLEdiHelper.CreateEdiTSL(ediModel); + } + else if (model.sendType == "E") + { + currRlt = TSLEdiHelper.CreateEdiTSLSI(ediModel); + } + #endregion + result.succ = currRlt.succ; result.extra = currRlt.succ ? currRlt.extra.ToString() : ""; } diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs index 580a3712..15f34a96 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs @@ -47,10 +47,11 @@ namespace Myshipping.Application private readonly SqlSugarRepository _taskStatManageInfoRepository; private readonly SqlSugarRepository _taskOriginalDownloadHisInfoRepository; private readonly IDjyWebsiteAccountConfigService _webAccountConfig; - + private readonly ISysCacheService _cache; private readonly ILogger _logger; const string CONST_WEB_ACCOUNT_TYPE = "CmaWeb"; + const string CONST_BOOK_ORIGINAL_DOWN_URL_CODE = "bookOriginalDownUrl"; public TaskManageService(SqlSugarRepository taskBaseInfoRepository, SqlSugarRepository taskSIFeedBackInfoRepository, @@ -63,6 +64,7 @@ namespace Myshipping.Application SqlSugarRepository taskStatManageInfoRepository, SqlSugarRepository taskOriginalDownloadHisInfoRepository, IDjyWebsiteAccountConfigService webAccountConfig, + ISysCacheService cache, ILogger logger) { _taskBaseInfoRepository = taskBaseInfoRepository; @@ -76,6 +78,7 @@ namespace Myshipping.Application _taskStatManageInfoRepository = taskStatManageInfoRepository; _taskOriginalDownloadHisInfoRepository = taskOriginalDownloadHisInfoRepository; _webAccountConfig = webAccountConfig; + _cache = cache; _logger = logger; } @@ -694,6 +697,12 @@ namespace Myshipping.Application DateTime startDate = DateTime.Now; + var downloadUrl = _cache.GetAllDictData().GetAwaiter().GetResult() + .First(t => t.Code.Equals(CONST_BOOK_ORIGINAL_DOWN_URL_CODE, StringComparison.OrdinalIgnoreCase))?.Value; + + if(string.IsNullOrWhiteSpace(downloadUrl)) + throw Oops.Bah($"正本下载URL不存在,请确认字典是否配置 code={CONST_BOOK_ORIGINAL_DOWN_URL_CODE}"); + TaskOriginalDownloadHisInfo taskOriginalDownloadHisInfo = new TaskOriginalDownloadHisInfo { PK_ID = IDGen.NextID().ToString(), @@ -710,6 +719,8 @@ namespace Myshipping.Application //写入记录 _taskOriginalDownloadHisInfoRepository.Insert(taskOriginalDownloadHisInfo); + + //请求远程链接 } catch (Exception ex) {