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 57748a00..f52ea4d4 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -3019,7 +3019,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); @@ -3042,7 +3042,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(); @@ -3074,13 +3074,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) {