From d4eec76bebf584d6032726f25e87df3518e9040a Mon Sep 17 00:00:00 2001 From: jiahao Date: Fri, 29 Sep 2023 01:01:02 +0800 Subject: [PATCH] =?UTF-8?q?debug:=20=E5=AE=A2=E8=A3=BD=E5=8C=96=E5=A0=B1?= =?UTF-8?q?=E8=A1=A8=E4=BF=AE=E6=AD=A3=20-=20=E5=8C=96=E5=B7=A5=E9=97=9C?= =?UTF-8?q?=E7=B8=BD=E8=A8=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiControllers/HydroMeterController.cs | 59 ++++++++++++++----- 1 file changed, 44 insertions(+), 15 deletions(-) diff --git a/FrontendWebApi/ApiControllers/HydroMeterController.cs b/FrontendWebApi/ApiControllers/HydroMeterController.cs index 6dd95f5..224925c 100644 --- a/FrontendWebApi/ApiControllers/HydroMeterController.cs +++ b/FrontendWebApi/ApiControllers/HydroMeterController.cs @@ -205,6 +205,12 @@ namespace FrontendWebApi.ApiControllers } l.building_name = await backendRepository.GetOneAsync("select full_name from building where building_tag = @building_tag and deleted = 0", new { building_tag = l.building_tag }); + //如果是 總計不含分盤 mode = custom; 就呈現 化工總計 + //if (input.Mode == HydroMeterInputSearchMode.Custom && l.building_tag == "D8") + //{ + // l.building_name = "化工館總計"; + //} + l.total = l.rawData.Where(x => x.avg_rawdata != "NaN").Sum(x => decimal.Parse(x.avg_rawdata ?? "0", System.Globalization.NumberStyles.Float)).ToString(); l.price = input.price.HasValue ? (Math.Round(input.price.Value, 2)).ToString() @@ -1017,12 +1023,12 @@ namespace FrontendWebApi.ApiControllers #region 特定棟別總計處理 foreach (var item in result) { - if (item.device_full_name == "NTPC_B4_EE_E4_B1F_VCB3B_WHT_N1") //學5舍5眷總盤 + if (item.device_full_name == "NTPC_D8_EE_E4_RF_H1_WHT_N1") //化工電機 { - Console.WriteLine("here 學5舍5眷總盤 " + item.building_name); - if (item.building_name == "學5舍5眷總盤") + Console.WriteLine("here 化工電機 " + item.building_name); + if (item.building_name == "化工電機") { - Console.WriteLine("here 學5舍5眷總盤 " + item.building_name); + Console.WriteLine("here 化工電機 " + item.building_name); } } if (!need_cal_total.Contains(item.building_name)) @@ -1093,13 +1099,27 @@ namespace FrontendWebApi.ApiControllers columnIndex++; cell = row.GetCell(columnIndex++) ?? row.CreateCell(columnIndex++); - cell.SetCellValue(last_build + "總計"); + if (last_build == "化工電機") + { + cell.SetCellValue("化工館總計"); + } + else { + + cell.SetCellValue(last_build + "總計"); + } cell.CellStyle = greenCellStyle; foreach (var timeStampData in buildingSumData[last_build]) { cell = row.GetCell(columnIndex++) ?? row.CreateCell(columnIndex++); - cell.SetCellValue(timeStampData.Value.ToString()); + //if (last_build == "化工電機") + //{ + // cell.SetCellValue(10); //總計結果寫入 + //} + //else + //{ + cell.SetCellValue(timeStampData.Value.ToString()); //總計結果寫入 by jiahao 09/28 + //} } rowIndex++; @@ -1107,7 +1127,8 @@ namespace FrontendWebApi.ApiControllers flag = false; columnIndex = 0; } - + + //增加總計欄位 if (flag && buildingName != last_build && need_cal_total.Contains(last_build)) { row = sheet.GetRow(rowIndex) ?? sheet.CreateRow(rowIndex); @@ -1123,12 +1144,8 @@ namespace FrontendWebApi.ApiControllers columnIndex++; cell = row.GetCell(columnIndex++) ?? row.CreateCell(columnIndex++); - - if (last_build == "化工電機") - { - cell.SetCellValue("化工館總計"); - } - else if (last_build == "學人會館") + + if (last_build == "學人會館") { cell.SetCellValue("學人國際總計"); } @@ -1149,7 +1166,8 @@ namespace FrontendWebApi.ApiControllers // continue; } - + + //是否需要總計 if (total_flag) { if (need_green_device.Contains(deviceFullName)) @@ -1306,6 +1324,7 @@ order by e.report_priority, a.priority"; "教學大樓總盤", "電子館分盤", "機械館分盤", + "化工電機總盤", "電機館分盤", "學1-4舍餐廳總盤", "學5舍5眷總盤", @@ -1330,7 +1349,11 @@ order by e.report_priority, a.priority"; //if (l.device_number == "NTPC_B4_EE_E4_B1F_VCB3B_WHT_N1")//"學5舍5眷總盤" //{ // Console.WriteLine("here " + l.device_full_name); - //} + //} + if (l.device_number == "NTPC_D8_EE_E4_RF_HM_WHT_N1")// 化工電機總盤 + { + Console.WriteLine("here " + l.device_full_name); + } if (input.Mode == HydroMeterInputSearchMode.Custom && !need_green_device.Contains(full_name)) { @@ -1393,6 +1416,12 @@ order by e.report_priority, a.priority"; l.device_full_name = full_name; l.building_name = await backendRepository.GetOneAsync("select full_name from building where building_tag = @building_tag and deleted = 0", new { building_tag = l.building_tag }); + + //不含分盤 需要修改大樓名稱 + //if(input.Mode == HydroMeterInputSearchMode.Custom && l.) + //{ + // l.building_name = "化工館總計"; + //} l.total = l.rawData.Where(x => x.avg_rawdata != "NaN").Sum(x => decimal.Parse(x.avg_rawdata ?? "0", System.Globalization.NumberStyles.Float)).ToString(); l.price = input.price.HasValue ? (Math.Round(input.price.Value, 2)).ToString()