新兴上传

This commit is contained in:
dell
2024-10-12 11:15:47 +08:00
parent aa742f0036
commit 86cbb1d54a
20 changed files with 4643 additions and 15 deletions

View File

@ -21,6 +21,8 @@ using System.Data;
using iTextSharp.text;
using Serenity.Data;
using Quartz;
using static iTextSharp.text.pdf.XfaForm;
using HT.Cloud.Domain.Entity.ReportManage;
namespace HT.Cloud.Service.ReportManage
{
@ -227,16 +229,20 @@ namespace HT.Cloud.Service.ReportManage
public async Task<string> GetReportDownLoad(DateTime startTime, DateTime endTime ,int interval, string systemName)
{
var groupName = _context.AsTenant().QueryableWithAttr<MetaGroupEntity>().Where(x => x.GroupDescription == systemName).First().GroupName;
var driverId = _context.AsTenant().QueryableWithAttr<MetaGroupEntity>().Where(x => x.GroupDescription == systemName).First().DriverID;
var driverName = _context.AsTenant().QueryableWithAttr<MetaDriverEntity>().Where(x => x.DriverID == driverId).First().DriverName;
var list = _context.AsTenant().GetConnection(dataDBNumber).Ado.SqlQuery<HistoryReportPathEntity>($"SELECT * FROM HT_{driverName}_{groupName}_REPORTPATH");
var f3dpath = list.First().ReportPath;
var listSub = TimeInOneDay(startTime, endTime);
var listSub = TimeInOneDay(startTime, endTime);
var pathroot = Directory.GetCurrentDirectory();
string fileurl = "报表 " + startTime.ToString("yyyy年MM月dd日 HH.mm.ss") + "至" + endTime.ToString("yyyy年MM月dd日 HH.mm.ss") + "(" + "时间间隔" + interval.ToString() + "秒" + ")" + "_" + DateTime.Now.ToString("yyyy年MM月dd日 HH.mm.ss") + "导出" + ".xlsx";
//var fileurl = $"电子报表2023_01_03_11_19_53.xlsx";
var path = pathroot + "\\wwwroot\\report\\" + fileurl;//{StartTime}-{EndTime}
var path3d = @f3dpath + fileurl;
var sheets = new Dictionary<string, object>();
var sheets3D = new Dictionary<string, object>();
try
{
for (int i = 0; i < listSub.Count; i++)
@ -279,7 +285,7 @@ namespace HT.Cloud.Service.ReportManage
//MiniExcel.SaveAs(path, reader, true, sheetName, ExcelType.XLSX, null, false);
sheets.Add(sheetName, reader);
sheets3D.Add(sheetName, reader);
//sqlConnection.Close();
}
}
@ -287,7 +293,21 @@ namespace HT.Cloud.Service.ReportManage
{
Console.WriteLine(ex.ToString());
}
MiniExcel.SaveAs(path, sheets);
try
{
//var sheets3d = new Dictionary<string, object>(sheets.ToDictionary(pair => pair.Key, pair => pair.Value));
//await Task.Delay(1000);
MiniExcel.SaveAs(path, sheets);
File.Copy(path, path3d, true);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
//await Task.WhenAll(taskCloud, task3D);
//bool a = true;
////MiniExcel.SaveAs(path, reader);
//while (a)