wangzelong
2022-09-15 e646950cee8a90926f837dbdb0af8cb1bf7e21b9
报表-月(暂时)
已重命名1个文件
已复制1个文件
已修改1个文件
44 ■■■■ 文件已修改
Application/IStation.Application.DataFile/Report/PdfCreate/Eta_Day_ReportPdf.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Application/IStation.Application.DataFile/Report/PdfCreate/Eta_Month_ReportPdf.cs 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Application/IStation.Application.DataFile/Report/Report_Controller.cs 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Application/IStation.Application.DataFile/Report/PdfCreate/Eta_Day_ReportPdf.cs
ÎļþÃû´Ó Application/IStation.Application.DataFile/Report/PdfCreate/ReportPdf4Default.cs ÐÞ¸Ä
@@ -13,7 +13,7 @@
    /// <summary>
    /// 
    /// </summary>
    public class ReportPdf4Default
    public class Eta_Day_ReportPdf
    {
        #region å±žæ€§
        Document _document;
@@ -349,12 +349,13 @@
            var ProductList = new Service.Product().GetByCorpID(list.FirstOrDefault().CorpID);
            cell = CreateCell2("能效信息", _fontSize11, 5, 1, 40, 0, Element.ALIGN_CENTER);
            table.AddCell(cell);
            var seviceEnginePump = new Service.Product();
            foreach (var item in list)
            {
                var EnginePumpLine = pipeList?.Find(x => x.ID == item.ObjectID);
                var EnginePump = ProductList.Find(x => x.BelongID == stationID && x.Name == EnginePumpLine.Name);
                var Pump = new Service.Product().GetChildPumpByEnginePumpID(EnginePump.CorpID, EnginePump.ID);
                var Motor = new Service.Product().GetChildMotorByEnginePumpID(EnginePump.CorpID, EnginePump.ID);
                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);
                table.AddCell(cell);
Application/IStation.Application.DataFile/Report/PdfCreate/Eta_Month_ReportPdf.cs
copy from Application/IStation.Application.DataFile/Report/PdfCreate/ReportPdf4Default.cs copy to Application/IStation.Application.DataFile/Report/PdfCreate/Eta_Month_ReportPdf.cs
Îļþ´Ó Application/IStation.Application.DataFile/Report/PdfCreate/ReportPdf4Default.cs ¸´ÖÆ
@@ -13,7 +13,7 @@
    /// <summary>
    /// 
    /// </summary>
    public class ReportPdf4Default
    public class Eta_Month_ReportPdf
    {
        #region å±žæ€§
        Document _document;
@@ -36,7 +36,7 @@
        /// <param name="list">机泵信息列表</param>
        /// <param name="path">路径</param>
        /// <returns></returns>
        public bool Create4Stream(Station station, List<Model.PipeLine> pipeList, List<EtaSumSingleDayRecord> list, DateTime datatime, string path)
        public bool Create4Stream(Station station, List<Model.PipeLine> pipeList, List<Model.EtaSumSingleMonthRecord> list,string path)
        {
            InitialFont();
            //初始化标题中的LOGO图片
@@ -47,7 +47,7 @@
            _document.SetMargins(-40, -40, 40, 40);
            _writer = PdfWriter.GetInstance(_document, new FileStream(path, FileMode.Create));
            _writer.PageEvent = new CreatHeaderAndFoot();
            CreatestationInfoPage(station, pipeList, list, datatime);//产品信息
            CreatestationInfoPage(station, pipeList, list);//产品信息
            _document.Close();
            return true;
        }
@@ -123,7 +123,7 @@
        /// <param name="sum"></param>
        /// <param name="pipeList"></param>
        /// <param name="list"></param>
        public void CreatestationInfoPage(Station station, List<Model.PipeLine> pipeList, List<EtaSumSingleDayRecord> list, DateTime dateTime)
        public void CreatestationInfoPage(Station station, List<Model.PipeLine> pipeList, List<Model.EtaSumSingleMonthRecord> list)
        {
            _document.Open();
            _document.NewPage();
@@ -155,7 +155,7 @@
                Dt = Math.Round((double)dt, 2).ToString();
            if (dt > 1000)
                Dt = Math.Round((double)dt, 1).ToString();
            CreatestationTable(station, runcout, dateTime, Qt, Dt);
            CreatestationTable(station, runcout, Qt, Dt);
            CreatestationInfoTable(pipeList, list, station.ID);
            PdfPTable table1 = new PdfPTable(3);
            float[] widths = { 80, 140, 300 };
@@ -291,7 +291,7 @@
        /// è®¾å¤‡ä¿¡æ¯
        /// </summary>
        //
        public void CreatestationTable(Station station, int cout, DateTime datatime, string qt, string dt)
        public void CreatestationTable(Station station, int cout, string qt, string dt)
        {
            PdfPTable table = new PdfPTable(4);
            PdfPCell cell = new PdfPCell();
@@ -317,7 +317,7 @@
            table.AddCell(cell);
            cell = CreateCell2("报告日期", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER);
            table.AddCell(cell);
            cell = CreateCell2(datatime.ToShortDateString(), _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER);
            cell = CreateCell2("", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER);
            table.AddCell(cell);
            cell = CreateCell2("使用状态", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER);
            table.AddCell(cell);
@@ -340,7 +340,7 @@
        /// ç”Ÿæˆæœºæ³µåˆ—表
        /// </summary>
        /// <param name="list">机泵列表</param>
        public void CreatestationInfoTable(List<Model.PipeLine> pipeList, List<EtaSumSingleDayRecord> list, long stationID)
        public void CreatestationInfoTable(List<Model.PipeLine> pipeList, List<Model.EtaSumSingleMonthRecord> list, long stationID)
        {
            PdfPTable table = new PdfPTable(5);
@@ -349,12 +349,13 @@
            var ProductList = new Service.Product().GetByCorpID(list.FirstOrDefault().CorpID);
            cell = CreateCell2("能效信息", _fontSize11, 5, 1, 40, 0, Element.ALIGN_CENTER);
            table.AddCell(cell);
            var seviceEnginePump = new Service.Product();
            foreach (var item in list)
            {
                var EnginePumpLine = pipeList?.Find(x => x.ID == item.ObjectID);
                var EnginePump = ProductList.Find(x => x.BelongID == stationID && x.Name == EnginePumpLine.Name);
                var Pump = new Service.Product().GetChildPumpByEnginePumpID(EnginePump.CorpID, EnginePump.ID);
                var Motor = new Service.Product().GetChildMotorByEnginePumpID(EnginePump.CorpID, EnginePump.ID);
                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);
                table.AddCell(cell);
Application/IStation.Application.DataFile/Report/Report_Controller.cs
@@ -16,7 +16,7 @@
namespace IStation.Application
{
    /// <summary>
    /// æŠ¥è¡¨
    /// Report
    /// </summary>
    [AllowAnonymous]
    [Route("DataFile/Report ")]
@@ -30,7 +30,7 @@
        /// </summary> 
        [Route("StationEtaDayReport@V1.0")]
        [HttpPost]
        public string StationEtaDayReport([FromQuery][Required] ObjectUnderCorpInput input, [FromQuery][Required] DateTime DateTime)
        public string StationEtaDayReport([FromQuery][Required] ObjectUnderCorpInput input, int year,int month)
        {
            var station = new Service.Station().GetByID(input.CorpID, input.ObjectID);
            if (station == null)
@@ -44,30 +44,30 @@
                throw Oops.Oh(ErrorCodes.D001, $"机泵不存在!");
            }
            var etaSumSingleDayRecordList = new List<Model.EtaSumSingleDayRecord>();
            var etaSumSingleDayRecordList = new List<Model.EtaSumSingleMonthRecord>();
            var etaSumSingleService = new Service.EtaSumSingleRecord();
            foreach (var pipeLineitem in pumpPipeLineList)
            {
                var etaSumSingleRecord = etaSumSingleService.GetDayByObjectOfDay(pipeLineitem.CorpID, IStation.ObjectType.PipeLine, pipeLineitem.ID, DateTime);
                var etaSumSingleRecord = etaSumSingleService.GetMonthByObjectOfMonth(pipeLineitem.CorpID, IStation.ObjectType.PipeLine, pipeLineitem.ID, year,month);
                etaSumSingleDayRecordList.Add(etaSumSingleRecord);
            }
            if (etaSumSingleDayRecordList == null || etaSumSingleDayRecordList.Count < 1)
            {
                throw Oops.Oh(ErrorCodes.D001, $"能效数据不存在!-日期:[{DateTime}]");
                throw Oops.Oh(ErrorCodes.D001, $"能效数据不存在!-日期:[{year-month}]");
            }
            var pdf = new ReportPdf4Default();
            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.ToString("M")}.pdf";
            var etaPdfFileName = $"{station.Name}_Eta_{DateTime.Now.ToString("M")}.pdf";
            var etaPdfFilePath = Path.Combine(folderPath, etaPdfFileName);
            if (File.Exists(etaPdfFilePath))
                File.Delete(etaPdfFilePath);
            if (!pdf.Create4Stream(station, pumpPipeLineList, etaSumSingleDayRecordList, DateTime, etaPdfFilePath))
            if (!pdf.Create4Stream(station, pumpPipeLineList, etaSumSingleDayRecordList, etaPdfFilePath))
            {
                throw Oops.Oh(ErrorCodes.D002, $"[{etaPdfFileName}]文件生成失败!");
            }