| | |
| | | [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> |
| | |
| | | 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, $"泵站不存在!!"); |
| | | } |
| | |
| | | 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)) |
| | |
| | | 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); |
| | |
| | | /// <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) |
| | |
| | | /// <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(); |
| | |
| | | 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 }; |
| | |
| | | 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); |
| | |
| | | /// 生成机泵列表 |
| | | /// </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) |
| | | { |
| | | |
| | |
| | | /// <param name="years">年</param> |
| | | /// <param name="months">月</param> |
| | | /// <returns>返回:yyyy-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); |
| | |
| | | /// <param name="years">年</param> |
| | | /// <param name="months">月</param> |
| | | /// <returns>返回:yyyy-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); |