|
|
@ -7,6 +7,7 @@ using Furion.FriendlyException;
|
|
|
|
using Furion.JsonSerialization;
|
|
|
|
using Furion.JsonSerialization;
|
|
|
|
using Furion.RemoteRequest.Extensions;
|
|
|
|
using Furion.RemoteRequest.Extensions;
|
|
|
|
using Mapster;
|
|
|
|
using Mapster;
|
|
|
|
|
|
|
|
using MathNet.Numerics;
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
@ -16,6 +17,7 @@ using Myshipping.Application.Entity;
|
|
|
|
using Myshipping.Core;
|
|
|
|
using Myshipping.Core;
|
|
|
|
using Myshipping.Core.Entity;
|
|
|
|
using Myshipping.Core.Entity;
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
|
|
|
|
using MySqlX.XDevAPI.Common;
|
|
|
|
using Org.BouncyCastle.Crypto;
|
|
|
|
using Org.BouncyCastle.Crypto;
|
|
|
|
using Org.BouncyCastle.Utilities;
|
|
|
|
using Org.BouncyCastle.Utilities;
|
|
|
|
using SqlSugar;
|
|
|
|
using SqlSugar;
|
|
|
@ -55,6 +57,7 @@ namespace Myshipping.Application
|
|
|
|
private readonly SqlSugarRepository<DjyWebsiteAccountConfig> _djyWebsiteAccountConfigRepository;
|
|
|
|
private readonly SqlSugarRepository<DjyWebsiteAccountConfig> _djyWebsiteAccountConfigRepository;
|
|
|
|
private readonly SqlSugarRepository<SysUser> _sysUserRepository;
|
|
|
|
private readonly SqlSugarRepository<SysUser> _sysUserRepository;
|
|
|
|
private readonly SqlSugarRepository<BookingLetteryard> _bookingLetteryardRepository;
|
|
|
|
private readonly SqlSugarRepository<BookingLetteryard> _bookingLetteryardRepository;
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<TaskBCInfo> _taskBCInfoRepository;
|
|
|
|
|
|
|
|
|
|
|
|
const string CONST_MAPPING_BC_MODULE_ROUTE = "BC_DOWN_RT";
|
|
|
|
const string CONST_MAPPING_BC_MODULE_ROUTE = "BC_DOWN_RT";
|
|
|
|
const string CONST_MAPPING_DRAFT_MODULE_ROUTE = "DRAFT_DOWN_RT";
|
|
|
|
const string CONST_MAPPING_DRAFT_MODULE_ROUTE = "DRAFT_DOWN_RT";
|
|
|
@ -72,7 +75,8 @@ namespace Myshipping.Application
|
|
|
|
public BookingValueAddedService(ISysCacheService cache, ILogger<BookingTruckService> logger,
|
|
|
|
public BookingValueAddedService(ISysCacheService cache, ILogger<BookingTruckService> logger,
|
|
|
|
SqlSugarRepository<BookingOrder> bookingOrderRepository, SqlSugarRepository<BookingFile> bookingfile,
|
|
|
|
SqlSugarRepository<BookingOrder> bookingOrderRepository, SqlSugarRepository<BookingFile> bookingfile,
|
|
|
|
SqlSugarRepository<DjyWebsiteAccountConfig> djyWebsiteAccountConfigRepository, SqlSugarRepository<SysUser> sysUserRepository,
|
|
|
|
SqlSugarRepository<DjyWebsiteAccountConfig> djyWebsiteAccountConfigRepository, SqlSugarRepository<SysUser> sysUserRepository,
|
|
|
|
SqlSugarRepository<BookingLetteryard> bookingLetteryardRepository, IBookingOrderService bookingOrderService)
|
|
|
|
SqlSugarRepository<BookingLetteryard> bookingLetteryardRepository, IBookingOrderService bookingOrderService
|
|
|
|
|
|
|
|
, SqlSugarRepository<TaskBCInfo> taskBCInfoRepository)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_cache = cache;
|
|
|
|
_cache = cache;
|
|
|
|
_logger = logger;
|
|
|
|
_logger = logger;
|
|
|
@ -84,6 +88,7 @@ namespace Myshipping.Application
|
|
|
|
_sysUserRepository = sysUserRepository;
|
|
|
|
_sysUserRepository = sysUserRepository;
|
|
|
|
_bookingLetteryardRepository = bookingLetteryardRepository;
|
|
|
|
_bookingLetteryardRepository = bookingLetteryardRepository;
|
|
|
|
_bookingOrderService = bookingOrderService;
|
|
|
|
_bookingOrderService = bookingOrderService;
|
|
|
|
|
|
|
|
_taskBCInfoRepository = taskBCInfoRepository;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1400,9 +1405,121 @@ namespace Myshipping.Application
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
var bookingOrder = _bookingOrderRepository.AsQueryable().First(a => a.Id == model.BookingOrderId);
|
|
|
|
var bookingOrder = _bookingOrderRepository.AsQueryable().First(a => a.Id == model.BookingOrderId);
|
|
|
|
|
|
|
|
|
|
|
|
if(bookingOrder == null)
|
|
|
|
if (bookingOrder == null)
|
|
|
|
throw Oops.Bah($"订舱信息获取失败,订舱信息不存在或已作废");
|
|
|
|
throw Oops.Bah($"订舱信息获取失败,订舱信息不存在或已作废");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var updateRlt = InnerBCUpdateBookingOrder(model, bookingOrder, batchNo,1).GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!updateRlt.succ)
|
|
|
|
|
|
|
|
throw Oops.Bah($"订舱信息更新失败,{updateRlt.msg}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (model.IsLetterYard)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 单票BC更新订舱后,用户选择转为入货通知,开始执行入货通知", batchNo
|
|
|
|
|
|
|
|
, bookingOrder.Id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(model.FileTempPath))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 未提交文件路径,请求失败", batchNo
|
|
|
|
|
|
|
|
, bookingOrder.Id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw Oops.Bah($"未提交文件路径,执行放舱失败");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var letterYardDto = new UpdateBookingLetteryardInput();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
letterYardDto = model.LetteryardDto.Adapt<UpdateBookingLetteryardInput>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (model.LetterYardId.HasValue && model.LetterYardId.Value > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
letterYardDto.Id = model.LetterYardId.Value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 单票BC更新订舱后,存在放舱记录 LetterYardId={LetterYardId}", batchNo
|
|
|
|
|
|
|
|
, bookingOrder.Id, letterYardDto.Id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var letterYardModel = _bookingLetteryardRepository.AsQueryable()
|
|
|
|
|
|
|
|
.First(x => x.BookingId == model.BookingOrderId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(letterYardModel != null)
|
|
|
|
|
|
|
|
letterYardDto.Id = letterYardModel.Id;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//放舱保存
|
|
|
|
|
|
|
|
var letterYardId = await _bookingOrderService.LetteryardSave(letterYardDto);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 已完放舱记录保存 返回结果{rlt}", batchNo
|
|
|
|
|
|
|
|
, bookingOrder.Id, letterYardId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} templateid={tempid} 开始发送放舱", batchNo
|
|
|
|
|
|
|
|
, bookingOrder.Id, model.TemplateId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//发送放舱
|
|
|
|
|
|
|
|
await _bookingOrderService.SendLetterYard(model.BookingOrderId, model.TemplateId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} templateid={tempid} 完成发送放舱", batchNo
|
|
|
|
|
|
|
|
, bookingOrder.Id, model.TemplateId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string fileTypeCode = "bc";
|
|
|
|
|
|
|
|
string fileTypeName = "Booking Confirmation";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//重新将暂存文件写入正式路径
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//读取文件配置
|
|
|
|
|
|
|
|
var bookFilePath = await FileAttachHelper.MoveFile(bookingOrder.Id.ToString(), model.FileTempPath,batchNo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//将BC引入的文件写入订舱的附件
|
|
|
|
|
|
|
|
await SaveEDIFile(bookingOrder.Id, bookFilePath, new System.IO.FileInfo(bookFilePath).Name,
|
|
|
|
|
|
|
|
fileTypeCode, fileTypeName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 完成写入附件表 {filepath}", batchNo
|
|
|
|
|
|
|
|
, bookingOrder.Id, model.FileTempPath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.succ = true;
|
|
|
|
|
|
|
|
result.msg = "执行成功";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
result.succ = false;
|
|
|
|
|
|
|
|
result.msg = ex.Message;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 单票BC更新订舱信息
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 单票BC更新订舱信息
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="model">BC详情</param>
|
|
|
|
|
|
|
|
/// <param name="bookingOrder">订舱详情</param>
|
|
|
|
|
|
|
|
/// <param name="batchNo">批次号</param>
|
|
|
|
|
|
|
|
/// <param name="sortNo">顺序号</param>
|
|
|
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
|
|
|
private async Task<TaskManageOrderResultDto> InnerBCUpdateBookingOrder(SingleBCDto model, BookingOrder bookingOrder,
|
|
|
|
|
|
|
|
string batchNo,int sortNo)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.bno = bookingOrder.MBLNO;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(result.bno))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingOrder.CUSTNO))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
result.bno = $"订 {bookingOrder.CUSTNO}";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
result.bno = $"NO.{sortNo}";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//截单日期
|
|
|
|
//截单日期
|
|
|
|
if (model.ClosingDate.HasValue)
|
|
|
|
if (model.ClosingDate.HasValue)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1438,7 +1555,7 @@ namespace Myshipping.Application
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//船名
|
|
|
|
//船名
|
|
|
|
if(!string.IsNullOrWhiteSpace(model.Vessel))
|
|
|
|
if (!string.IsNullOrWhiteSpace(model.Vessel))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.LogInformation("批次={no} id={id} 更新船名 原:{date1} 变更为 {date2}", batchNo, bookingOrder.Id,
|
|
|
|
_logger.LogInformation("批次={no} id={id} 更新船名 原:{date1} 变更为 {date2}", batchNo, bookingOrder.Id,
|
|
|
|
bookingOrder.VESSEL, model.Vessel);
|
|
|
|
bookingOrder.VESSEL, model.Vessel);
|
|
|
@ -1464,12 +1581,11 @@ namespace Myshipping.Application
|
|
|
|
bookingOrder.MBLNO = model.BLNo;
|
|
|
|
bookingOrder.MBLNO = model.BLNo;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bookingOrder.UpdatedTime = DateTime.Now;
|
|
|
|
bookingOrder.UpdatedTime = DateTime.Now;
|
|
|
|
bookingOrder.UpdatedUserId = UserManager.UserId;
|
|
|
|
bookingOrder.UpdatedUserId = UserManager.UserId;
|
|
|
|
bookingOrder.UpdatedUserName = UserManager.Name;
|
|
|
|
bookingOrder.UpdatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
|
|
|
|
_bookingOrderRepository.AsUpdateable(bookingOrder).UpdateColumns(it => new
|
|
|
|
await _bookingOrderRepository.AsUpdateable(bookingOrder).UpdateColumns(it => new
|
|
|
|
{
|
|
|
|
{
|
|
|
|
it.UpdatedTime,
|
|
|
|
it.UpdatedTime,
|
|
|
|
it.UpdatedUserId,
|
|
|
|
it.UpdatedUserId,
|
|
|
@ -1481,81 +1597,117 @@ namespace Myshipping.Application
|
|
|
|
it.VESSEL,
|
|
|
|
it.VESSEL,
|
|
|
|
it.VOYNO,
|
|
|
|
it.VOYNO,
|
|
|
|
it.MBLNO
|
|
|
|
it.MBLNO
|
|
|
|
}).ExecuteCommand();
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} BC引入更新订舱完成", batchNo, bookingOrder.Id);
|
|
|
|
_logger.LogInformation("批次={no} id={id} BC引入更新订舱完成", batchNo, bookingOrder.Id);
|
|
|
|
|
|
|
|
|
|
|
|
if (model.IsLetterYard)
|
|
|
|
result.succ = true;
|
|
|
|
{
|
|
|
|
result.msg = "执行成功";
|
|
|
|
_logger.LogInformation("批次={no} id={id} 单票BC更新订舱后,用户选择转为入货通知,开始执行入货通知", batchNo
|
|
|
|
}
|
|
|
|
, bookingOrder.Id);
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
if (string.IsNullOrWhiteSpace(model.FileTempPath))
|
|
|
|
result.succ = false;
|
|
|
|
{
|
|
|
|
result.msg = ex.Message;
|
|
|
|
_logger.LogInformation("批次={no} id={id} 未提交文件路径,请求失败", batchNo
|
|
|
|
}
|
|
|
|
, bookingOrder.Id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw Oops.Bah($"未提交文件路径,执行放舱失败");
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
var letterYardDto = new UpdateBookingLetteryardInput();
|
|
|
|
#region 批量BC更新订舱
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 批量BC更新订舱
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="batchBCList">批量BC更新列表</param>
|
|
|
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
|
|
|
[HttpPost("/BookingValueAdded/BatchBCUpdate")]
|
|
|
|
|
|
|
|
public async Task<TaskManageOrderResultDto> BatchBCUpdate([FromBody]List<BatchBCDto> batchBCList)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
List<Task<TaskManageOrderResultDto>> taskList = new List<Task<TaskManageOrderResultDto>>();
|
|
|
|
|
|
|
|
|
|
|
|
letterYardDto = model.LetteryardDto.Adapt<UpdateBookingLetteryardInput>();
|
|
|
|
string batchNo = IDGen.NextID().ToString();
|
|
|
|
|
|
|
|
|
|
|
|
if (model.LetterYardId.HasValue && model.LetterYardId.Value > 0)
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
letterYardDto.Id = model.LetterYardId.Value;
|
|
|
|
var bcTaskList = batchBCList.Select(a=>a.bcPKId).Distinct().ToList();
|
|
|
|
|
|
|
|
var bkOrderList = batchBCList.Select(a => a.bkOrderId.Value).Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 单票BC更新订舱后,存在放舱记录 LetterYardId={LetterYardId}", batchNo
|
|
|
|
var bklist = _bookingOrderRepository.AsQueryable()
|
|
|
|
, bookingOrder.Id, letterYardDto.Id);
|
|
|
|
.Where(a => bkOrderList.Contains(a.Id)).ToList();
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var letterYardModel = _bookingLetteryardRepository.AsQueryable()
|
|
|
|
|
|
|
|
.First(x => x.BookingId == model.BookingOrderId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(letterYardModel != null)
|
|
|
|
var bclist = _taskBCInfoRepository.AsQueryable()
|
|
|
|
letterYardDto.Id = letterYardModel.Id;
|
|
|
|
.Where(a => bcTaskList.Contains(a.PK_ID)).ToList();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//放舱保存
|
|
|
|
if (bklist.Count != bkOrderList.Count)
|
|
|
|
var letterYardId = await _bookingOrderService.LetteryardSave(letterYardDto);
|
|
|
|
throw Oops.Oh($"订舱信息获取失败,订舱信息不存在或已作废");
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 已完放舱记录保存 返回结果{rlt}", batchNo
|
|
|
|
var noList = bklist.Select((a, idx) => new { no = idx + 1, id = a.Id }).ToList();
|
|
|
|
, bookingOrder.Id, letterYardId);
|
|
|
|
foreach (var bk in bklist)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var sortNo = noList.FirstOrDefault(a => a.id == bk.Id).no;
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} templateid={tempid} 开始发送放舱", batchNo
|
|
|
|
var currBC = batchBCList.Join(bclist, l => l.bcPKId, r => r.PK_ID, (l, r) => {
|
|
|
|
, bookingOrder.Id, model.TemplateId);
|
|
|
|
return r;
|
|
|
|
|
|
|
|
}).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SingleBCDto singleBCDto = new SingleBCDto {
|
|
|
|
|
|
|
|
BLNo = currBC.MBL_NO,
|
|
|
|
|
|
|
|
Vessel = currBC.VESSEL,
|
|
|
|
|
|
|
|
Voyage = currBC.VOYNO,
|
|
|
|
|
|
|
|
ETD = currBC.ETD,
|
|
|
|
|
|
|
|
CYCutOffTime = currBC.CY_CUTOFF_TIME,
|
|
|
|
|
|
|
|
VGMCutOffTime = currBC.VGM_CUTOFF_TIME,
|
|
|
|
|
|
|
|
ClosingDate = currBC.CUT_SINGLE_TIME
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
taskList.Add(Task.Run(() => InnerBCUpdateBookingOrder(singleBCDto,bk, batchNo, sortNo)));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//发送放舱
|
|
|
|
Task.WaitAll(taskList.ToArray());
|
|
|
|
await _bookingOrderService.SendLetterYard(model.BookingOrderId, model.TemplateId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} templateid={tempid} 完成发送放舱", batchNo
|
|
|
|
result.succ = true;
|
|
|
|
, bookingOrder.Id, model.TemplateId);
|
|
|
|
result.msg = "批量执行成功";
|
|
|
|
|
|
|
|
|
|
|
|
string fileTypeCode = "bc";
|
|
|
|
var downResultList = taskList.Select(x => x.Result).ToList();
|
|
|
|
string fileTypeName = "Booking Confirmation";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//重新将暂存文件写入正式路径
|
|
|
|
if (downResultList.Any(x => !x.succ))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
result.succ = false;
|
|
|
|
|
|
|
|
result.msg = "批量执行失败";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
result.succ = true;
|
|
|
|
|
|
|
|
result.msg = downResultList.FirstOrDefault().msg;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//读取文件配置
|
|
|
|
result.ext = downResultList;
|
|
|
|
var bookFilePath = await FileAttachHelper.MoveFile(bookingOrder.Id.ToString(), model.FileTempPath,batchNo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//将BC引入的文件写入订舱的附件
|
|
|
|
var succ = downResultList.Count(x => x.succ);
|
|
|
|
await SaveEDIFile(bookingOrder.Id, bookFilePath, new System.IO.FileInfo(bookFilePath).Name,
|
|
|
|
var fail = downResultList.Count(x => !x.succ);
|
|
|
|
fileTypeCode, fileTypeName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 完成写入附件表 {filepath}", batchNo
|
|
|
|
if (succ > 0)
|
|
|
|
, bookingOrder.Id, model.FileTempPath);
|
|
|
|
{
|
|
|
|
|
|
|
|
result.batchTotal = succ.ToString();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
result.batchTotal = "- ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
result.succ = true;
|
|
|
|
if (fail > 0)
|
|
|
|
result.msg = "执行成功";
|
|
|
|
{
|
|
|
|
|
|
|
|
result.batchTotal += "/" + fail.ToString();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
result.batchTotal += " -";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
result.succ = false;
|
|
|
|
result.succ = false;
|
|
|
|
result.msg = ex.Message;
|
|
|
|
result.msg = $"批量执行失败,原因:{ex.Message}";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|