|
|
|
@ -77,6 +77,7 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly SqlSugarRepository<BookingSampleBill> _repSampleBill;
|
|
|
|
|
private readonly SqlSugarRepository<DjyUserMailAccount> _repUserMail;
|
|
|
|
|
private readonly SqlSugarRepository<SysTenant> _repTenant;
|
|
|
|
|
private readonly SqlSugarRepository<BookingStatus> _repBookingStatus;
|
|
|
|
|
|
|
|
|
|
const string CONST_MAPPING_MODULE = "BOOK_OR_CLOSING";
|
|
|
|
|
|
|
|
|
@ -88,7 +89,7 @@ namespace Myshipping.Application
|
|
|
|
|
ILogger<BookingOrderService> logger, ISysCacheService cache,
|
|
|
|
|
SqlSugarRepository<BookingPrintTemplate> repPrintTemplate, SqlSugarRepository<BookingLetteryard> repLetterYard, SqlSugarRepository<SysUser> repUser,
|
|
|
|
|
SqlSugarRepository<BookingOrderUrl> repOrderUrl, SqlSugarRepository<BookingOrderContact> repOrderContact, SqlSugarRepository<BookingSampleBill> repSampleBill,
|
|
|
|
|
SqlSugarRepository<DjyUserMailAccount> repUserMail, SqlSugarRepository<SysTenant> repTenant)
|
|
|
|
|
SqlSugarRepository<DjyUserMailAccount> repUserMail, SqlSugarRepository<SysTenant> repTenant, SqlSugarRepository<BookingStatus> repBookingStatus)
|
|
|
|
|
{
|
|
|
|
|
this._logger = logger;
|
|
|
|
|
this._rep = rep;
|
|
|
|
@ -112,6 +113,7 @@ namespace Myshipping.Application
|
|
|
|
|
this._repSampleBill = repSampleBill;
|
|
|
|
|
this._repUserMail = repUserMail;
|
|
|
|
|
this._repTenant = repTenant;
|
|
|
|
|
this._repBookingStatus = repBookingStatus;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 主表和箱信息
|
|
|
|
@ -547,7 +549,7 @@ namespace Myshipping.Application
|
|
|
|
|
FilePath = fileRelaPath,
|
|
|
|
|
TypeCode = dto.TypeCode,
|
|
|
|
|
TypeName = dto.TypeName,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
await _bookingfile.InsertAsync(newFile);
|
|
|
|
|
using (var stream = File.Create(fileAbsPath))
|
|
|
|
@ -806,7 +808,7 @@ namespace Myshipping.Application
|
|
|
|
|
FilePath = fileRelaPath,
|
|
|
|
|
TypeCode = "ruhuotongzhi",
|
|
|
|
|
TypeName = ".pdf",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
await _bookingfile.InsertAsync(newFile);
|
|
|
|
|
#endregion
|
|
|
|
@ -820,6 +822,9 @@ namespace Myshipping.Application
|
|
|
|
|
bsl.MBLNO = order.MBLNO;
|
|
|
|
|
await _repStatuslog.InsertAsync(bsl);
|
|
|
|
|
|
|
|
|
|
//订舱状态
|
|
|
|
|
await SaveBookingStatus(bookingId, "sta_letter_yard", "放舱");
|
|
|
|
|
|
|
|
|
|
#region 发送邮件
|
|
|
|
|
|
|
|
|
|
var mailSubject = $"放舱信息:{order.MBLNO}/{order.CARRIERID}/{order.VESSEL}/{order.VOYNO}/PO:{order.PONO}/{order.TenantName}";
|
|
|
|
@ -862,6 +867,7 @@ namespace Myshipping.Application
|
|
|
|
|
var sendResult = await MailSendHelper.SendMail(mailAcc, mailSubject, mailContent, letterYard.AttnMail);
|
|
|
|
|
if (!sendResult.Key)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError($"放舱邮件发送失败:从{mailAcc.MailAccount}到{letterYard.AttnMail},主题 {mailSubject}");
|
|
|
|
|
throw Oops.Oh($"邮件发送失败:{sendResult.Value}");
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
@ -991,6 +997,8 @@ namespace Myshipping.Application
|
|
|
|
|
throw Oops.Oh($"发送失败:{rtn.Value}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//订舱状态
|
|
|
|
|
await SaveBookingStatus(bookingId, "sta_xhz", "下货纸");
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
@ -1874,8 +1882,8 @@ namespace Myshipping.Application
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
/// <param name="type">类型,对应字典中的【订舱打印模板类型】</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/BookingOrder/GenReportJson")]
|
|
|
|
|
public async Task<IActionResult> GenReportJson(long id, string type)
|
|
|
|
|
[HttpGet("/BookingOrder/GenReportFile")]
|
|
|
|
|
public async Task<IActionResult> GenReportFile(long id, string type)
|
|
|
|
|
{
|
|
|
|
|
//打印报表服务地址
|
|
|
|
|
var reportUrl = _cache.GetAllDictData().Result.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "url_report_generate").Value;
|
|
|
|
@ -1942,6 +1950,34 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 记录或更新订舱状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bookingId"></param>
|
|
|
|
|
/// <param name="code"></param>
|
|
|
|
|
/// <param name="name"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task SaveBookingStatus(long bookingId, string code, string name)
|
|
|
|
|
{
|
|
|
|
|
var bookSta = _repBookingStatus.FirstOrDefault(x => x.BookingId == bookingId && x.StaCode == code);
|
|
|
|
|
if (bookSta == null)
|
|
|
|
|
{
|
|
|
|
|
//记录状态
|
|
|
|
|
bookSta = new BookingStatus();
|
|
|
|
|
bookSta.BookingId = bookingId;
|
|
|
|
|
bookSta.StaCode = "sta_xhz";
|
|
|
|
|
bookSta.StaName = "下货纸";
|
|
|
|
|
bookSta.StaTime = DateTime.Now;
|
|
|
|
|
await _repBookingStatus.InsertAsync(bookSta);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bookSta.StaTime = DateTime.Now;
|
|
|
|
|
await _repBookingStatus.UpdateAsync(bookSta);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|