|
|
|
@ -7,44 +7,29 @@ using Furion.FriendlyException;
|
|
|
|
|
using Furion.JsonSerialization;
|
|
|
|
|
using Furion.RemoteRequest.Extensions;
|
|
|
|
|
using Mapster;
|
|
|
|
|
using MathNet.Numerics;
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Microsoft.AspNetCore.Rewrite;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
|
using Myshipping.Application.ConfigOption;
|
|
|
|
|
using Myshipping.Application.Entity;
|
|
|
|
|
using Myshipping.Application.Service.BookingOrder.Dto;
|
|
|
|
|
using Myshipping.Core;
|
|
|
|
|
using Myshipping.Core.Entity;
|
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
|
using MySqlX.XDevAPI.Common;
|
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
|
using Org.BouncyCastle.Crypto;
|
|
|
|
|
using Org.BouncyCastle.Utilities;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
using StackExchange.Profiling.Internal;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Collections.Specialized;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using System.Net.NetworkInformation;
|
|
|
|
|
using System.Reflection.Metadata;
|
|
|
|
|
using System.Reflection.Metadata.Ecma335;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Text.Json;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using Ubiety.Dns.Core;
|
|
|
|
|
using Yitter.IdGenerator;
|
|
|
|
|
using static Aliyun.OSS.Model.CreateSelectObjectMetaInputFormatModel;
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
@ -124,7 +109,7 @@ namespace Myshipping.Application
|
|
|
|
|
/// <param name="bookingIds">订舱主键数组</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
[HttpPost("/BookingValueAdded/DownloadBookingConfirm")]
|
|
|
|
|
public async Task<TaskManageOrderResultDto> DownloadBookingConfirm([FromBody]long[] bookingIds)
|
|
|
|
|
public async Task<TaskManageOrderResultDto> DownloadBookingConfirm([FromBody] long[] bookingIds)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
@ -152,7 +137,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
foreach (var bk in list)
|
|
|
|
|
{
|
|
|
|
|
var sortNo = noList.FirstOrDefault(a=>a.id == bk.Id).no;
|
|
|
|
|
var sortNo = noList.FirstOrDefault(a => a.id == bk.Id).no;
|
|
|
|
|
taskList.Add(Task.Run(() => InnerDownloadBookingConfirm(bk, batchNo, sortNo)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -188,7 +173,7 @@ namespace Myshipping.Application
|
|
|
|
|
result.batchTotal = "- ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(fail > 0)
|
|
|
|
|
if (fail > 0)
|
|
|
|
|
{
|
|
|
|
|
result.batchTotal += "/" + fail.ToString();
|
|
|
|
|
}
|
|
|
|
@ -214,7 +199,7 @@ namespace Myshipping.Application
|
|
|
|
|
/// <param name="batchNo">批次号</param>
|
|
|
|
|
/// <param name="sortNo">请求顺序号</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
private async Task<TaskManageOrderResultDto> InnerDownloadBookingConfirm(BookingOrder bookingOrder,string batchNo, int sortNo)
|
|
|
|
|
private async Task<TaskManageOrderResultDto> InnerDownloadBookingConfirm(BookingOrder bookingOrder, string batchNo, int sortNo)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
@ -277,7 +262,7 @@ namespace Myshipping.Application
|
|
|
|
|
string webKey = string.Format(CONST_FORMAT_WEB, bcOrDraftRouteCfg.MapCode);
|
|
|
|
|
|
|
|
|
|
//获取个人对应的账户,这里GetAccountConfig逻辑优先取个人,个人没有配置取公司对应配置
|
|
|
|
|
var userWebAccountConfig = GetAccountConfig(webKey, UserManager.UserId,UserManager.TENANT_ID).GetAwaiter()
|
|
|
|
|
var userWebAccountConfig = GetAccountConfig(webKey, UserManager.UserId, UserManager.TENANT_ID).GetAwaiter()
|
|
|
|
|
.GetResult();
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 获取获取网站的账户完成,result={Num}", batchNo, JSON.Serialize(userWebAccountConfig));
|
|
|
|
@ -306,7 +291,7 @@ namespace Myshipping.Application
|
|
|
|
|
var timeDiff = ts.TotalMilliseconds;
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} result={result} 请求BC远端下载结束 耗时:{timeDiff}ms. ", batchNo,
|
|
|
|
|
JSON.Serialize(rlt),timeDiff);
|
|
|
|
|
JSON.Serialize(rlt), timeDiff);
|
|
|
|
|
|
|
|
|
|
if (rlt.code == 200)
|
|
|
|
|
{
|
|
|
|
@ -420,7 +405,7 @@ namespace Myshipping.Application
|
|
|
|
|
/// <param name="bookingIds">订舱主键数组</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/BookingValueAdded/DownloadDraft")]
|
|
|
|
|
public async Task<TaskManageOrderResultDto> DownloadDraft([FromBody]long[] bookingIds)
|
|
|
|
|
public async Task<TaskManageOrderResultDto> DownloadDraft([FromBody] long[] bookingIds)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
List<Task<TaskManageOrderResultDto>> taskList = new List<Task<TaskManageOrderResultDto>>();
|
|
|
|
@ -447,7 +432,7 @@ namespace Myshipping.Application
|
|
|
|
|
var noList = bookingIds.Select((a, idx) => new { no = idx + 1, id = a }).ToList();
|
|
|
|
|
foreach (var bk in list)
|
|
|
|
|
{
|
|
|
|
|
var sortNo = noList.FirstOrDefault(a=>a.id == bk.Id).no;
|
|
|
|
|
var sortNo = noList.FirstOrDefault(a => a.id == bk.Id).no;
|
|
|
|
|
taskList.Add(Task.Run(() => InnerDownloadDraft(bk, batchNo, sortNo)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -509,7 +494,7 @@ namespace Myshipping.Application
|
|
|
|
|
/// <param name="batchNo">批次号</param>
|
|
|
|
|
/// <param name="sortNo">请求顺序号</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
private async Task<TaskManageOrderResultDto> InnerDownloadDraft(BookingOrder bookingOrder, string batchNo,int sortNo)
|
|
|
|
|
private async Task<TaskManageOrderResultDto> InnerDownloadDraft(BookingOrder bookingOrder, string batchNo, int sortNo)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
@ -524,9 +509,9 @@ namespace Myshipping.Application
|
|
|
|
|
4、请求相应的链接。
|
|
|
|
|
5、返回成功写入附件。
|
|
|
|
|
*/
|
|
|
|
|
if(bookingOrder.CARRIERID.Equals("ESL", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
if (bookingOrder.CARRIERID.Equals("ESL", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
if(string.IsNullOrWhiteSpace(bookingOrder.TMBLNO))
|
|
|
|
|
if (string.IsNullOrWhiteSpace(bookingOrder.TMBLNO))
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingOrder.CUSTNO))
|
|
|
|
|
{
|
|
|
|
@ -602,7 +587,7 @@ namespace Myshipping.Application
|
|
|
|
|
string downloadFilePathRlt = string.Empty;
|
|
|
|
|
string erroMsg = string.Empty;
|
|
|
|
|
|
|
|
|
|
if(bcOrDraftRouteCfg.MapCode.Trim().Equals("ESL", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
if (bcOrDraftRouteCfg.MapCode.Trim().Equals("ESL", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
ESLDraftRequestDto requestDto = new ESLDraftRequestDto
|
|
|
|
|
{
|
|
|
|
@ -764,7 +749,8 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} 对应请求报文 request={res}", batchNo, JSON.Serialize(info));
|
|
|
|
|
|
|
|
|
|
var res = await url.OnClientCreating(client => {
|
|
|
|
|
var res = await url.OnClientCreating(client =>
|
|
|
|
|
{
|
|
|
|
|
// client 为 HttpClient 对象
|
|
|
|
|
client.Timeout = TimeSpan.FromMinutes(15); // 设置超时时间 15分钟
|
|
|
|
|
}).SetHttpMethod(HttpMethod.Post)
|
|
|
|
@ -816,7 +802,8 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} 对应请求报文 request={res}", batchNo, JSON.Serialize(info));
|
|
|
|
|
|
|
|
|
|
var res = await url.OnClientCreating(client => {
|
|
|
|
|
var res = await url.OnClientCreating(client =>
|
|
|
|
|
{
|
|
|
|
|
// client 为 HttpClient 对象
|
|
|
|
|
client.Timeout = TimeSpan.FromMinutes(15); // 设置超时时间 15分钟
|
|
|
|
|
}).SetHttpMethod(HttpMethod.Post)
|
|
|
|
@ -869,10 +856,11 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} 对应请求报文 request={res}", batchNo, JSON.Serialize(info));
|
|
|
|
|
|
|
|
|
|
var res = await url.OnClientCreating(client => {
|
|
|
|
|
var res = await url.OnClientCreating(client =>
|
|
|
|
|
{
|
|
|
|
|
// client 为 HttpClient 对象
|
|
|
|
|
client.Timeout = TimeSpan.FromMinutes(15); // 设置超时时间 15分钟
|
|
|
|
|
}).SetHttpMethod(HttpMethod.Post)
|
|
|
|
|
client.Timeout = TimeSpan.FromMinutes(15); // 设置超时时间 15分钟
|
|
|
|
|
}).SetHttpMethod(HttpMethod.Post)
|
|
|
|
|
.SetBody(JSON.Serialize(info), "application/json")
|
|
|
|
|
.SetContentEncoding(Encoding.UTF8)
|
|
|
|
|
.PostAsync();
|
|
|
|
@ -918,7 +906,8 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} 对应请求报文 request={res}", batchNo, JSON.Serialize(info));
|
|
|
|
|
|
|
|
|
|
var res = await url.OnClientCreating(client => {
|
|
|
|
|
var res = await url.OnClientCreating(client =>
|
|
|
|
|
{
|
|
|
|
|
// client 为 HttpClient 对象
|
|
|
|
|
client.Timeout = TimeSpan.FromMinutes(15); // 设置超时时间 15分钟
|
|
|
|
|
}).SetHttpMethod(HttpMethod.Post)
|
|
|
|
@ -1146,7 +1135,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
if (rlt.status == 1)
|
|
|
|
|
{
|
|
|
|
|
if(rlt.data == null || string.IsNullOrWhiteSpace(rlt.data.esl_no))
|
|
|
|
|
if (rlt.data == null || string.IsNullOrWhiteSpace(rlt.data.esl_no))
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} 舱位分配查询失败,ESL号不存在", batchNo);
|
|
|
|
|
|
|
|
|
@ -1159,7 +1148,7 @@ namespace Myshipping.Application
|
|
|
|
|
*/
|
|
|
|
|
var bkInfo = _bookingOrderRepository.AsQueryable().First(a => a.Id == bookingOrder.Id);
|
|
|
|
|
|
|
|
|
|
if(bkInfo == null)
|
|
|
|
|
if (bkInfo == null)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 订舱信息获取失败,无法更新", batchNo, bookingOrder.Id);
|
|
|
|
|
|
|
|
|
@ -1383,7 +1372,8 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} 对应请求报文 request={res}", batchNo, JSON.Serialize(info));
|
|
|
|
|
|
|
|
|
|
var res = await url.OnClientCreating(client => {
|
|
|
|
|
var res = await url.OnClientCreating(client =>
|
|
|
|
|
{
|
|
|
|
|
// client 为 HttpClient 对象
|
|
|
|
|
client.Timeout = TimeSpan.FromMinutes(15); // 设置超时时间 15分钟
|
|
|
|
|
}).SetHttpMethod(HttpMethod.Post)
|
|
|
|
@ -1419,7 +1409,7 @@ namespace Myshipping.Application
|
|
|
|
|
/// <param name="userId">用户ID</param>
|
|
|
|
|
/// <param name="tendId">租户ID</param>
|
|
|
|
|
/// <returns>返回账户配置</returns>
|
|
|
|
|
private async Task<DjyWebsiteAccountConfig> GetAccountConfig(string typeCode,long userId,long tendId)
|
|
|
|
|
private async Task<DjyWebsiteAccountConfig> GetAccountConfig(string typeCode, long userId, long tendId)
|
|
|
|
|
{
|
|
|
|
|
DjyWebsiteAccountConfig accountConfig = new DjyWebsiteAccountConfig();
|
|
|
|
|
accountConfig = await _djyWebsiteAccountConfigRepository.EntityContext.CopyNew().Queryable<DjyWebsiteAccountConfig>()
|
|
|
|
@ -1455,12 +1445,12 @@ namespace Myshipping.Application
|
|
|
|
|
2、解析识别结果,并返回BC的解析明细。
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if(bookingOrderId < 0)
|
|
|
|
|
if (bookingOrderId < 0)
|
|
|
|
|
throw Oops.Oh($"订舱主键不能为空");
|
|
|
|
|
|
|
|
|
|
var bookingOrder = _bookingOrderRepository.AsQueryable().First(a => a.Id == bookingOrderId);
|
|
|
|
|
|
|
|
|
|
if(bookingOrder == null)
|
|
|
|
|
if (bookingOrder == null)
|
|
|
|
|
throw Oops.Oh($"订舱信息获取失败,订舱信息不存在或已作废");
|
|
|
|
|
|
|
|
|
|
//获取解析BC文件链接
|
|
|
|
@ -1501,11 +1491,11 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
var currBC = bcParseRlt.data.BCList.FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
if(!string.IsNullOrWhiteSpace(currBC.Vessel) && Regex.IsMatch(currBC.Vessel, "\\(|(|\\)|)|\\n"))
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(currBC.Vessel) && Regex.IsMatch(currBC.Vessel, "\\(|(|\\)|)|\\n"))
|
|
|
|
|
{
|
|
|
|
|
if(Regex.IsMatch(currBC.Vessel, "\\(|(|\\)|)"))
|
|
|
|
|
if (Regex.IsMatch(currBC.Vessel, "\\(|(|\\)|)"))
|
|
|
|
|
{
|
|
|
|
|
currBC.Vessel = Regex.Match(currBC.Vessel,"\\w+\\s?\\n?\\s?\\w+(?=\\()").Value;
|
|
|
|
|
currBC.Vessel = Regex.Match(currBC.Vessel, "\\w+\\s?\\n?\\s?\\w+(?=\\()").Value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Regex.IsMatch(currBC.Vessel, "\\n"))
|
|
|
|
@ -1526,7 +1516,8 @@ namespace Myshipping.Application
|
|
|
|
|
ETD = currBC.ETD
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
singleBCDto.BookingOrderBCDto = new BookingOrderBCDto {
|
|
|
|
|
singleBCDto.BookingOrderBCDto = new BookingOrderBCDto
|
|
|
|
|
{
|
|
|
|
|
MBLNO = bookingOrder.MBLNO,
|
|
|
|
|
CUSTNO = bookingOrder.CUSTNO,
|
|
|
|
|
CLOSEDOCDATE = bookingOrder.CLOSEDOCDATE,
|
|
|
|
@ -1542,7 +1533,7 @@ namespace Myshipping.Application
|
|
|
|
|
*/
|
|
|
|
|
//读取文件配置
|
|
|
|
|
|
|
|
|
|
var fileFullName = await FileAttachHelper.TempSaveWebFile(bookingOrder.Id.ToString(), file, batchNo);
|
|
|
|
|
var fileFullName = await FileAttachHelper.TempSaveWebFile(bookingOrder.Id.ToString(), file, batchNo);
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 完成文件保存 filepath={path}", batchNo, fileFullName);
|
|
|
|
|
|
|
|
|
@ -1557,7 +1548,7 @@ namespace Myshipping.Application
|
|
|
|
|
result.msg = $"解析BC失败,原因:{bcParseRlt.message}";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} 解析BC异常,原因:{error} ", batchNo, ex.Message);
|
|
|
|
|
|
|
|
|
@ -1580,7 +1571,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var response = await requestUrl.SetContentType("multipart/form-data")
|
|
|
|
|
var response = await requestUrl.SetContentType("multipart/form-data")
|
|
|
|
|
.SetBodyBytes((fileInfo.file.ToString(), fileInfo.fileBytes, HttpUtility.UrlEncode(fileInfo.fileName.ToString())))
|
|
|
|
|
.PostAsync();
|
|
|
|
|
|
|
|
|
@ -1637,7 +1628,7 @@ namespace Myshipping.Application
|
|
|
|
|
if (bookingOrder == null)
|
|
|
|
|
throw Oops.Bah($"订舱信息获取失败,订舱信息不存在或已作废");
|
|
|
|
|
|
|
|
|
|
var updateRlt = InnerBCUpdateBookingOrder(model, bookingOrder, batchNo,1).GetAwaiter().GetResult();
|
|
|
|
|
var updateRlt = InnerBCUpdateBookingOrder(model, bookingOrder, batchNo, 1).GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
|
|
if (!updateRlt.succ)
|
|
|
|
|
throw Oops.Bah($"订舱信息更新失败,{updateRlt.msg}");
|
|
|
|
@ -1671,7 +1662,7 @@ namespace Myshipping.Application
|
|
|
|
|
var letterYardModel = _bookingLetteryardRepository.AsQueryable()
|
|
|
|
|
.First(x => x.BookingId == model.BookingOrderId);
|
|
|
|
|
|
|
|
|
|
if(letterYardModel != null)
|
|
|
|
|
if (letterYardModel != null)
|
|
|
|
|
letterYardDto.Id = letterYardModel.Id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1696,7 +1687,7 @@ namespace Myshipping.Application
|
|
|
|
|
//重新将暂存文件写入正式路径
|
|
|
|
|
|
|
|
|
|
//读取文件配置
|
|
|
|
|
var bookFilePath = await FileAttachHelper.MoveFile(bookingOrder.Id.ToString(), model.FileTempPath,batchNo);
|
|
|
|
|
var bookFilePath = await FileAttachHelper.MoveFile(bookingOrder.Id.ToString(), model.FileTempPath, batchNo);
|
|
|
|
|
|
|
|
|
|
//将BC引入的文件写入订舱的附件
|
|
|
|
|
await SaveEDIFile(bookingOrder.Id, bookFilePath, new System.IO.FileInfo(bookFilePath).Name,
|
|
|
|
@ -1729,7 +1720,7 @@ namespace Myshipping.Application
|
|
|
|
|
/// <param name="sortNo">顺序号</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
private async Task<TaskManageOrderResultDto> InnerBCUpdateBookingOrder(SingleBCDto model, BookingOrder bookingOrder,
|
|
|
|
|
string batchNo,int sortNo)
|
|
|
|
|
string batchNo, int sortNo)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
@ -1850,7 +1841,7 @@ namespace Myshipping.Application
|
|
|
|
|
/// <param name="batchBCList">批量BC更新列表</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
[HttpPost("/BookingValueAdded/BatchBCUpdate")]
|
|
|
|
|
public async Task<TaskManageOrderResultDto> BatchBCUpdate([FromBody]List<BatchBCDto> batchBCList)
|
|
|
|
|
public async Task<TaskManageOrderResultDto> BatchBCUpdate([FromBody] List<BatchBCDto> batchBCList)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
List<Task<TaskManageOrderResultDto>> taskList = new List<Task<TaskManageOrderResultDto>>();
|
|
|
|
@ -1859,7 +1850,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var bcTaskList = batchBCList.Select(a=>a.bcPKId).Distinct().ToList();
|
|
|
|
|
var bcTaskList = batchBCList.Select(a => a.bcPKId).Distinct().ToList();
|
|
|
|
|
var bkOrderList = batchBCList.Select(a => a.bkOrderId.Value).Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
var bklist = _bookingOrderRepository.AsQueryable()
|
|
|
|
@ -1876,11 +1867,13 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
var sortNo = noList.FirstOrDefault(a => a.id == bk.Id).no;
|
|
|
|
|
|
|
|
|
|
var currBC = batchBCList.Join(bclist, l => l.bcPKId, r => r.PK_ID, (l, r) => {
|
|
|
|
|
var currBC = batchBCList.Join(bclist, l => l.bcPKId, r => r.PK_ID, (l, r) =>
|
|
|
|
|
{
|
|
|
|
|
return r;
|
|
|
|
|
}).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
SingleBCDto singleBCDto = new SingleBCDto {
|
|
|
|
|
SingleBCDto singleBCDto = new SingleBCDto
|
|
|
|
|
{
|
|
|
|
|
BLNo = currBC.MBL_NO,
|
|
|
|
|
Vessel = currBC.VESSEL,
|
|
|
|
|
Voyage = currBC.VOYNO,
|
|
|
|
@ -1889,7 +1882,7 @@ namespace Myshipping.Application
|
|
|
|
|
VGMCutOffTime = currBC.VGM_CUTOFF_TIME,
|
|
|
|
|
ClosingDate = currBC.CUT_SINGLE_TIME
|
|
|
|
|
};
|
|
|
|
|
taskList.Add(Task.Run(() => InnerBCUpdateBookingOrder(singleBCDto,bk, batchNo, sortNo)));
|
|
|
|
|
taskList.Add(Task.Run(() => InnerBCUpdateBookingOrder(singleBCDto, bk, batchNo, sortNo)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Task.WaitAll(taskList.ToArray());
|
|
|
|
@ -2063,20 +2056,22 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var bookingOrder = _bookingOrderRepository.AsQueryable().Filter(null,true)
|
|
|
|
|
.First(a=>a.Id == model.BookingId);
|
|
|
|
|
var bookingOrder = _bookingOrderRepository.AsQueryable().Filter(null, true)
|
|
|
|
|
.First(a => a.Id == model.BookingId);
|
|
|
|
|
|
|
|
|
|
if(bookingOrder == null)
|
|
|
|
|
if (bookingOrder == null)
|
|
|
|
|
throw Oops.Oh($"订舱信息获取失败,订舱信息不存在或已作废");
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 请求保存服务项目 modifyjson={msg}", batchNo, JSON.Serialize(model));
|
|
|
|
|
|
|
|
|
|
TrackingMessageInfo msgInfo = new TrackingMessageInfo {
|
|
|
|
|
Head = new TrackingMessageHeadInfo {
|
|
|
|
|
TrackingMessageInfo msgInfo = new TrackingMessageInfo
|
|
|
|
|
{
|
|
|
|
|
Head = new TrackingMessageHeadInfo
|
|
|
|
|
{
|
|
|
|
|
GID = IDGen.NextID().ToString(),
|
|
|
|
|
MessageType = "PROJECT",
|
|
|
|
|
ReceiverId = "ServiceProjectStatus",
|
|
|
|
|
ReceiverName= "服务项目和状态",
|
|
|
|
|
ReceiverName = "服务项目和状态",
|
|
|
|
|
SenderId = "BookingOrder",
|
|
|
|
|
SenderName = "海运订舱",
|
|
|
|
|
RequestDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
|
|
|
|
@ -2097,7 +2092,7 @@ namespace Myshipping.Application
|
|
|
|
|
OperUserId = UserManager.UserId.ToString(),
|
|
|
|
|
OperUserName = UserManager.Name,
|
|
|
|
|
SourceType = TrackingSourceTypeEnum.MANUAL,
|
|
|
|
|
ProjectList = model.ProjectCodes.Select(a=> new TrackingMessageMainProjectInfo
|
|
|
|
|
ProjectList = model.ProjectCodes.Select(a => new TrackingMessageMainProjectInfo
|
|
|
|
|
{
|
|
|
|
|
ServiceProjectCode = a,
|
|
|
|
|
}).ToList()
|
|
|
|
@ -2114,7 +2109,7 @@ namespace Myshipping.Application
|
|
|
|
|
var timeDiff = ts.TotalMilliseconds;
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg} result={rlt}", batchNo, timeDiff, (rlt.succ ? "成功" : "失败")
|
|
|
|
|
,JSON.Serialize(rlt));
|
|
|
|
|
, JSON.Serialize(rlt));
|
|
|
|
|
|
|
|
|
|
if (!rlt.succ)
|
|
|
|
|
{
|
|
|
|
@ -2127,7 +2122,7 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = $"服务项目保存失败,原因:{ex.Message}";
|
|
|
|
@ -2309,7 +2304,7 @@ namespace Myshipping.Application
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.msg = "推送成功";
|
|
|
|
|
|
|
|
|
|
await _bookingOrderService.SetBookingGoodsStatus(bookingOrder.Id, true);
|
|
|
|
|
await _bookingOrderService.SetBookingGoodsStatus(bookingOrder.Id, true, "手动设置订舱货物状态(启用)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -2403,7 +2398,7 @@ namespace Myshipping.Application
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.msg = "推送成功";
|
|
|
|
|
|
|
|
|
|
await _bookingOrderService.SetBookingGoodsStatus(bookingOrder.Id, true);
|
|
|
|
|
await _bookingOrderService.SetBookingGoodsStatus(bookingOrder.Id, true, "手动设置订舱货物状态(取消)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -2439,7 +2434,8 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
DateTime bDate = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
QueryServiceProjectWithStatus queryInfo = new QueryServiceProjectWithStatus {
|
|
|
|
|
QueryServiceProjectWithStatus queryInfo = new QueryServiceProjectWithStatus
|
|
|
|
|
{
|
|
|
|
|
BookingId = model.BookingId,
|
|
|
|
|
QueryType = TrackingQueryTypeEnum.QUERY_SERVICE_PROJECT,
|
|
|
|
|
TenantId = bookingOrder.TenantId.Value
|
|
|
|
@ -2451,9 +2447,9 @@ namespace Myshipping.Application
|
|
|
|
|
TimeSpan ts = eDate.Subtract(bDate);
|
|
|
|
|
var timeDiff = ts.TotalMilliseconds;
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 单票请求服务项目结果 耗时:{timeDiff}ms. ", batchNo, model.BookingId,timeDiff);
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 单票请求服务项目结果 耗时:{timeDiff}ms. ", batchNo, model.BookingId, timeDiff);
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = $"获取服务项目列表失败,原因:{ex.Message}";
|
|
|
|
@ -2537,9 +2533,9 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var rlt = await _bookingOrderService.SendBookingOrder(ids);
|
|
|
|
|
var rlt = await _bookingOrderService.SendBookingOrder(ids);
|
|
|
|
|
|
|
|
|
|
if(rlt != null)
|
|
|
|
|
if (rlt != null)
|
|
|
|
|
{
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.msg = "同步完成";
|
|
|
|
@ -2605,7 +2601,7 @@ namespace Myshipping.Application
|
|
|
|
|
var curStr = reader.GetString();
|
|
|
|
|
Int32 curVal = 0;
|
|
|
|
|
Int32.TryParse(curStr, out curVal);
|
|
|
|
|
return curVal;
|
|
|
|
|
return curVal;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|