From ebe14c5eb181f60f3380ba9389bc170e5c395f6a Mon Sep 17 00:00:00 2001
From: wangzelong <2692854983@qq.com>
Date: 星期三, 30 十一月 2022 17:20:51 +0800
Subject: [PATCH] 报表修改

---
 Application/IStation.Application.DataFile/eta_day_report/PdfCreate/Eta_Day_ReportPdf.cs |  153 +++++++++++++--------------------------------------
 1 files changed, 39 insertions(+), 114 deletions(-)

diff --git a/Application/IStation.Application.DataFile/eta_day_report/PdfCreate/Eta_Day_ReportPdf.cs b/Application/IStation.Application.DataFile/eta_day_report/PdfCreate/Eta_Day_ReportPdf.cs
index dc2ac0e..8313062 100644
--- a/Application/IStation.Application.DataFile/eta_day_report/PdfCreate/Eta_Day_ReportPdf.cs
+++ b/Application/IStation.Application.DataFile/eta_day_report/PdfCreate/Eta_Day_ReportPdf.cs
@@ -1,4 +1,5 @@
-锘縰sing IStation.Application.Report.Helper;
+锘縰sing Furion.LinqBuilder;
+using IStation.Application.Report.Helper;
 using IStation.Model;
 using IStation.Model.Eta;
 using iTextSharp.text;
@@ -30,7 +31,7 @@
         /// <summary>
         /// 鐢熸垚鎶ヨ〃
         /// </summary>
-        /// <param name="station">娉电珯淇℃伅</param>
+        /// <param name="station?">娉电珯淇℃伅</param>
         /// <param name="datatime">鏃堕棿</param>
         /// <param name="pipeList">鏈烘车绠¤矾鍒楄〃</param>
         /// <param name="list">鏈烘车淇℃伅鍒楄〃</param>
