|
|
|
@ -1275,6 +1275,7 @@ namespace Myshipping.Application
|
|
|
|
|
Voyage = currBC.Voyage?.Trim().ToUpper(),
|
|
|
|
|
ClosingDate = currBC.CutSingleTime,
|
|
|
|
|
CYCutOffTime = currBC.CYCutOffTime,
|
|
|
|
|
VGMCutOffTime = currBC.VGMCutOffTime,
|
|
|
|
|
ETD = currBC.ETD
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -1288,7 +1289,41 @@ namespace Myshipping.Application
|
|
|
|
|
VESSEL = bookingOrder.VESSEL,
|
|
|
|
|
VOYNO = bookingOrder.VOYNO,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
这里考虑后面会有将文件写入附件表的动作,在识别成功后将文件写入暂存路径,后续完成放舱讲文件写入正式链接
|
|
|
|
|
*/
|
|
|
|
|
//读取文件配置
|
|
|
|
|
|
|
|
|
|
var opt = App.GetOptions<TempFileOptions>().Path;
|
|
|
|
|
|
|
|
|
|
string filePath = $"{Path.Combine(App.WebHostEnvironment.WebRootPath, opt)}\\bcfilestemp\\{bookingOrder.Id}\\";
|
|
|
|
|
|
|
|
|
|
string fileFullName = $"{filePath}\\{file.FileName}";
|
|
|
|
|
|
|
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
|
|
|
{
|
|
|
|
|
filePath = filePath.Replace("\\", "/");
|
|
|
|
|
|
|
|
|
|
fileFullName = fileFullName.Replace("\\", "/");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 生成文件保存路径完成 路由={filePath} 服务器系统={system}", batchNo, filePath, RuntimeInformation.OSDescription);
|
|
|
|
|
//预先创建目录
|
|
|
|
|
if (!Directory.Exists(filePath))
|
|
|
|
|
{
|
|
|
|
|
Directory.CreateDirectory(filePath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
using (var fileStream = File.Create(fileFullName))
|
|
|
|
|
{
|
|
|
|
|
await file.CopyToAsync(fileStream);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 完成文件保存 filepath={path}", batchNo, fileFullName);
|
|
|
|
|
|
|
|
|
|
singleBCDto.FileTempPath = fileFullName;
|
|
|
|
|
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.ext = singleBCDto;
|
|
|
|
|
}
|
|
|
|
@ -1308,6 +1343,7 @@ namespace Myshipping.Application
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 请求BC解析
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 请求BC解析
|
|
|
|
|
/// </summary>
|
|
|
|
@ -1350,6 +1386,7 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
return model;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 单票BC更新订舱
|
|
|
|
@ -1375,30 +1412,92 @@ namespace Myshipping.Application
|
|
|
|
|
if(bookingOrder == null)
|
|
|
|
|
throw Oops.Bah($"订舱信息获取失败,订舱信息不存在或已作废");
|
|
|
|
|
|
|
|
|
|
//截单日期
|
|
|
|
|
if (model.ClosingDate.HasValue)
|
|
|
|
|
bookingOrder.CLOSINGDATE = model.ClosingDate;
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 更新截单日期 原:{date1} 变更为 {date2}", batchNo, bookingOrder.Id,
|
|
|
|
|
bookingOrder.CLOSEDOCDATE, model.ClosingDate);
|
|
|
|
|
|
|
|
|
|
bookingOrder.CLOSEDOCDATE = model.ClosingDate;
|
|
|
|
|
}
|
|
|
|
|
//截VGM时间
|
|
|
|
|
if (model.VGMCutOffTime.HasValue)
|
|
|
|
|
bookingOrder.CLOSEVGMDATE = model.VGMCutOffTime;
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 更新截VGM日期 原:{date1} 变更为 {date2}", batchNo, bookingOrder.Id,
|
|
|
|
|
bookingOrder.CLOSEVGMDATE, model.VGMCutOffTime);
|
|
|
|
|
|
|
|
|
|
bookingOrder.CLOSEVGMDATE = model.VGMCutOffTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//截港日期
|
|
|
|
|
if (model.CYCutOffTime.HasValue)
|
|
|
|
|
bookingOrder.CLOSEDOCDATE = model.CYCutOffTime;
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 更新截港日期 原:{date1} 变更为 {date2}", batchNo, bookingOrder.Id,
|
|
|
|
|
bookingOrder.CLOSINGDATE, model.CYCutOffTime);
|
|
|
|
|
|
|
|
|
|
bookingOrder.CLOSINGDATE = model.CYCutOffTime;
|
|
|
|
|
}
|
|
|
|
|
//开船日期
|
|
|
|
|
if (model.ETD.HasValue)
|
|
|
|
|
bookingOrder.ETD = model.ETD;
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 更新截港日期 原:{date1} 变更为 {date2}", batchNo, bookingOrder.Id,
|
|
|
|
|
bookingOrder.CLOSINGDATE, model.CYCutOffTime);
|
|
|
|
|
|
|
|
|
|
bookingOrder.ETD = model.ETD;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//船名
|
|
|
|
|
if(!string.IsNullOrWhiteSpace(model.Vessel))
|
|
|
|
|
bookingOrder.VESSEL = model.Vessel;
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 更新船名 原:{date1} 变更为 {date2}", batchNo, bookingOrder.Id,
|
|
|
|
|
bookingOrder.VESSEL, model.Vessel);
|
|
|
|
|
|
|
|
|
|
bookingOrder.VESSEL = model.Vessel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//航次
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(model.Voyage))
|
|
|
|
|
bookingOrder.VOYNO = model.Voyage;
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 更新航次 原:{date1} 变更为 {date2}", batchNo, bookingOrder.Id,
|
|
|
|
|
bookingOrder.VOYNO, model.Voyage);
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(model.Voyage))
|
|
|
|
|
bookingOrder.VOYNO = model.Voyage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//提单号
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(model.BLNo))
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 更新提单号 原:{date1} 变更为 {date2}", batchNo, bookingOrder.Id,
|
|
|
|
|
bookingOrder.MBLNO, model.BLNo);
|
|
|
|
|
|
|
|
|
|
bookingOrder.MBLNO = model.BLNo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bookingOrder.UpdatedTime = DateTime.Now;
|
|
|
|
|
bookingOrder.UpdatedUserId = UserManager.UserId;
|
|
|
|
|
bookingOrder.UpdatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
|
|
await _bookingOrderRepository.AsUpdateable(bookingOrder).UpdateColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.UpdatedTime,
|
|
|
|
|
it.UpdatedUserId,
|
|
|
|
|
it.UpdatedUserName,
|
|
|
|
|
it.CLOSEDOCDATE,
|
|
|
|
|
it.CLOSEVGMDATE,
|
|
|
|
|
it.CLOSINGDATE,
|
|
|
|
|
it.ETD,
|
|
|
|
|
it.VESSEL,
|
|
|
|
|
it.VOYNO,
|
|
|
|
|
it.MBLNO
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} BC引入更新订舱完成", batchNo, bookingOrder.Id);
|
|
|
|
|
|
|
|
|
|
if (model.IsLetterYard)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("批次={no} 单票BC更新订舱后,用户选择了,转为入货通知,开始发送入货通知", batchNo);
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 单票BC更新订舱后,用户选择转为入货通知,开始执行入货通知", batchNo
|
|
|
|
|
, bookingOrder.Id);
|
|
|
|
|
|
|
|
|
|
var letterYardDto = new UpdateBookingLetteryardInput();
|
|
|
|
|
|
|
|
|
@ -1407,17 +1506,44 @@ namespace Myshipping.Application
|
|
|
|
|
if(model.LetterYardId.HasValue)
|
|
|
|
|
{
|
|
|
|
|
letterYardDto.Id = model.LetterYardId.Value;
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} id={id} 单票BC更新订舱后,存在放舱记录 LetterYardId={LetterYardId}", batchNo
|
|
|
|
|
, bookingOrder.Id, letterYardDto.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";
|
|
|
|
|
|
|
|
|
|
//将BC引入的文件写入订舱的附件
|
|
|
|
|
await SaveEDIFile(bookingOrder.Id, model.FileTempPath, new System.IO.FileInfo(model.FileTempPath).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;
|
|
|
|
|