wangzelong
2022-09-20 85a3bba2ed29b8cf6f6009f837d01583c5daf9d4
月报表
已修改2个文件
28 ■■■■■ 文件已修改
Application/IStation.Application.DataFile/eta_month_report/Eta_Month_Report_Controller.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Application/IStation.Application.DataFile/eta_month_report/PdfCreate/Eta_Month_ReportPdf.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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);
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>返回: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);
@@ -705,7 +708,7 @@
        /// <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);