wet 2 years ago
commit edfbce4e7b

@ -195,6 +195,9 @@ namespace Myshipping.Application.EDI.ESL
/// <returns></returns> /// <returns></returns>
public static string formatEdiStr(string fileType, string str) public static string formatEdiStr(string fileType, string str)
{ {
if (str == null)
str = string.Empty;
if (fileType == "txt") if (fileType == "txt")
{ {
return str.Replace("?", "??").Replace(":", "?:").Replace("+", "?+").Replace("'", "?'"); return str.Replace("?", "??").Replace(":", "?:").Replace("+", "?+").Replace("'", "?'");
@ -282,7 +285,7 @@ namespace Myshipping.Application.EDI.ESL
#endregion #endregion
#region 检查 #region 检查
public static string IsCreateESLEDI(MsESLEdiModel InttrEdi) public static string IsCreateESLEDI(EDIBaseModel InttrEdi)
{ {
var error = ""; var error = "";
@ -317,8 +320,9 @@ namespace Myshipping.Application.EDI.ESL
if (string.IsNullOrEmpty(headData.BLFRT)) if (string.IsNullOrEmpty(headData.BLFRT))
{ error = error + "<br />提单号:" + headData.MBLNO + " 付费方式不能为空"; } { error = error + "<br />提单号:" + headData.MBLNO + " 付费方式不能为空"; }
if (string.IsNullOrEmpty(headData.ESLLINECODE)) //2023-01-04 JHQ 跟韩训涛确认ESL这里不处理航线代码去掉不为空校验并在生成EDI报文时对ESL航线代码赋空串
{ error = error + "<br />提单号:" + headData.MBLNO + " ESL航线代码不能为空"; } //if (string.IsNullOrEmpty(headData.ESLLINECODE))
//{ error = error + "<br />提单号:" + headData.MBLNO + " ESL航线代码不能为空"; }
if (InttrEdi.filetype == "E") if (InttrEdi.filetype == "E")
{ {
@ -610,10 +614,12 @@ namespace Myshipping.Application.EDI.ESL
#endregion #endregion
#region 生成报文(订舱(InttrEdi.filetype=="B"),截单(InttrEdi.filetype=="E")) #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 }; CommonWebApiResult result = new CommonWebApiResult { succ = false };
var filetype = "IFTMIN"; var filetype = "IFTMIN";
if (InttrEdi.filetype != "E") filetype = "IFTMBF"; if (InttrEdi.filetype != "E") filetype = "IFTMBF";
@ -628,8 +634,17 @@ namespace Myshipping.Application.EDI.ESL
var icount = 0; var icount = 0;
var bsno = ""; var bsno = "";
var isfirst = true; var isfirst = true;
foreach (var bill in InttrEdi.BSLIST) 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 (isfirst)
{ {
if (InttrEdi.filetype == "E") if (InttrEdi.filetype == "E")
@ -697,6 +712,8 @@ namespace Myshipping.Application.EDI.ESL
icount++; icount++;
var ISSUETYPE = ""; var ISSUETYPE = "";
/* 2022-01-04
if (bill.ISSUETYPE == "正本") if (bill.ISSUETYPE == "正本")
{ {
ISSUETYPE = "ORI"; ISSUETYPE = "ORI";
@ -706,7 +723,19 @@ namespace Myshipping.Application.EDI.ESL
ISSUETYPE = "TER"; ISSUETYPE = "TER";
} }
else ISSUETYPE = "EXP"; 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 + "'"); r.WriteLine("03:" + ISSUETYPE + ":" + bill.ISSUEPLACEID.Trim() + ":" + bill.ISSUEPLACE.Trim() + ":" + GetDateStr(bill.ISSUEDATE, "yyyyMMdd") + ":" + GetBillNum2(bill.NOBILL) + ":" + bill.PREPARDAT + ":" + bill.PAYABLEAT + "'");

@ -35,6 +35,7 @@ namespace Myshipping.Application
/// 未指定 /// 未指定
/// </summary> /// </summary>
NULL, NULL,
/// <summary> /// <summary>
/// 阿联酋航运 /// 阿联酋航运
/// </summary> /// </summary>

@ -6233,7 +6233,7 @@
<param name="model">订舱、截单EDI请求</param> <param name="model">订舱、截单EDI请求</param>
<returns>返回回执</returns> <returns>返回回执</returns>
</member> </member>
<member name="M:Myshipping.Application.BookingOrderService.DownloadBookingOrClosingEDI(System.Int64,System.String,System.Boolean,System.String,System.String,System.String)"> <member name="M:Myshipping.Application.BookingOrderService.DownloadBookingOrClosingEDI(System.Int64,System.String,System.Boolean,System.String,System.String,System.String,System.String)">
<summary> <summary>
下载订舱、截单EDI 下载订舱、截单EDI
</summary> </summary>

@ -57,6 +57,8 @@ using System.Linq.Expressions;
using Myshipping.Core.Extension; using Myshipping.Core.Extension;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using MathNet.Numerics.Distributions; using MathNet.Numerics.Distributions;
using Microsoft.IdentityModel.Tokens;
using Myshipping.Application.EDI.ESL;
namespace Myshipping.Application namespace Myshipping.Application
{ {
@ -2859,13 +2861,14 @@ namespace Myshipping.Application
/// <returns></returns> /// <returns></returns>
[HttpGet("/BookingOrder/DownloadBookingOrClosingEDI")] [HttpGet("/BookingOrder/DownloadBookingOrClosingEDI")]
public IActionResult DownloadBookingOrClosingEDI([FromQuery] long id, [FromQuery] string orderNo, [FromQuery] bool useForwarderCode, 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 var model = new BookingOrClosingEDIOrderDto
{ {
Id = id, Id = id,
orderNo = orderNo, orderNo = orderNo,
useForwarderCode = useForwarderCode, useForwarderCode = useForwarderCode,
forwarderCode = forwarderCode,
forwarderName = forwarderName, forwarderName = forwarderName,
fileRole = fileRole, fileRole = fileRole,
send = false, send = false,
@ -3091,7 +3094,7 @@ namespace Myshipping.Application
else if (ediRouteEnum == EDIRouteEnum.ESL) else if (ediRouteEnum == EDIRouteEnum.ESL)
{ {
#region YT #region YT
string strCheck = TSLEdiHelper.IsCreateTSL(ediModel); string strCheck = ESLEdiHelper.IsCreateESLEDI(ediModel);
_logger.LogInformation($"调用SO(SI),校验:{strCheck},数据对象:{JsonConvert.SerializeObject(ediModel)}"); _logger.LogInformation($"调用SO(SI),校验:{strCheck},数据对象:{JsonConvert.SerializeObject(ediModel)}");
@ -3106,16 +3109,7 @@ namespace Myshipping.Application
} }
CommonWebApiResult currRlt = new CommonWebApiResult(); CommonWebApiResult currRlt = ESLEdiHelper.CreateEdiESL(ediModel);
if (model.sendType == "B")
{
currRlt = TSLEdiHelper.CreateEdiTSL(ediModel);
}
else if (model.sendType == "E")
{
currRlt = TSLEdiHelper.CreateEdiTSLSI(ediModel);
}
#endregion #endregion
result.succ = currRlt.succ; result.succ = currRlt.succ;

@ -4,6 +4,7 @@ using Furion.DynamicApiController;
using Furion.FriendlyException; using Furion.FriendlyException;
using Furion.JsonSerialization; using Furion.JsonSerialization;
using Furion.RemoteRequest; using Furion.RemoteRequest;
using Furion.RemoteRequest.Extensions;
using Mapster; using Mapster;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
@ -16,6 +17,7 @@ using Myshipping.Core;
using Myshipping.Core.Entity; using Myshipping.Core.Entity;
using Myshipping.Core.Service; using Myshipping.Core.Service;
using MySqlX.XDevAPI.Common; using MySqlX.XDevAPI.Common;
using Newtonsoft.Json.Linq;
using NPOI.SS.Formula.Functions; using NPOI.SS.Formula.Functions;
using SqlSugar; using SqlSugar;
using StackExchange.Profiling.Internal; using StackExchange.Profiling.Internal;
@ -23,6 +25,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -636,13 +639,21 @@ namespace Myshipping.Application
{ {
TaskManageOrderResultDto result = new TaskManageOrderResultDto(); TaskManageOrderResultDto result = new TaskManageOrderResultDto();
string batchNo = IDGen.NextID().ToString();
_logger.LogInformation("批次={no} ids={ids} 下载正本提单开始", batchNo, string.Join(",", PKIds));
try try
{ {
var taskList = _taskBaseInfoRepository.AsQueryable().Where(t => PKIds.Contains(t.PK_ID)).ToList(); var taskList = _taskBaseInfoRepository.AsQueryable().Where(t => PKIds.Contains(t.PK_ID)).ToList();
_logger.LogInformation("批次={no} 获取任务完成Num={Num}", batchNo, taskList.Count);
//获取个人对应的账户,这里GetAccountConfig逻辑优先取个人个人没有配置取公司对应配置 //获取个人对应的账户,这里GetAccountConfig逻辑优先取个人个人没有配置取公司对应配置
var userWebAccountConfig = _webAccountConfig.GetAccountConfig(CONST_WEB_ACCOUNT_TYPE, UserManager.UserId).GetAwaiter().GetResult(); var userWebAccountConfig = _webAccountConfig.GetAccountConfig(CONST_WEB_ACCOUNT_TYPE, UserManager.UserId).GetAwaiter().GetResult();
_logger.LogInformation("批次={no} 获取获取网站的账户完成result={Num}", batchNo, JSON.Serialize(userWebAccountConfig));
if (userWebAccountConfig == null) if (userWebAccountConfig == null)
throw Oops.Bah($"个人/公司网站【{CONST_WEB_ACCOUNT_TYPE}】获取失败,请维护个人/公司网站账户信息"); throw Oops.Bah($"个人/公司网站【{CONST_WEB_ACCOUNT_TYPE}】获取失败,请维护个人/公司网站账户信息");
@ -721,6 +732,21 @@ namespace Myshipping.Application
_taskOriginalDownloadHisInfoRepository.Insert(taskOriginalDownloadHisInfo); _taskOriginalDownloadHisInfoRepository.Insert(taskOriginalDownloadHisInfo);
//请求远程链接 //请求远程链接
Dictionary<string, string> formDict = new Dictionary<string, string> {
{"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) catch (Exception ex)
{ {
@ -731,7 +757,17 @@ namespace Myshipping.Application
return result; return result;
} }
//private async Task<TaskManageOrderResultDto> Inner private async Task<TaskManageOrderResultDto> InnerRemoteDownOriginal(string url, Dictionary<string, string> dic)
{
var result = new TaskManageOrderResultDto();
var t = url.SetBody(dic, "application/x-www-form-urlencoded");
return result;
}
} }
} }

Loading…
Cancel
Save