diff --git a/Myshipping.Application/Entity/BookingStatus.cs b/Myshipping.Application/Entity/BookingStatus.cs new file mode 100644 index 00000000..89d16836 --- /dev/null +++ b/Myshipping.Application/Entity/BookingStatus.cs @@ -0,0 +1,31 @@ +using System; +using SqlSugar; +using System.ComponentModel; +using Myshipping.Core.Entity; +namespace Myshipping.Application.Entity +{ + /// + /// 订舱状态 + /// + [SugarTable("booking_status")] + [Description("订舱状态")] + public class BookingStatus : PrimaryKeyEntity + { + /// + /// 订舱id + /// + public long? BookingId { get; set; } + /// + /// 状态代码 + /// + public string StaCode { get; set; } + /// + /// 状态名称 + /// + public string StaName { get; set; } + /// + /// 状态时间 + /// + public DateTime? StaTime { get; set; } + } +} \ No newline at end of file diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml index 6c837fd4..a5214989 100644 --- a/Myshipping.Application/Myshipping.Application.xml +++ b/Myshipping.Application/Myshipping.Application.xml @@ -3301,6 +3301,31 @@ 备注 + + + 订舱状态 + + + + + 订舱id + + + + + 状态代码 + + + + + 状态名称 + + + + + 状态时间 + + 货运跟踪 @@ -4749,7 +4774,7 @@ - + 生成报表文件 @@ -4757,6 +4782,15 @@ 类型,对应字典中的【订舱打印模板类型】 + + + 记录或更新订舱状态 + + + + + + 操作类型(新增,编辑) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index bb2a1811..0516aa54 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -77,6 +77,7 @@ namespace Myshipping.Application private readonly SqlSugarRepository _repSampleBill; private readonly SqlSugarRepository _repUserMail; private readonly SqlSugarRepository _repTenant; + private readonly SqlSugarRepository _repBookingStatus; const string CONST_MAPPING_MODULE = "BOOK_OR_CLOSING"; @@ -88,7 +89,7 @@ namespace Myshipping.Application ILogger logger, ISysCacheService cache, SqlSugarRepository repPrintTemplate, SqlSugarRepository repLetterYard, SqlSugarRepository repUser, SqlSugarRepository repOrderUrl, SqlSugarRepository repOrderContact, SqlSugarRepository repSampleBill, - SqlSugarRepository repUserMail, SqlSugarRepository repTenant) + SqlSugarRepository repUserMail, SqlSugarRepository repTenant, SqlSugarRepository 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 /// /// 类型,对应字典中的【订舱打印模板类型】 /// - [HttpGet("/BookingOrder/GenReportJson")] - public async Task GenReportJson(long id, string type) + [HttpGet("/BookingOrder/GenReportFile")] + public async Task 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 } } + + /// + /// 记录或更新订舱状态 + /// + /// + /// + /// + /// + [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 } } diff --git a/Myshipping.Core/Entity/PingTai/CodeYard.cs b/Myshipping.Core/Entity/PingTai/PingTaiUser.cs similarity index 100% rename from Myshipping.Core/Entity/PingTai/CodeYard.cs rename to Myshipping.Core/Entity/PingTai/PingTaiUser.cs