######有什么办法可以将bytess 的值放在Excel的Sheet2里,在线等.....
public async Task<double> SolderPasteGlueExpdateWarningMailAsync()
{
//获取数据字段配置预警天数
var Detail = await _repository.FindEntityAsync<DataItemDetailEntity>(x =>
x.ItemId == "0A51DB34DF7E4BA38DDDF8E07F75DCE4" && x.DetailName == "预警天数" && x.Enabled == 1);
//获取预警信息
string sql1 = @"";
DataTable dt = await _repository.FindTableAsync(sql1,new { Days = Detail.DetailCode });
// 发送消息
var fileName = $"title_{DateTime.Now.ToDateString()}.xlsx";
var bytes = ExcelHelper.EPPlusExportExcelToBytes(dt, null, TableStyles.None);
var bytess = ExcelHelper.EPPlusExportExcelToBytes(dt, null, TableStyles.None);
var attachments = new List<AttachmentEntity> { new AttachmentEntity {
Bytes=bytes,
FileName=fileName
}};
var mail = "mail地址";
var title = "title";
await _mailMessageService.SendMailMessageAsync(new MailMessageInput
{
AppId = "1E3331D5833A0BAABCAC",
AppKey = "0x1e3331d50x7ab",
Title = title,
Content = $@"
<br/><span style='color:red'>本邮件由系统自动发送,请勿回复。</span>",
Attachments = attachments,
TO = mail
});
return ErrorCode.Successful;
}