@@ -39,6 +40,18 @@
         /// <returns></returns>
         public bool Create4Stream(Station station, List<Model.PipeLine> pipeList, List<EtaSumSingleDayRecord> list,long corpID, DateTime datatime, string path)
         {
+            if (station == null)
+                return false;
+            if (pipeList == null || pipeList.Count < 1)
+                return false;
+            if (list == null || list.Count < 1)
+                return false;
+            if (corpID < 1)
+                return false;
+            if (string.IsNullOrEmpty(datatime.ToShortDateString()))
+                return false;
+            if (path == "")
+                return false;
             InitialFont();
             //鍒濆鍖栨爣棰樹腑鐨凩OGO鍥剧墖
             InitialTitleLogoImage();
@@ -124,7 +137,7 @@
         /// <summary>
         /// 
         /// </summary>
-        /// <param name="station"></param>
+        /// <param name="station?"></param>
         /// <param name="pipeList"></param>
         /// <param name="list"></param>
         /// <param name="dateTime"></param>
@@ -138,14 +151,17 @@
             int runcout = 0;
             double? qt = 0;
             double? dt = 0;
-            foreach (var item in list)
+            if (list != null || list.Count > 0) 
             {
-                if (item.RunTime > 0)
-                    runcout = runcout + 1;
-                if (item.Qt > 0)
-                    qt += item.Qt;
-                if (item.Dt > 0)
-                    dt += item.Dt;
+                foreach (var item in list)
+                {
+                    if (item.RunTime > 0)
+                        runcout = runcout + 1;
+                    if (item.Qt > 0)
+                        qt += item.Qt;
+                    if (item.Dt > 0)
+                        dt += item.Dt;
+                }
             }
             LogHelper.Info("璁剧疆鎬荤數鑳藉拰鎬绘祦閲�");
             string Qt = "";
@@ -171,14 +187,14 @@
             LogHelper.Info("淇濈暀鐢佃兘鍜屾祦閲忓皬鏁�");
             CreatestationTable(station, runcout, dateTime, Qt, Dt);
             LogHelper.Info("鍒涘缓娉电珯鑳芥晥鏁村悎琛ㄦ牸");
-            CreatestationInfoTable(pipeList, list, corpID, station.ID);
+            CreatestationInfoTable(pipeList, list, corpID, station?.ID);
             LogHelper.Info("鍒涘缓娉电珯鑳芥晥涓讳綋琛ㄦ牸");
             PdfPTable table1 = new PdfPTable(3);
             float[] widths = { 80, 140, 300 };
             table1.SetWidths(widths);
             PdfPCell cell = new PdfPCell();
 
-            cell = CreateCell2("璁惧鐘舵�侊細" + station.UseStatus, _fontSize8, 1, 1);
+            cell = CreateCell2("璁惧鐘舵�侊細" + station?.UseStatus, _fontSize8, 1, 1);
             table1.AddCell(cell);
             _document.Add(table1);
             CreatePropTable();
@@ -317,7 +333,7 @@
             table.AddCell(cell);
             cell = CreateCell2("娉电珯鍚嶇О", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER);
             table.AddCell(cell);
-            cell = CreateCell2(station.Name, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER);
+            cell = CreateCell2(station?.Name, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER);
             table.AddCell(cell);
             cell = CreateCell2("杩愯鏁伴噺" + " (鍙�)", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER);
             table.AddCell(cell);
@@ -333,19 +349,19 @@
             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(datatime.ToShortDateString()==""? "": datatime.ToShortDateString(), _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(station.UseStatus == eUseStatus.Enable ? "浣跨敤涓�" : "宸插仠鐢�", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER);
-            if (station.UseStatus == eUseStatus.Enable)
+            cell = CreateCell2(station?.UseStatus == eUseStatus.Enable ? "浣跨敤涓�" : "宸插仠鐢�", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER);
+            if (station?.UseStatus == eUseStatus.Enable)
                 cell.BackgroundColor = BaseColor.Green;
-            if (station.UseStatus == eUseStatus.Disable)
+            if (station?.UseStatus == eUseStatus.Disable)
                 cell.BackgroundColor = BaseColor.Gray;
             table.AddCell(cell);
             cell = CreateCell2("鍦板潃", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER);
             table.AddCell(cell);
-            cell = CreateCell2(station.Address, _fontSize11, 3, 1, 40, 0, Element.ALIGN_CENTER);
+            cell = CreateCell2(station?.Address, _fontSize11, 3, 1, 40, 0, Element.ALIGN_CENTER);
             table.AddCell(cell);
 
             table.SetWidths(widths);
@@ -360,112 +376,21 @@
         /// <param name="list"></param>
         /// <param name="stationID"></param>
         /// <param name="corpID"></param>
-        public void CreatestationInfoTable(List<Model.PipeLine> pipeList, List<EtaSumSingleDayRecord> list,long corpID, long stationID)
+        public void CreatestationInfoTable(List<Model.PipeLine> pipeList, List<EtaSumSingleDayRecord> list,long corpID, long? stationID)
         {
 
             PdfPTable table = new PdfPTable(5);
             PdfPCell cell = new PdfPCell();
             float[] widths = new float[] { 60, 60, 60, 60, 60 };
-            var ProductList = new Service.Product().GetByCorpID(list.FirstOrDefault().CorpID);
+            var ProductList = new Service.Product().GetByCorpID(corpID);
             cell = CreateCell2("鑳芥晥淇℃伅", _fontSize11, 5, 1, 40, 0, Element.ALIGN_CENTER);
             table.AddCell(cell);
             var seviceEnginePump = new Service.Product();
-            foreach (var item in list)
+            if (list != null || list.Count > 0) 
             {
-                var EnginePumpLine = pipeList.Find(x => x.ID == item.ObjectID);
-                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);
-                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);
-                int usetatus = 0;
-                if (item.UWPavg < 1)
-                    usetatus = 0;
-                if (item.UWPavg > 0)
-                    usetatus = 1;
-                cell = CreateCell2(usetatus == 1 ? "寮�鍚�" : "鏈紑鍚�", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER);
-                if (usetatus == 1)
-                    cell.BackgroundColor = BaseColor.Green;
-                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);
-                cell = CreateCell2(runtime < 1 ? @"/" : runtime.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);
-                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);
-                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);
-                string Dt = "";
-                if (item.Dt < 10)
-                    Dt = Math.Round((double)item.Dt, 3).ToString();
-                if (10 < item.Dt && item.Dt < 1000)
-                    Dt = Math.Round((double)item.Dt, 2).ToString();
-                if (item.Dt > 1000)
-                    Dt = Math.Round((double)item.Dt, 1).ToString();
-                cell = CreateCell2(item.Dt < 1 ? @"/" : Dt, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER);
-                table.AddCell(cell);
-                cell = CreateCell2("鎬绘祦閲�" + " (m鲁)", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER);
-                table.AddCell(cell);
-                string Qt = "";
-                if (item.Qt < 10)
-                    Qt = Math.Round((double)item.Qt, 3).ToString();
-                if (10 < item.Qt && item.Qt < 1000)
-                    Qt = Math.Round((double)item.Qt, 2).ToString();
-                if (item.Qt > 1000)
-                    Qt = Math.Round((double)item.Qt, 1).ToString();
-                cell = CreateCell2(item.Qt < 1 ? @"/" : Qt, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER);
-                table.AddCell(cell);
-                cell = CreateCell2("骞冲潎鍗曚綅鑳借��" + " \n(kw路h)", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER);
-                table.AddCell(cell);
-                string UWPavg = "";
-                if (item.UWPavg < 10)
-                    UWPavg = Math.Round((double)item.UWPavg, 3).ToString();
-                if (10 < item.UWPavg && item.UWPavg < 1000)
-                    UWPavg = Math.Round((double)item.UWPavg, 2).ToString();
-                if (item.UWPavg > 1000)
-                    UWPavg = Math.Round((double)item.UWPavg, 1).ToString();
-                cell = CreateCell2(item.UWPavg < 1 ? @"/" : UWPavg, _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER);
-                table.AddCell(cell);
-                cell = CreateCell2("骞冲潎鍗冨惃鑳借��" + " \n(kw路h)", _fontSize11, 1, 1, 40, 0, Element.ALIGN_CENTER);
-                table.AddCell(cell);
-                string wpavg = "";
-                if (item.WPavg < 10)
-                    wpavg = Math.Round((double)item.WPavg, 3).ToString();
-                if (10 < item.WPavg && item.WPavg < 1000)
-                    wpavg = Math.Round((double)item.WPavg, 2).ToString();
-                if (item.WPavg > 1000)
-                    wpavg = Math.Round((double)item.WPavg, 1).ToString();
-                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);
             _document.Add(table);
             LogHelper.Info("涓讳綋宸插垱寤�");

--
Gitblit v1.9.3