From 60db2eeb28669b0af939b904d92d10f6f8fd99b6 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 3 Jan 2023 18:11:09 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9EDI=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Myshipping.Application/Enum/EDIRouteEnum.cs | 1 + Myshipping.Application/Myshipping.Application.xml | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/Myshipping.Application/Enum/EDIRouteEnum.cs b/Myshipping.Application/Enum/EDIRouteEnum.cs index 4bb649e1..a755a3be 100644 --- a/Myshipping.Application/Enum/EDIRouteEnum.cs +++ b/Myshipping.Application/Enum/EDIRouteEnum.cs @@ -35,6 +35,7 @@ namespace Myshipping.Application /// 未指定 /// NULL, + /// /// 阿联酋航运 /// diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml index aefa92e4..bca69b49 100644 --- a/Myshipping.Application/Myshipping.Application.xml +++ b/Myshipping.Application/Myshipping.Application.xml @@ -4636,6 +4636,11 @@ 未指定 + + + 阿联酋航运 + + 任务类型基础枚举 From ab74b16e30eaa2269f262c43ccae553ab2ba4046 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Wed, 4 Jan 2023 10:27:34 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9ESL=E7=9A=84EDI=E7=94=9F?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Myshipping.Application/EDI/ESLEdiHelper.cs | 37 +++++++++++++++++-- .../BookingOrder/BookingOrderService.cs | 15 ++------ .../TaskManagePlat/TaskManageService.cs | 14 ++++++- 3 files changed, 50 insertions(+), 16 deletions(-) diff --git a/Myshipping.Application/EDI/ESLEdiHelper.cs b/Myshipping.Application/EDI/ESLEdiHelper.cs index 4f4269c2..1d5c58e3 100644 --- a/Myshipping.Application/EDI/ESLEdiHelper.cs +++ b/Myshipping.Application/EDI/ESLEdiHelper.cs @@ -195,6 +195,9 @@ namespace Myshipping.Application.EDI.ESL /// public static string formatEdiStr(string fileType, string str) { + if (str == null) + str = string.Empty; + if (fileType == "txt") { return str.Replace("?", "??").Replace(":", "?:").Replace("+", "?+").Replace("'", "?'"); @@ -282,7 +285,7 @@ namespace Myshipping.Application.EDI.ESL #endregion #region 检查 - public static string IsCreateESLEDI(MsESLEdiModel InttrEdi) + public static string IsCreateESLEDI(EDIBaseModel InttrEdi) { var error = ""; @@ -317,8 +320,9 @@ namespace Myshipping.Application.EDI.ESL if (string.IsNullOrEmpty(headData.BLFRT)) { error = error + "
提单号:" + headData.MBLNO + " 付费方式不能为空"; } - if (string.IsNullOrEmpty(headData.ESLLINECODE)) - { error = error + "
提单号:" + headData.MBLNO + " ESL航线代码不能为空"; } + //2023-01-04 JHQ 跟韩训涛确认,ESL这里不处理航线代码,去掉不为空校验,并在生成EDI报文时,对ESL航线代码赋空串 + //if (string.IsNullOrEmpty(headData.ESLLINECODE)) + //{ error = error + "
提单号:" + headData.MBLNO + " ESL航线代码不能为空"; } if (InttrEdi.filetype == "E") { @@ -610,10 +614,12 @@ namespace Myshipping.Application.EDI.ESL #endregion #region 生成报文(订舱(InttrEdi.filetype=="B"),截单(InttrEdi.filetype=="E")) - public static CommonWebApiResult CreateEdiESL(MsESLEdiModel InttrEdi) + public static CommonWebApiResult CreateEdiESL(EDIBaseModel InttrEdi) { CommonWebApiResult result = new CommonWebApiResult { succ = false }; + + var filetype = "IFTMIN"; if (InttrEdi.filetype != "E") filetype = "IFTMBF"; @@ -628,8 +634,17 @@ namespace Myshipping.Application.EDI.ESL var icount = 0; var bsno = ""; var isfirst = true; + foreach (var bill in InttrEdi.BSLIST) { + //2023-01-04 JHQ 跟韩训涛确认,ESL这里不处理航线代码,去掉不为空校验,并在生成EDI报文时,对ESL航线代码赋空串 + if (bill.ESLLINECODE == null) + bill.ESLLINECODE = string.Empty; + + //2022-01-04 + if (InttrEdi.ForWarderName == null) + InttrEdi.ForWarderName = string.Empty; + if (isfirst) { if (InttrEdi.filetype == "E") @@ -697,6 +712,8 @@ namespace Myshipping.Application.EDI.ESL icount++; var ISSUETYPE = ""; + + /* 2022-01-04 这里新订舱系统的签单方式代码已变更采用新的编码来判断 if (bill.ISSUETYPE == "正本") { ISSUETYPE = "ORI"; @@ -706,7 +723,19 @@ namespace Myshipping.Application.EDI.ESL ISSUETYPE = "TER"; } else ISSUETYPE = "EXP"; + */ + if (bill.ISSUETYPE == "ORIGINAL") + { + //正本 + ISSUETYPE = "ORI"; + } + else if (bill.ISSUETYPE == "TELEX") + { + //电放 + ISSUETYPE = "TER"; + } + else ISSUETYPE = "EXP"; r.WriteLine("03:" + ISSUETYPE + ":" + bill.ISSUEPLACEID.Trim() + ":" + bill.ISSUEPLACE.Trim() + ":" + GetDateStr(bill.ISSUEDATE, "yyyyMMdd") + ":" + GetBillNum2(bill.NOBILL) + ":" + bill.PREPARDAT + ":" + bill.PAYABLEAT + "'"); diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 74169d9d..f28b6d39 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -57,6 +57,8 @@ using System.Linq.Expressions; using Myshipping.Core.Extension; using System.Text.RegularExpressions; using MathNet.Numerics.Distributions; +using Microsoft.IdentityModel.Tokens; +using Myshipping.Application.EDI.ESL; namespace Myshipping.Application { @@ -3086,7 +3088,7 @@ namespace Myshipping.Application else if (ediRouteEnum == EDIRouteEnum.ESL) { #region YT - string strCheck = TSLEdiHelper.IsCreateTSL(ediModel); + string strCheck = ESLEdiHelper.IsCreateESLEDI(ediModel); _logger.LogInformation($"调用SO(SI),校验:{strCheck},数据对象:{JsonConvert.SerializeObject(ediModel)}"); @@ -3101,16 +3103,7 @@ namespace Myshipping.Application } - CommonWebApiResult currRlt = new CommonWebApiResult(); - - if (model.sendType == "B") - { - currRlt = TSLEdiHelper.CreateEdiTSL(ediModel); - } - else if (model.sendType == "E") - { - currRlt = TSLEdiHelper.CreateEdiTSLSI(ediModel); - } + CommonWebApiResult currRlt = ESLEdiHelper.CreateEdiESL(ediModel); #endregion result.succ = currRlt.succ; diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs index 15f34a96..5ebc252c 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs @@ -4,6 +4,7 @@ using Furion.DynamicApiController; using Furion.FriendlyException; using Furion.JsonSerialization; using Furion.RemoteRequest; +using Furion.RemoteRequest.Extensions; using Mapster; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -731,7 +732,18 @@ namespace Myshipping.Application return result; } - //private async Task Inner + private async Task InnerRemoteDownOriginal(string url, Dictionary dic) + { + + var result = new TaskManageOrderResultDto(); + + //var t = await url.SetBody(new Dictionary { + // { "Id", 1 }, + // { "Name", "Furion"} + //}, "application/x-www-form-urlencoded"); + + return result; + } } } From 7aa674e8fbe8f5208316913f450590526af54936 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Wed, 4 Jan 2023 11:24:15 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9EDI=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Myshipping.Application.xml | 2 +- .../BookingOrder/BookingOrderService.cs | 3 +- .../TaskManagePlat/TaskManageService.cs | 32 ++++++++++++++++--- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml index bca69b49..b8f98792 100644 --- a/Myshipping.Application/Myshipping.Application.xml +++ b/Myshipping.Application/Myshipping.Application.xml @@ -6233,7 +6233,7 @@ 订舱、截单EDI请求 返回回执 - + 下载订舱、截单EDI diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index f28b6d39..2a4e3f3f 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -2856,13 +2856,14 @@ namespace Myshipping.Application /// [HttpGet("/BookingOrder/DownloadBookingOrClosingEDI")] public IActionResult DownloadBookingOrClosingEDI([FromQuery] long id, [FromQuery] string orderNo, [FromQuery] bool useForwarderCode, - [FromQuery] string forwarderName, [FromQuery] string fileRole, [FromQuery] string sendType) + [FromQuery] string forwarderCode, [FromQuery] string forwarderName, [FromQuery] string fileRole, [FromQuery] string sendType) { var model = new BookingOrClosingEDIOrderDto { Id = id, orderNo = orderNo, useForwarderCode = useForwarderCode, + forwarderCode = forwarderCode, forwarderName = forwarderName, fileRole = fileRole, send = false, diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs index 5ebc252c..da446f38 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageService.cs @@ -17,6 +17,7 @@ using Myshipping.Core; using Myshipping.Core.Entity; using Myshipping.Core.Service; using MySqlX.XDevAPI.Common; +using Newtonsoft.Json.Linq; using NPOI.SS.Formula.Functions; using SqlSugar; using StackExchange.Profiling.Internal; @@ -24,6 +25,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; @@ -637,13 +639,21 @@ namespace Myshipping.Application { TaskManageOrderResultDto result = new TaskManageOrderResultDto(); + string batchNo = IDGen.NextID().ToString(); + + _logger.LogInformation("批次={no} ids={ids} 下载正本提单开始", batchNo, string.Join(",", PKIds)); + try { var taskList = _taskBaseInfoRepository.AsQueryable().Where(t => PKIds.Contains(t.PK_ID)).ToList(); + _logger.LogInformation("批次={no} 获取任务完成,Num={Num}", batchNo, taskList.Count); + //获取个人对应的账户,这里GetAccountConfig逻辑优先取个人,个人没有配置取公司对应配置 var userWebAccountConfig = _webAccountConfig.GetAccountConfig(CONST_WEB_ACCOUNT_TYPE, UserManager.UserId).GetAwaiter().GetResult(); + _logger.LogInformation("批次={no} 获取获取网站的账户完成,result={Num}", batchNo, JSON.Serialize(userWebAccountConfig)); + if (userWebAccountConfig == null) throw Oops.Bah($"个人/公司网站【{CONST_WEB_ACCOUNT_TYPE}】获取失败,请维护个人/公司网站账户信息"); @@ -722,6 +732,21 @@ namespace Myshipping.Application _taskOriginalDownloadHisInfoRepository.Insert(taskOriginalDownloadHisInfo); //请求远程链接 + Dictionary formDict = new Dictionary { + {"bno", taskBaseInfo.MBL_NO }, + {"page_url", downloadUrl }, + {"web_user", webAccountConfig.Account }, + {"web_pwd", webAccountConfig.Password }, + {"web_pwd", "myshipping_task" }, + {"web_pwd", "" } + }; + + //请求下载正本 + var postResult = await InnerRemoteDownOriginal(downloadUrl, formDict); + + //var rtnObj = JObject.Parse(rtnStr); + //var sta = rtnObj.GetValue("status").ToString(); + //var msg = rtnObj.GetValue("message").ToString(); } catch (Exception ex) { @@ -735,12 +760,11 @@ namespace Myshipping.Application private async Task InnerRemoteDownOriginal(string url, Dictionary dic) { + + var result = new TaskManageOrderResultDto(); - //var t = await url.SetBody(new Dictionary { - // { "Id", 1 }, - // { "Name", "Furion"} - //}, "application/x-www-form-urlencoded"); + var t = url.SetBody(dic, "application/x-www-form-urlencoded"); return result; }