From f2567c7e2afc6f377be549c8ce440edc3c35c36a Mon Sep 17 00:00:00 2001 From: wangzelong <2692854983@qq.com> Date: 星期二, 20 九月 2022 10:45:56 +0800 Subject: [PATCH] 月报表 --- Application/IStation.Application.DataFile/IStation.Application.DataFile.csproj | 4 Application/IStation.Application.DataFile/eta_month_report/dto/EtaKpiMonthItem.cs | 34 ++++ Application/IStation.Application.DataFile/Helpers/ITextSharpPdfHeadAndFooterHelper.cs | 2 Application/IStation.Application.DataFile/eta_month_report/Eta_Month_Report_Controller.cs | 85 ++++++++++++ Application/IStation.Application.DataFile/eta_month_report/dto/Month_DataFileTestInput.cs | 36 +++++ Application/IStation.Application.DataFile/eta_day_report/dto/Day_DataFileTestInput.cs | 23 +++ Application/IStation.Application.DataFile/eta_day_report/PdfCreate/Eta_Day_ReportPdf.cs | 28 +++ Application/IStation.Application.DataFile/eta_month_report/PdfCreate/Eta_Month_ReportPdf.cs | 72 ++++++++-- Model/IStation.Model.Eta/eta_accord/multi/EtaAccordMultiMonthRecord.cs | 2 Application/IStation.Application.DataFile/eta_day_report/Eta_Day_Report_Controller.cs | 42 +++-- Application/IStation.Application.DataFile/eta_month_report/dto/EtaKpiMonthItemRecord.cs | 21 +- Entry/IStation.WebApi.Entry/IStation.WebApi.Entry.csproj.user | 13 + 12 files changed, 306 insertions(+), 56 deletions(-) diff --git a/Application/IStation.Application.DataFile/Report/Helper/ITextSharpPdfHeadAndFooterHelper.cs b/Application/IStation.Application.DataFile/Helpers/ITextSharpPdfHeadAndFooterHelper.cs similarity index 94% rename from Application/IStation.Application.DataFile/Report/Helper/ITextSharpPdfHeadAndFooterHelper.cs rename to Application/IStation.Application.DataFile/Helpers/ITextSharpPdfHeadAndFooterHelper.cs index 5b1a8b9..121a135 100644 --- a/Application/IStation.Application.DataFile/Report/Helper/ITextSharpPdfHeadAndFooterHelper.cs +++ b/Application/IStation.Application.DataFile/Helpers/ITextSharpPdfHeadAndFooterHelper.cs @@ -43,7 +43,7 @@ Font fontfooter = new Font(BsFont, 10); PdfContentByte cbs = writer.DirectContent; cbs.SetCharacterSpacing(1.3f); //璁剧疆鏂囧瓧鏄剧ず鏃剁殑瀛楅棿璺� - Phrase footer = new Phrase(DateTime.Now.ToShortDateString(), fontfooter); + Phrase footer = new Phrase("鐢熸垚鏃ユ湡:"+DateTime.Now.ToShortDateString(), fontfooter); ColumnText.ShowTextAligned(cbs, Element.ALIGN_CENTER, footer, document.Right / 2, document.Bottom, 0); diff --git a/Application/IStation.Application.DataFile/IStation.Application.DataFile.csproj b/Application/IStation.Application.DataFile/IStation.Application.DataFile.csproj index 3e9aa2c..7e9a2a7 100644 --- a/Application/IStation.Application.DataFile/IStation.Application.DataFile.csproj +++ b/Application/IStation.Application.DataFile/IStation.Application.DataFile.csproj @@ -10,6 +10,10 @@ </PropertyGroup> <ItemGroup> + <Compile Remove="eta_month_report\Report_Controller.cs" /> + </ItemGroup> + + <ItemGroup> <ProjectReference Include="..\..\DAL\IStation.DAL.Eta\IStation.DAL.Eta.csproj" /> <ProjectReference Include="..\..\DataFile\IStation.DataFile\IStation.DataFile.csproj" /> <ProjectReference Include="..\..\Model\IStation.Model.Main\IStation.Model.Main.csproj" /> diff --git a/Application/IStation.Application.DataFile/Report/Report_Controller.cs b/Application/IStation.Application.DataFile/eta_day_report/Eta_Day_Report_Controller.cs similarity index 63% rename from Application/IStation.Application.DataFile/Report/Report_Controller.cs rename to Application/IStation.Application.DataFile/eta_day_report/Eta_Day_Report_Controller.cs index aaa88b1..f8888e6 100644 --- a/Application/IStation.Application.DataFile/Report/Report_Controller.cs +++ b/Application/IStation.Application.DataFile/eta_day_report/Eta_Day_Report_Controller.cs @@ -21,7 +21,7 @@ [AllowAnonymous] [Route("DataFile/Report ")] [ApiDescriptionSettings("DataFile", Name = "鎶ヨ〃", Order = 999)] - public class Report_Controller : IDynamicApiController, ITransient + public class Eta_Day_Report_Controller : IDynamicApiController, ITransient { private readonly Service.EtaMultiRealRecord _service = new Service.EtaMultiRealRecord(); @@ -30,49 +30,53 @@ /// </summary> [Route("StationEtaDayReport@V1.0")] [HttpPost] - public string StationEtaDayReport([FromQuery][Required] ObjectUnderCorpInput input, int year,int month) + public string StationEtaDayReport([FromQuery][Required] Day_DataFileTestInput input) { var station = new Service.Station().GetByID(input.CorpID, input.ObjectID); if (station == null) { throw Oops.Oh(ErrorCodes.D001, $"娉电珯涓嶅瓨鍦�!!"); } - var pumpPipeLineList = new Service.PipeLine().GetByBelongTypeAndBelongID(input.CorpID, input.ObjectType, input.ObjectID)?.FindAll(x => x.Catalog == IStation.Product.Catalog_JiBeng); if (pumpPipeLineList == null) { throw Oops.Oh(ErrorCodes.D001, $"鏈烘车涓嶅瓨鍦�!"); } - - var etaSumSingleDayRecordList = new List<Model.EtaSumSingleMonthRecord>(); + var etaSumSingleDayRecordList = new List<Model.EtaSumSingleDayRecord>(); var etaSumSingleService = new Service.EtaSumSingleRecord(); foreach (var pipeLineitem in pumpPipeLineList) { - var etaSumSingleRecord = etaSumSingleService.GetMonthByObjectOfMonth(pipeLineitem.CorpID, IStation.ObjectType.PipeLine, pipeLineitem.ID, year,month); + var etaSumSingleRecord = etaSumSingleService.GetDayByObjectOfDay(pipeLineitem.CorpID, IStation.ObjectType.PipeLine, pipeLineitem.ID, input.DateTime); etaSumSingleDayRecordList.Add(etaSumSingleRecord); } - if (etaSumSingleDayRecordList == null || etaSumSingleDayRecordList.Count < 1) { - throw Oops.Oh(ErrorCodes.D001, $"鑳芥晥鏁版嵁涓嶅瓨鍦�!-鏃ユ湡:[{year-month}]"); + throw Oops.Oh(ErrorCodes.D001, $"鑳芥晥鏁版嵁涓嶅瓨鍦�!-鏃ユ湡:[{input.DateTime}]"); } - - var pdf = new Eta_Month_ReportPdf(); - var folderPath = Path.Combine(ConfigHelper.DataPath, Settings.DataFile.PdfFolder); - if (!Directory.Exists(folderPath)) - Directory.CreateDirectory(folderPath); - - var etaPdfFileName = $"{station.Name}_Eta_{DateTime.Now.ToString("M")}.pdf"; - var etaPdfFilePath = Path.Combine(folderPath, etaPdfFileName); + var pdf = new Eta_Day_ReportPdf(); + var ReportPath = Path.Combine(ConfigHelper.DataPath, Settings.DataFile.PdfFolder); + if (!Directory.Exists(ReportPath)) + Directory.CreateDirectory(ReportPath); + var EtaPathName = "Eta-Day"; + var EtaPath = Path.Combine(ReportPath, EtaPathName); + if (!Directory.Exists(EtaPath)) + Directory.CreateDirectory(EtaPath); + var dateTimePathName = input.DateTime.ToString("yyyy-MM"); + var pdfPath= Path.Combine(EtaPath, dateTimePathName); + if (!Directory.Exists(pdfPath)) + Directory.CreateDirectory(pdfPath); + var etaPdfFileName = $"Station_Eta_{station.ID}_{input.DateTime.ToString("MM-dd")}.pdf"; + var etaPdfFilePath = Path.Combine(pdfPath, etaPdfFileName); if (File.Exists(etaPdfFilePath)) File.Delete(etaPdfFilePath); - - if (!pdf.Create4Stream(station, pumpPipeLineList, etaSumSingleDayRecordList, etaPdfFilePath)) + if (!pdf.Create4Stream(station, pumpPipeLineList, etaSumSingleDayRecordList, input.DateTime, etaPdfFilePath)) { throw Oops.Oh(ErrorCodes.D002, $"[{etaPdfFileName}]鏂囦欢鐢熸垚澶辫触!"); } - return Path.Combine(Settings.DataFile.SaveFileUrl, etaPdfFilePath); + var turePath = Path.Combine("/" + Settings.DataFile.PdfFolder, EtaPathName, dateTimePathName, etaPdfFileName); + turePath = turePath.Replace("\\", "/"); + return turePath; } diff --git a/Application/IStation.Application.DataFile/Report/PdfCreate/Eta_Day_ReportPdf.cs b/Application/IStation.Application.DataFile/eta_day_report/PdfCreate/Eta_Day_ReportPdf.cs similarity index 95% rename from Application/IStation.Application.DataFile/Report/PdfCreate/Eta_Day_ReportPdf.cs rename to Application/IStation.Application.DataFile/eta_day_report/PdfCreate/Eta_Day_ReportPdf.cs index f661e1a..fa75da7 100644 --- a/Application/IStation.Application.DataFile/Report/PdfCreate/Eta_Day_ReportPdf.cs +++ b/Application/IStation.Application.DataFile/eta_day_report/PdfCreate/Eta_Day_ReportPdf.cs @@ -31,7 +31,7 @@ /// 鐢熸垚鎶ヨ〃 /// </summary> /// <param name="station">娉电珯淇℃伅</param> - /// <param name="sum">姹囨��</param> + /// <param name="datatime">鏃堕棿</param> /// <param name="pipeList">鏈烘车绠¤矾鍒楄〃</param> /// <param name="list">鏈烘车淇℃伅鍒楄〃</param> /// <param name="path">璺緞</param> @@ -356,8 +356,10 @@ var EnginePump = ProductList.Find(x => x.BelongID == stationID && x.Name == EnginePumpLine.Name); var Pump = seviceEnginePump.GetChildPumpByEnginePumpID(EnginePump.CorpID, EnginePump.ID); var Motor = seviceEnginePump.GetChildMotorByEnginePumpID(EnginePump.CorpID, EnginePump.ID); - - cell = CreateCell2(EnginePump?.Name, _fontSize11, 1, 4, 40, 0, Element.ALIGN_CENTER); + string EnginePumpName = ""; + if(EnginePump!=null) + EnginePumpName=EnginePump.Name; + cell = CreateCell2(EnginePumpName, _fontSize11, 1, 5, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); cell = CreateCell2("鐘舵��", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); @@ -372,6 +374,7 @@ if (usetatus == 0) cell.BackgroundColor = BaseColor.Gray; table.AddCell(cell); + cell = CreateCell2("杩愯鏃堕棿" + " (h)", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); var runtime = Math.Round((decimal)item.RunTime / 3600, 1); @@ -379,11 +382,17 @@ table.AddCell(cell); cell = CreateCell2("娉靛瀷鍙�", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); - cell = CreateCell2(Pump?.Code, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); + string PumpCode = ""; + if (Pump != null) + PumpCode = Pump.Code; + cell = CreateCell2(PumpCode, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); cell = CreateCell2("鐢垫満鍨嬪彿", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); - cell = CreateCell2(Motor?.Code, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); + string MotorCode = ""; + if (Pump != null) + MotorCode = Motor.Code; + cell = CreateCell2(MotorCode, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); cell = CreateCell2("鎬荤數鑳�" + " (A)", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); @@ -427,7 +436,14 @@ wpavg = Math.Round((double)item.WPavg, 2).ToString(); if (item.WPavg > 1000) wpavg = Math.Round((double)item.WPavg, 1).ToString(); - cell = CreateCell2(item.WPavg < 1 ? @"/" : wpavg, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); + cell = CreateCell2(item.WPavg ==0 ? @"/" : wpavg, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); + table.AddCell(cell); + + cell = CreateCell2("鑰楃叅" + " (t)", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); + table.AddCell(cell); + var run_coal = item.Pavg + item.BootTimes / 3600f; + var value = ((run_coal / 10000f) * 2.7978); + cell = CreateCell2(value == 0?"/": Math.Round((double)value, 5).ToString(), _fontSize11, 3, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); } table.SetWidths(widths); diff --git a/Application/IStation.Application.DataFile/eta_day_report/dto/Day_DataFileTestInput.cs b/Application/IStation.Application.DataFile/eta_day_report/dto/Day_DataFileTestInput.cs new file mode 100644 index 0000000..76d0bde --- /dev/null +++ b/Application/IStation.Application.DataFile/eta_day_report/dto/Day_DataFileTestInput.cs @@ -0,0 +1,23 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IStation.Application +{ + /// <summary> + /// + /// </summary> + public class Day_DataFileTestInput : ObjectUnderCorpInput + { + + /// <summary> + /// 鏃ユ湡 + /// </summary> + [Required] + public DateTime DateTime { get; set; } + + } +} 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 new file mode 100644 index 0000000..7b2b85e --- /dev/null +++ b/Application/IStation.Application.DataFile/eta_month_report/Eta_Month_Report_Controller.cs @@ -0,0 +1,85 @@ +锘縰sing Microsoft.AspNetCore.Mvc; +using System.Net; +using System.Net.Http.Headers; +using Microsoft.Extensions.Hosting.Internal; +using Microsoft.AspNetCore.Http.Extensions; +using IStation.Untity; +using Furion.DynamicApiController; +using System.ComponentModel.DataAnnotations; +using Mapster; +using Microsoft.AspNetCore.Http; +using Furion.DependencyInjection; +using Microsoft.AspNetCore.Authorization; +using Furion.DataEncryption; +using Furion.FriendlyException; + +namespace IStation.Application +{ + /// <summary> + /// Report + /// </summary> + [AllowAnonymous] + [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> + /// 娉电珯鑳芥晥鏈堟姤琛� + /// </summary> + [Route("StationEtaMonthReport@V1.0")] + [HttpPost] + 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); + if (station == null) + { + throw Oops.Oh(ErrorCodes.D001, $"娉电珯涓嶅瓨鍦�!!"); + } + var pumpPipeLineList = new Service.PipeLine().GetByBelongTypeAndBelongID(input.CorpID, input.ObjectType, input.ObjectID)?.FindAll(x => x.Catalog == IStation.Product.Catalog_JiBeng); + if (pumpPipeLineList == null) + { + throw Oops.Oh(ErrorCodes.D001, $"鏈烘车涓嶅瓨鍦�!"); + } + var etaSumSingleDayRecordList = new List<Model.EtaSumSingleMonthRecord>(); + 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); + etaSumSingleDayRecordList.Add(etaSumSingleRecord); + } + if (etaSumSingleDayRecordList == null || etaSumSingleDayRecordList.Count < 1) + { + 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)) + Directory.CreateDirectory(ReportPath); + var EtaPathName = "Eta-Month"; + var EtaPath = Path.Combine(ReportPath, EtaPathName); + if (!Directory.Exists(EtaPath)) + Directory.CreateDirectory(EtaPath); + string dateTimePathName = input.Year+"-"+input.Month; + var pdfPath = Path.Combine(EtaPath, dateTimePathName); + if (!Directory.Exists(pdfPath)) + Directory.CreateDirectory(pdfPath); + var etaPdfFileName = $"Station_Eta_{station.ID}_{dateTimePathName}.pdf"; + var etaPdfFilePath = Path.Combine(pdfPath, etaPdfFileName); + + if (File.Exists(etaPdfFilePath)) + File.Delete(etaPdfFilePath); + if (!pdf.Create4Stream(station, etaSumRecord, pumpPipeLineList, etaSumSingleDayRecordList, dateTimePathName, etaPdfFilePath)) + { + throw Oops.Oh(ErrorCodes.D002, $"[{etaPdfFileName}]鏂囦欢鐢熸垚澶辫触!"); + } + var turePath = Path.Combine("/" + Settings.DataFile.PdfFolder, EtaPathName, dateTimePathName, etaPdfFileName); + turePath = turePath.Replace("\\", "/"); + return turePath; + } + + + } +} \ No newline at end of file diff --git a/Application/IStation.Application.DataFile/Report/PdfCreate/Eta_Month_ReportPdf.cs b/Application/IStation.Application.DataFile/eta_month_report/PdfCreate/Eta_Month_ReportPdf.cs similarity index 88% rename from Application/IStation.Application.DataFile/Report/PdfCreate/Eta_Month_ReportPdf.cs rename to Application/IStation.Application.DataFile/eta_month_report/PdfCreate/Eta_Month_ReportPdf.cs index d1d7261..71035ed 100644 --- a/Application/IStation.Application.DataFile/Report/PdfCreate/Eta_Month_ReportPdf.cs +++ b/Application/IStation.Application.DataFile/eta_month_report/PdfCreate/Eta_Month_ReportPdf.cs @@ -31,12 +31,13 @@ /// 鐢熸垚鎶ヨ〃 /// </summary> /// <param name="station">娉电珯淇℃伅</param> - /// <param name="sum">姹囨��</param> + /// <param name="datatime">鏃堕棿</param> /// <param name="pipeList">鏈烘车绠¤矾鍒楄〃</param> /// <param name="list">鏈烘车淇℃伅鍒楄〃</param> + /// <param name="monthlist">娉电珯鏈堝垪琛�</param> /// <param name="path">璺緞</param> /// <returns></returns> - public bool Create4Stream(Station station, List<Model.PipeLine> pipeList, List<Model.EtaSumSingleMonthRecord> list,string path) + public bool Create4Stream(Station station, Model.EtaSumMultiMonthRecord sum, List<Model.PipeLine> pipeList, List<Model.EtaSumSingleMonthRecord> list, string datatime, string path) { InitialFont(); //鍒濆鍖栨爣棰樹腑鐨凩OGO鍥剧墖 @@ -47,7 +48,7 @@ _document.SetMargins(-40, -40, 40, 40); _writer = PdfWriter.GetInstance(_document, new FileStream(path, FileMode.Create)); _writer.PageEvent = new CreatHeaderAndFoot(); - CreatestationInfoPage(station, pipeList, list);//浜у搧淇℃伅 + CreatestationInfoPage(station, pipeList, sum, list, datatime);//浜у搧淇℃伅 _document.Close(); return true; } @@ -123,7 +124,7 @@ /// <param name="sum"></param> /// <param name="pipeList"></param> /// <param name="list"></param> - public void CreatestationInfoPage(Station station, List<Model.PipeLine> pipeList, List<Model.EtaSumSingleMonthRecord> list) + public void CreatestationInfoPage(Station station, List<Model.PipeLine> pipeList, Model.EtaSumMultiMonthRecord sum, List<Model.EtaSumSingleMonthRecord> list, string dateTime) { _document.Open(); _document.NewPage(); @@ -155,7 +156,7 @@ Dt = Math.Round((double)dt, 2).ToString(); if (dt > 1000) Dt = Math.Round((double)dt, 1).ToString(); - CreatestationTable(station, runcout, Qt, Dt); + CreatestationTable(station,sum, runcout,dateTime); CreatestationInfoTable(pipeList, list, station.ID); PdfPTable table1 = new PdfPTable(3); float[] widths = { 80, 140, 300 }; @@ -278,7 +279,7 @@ { PdfPTable table = new PdfPTable(1); PdfPCell cell = new PdfPCell(); - cell = CreateCell2("娉电珯鑳芥晥鏃ユ姤琛�", _fontSize13_bold, 1, 1, 50, 0, Element.ALIGN_CENTER); + cell = CreateCell2("娉电珯鑳芥晥鏈堟姤琛�", _fontSize13_bold, 1, 1, 50, 0, Element.ALIGN_CENTER); cell.HorizontalAlignment = Element.ALIGN_CENTER;//姘村钩灞呬腑 cell.VerticalAlignment = Element.ALIGN_MIDDLE;//鍨傜洿灞呬腑 table.AddCell(cell); @@ -291,7 +292,7 @@ /// 璁惧淇℃伅 /// </summary> // - public void CreatestationTable(Station station, int cout, string qt, string dt) + public void CreatestationTable(Station station, EtaSumMultiMonthRecord sum, int cout, string datatime) { PdfPTable table = new PdfPTable(4); PdfPCell cell = new PdfPCell(); @@ -309,15 +310,15 @@ table.AddCell(cell); cell = CreateCell2("鎬荤數鑳�" + " (A)", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); - cell = CreateCell2(dt, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); + cell = CreateCell2(sum.Dt.ToString(), _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); - cell = CreateCell2("鎬绘祦閲�" + " (m鲁)", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); + cell = CreateCell2("渚涙按閲�" + " (t)", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); - cell = CreateCell2(qt, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); + cell = CreateCell2(sum.Qt.ToString(), _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); cell = CreateCell2("鎶ュ憡鏃ユ湡", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); - cell = CreateCell2("", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); + cell = CreateCell2(datatime, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); cell = CreateCell2("浣跨敤鐘舵��", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); @@ -356,8 +357,10 @@ var EnginePump = ProductList.Find(x => x.BelongID == stationID && x.Name == EnginePumpLine.Name); var Pump = seviceEnginePump.GetChildPumpByEnginePumpID(EnginePump.CorpID, EnginePump.ID); var Motor = seviceEnginePump.GetChildMotorByEnginePumpID(EnginePump.CorpID, EnginePump.ID); - - cell = CreateCell2(EnginePump?.Name, _fontSize11, 1, 4, 40, 0, Element.ALIGN_CENTER); + string EnginePumpName = ""; + if (EnginePump != null) + EnginePumpName = EnginePump.Name; + cell = CreateCell2(EnginePumpName, _fontSize11, 1, 5, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); cell = CreateCell2("鐘舵��", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); @@ -372,6 +375,7 @@ if (usetatus == 0) cell.BackgroundColor = BaseColor.Gray; table.AddCell(cell); + cell = CreateCell2("杩愯鏃堕棿" + " (h)", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); var runtime = Math.Round((decimal)item.RunTime / 3600, 1); @@ -379,11 +383,17 @@ table.AddCell(cell); cell = CreateCell2("娉靛瀷鍙�", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); - cell = CreateCell2(Pump?.Code, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); + string PumpCode = ""; + if (Pump != null) + PumpCode = Pump.Code; + cell = CreateCell2(PumpCode, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); cell = CreateCell2("鐢垫満鍨嬪彿", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); - cell = CreateCell2(Motor?.Code, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); + string MotorCode = ""; + if (Pump != null) + MotorCode = Motor.Code; + cell = CreateCell2(MotorCode, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); cell = CreateCell2("鎬荤數鑳�" + " (A)", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); @@ -427,7 +437,14 @@ wpavg = Math.Round((double)item.WPavg, 2).ToString(); if (item.WPavg > 1000) wpavg = Math.Round((double)item.WPavg, 1).ToString(); - cell = CreateCell2(item.WPavg < 1 ? @"/" : wpavg, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); + cell = CreateCell2(item.WPavg == 0 ? @"/" : wpavg, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); + table.AddCell(cell); + + cell = CreateCell2("鑰楃叅" + " (t)", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER); + table.AddCell(cell); + var run_coal = item.Pavg + item.BootTimes / 3600f; + var value = ((run_coal / 10000f) * 2.7978); + cell = CreateCell2(value == 0 ? "/" : Math.Round((double)value, 5).ToString(), _fontSize11, 3, 1, 40, 0, Element.ALIGN_CENTER); table.AddCell(cell); } table.SetWidths(widths); @@ -670,6 +687,29 @@ table1.WidthPercentage = percentage;//琛ㄦ牸鎵�鍗犵晫闈㈢殑鐧惧垎姣� return table1; } + /// <summary> + /// 鏍规嵁 骞� 鍜� 鏈堬紝鑾峰彇褰撴湀绗竴澶� + /// </summary> + /// <param name="years">骞�</param> + /// <param name="months">鏈�</param> + /// <returns>杩斿洖锛歽yyy-MM-dd 褰㈠紡</returns> + public DateTime GetFirstDayByYearMonth(int years, int months) + { + DateTime datetime = DateTime.Parse(years + "-" + months + "-" + "15"); + return datetime.AddDays(1 - datetime.Day); + } + + /// <summary> + /// 鏍规嵁 骞� 鍜� 鏈堬紝鑾峰彇褰撴湀鏈�鍚庝竴澶� + /// </summary> + /// <param name="years">骞�</param> + /// <param name="months">鏈�</param> + /// <returns>杩斿洖锛歽yyy-MM-dd 褰㈠紡</returns> + public DateTime GetLastDayByYearMonth(int years, int months) + { + DateTime datetime = DateTime.Parse(years + "-" + months + "-" + "15"); + return datetime.AddDays(1 - datetime.Day).AddMonths(1).AddDays(-1); + } } } #endregion \ No newline at end of file diff --git a/Application/IStation.Application.DataFile/eta_month_report/dto/EtaKpiMonthItem.cs b/Application/IStation.Application.DataFile/eta_month_report/dto/EtaKpiMonthItem.cs new file mode 100644 index 0000000..46f2267 --- /dev/null +++ b/Application/IStation.Application.DataFile/eta_month_report/dto/EtaKpiMonthItem.cs @@ -0,0 +1,34 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IStation.Application +{ + /// <summary> + /// 鑳芥晥kpi鏈堝害閲忛」 + /// </summary> + public class EtaKpiMonthItem + { + /// <summary> + /// 鍚嶇О + /// </summary> + public string Name { get; set; } + + /// <summary> + /// 鍗曚綅 + /// </summary> + public string Unit { get; set; } + + /// <summary> + /// 涓婃湀璁板綍鍒楄〃 + /// </summary> + public List<EtaKpiMonthItemRecord> LastMonthRecords { get; set; } + + /// <summary> + /// 褰撴湀璁板綍鍒楄〃 + /// </summary> + public List<EtaKpiMonthItemRecord> ThisMonthRecords { get; set; } + } +} diff --git a/Application/IStation.Application.DataFile/Report/dto/DataFileTestInput.cs b/Application/IStation.Application.DataFile/eta_month_report/dto/EtaKpiMonthItemRecord.cs similarity index 60% rename from Application/IStation.Application.DataFile/Report/dto/DataFileTestInput.cs rename to Application/IStation.Application.DataFile/eta_month_report/dto/EtaKpiMonthItemRecord.cs index 94a656f..2fcf864 100644 --- a/Application/IStation.Application.DataFile/Report/dto/DataFileTestInput.cs +++ b/Application/IStation.Application.DataFile/eta_month_report/dto/EtaKpiMonthItemRecord.cs @@ -7,23 +7,18 @@ namespace IStation.Application { /// <summary> - /// + /// 鑳芥晥kpi鏈堝害閲忛」璁板綍 /// </summary> - public class DataFileTestInput + public class EtaKpiMonthItemRecord { - + /// <summary> + /// 鏃ユ湡 + /// </summary> + public int Day { get; set; } /// <summary> - /// + /// 鍊� /// </summary> - public string Sub { get; set; } - - /// <summary> - /// - /// </summary> - public string Name { get; set; } - - - + public double? Value { get; set; } } } diff --git a/Application/IStation.Application.DataFile/eta_month_report/dto/Month_DataFileTestInput.cs b/Application/IStation.Application.DataFile/eta_month_report/dto/Month_DataFileTestInput.cs new file mode 100644 index 0000000..0f1ac57 --- /dev/null +++ b/Application/IStation.Application.DataFile/eta_month_report/dto/Month_DataFileTestInput.cs @@ -0,0 +1,36 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IStation.Application +{ + /// <summary> + /// + /// </summary> + public class Month_DataFileTestInput : ObjectUnderCorpInput + { + + /// <summary> + /// 骞� + /// </summary> + [Required] + public int Year { get; set; } + + /// <summary> + ///鏈� + /// </summary> + [Required] + public int Month { get; set; } + + /// <summary> + ///涓氬姟鍖哄煙ID + /// </summary> + [Required] + public int LogicAreaID{ get; set;} + + + } +} diff --git a/Entry/IStation.WebApi.Entry/IStation.WebApi.Entry.csproj.user b/Entry/IStation.WebApi.Entry/IStation.WebApi.Entry.csproj.user new file mode 100644 index 0000000..74d0e99 --- /dev/null +++ b/Entry/IStation.WebApi.Entry/IStation.WebApi.Entry.csproj.user @@ -0,0 +1,13 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <NameOfLastUsedPublishProfile>D:\WorkData\IStation\V4\Service.V4.1\Entry\IStation.WebApi.Entry\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile> + <ActiveDebugProfile>IIS Express</ActiveDebugProfile> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> + <DebuggerFlavor>ProjectDebugger</DebuggerFlavor> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> + <DebuggerFlavor>ProjectDebugger</DebuggerFlavor> + </PropertyGroup> +</Project> \ No newline at end of file diff --git a/Model/IStation.Model.Eta/eta_accord/multi/EtaAccordMultiMonthRecord.cs b/Model/IStation.Model.Eta/eta_accord/multi/EtaAccordMultiMonthRecord.cs index bd4abcc..ebea6f9 100644 --- a/Model/IStation.Model.Eta/eta_accord/multi/EtaAccordMultiMonthRecord.cs +++ b/Model/IStation.Model.Eta/eta_accord/multi/EtaAccordMultiMonthRecord.cs @@ -286,7 +286,7 @@ /// <summary> /// 鎬荤偣鏁� - /// </summary> + /// </summary>渚涙按 public int TotalPointCount { get; set; } /// <summary> -- Gitblit v1.9.3