From a5e1cd248edb473bb3a29ac829fdb9ae50c19aca Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Wed, 10 May 2023 11:36:21 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9PIL=E7=9A=84EDI=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=88=A4=E6=96=AD=EF=BC=8C=E5=A6=82=E6=9E=9C=E8=BF=90?= =?UTF-8?q?=E6=8A=B5=E6=97=A5=E6=9C=9F=E4=B8=BA=E7=A9=BA=EF=BC=8C=E5=BC=80?= =?UTF-8?q?=E8=88=B9=E6=97=A5=E6=9C=9F=E4=B8=8D=E4=B8=BA=E7=A9=BA=EF=BC=8C?= =?UTF-8?q?=E5=B0=86=E5=BC=80=E8=88=B9=E6=97=A5=E6=9C=9F=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E4=B8=BA=E9=A2=84=E6=8A=B5=E6=97=A5=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingOrder/BookingOrderService.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index fb195b08..796e0b04 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -4275,6 +4275,13 @@ namespace Myshipping.Application primaryModel.wNCM = ediExtModel.WNCM; primaryModel.ORDERREMARK = ediExtModel.OrderRemark; + //2023-05-10 (PIL)订舱的预抵日期不提供输入框,按照和川操作要求取开船日期填写到预抵日期 + if(string.IsNullOrWhiteSpace(primaryModel.ETA) && !string.IsNullOrWhiteSpace(primaryModel.ETD) && + ediRouteEnum == EDIRouteEnum.PIL) + { + primaryModel.ETA = primaryModel.ETD; + } + primaryModel.KINGTAREWEIGHT = ediExtModel.KingTareweight.HasValue ? ediExtModel.KingTareweight.Value : 0; _logger.LogInformation("批次={no} 提取箱完成 数量={total}", batchNo, contaList.Count); From 6c537acb74dbf1999893f23112adbff5a2421270 Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Wed, 10 May 2023 14:10:17 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=BC=95=E5=85=A5=E5=9C=BA=E7=AB=99?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E8=AF=BB=E5=8F=96=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E4=BA=91=E6=B8=AF=E9=80=9A=E5=92=8C=E9=99=86?= =?UTF-8?q?=E6=B5=B7=E9=80=9A=E8=B4=A6=E5=8F=B7=E7=9A=84=E5=9C=BA=E7=AB=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Helper/YardDataHelper.cs | 44 ++++++++++++------- .../BookingOrder/BookingOrderService.cs | 27 +++++++----- 2 files changed, 46 insertions(+), 25 deletions(-) diff --git a/Myshipping.Application/Helper/YardDataHelper.cs b/Myshipping.Application/Helper/YardDataHelper.cs index f4756b44..c5140f9c 100644 --- a/Myshipping.Application/Helper/YardDataHelper.cs +++ b/Myshipping.Application/Helper/YardDataHelper.cs @@ -22,31 +22,45 @@ namespace Myshipping.Application.Helper var cacheService = App.GetService(); var webAccService = App.GetService(); - var sysConfig = await cacheService.GetAllSysConfig(); var userKey = sysConfig.FirstOrDefault(x => x.Code == "spiderUserKeyBilltrace"); var userSecret = sysConfig.FirstOrDefault(x => x.Code == "spiderUserSecretBilltrace"); var spiderServerUrl = sysConfig.FirstOrDefault(x => x.Code == "spiderServerUrlBillTraceNew"); - if (yardid == "YIHANG" || yardid == "YZH") yardid = "GLJ"; + var needYgtAccountList = cacheService.GetAllDictData().Result.Where(x => x.TypeCode == "YardListNeedYgtAccount").ToList();//需要云港通账号的场站 + var needLhtAccountList = cacheService.GetAllDictData().Result.Where(x => x.TypeCode == "YardListNeedLhtAccount").ToList();//需要陆海通账号的场站 + + + var webAcc = ""; + var webPwd = ""; + if (needYgtAccountList.Count(x => x.Code == yardid) > 0) + { + //从租户参数中获取网站云港通账号密码 + var tenantParam = await cacheService.GetAllTenantParam(); + var ygtAcc = await webAccService.GetAccountConfig("YunGangTong", userId); + + if (ygtAcc == null || string.IsNullOrEmpty(ygtAcc.Account) || string.IsNullOrEmpty(ygtAcc.Password)) + { + return new KeyValuePair(false, "未找到云港通账号、密码配置,请到账号维护模块中添加"); + } + + webAcc = ygtAcc.Account; + webPwd = ygtAcc.Password; + } - var qduname = ""; - var qdpwd = ""; - if (yardid == "YGT" || yardid == "CHANGRONG" || yardid == "GLR" || yardid == "JZLG") + if (needLhtAccountList.Count(x => x.Code == yardid) > 0) { - //从租户参数中获取网站青岛港账号密码 + //从租户参数中获取网站云港通账号密码 var tenantParam = await cacheService.GetAllTenantParam(); - var qdPortAcc = await webAccService.GetAccountConfig("QingDaoPort", userId); - //var tenantUserName = tenantParam.FirstOrDefault(x => x.TenantId == tenantId && x.ParaCode == "QDPORT_USERNAME"); - //var tenantPwd = tenantParam.FirstOrDefault(x => x.TenantId == tenantId && x.ParaCode == "QDPORT_PWD"); + var ygtAcc = await webAccService.GetAccountConfig("LuHaiTong", userId); - if (qdPortAcc == null || string.IsNullOrEmpty(qdPortAcc.Account) || string.IsNullOrEmpty(qdPortAcc.Password)) + if (ygtAcc == null || string.IsNullOrEmpty(ygtAcc.Account) || string.IsNullOrEmpty(ygtAcc.Password)) { - return new KeyValuePair(false, "未找到青岛港用户名、密码配置,请到账号维护模块中添加"); + return new KeyValuePair(false, "未找到陆海通账号、密码配置,请到账号维护模块中添加"); } - qduname = qdPortAcc.Account; - qdpwd = qdPortAcc.Password; + webAcc = ygtAcc.Account; + webPwd = ygtAcc.Password; } var yardMappings = await cacheService.GetAllMappingYard(); @@ -65,8 +79,8 @@ namespace Myshipping.Application.Helper web_code = ym.MapCode, bno = mblno, req_type = isWeb ? "1" : "0", - web_user = qduname, - web_psw = qdpwd, + web_user = webAcc, + web_psw = webPwd, }; var urlYard = spiderServerUrl.Value; diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 796e0b04..62172a9e 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -2209,17 +2209,17 @@ namespace Myshipping.Application throw Oops.Bah("放舱信息未找到,请先保存数据"); } - var mailAcc = await _repUserMail.FirstOrDefaultAsync(x => x.CreatedUserId == user.Id && x.SmtpPort > 0 && x.SmtpServer != null && x.SmtpServer != ""); + var mailAcc = await _repUserMail.FirstOrDefaultAsync(x => x.CreatedUserId == user.Id && x.MailAccount == letterYard.AttnMail && x.SmtpPort > 0 && x.SmtpServer != null && x.SmtpServer != ""); if (mailAcc == null) { throw Oops.Bah("用户邮箱未设置或smtp未正确配置"); } var orderUrl = await _repOrderUrl.FirstOrDefaultAsync(u => u.BookingId == bookingId); - if (orderUrl == null) - { - throw Oops.Bah("未生成链接信息,请重新保存数据"); - } + //if (orderUrl == null) + //{ + // throw Oops.Bah("未生成链接信息,请重新保存数据"); + //} if (string.IsNullOrEmpty(letterYard.AttnMail)) { @@ -2285,6 +2285,13 @@ namespace Myshipping.Application extContent = $"危险品等级:{order.DCLASS}
危险品编号:{order.DUNNO}
"; } + var linkContent = string.Empty; + if (orderUrl != null) + { + linkContent = $@"提箱小票链接:{orderUrl.UrlTxxp}
+提交VGM链接:{orderUrl.UrlVgm}
"; + } + var mailContent = $@"TO:{order.CUSTOMERNAME} 贵司委托我司代理订舱出口的货物信息如下,详情请见附件,谢谢!
提单号:{order.MBLNO}
船名航次:{order.VESSEL}/{order.VOYNO}
@@ -2297,8 +2304,7 @@ namespace Myshipping.Application 截VGM时间:{order.CLOSEVGMDATE}
{extContent} 备注:{order.YARDREMARK}
- 提箱小票链接:{orderUrl.UrlTxxp}
- 提交VGM链接:{orderUrl.UrlVgm}
+{linkContent}
温馨提示:
如果分票报关,请回箱前通知场站及我司。
@@ -4276,7 +4282,7 @@ namespace Myshipping.Application primaryModel.ORDERREMARK = ediExtModel.OrderRemark; //2023-05-10 (PIL)订舱的预抵日期不提供输入框,按照和川操作要求取开船日期填写到预抵日期 - if(string.IsNullOrWhiteSpace(primaryModel.ETA) && !string.IsNullOrWhiteSpace(primaryModel.ETD) && + if (string.IsNullOrWhiteSpace(primaryModel.ETA) && !string.IsNullOrWhiteSpace(primaryModel.ETD) && ediRouteEnum == EDIRouteEnum.PIL) { primaryModel.ETA = primaryModel.ETD; @@ -5636,10 +5642,11 @@ namespace Myshipping.Application } var CtnDayNumlist = await GetGoodsStatusList(item.Id); - if (CtnDayNumlist!=null) { + if (CtnDayNumlist != null) + { item.CtnDayNum = CtnDayNumlist.Where(x => x.StatusName == "申请箱使").Select(x => x.ExtData).FirstOrDefault(); } - + //if (!string.IsNullOrEmpty(item.ISSUETYPE)) //{ // var ISSUETYPE = _cache.GetAllMappingIssueType().Result.Where(x => x.Module == "HeChuan" && x.Code == item.ISSUETYPE).Select(x => x.MapName).FirstOrDefault(); From 55db99f034e59670dacdc909f70e9f2564beba9d Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Wed, 10 May 2023 16:09:13 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=85=A5=E8=B4=A7=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingOrder/BookingOrderService.cs | 12 ++++----- Myshipping.Core/Helper/MailSendHelper.cs | 26 ++++++++++++++++--- Myshipping.Core/Myshipping.Core.xml | 3 ++- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 62172a9e..d2140832 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -2209,6 +2209,11 @@ namespace Myshipping.Application throw Oops.Bah("放舱信息未找到,请先保存数据"); } + if (string.IsNullOrEmpty(letterYard.AttnMail)) + { + throw Oops.Bah("ATTN MAIL未正确填写"); + } + var mailAcc = await _repUserMail.FirstOrDefaultAsync(x => x.CreatedUserId == user.Id && x.MailAccount == letterYard.AttnMail && x.SmtpPort > 0 && x.SmtpServer != null && x.SmtpServer != ""); if (mailAcc == null) { @@ -2221,11 +2226,6 @@ namespace Myshipping.Application // throw Oops.Bah("未生成链接信息,请重新保存数据"); //} - if (string.IsNullOrEmpty(letterYard.AttnMail)) - { - throw Oops.Bah("ATTN MAIL未正确填写"); - } - #region 保存放舱文件,并挂载到订舱附件 var fileBytes = await GetReportFile(bookingId, "fangcang"); var opt = App.GetOptions(); @@ -2316,7 +2316,7 @@ namespace Myshipping.Application 邮箱:{user.Email}
"; - var sendResult = await MailSendHelper.SendMail(mailAcc, mailSubject, mailContent, letterYard.AttnMail); + var sendResult = await MailSendHelper.SendMail(mailAcc, mailSubject, mailContent, letterYard.AttnMail, new KeyValuePair(fileSaveName, fileBytes)); if (!sendResult.Key) { _logger.LogError($"放舱邮件发送失败:从{mailAcc.MailAccount}到{letterYard.AttnMail},主题 {mailSubject}"); diff --git a/Myshipping.Core/Helper/MailSendHelper.cs b/Myshipping.Core/Helper/MailSendHelper.cs index 39bdf28f..b584dbfa 100644 --- a/Myshipping.Core/Helper/MailSendHelper.cs +++ b/Myshipping.Core/Helper/MailSendHelper.cs @@ -21,7 +21,8 @@ namespace Myshipping.Core.Helper /// /// /// - public static async Task> SendMail(DjyUserMailAccount acc, string subject, string body, string sendTo) + /// 附件列表,key为附件名称,value为文件字节数组 + public static async Task> SendMail(DjyUserMailAccount acc, string subject, string body, string sendTo, params KeyValuePair[] attachList) { SmtpClient client = null; try @@ -58,16 +59,33 @@ namespace Myshipping.Core.Helper } message.Subject = subject; + message.Sender = MailboxAddress.Parse(acc.MailAccount); + var html = new TextPart("html") { Text = body }; - MimeEntity entity = html; + if (attachList != null && attachList.Length > 0) + { + var mult = new Multipart("mixed") { html }; - message.Sender = MailboxAddress.Parse(acc.MailAccount); - message.Body = entity; + foreach (var item in attachList) + { + var attPart = new MimePart(); + attPart.Content = new MimeContent(new MemoryStream(item.Value)); + attPart.ContentDisposition = new ContentDisposition(ContentDisposition.Attachment); + attPart.ContentTransferEncoding = ContentEncoding.Base64; + attPart.FileName = "=?UTF-8?B?" + Convert.ToBase64String(Encoding.UTF8.GetBytes(item.Key)) + "?="; + mult.Add(attPart); + } + message.Body = mult; + } + else + { + message.Body = html; + } using (client = new SmtpClient()) { diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index f9b4de62..49a38200 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -5557,7 +5557,7 @@ 标题 内容 - + 使用用户邮箱配置发送邮件 @@ -5565,6 +5565,7 @@ + 附件列表,key为附件名称,value为文件字节数组 From 046f520e6312cd48e1fe49553025505c0ec73f46 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Wed, 10 May 2023 16:39:49 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E8=B4=A7?= =?UTF-8?q?=E7=BA=B8=E6=AF=94=E5=AF=B9=E8=AF=B7=E6=B1=82=E8=B6=85=E6=97=B6?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/TaskManagePlat/TaskShippingOrderCompareService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskShippingOrderCompareService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskShippingOrderCompareService.cs index 0d92bc6d..aa992296 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskShippingOrderCompareService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskShippingOrderCompareService.cs @@ -328,7 +328,7 @@ namespace Myshipping.Application try { - var res = await url.SetHttpMethod(HttpMethod.Post) + var res = await url.SetClientTimeout(180).SetHttpMethod(HttpMethod.Post) .SetBody(JSON.Serialize(info), "application/json") .SetContentEncoding(Encoding.UTF8) .PostAsync();