From 85a3bba2ed29b8cf6f6009f837d01583c5daf9d4 Mon Sep 17 00:00:00 2001 From: wangzelong <2692854983@qq.com> Date: 星期二, 20 九月 2022 15:23:56 +0800 Subject: [PATCH] 月报表 --- Application/IStation.Application.DataFile/eta_month_report/Eta_Month_Report_Controller.cs | 15 ++++++++++----- Application/IStation.Application.DataFile/eta_month_report/PdfCreate/Eta_Month_ReportPdf.cs | 13 ++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Application/IStation.Application.DataFile/eta_month_report/Eta_Month_Report_Controller.cs b/Application/IStation.Application.DataFile/eta_month_report/Eta_Month_Report_Controller.cs index 7b2b85e..ca2a9c6 100644 --- a/Application/IStation.Application.DataFile/eta_month_report/Eta_Month_Report_Controller.cs +++ b/Application/IStation.Application.DataFile/eta_month_report/Eta_Month_Report_Controller.cs @@ -22,7 +22,7 @@ [Route("DataFile/Report ")] [ApiDescriptionSettings("DataFile", Name = "鎶ヨ〃", Order = 999)] public class Eta_Month_Report_Controller : IDynamicApiController, ITransient - { + { private readonly Service.EtaSumMultiRecord _service = new Service.EtaSumMultiRecord(); /// <summary> @@ -33,8 +33,12 @@ public string StationEtaMonthReport([FromQuery][Required] Month_DataFileTestInput input) { var station = new Service.Station().GetByID(input.CorpID, input.ObjectID); - var etaSumRecord = new Service.EtaSumMultiRecord().GetMonthByObjectOfMonth(input.CorpID, IStation.ObjectType.Station, input.ObjectID, input.Year, input.Month); + var etaSumRecord = new Service.EtaSumMultiRecord().GetMonthByObjectOfMonth(input.CorpID, input.ObjectType, input.ObjectID, input.Year, input.Month); if (station == null) + { + throw Oops.Oh(ErrorCodes.D001, $"娉电珯涓嶅瓨鍦�!!"); + } + if (etaSumRecord == null) { throw Oops.Oh(ErrorCodes.D001, $"娉电珯涓嶅瓨鍦�!!"); } @@ -47,13 +51,14 @@ var etaSumSingleService = new Service.EtaSumSingleRecord(); foreach (var pipeLineitem in pumpPipeLineList) { - var etaSumSingleRecord = etaSumSingleService.GetMonthByObjectOfMonth(pipeLineitem.CorpID, IStation.ObjectType.PipeLine, pipeLineitem.ID, input.Year,input.Month); + var etaSumSingleRecord = etaSumSingleService.GetMonthByObjectOfMonth(pipeLineitem.CorpID, IStation.ObjectType.PipeLine, pipeLineitem.ID, input.Year, input.Month); etaSumSingleDayRecordList.Add(etaSumSingleRecord); } if (etaSumSingleDayRecordList == null || etaSumSingleDayRecordList.Count < 1) { - throw Oops.Oh(ErrorCodes.D001, $"鑳芥晥鏁版嵁涓嶅瓨鍦�!-鏃ユ湡:[{input.Year+input.Month}]"); + throw Oops.Oh(ErrorCodes.D001, $"鑳芥晥鏁版嵁涓嶅瓨鍦�!-鏃ユ湡:[{input.Year + input.Month}]"); } + var pdf = new Eta_Month_ReportPdf(); var ReportPath = Path.Combine(ConfigHelper.DataPath, Settings.DataFile.PdfFolder); if (!Directory.Exists(ReportPath)) @@ -62,7 +67,7 @@ var EtaPath = Path.Combine(ReportPath, EtaPathName); if (!Directory.Exists(EtaPath)) Directory.CreateDirectory(EtaPath); - string dateTimePathName = input.Year+"-"+input.Month; + string dateTimePathName = input.Year + "-" + input.Month; var pdfPath = Path.Combine(EtaPath, dateTimePathName); if (!Directory.Exists(pdfPath)) Directory.CreateDirectory(pdfPath); diff --git a/Application/IStation.Application.DataFile/eta_month_report/PdfCreate/Eta_Month_ReportPdf.cs b/Application/IStation.Application.DataFile/eta_month_report/PdfCreate/Eta_Month_ReportPdf.cs index 71035ed..1dd8867 100644 --- a/Application/IStation.Application.DataFile/eta_month_report/PdfCreate/Eta_Month_ReportPdf.cs +++ b/Application/IStation.Application.DataFile/eta_month_report/PdfCreate/Eta_Month_ReportPdf.cs @@ -34,7 +34,7 @@ /// <param name="datatime">鏃堕棿</param> /// <param name="pipeList">鏈烘车绠¤矾鍒楄〃</param> /// <param name="list">鏈烘车淇℃伅鍒楄〃</param> - /// <param name="monthlist">娉电珯鏈堝垪琛�</param> + /// <param name="sum">娉电珯鏈堜俊鎭垪琛�</param> /// <param name="path">璺緞</param> /// <returns></returns> public bool Create4Stream(Station station, Model.EtaSumMultiMonthRecord sum, List<Model.PipeLine> pipeList, List<Model.EtaSumSingleMonthRecord> list, string datatime, string path) @@ -124,6 +124,7 @@ /// <param name="sum"></param> /// <param name="pipeList"></param> /// <param name="list"></param> + /// <param name="dateTime"></param> public void CreatestationInfoPage(Station station, List<Model.PipeLine> pipeList, Model.EtaSumMultiMonthRecord sum, List<Model.EtaSumSingleMonthRecord> list, string dateTime) { _document.Open(); @@ -156,7 +157,7 @@ Dt = Math.Round((double)dt, 2).ToString(); if (dt > 1000) Dt = Math.Round((double)dt, 1).ToString(); - CreatestationTable(station,sum, runcout,dateTime); + CreatestationTable(station, sum, runcout, dateTime); CreatestationInfoTable(pipeList, list, station.ID); PdfPTable table1 = new PdfPTable(3); float[] widths = { 80, 140, 300 }; @@ -312,7 +313,7 @@ table.AddCell(cell); cell = CreateCell2(sum.Dt.ToString(), _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); - cell = CreateCell2("渚涙按閲�" + " (t)", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); + cell = CreateCell2("鎬绘祦閲�" + " (t)", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); cell = CreateCell2(sum.Qt.ToString(), _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); @@ -341,6 +342,8 @@ /// 鐢熸垚鏈烘车鍒楄〃 /// </summary> /// <param name="list">鏈烘车鍒楄〃</param> + /// <param name="pipeList">绠¤矾</param> + /// <param name="stationID">娉电珯ID</param> public void CreatestationInfoTable(List<Model.PipeLine> pipeList, List<Model.EtaSumSingleMonthRecord> list, long stationID) { @@ -693,7 +696,7 @@ /// <param name="years">骞�</param> /// <param name="months">鏈�</param> /// <returns>杩斿洖锛歽yyy-MM-dd 褰㈠紡</returns> - public DateTime GetFirstDayByYearMonth(int years, int months) + public DateTime GetFirstDayByYearMonth(int years, int months) { DateTime datetime = DateTime.Parse(years + "-" + months + "-" + "15"); return datetime.AddDays(1 - datetime.Day); @@ -705,7 +708,7 @@ /// <param name="years">骞�</param> /// <param name="months">鏈�</param> /// <returns>杩斿洖锛歽yyy-MM-dd 褰㈠紡</returns> - public DateTime GetLastDayByYearMonth(int years, int months) + public DateTime GetLastDayByYearMonth(int years, int months) { DateTime datetime = DateTime.Parse(years + "-" + months + "-" + "15"); return datetime.AddDays(1 - datetime.Day).AddMonths(1).AddDays(-1); -- Gitblit v1.9.3