添加项目文件。

This commit is contained in:
dell
2023-03-03 16:07:50 +08:00
parent 2c462551b6
commit 011039960e
585 changed files with 362460 additions and 0 deletions

View File

@ -0,0 +1,80 @@
using MiniExcelLibs;
using Serenity.Services;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HT.Cloud.Domain.ReportManage;
namespace HT.Cloud.Service.ReportManage
{
public class HistoryReportService : BaseService<HistoryReportEntity>, IDenpendency
{
public HistoryReportService(ISqlSugarClient context) : base(context)
{
}
public async Task<string> GetReportFileName(string startdt, string enddt, int timeinterval)
{
//SqlParameter[] sqlParameters =
//{
// new SqlParameter("@startdt",startdt),
// new SqlParameter("@enddt",enddt),
// new SqlParameter("@timeinterval",timeinterval)
//};
////*
//string conn = db.Database.GetConnectionString(); //"Data Source=192.168.110.32;Initial Catalog=SCADA;User Id= sa;Password= Sa1qaz;Integrated Security=False;Encrypt=True;TrustServerCertificate=True;";
//SqlConnection sqlConnection = new SqlConnection(conn);
//var ds = sqlConnection.SqlQueryex("Query_Report_YL", sqlParameters);
//*
//var ds = db.SqlQuery("Query_Report_Period", sqlParameters);///
SugarParameter[] sqlParameters ={
new SugarParameter("@startdt",startdt),
new SugarParameter("@enddt",enddt),
new SugarParameter("@timeinterval",timeinterval)
};
var Report = _context.Ado.UseStoredProcedure().GetDataTable("Query_Report_YL", sqlParameters);
Report.TableName = "Report";
var value = new Dictionary<string, object>()
{
["title"] = "Report",
["Report"] = Report,
};
//var pathroot = "";
//var Isdebug = Configuration["Isdebug"];
//if (Isdebug.Equals("yes"))
//{
// pathroot = Directory.GetCurrentDirectory();
//}
//else
//{
// pathroot = AppContext.BaseDirectory;
//}
var pathroot = Directory.GetCurrentDirectory();
var templatePath = pathroot + "\\wwwroot\\report\\" + "报表预设模板" + ".xlsx";
string fileurl = "Report" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";
//var fileurl = $"电子报表2023_01_03_11_19_53.xlsx";
var path = pathroot + "\\wwwroot\\report\\" + fileurl;//{StartTime}-{EndTime}
MiniExcel.SaveAsByTemplate(path: path, templatePath: templatePath, value: value);
////await Task.Delay(1);
//Result<string> result = new Result<string>();
//result.data = fileurl;
return fileurl;
}
}
}