wet 2 years ago
commit d1e32c026f

@ -62,9 +62,9 @@ namespace Myshipping.Application.Entity
[Description("FROM")]
public string FromName { get; set; }
/// <summary>
/// FROM电话
/// FROM座机
/// </summary>
[Description("FROM电话")]
[Description("FROM座机")]
public string FromTel { get; set; }
/// <summary>
/// FROM邮箱
@ -72,6 +72,11 @@ namespace Myshipping.Application.Entity
[Description("FROM邮箱")]
public string FromMail { get; set; }
/// <summary>
/// FROM手机号
/// </summary>
[Description("FROM手机号")]
public string FromMobile { get; set; }
/// <summary>
/// FROM传真
/// </summary>
[Description("FROM传真")]

@ -73,9 +73,9 @@ namespace Myshipping.Application.Entity
[Description("FROM")]
public string FromName { get; set; }
/// <summary>
/// FROM电话
/// FROM座机
/// </summary>
[Description("FROM电话")]
[Description("FROM座机")]
public string FromTel { get; set; }
/// <summary>
/// FROM邮箱
@ -83,6 +83,11 @@ namespace Myshipping.Application.Entity
[Description("FROM邮箱")]
public string FromMail { get; set; }
/// <summary>
/// FROM手机号
/// </summary>
[Description("FROM手机号")]
public string FromMobile { get; set; }
/// <summary>
/// FROM传真
/// </summary>
[Description("FROM传真")]

@ -2194,10 +2194,11 @@ namespace Myshipping.Application
/// <summary>
/// 放舱发送
/// </summary>
/// <param name="bookingId"></param>
/// <param name="bookingId">订舱ID</param>
/// <param name="templateId">打印模板ID</param>
/// <returns></returns>
[HttpPost("/BookingLetteryard/SendLetterYard")]
public async Task SendLetterYard(long bookingId)
public async Task SendLetterYard(long bookingId, long templateId)
{
var order = _rep.FirstOrDefault(x => x.Id == bookingId);
var user = await _repUser.FirstOrDefaultAsync(u => u.Id == order.CreatedUserId);
@ -2214,7 +2215,12 @@ namespace Myshipping.Application
throw Oops.Bah("ATTN MAIL未正确填写");
}
var mailAcc = await _repUserMail.FirstOrDefaultAsync(x => x.CreatedUserId == user.Id && x.MailAccount == letterYard.AttnMail && x.SmtpPort > 0 && x.SmtpServer != null && x.SmtpServer != "");
if (string.IsNullOrEmpty(letterYard.FromMail))
{
throw Oops.Bah("FROM MAIL未正确填写");
}
var mailAcc = await _repUserMail.FirstOrDefaultAsync(x => x.CreatedUserId == user.Id && x.MailAccount == letterYard.FromMail && x.SmtpPort > 0 && x.SmtpServer != null && x.SmtpServer != "");
if (mailAcc == null)
{
throw Oops.Bah("用户邮箱未设置或smtp未正确配置");
@ -2227,7 +2233,14 @@ namespace Myshipping.Application
//}
#region 保存放舱文件,并挂载到订舱附件
var fileBytes = await GetReportFile(bookingId, "fangcang");
var printTemplate = await _repPrintTemplate.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == templateId);
if (printTemplate == null)
{
throw Oops.Bah(BookingErrorCode.BOOK115);
}
var bs = await GenPrintFile(bookingId, printTemplate);
var opt = App.GetOptions<BookingAttachOptions>();
var fileSaveName = $"放舱_{order.MBLNO}_{DateTime.Now.Ticks}.pdf"; // 文件原始名称
var dirAbs = string.Empty;
@ -2246,7 +2259,7 @@ namespace Myshipping.Application
var fileRelaPath = Path.Combine(opt.relativePath, fileSaveName).ToLower();
var fileAbsPath = Path.Combine(dirAbs, fileSaveName).ToLower();
File.WriteAllBytes(fileAbsPath, fileBytes);
File.WriteAllBytes(fileAbsPath, bs);
var newFile = new BookingFile
{
@ -2316,7 +2329,7 @@ namespace Myshipping.Application
{user.Email}
<br/>";
var sendResult = await MailSendHelper.SendMail(mailAcc, mailSubject, mailContent, letterYard.AttnMail, new KeyValuePair<string, byte[]>(fileSaveName, fileBytes));
var sendResult = await MailSendHelper.SendMail(mailAcc, mailSubject, mailContent, letterYard.AttnMail, new KeyValuePair<string, byte[]>(fileSaveName, bs));
if (!sendResult.Key)
{
_logger.LogError($"放舱邮件发送失败:从{mailAcc.MailAccount}到{letterYard.AttnMail},主题 {mailSubject}");

@ -517,6 +517,7 @@ namespace Myshipping.Application
model.FromName = UserManager.Name;
model.FromTel = UserManager.TEl;
model.FromMail = UserManager.Email;
model.FromMobile = UserManager.Phone;
//这里岗位是调度的信息,如果默认只有一条记录,取第一条,其他情况不返回默认值
var userPosInfo = await _sysUserService.QueryUserByPos("", "PCDD");

@ -57,10 +57,14 @@ namespace Myshipping.Application
/// </summary>
public string FromName { get; set; }
/// <summary>
/// FROM电话
/// FROM座机
/// </summary>
public string FromTel { get; set; }
/// <summary>
/// FROM手机号
/// </summary>
public string FromMobile { get; set; }
/// <summary>
/// FROM邮箱
/// </summary>
public string FromMail { get; set; }

@ -38,7 +38,7 @@ namespace Myshipping.Application
/// </summary>
public string Attn { get; set; }
/// <summary>
/// ATTN电话
/// ATTN座机
/// </summary>
public string AttnTel { get; set; }
/// <summary>
@ -50,6 +50,10 @@ namespace Myshipping.Application
/// </summary>
public string AttnFax { get; set; }
/// <summary>
/// FROM手机号
/// </summary>
public string FromMobile { get; set; }
/// <summary>
/// FROM
/// </summary>
public string FromName { get; set; }

@ -53,10 +53,14 @@ namespace Myshipping.Application
/// </summary>
public string FromName { get; set; }
/// <summary>
/// FROM电话
/// FROM座机
/// </summary>
public string FromTel { get; set; }
/// <summary>
/// FROM手机号
/// </summary>
public string FromMobile { get; set; }
/// <summary>
/// FROM邮箱
/// </summary>
public string FromMail { get; set; }

@ -52,10 +52,14 @@ namespace Myshipping.Application
/// </summary>
public string FromName { get; set; }
/// <summary>
/// FROM电话
/// FROM座机
/// </summary>
public string FromTel { get; set; }
/// <summary>
/// FROM手机号
/// </summary>
public string FromMobile { get; set; }
/// <summary>
/// FROM邮箱
/// </summary>
public string FromMail { get; set; }

@ -56,10 +56,14 @@ namespace Myshipping.Application
/// </summary>
public string FromName { get; set; }
/// <summary>
/// FROM电话
/// FROM座机
/// </summary>
public string FromTel { get; set; }
/// <summary>
/// FROM手机号
/// </summary>
public string FromMobile { get; set; }
/// <summary>
/// FROM邮箱
/// </summary>
public string FromMail { get; set; }

@ -49,10 +49,14 @@ namespace Myshipping.Application
/// </summary>
public string FromName { get; set; }
/// <summary>
/// FROM电话
/// FROM座机
/// </summary>
public string FromTel { get; set; }
/// <summary>
/// FROM手机号
/// </summary>
public string FromMobile { get; set; }
/// <summary>
/// FROM邮箱
/// </summary>
public string FromMail { get; set; }

@ -328,7 +328,10 @@ namespace Myshipping.Application
try
{
var res = await url.SetClientTimeout(180).SetHttpMethod(HttpMethod.Post)
var res = await url.OnClientCreating(client => {
// client 为 HttpClient 对象
client.Timeout = TimeSpan.FromMinutes(15); // 设置超时时间 15分钟
}).SetHttpMethod(HttpMethod.Post)
.SetBody(JSON.Serialize(info), "application/json")
.SetContentEncoding(Encoding.UTF8)
.PostAsync();

Loading…
Cancel
Save