debug: 客製化報表修正 - 化工關總計
This commit is contained in:
parent
e4806ab0ac
commit
d4eec76beb
@ -205,6 +205,12 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
}
|
}
|
||||||
l.building_name = await backendRepository.GetOneAsync<string>("select full_name from building where building_tag = @building_tag and deleted = 0",
|
l.building_name = await backendRepository.GetOneAsync<string>("select full_name from building where building_tag = @building_tag and deleted = 0",
|
||||||
new { building_tag = l.building_tag });
|
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.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
|
l.price = input.price.HasValue
|
||||||
? (Math.Round(input.price.Value, 2)).ToString()
|
? (Math.Round(input.price.Value, 2)).ToString()
|
||||||
@ -1017,12 +1023,12 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
#region 特定棟別總計處理
|
#region 特定棟別總計處理
|
||||||
foreach (var item in result)
|
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);
|
Console.WriteLine("here 化工電機 " + item.building_name);
|
||||||
if (item.building_name == "學5舍5眷總盤")
|
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))
|
if (!need_cal_total.Contains(item.building_name))
|
||||||
@ -1093,13 +1099,27 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
columnIndex++;
|
columnIndex++;
|
||||||
|
|
||||||
cell = row.GetCell(columnIndex++) ?? row.CreateCell(columnIndex++);
|
cell = row.GetCell(columnIndex++) ?? row.CreateCell(columnIndex++);
|
||||||
|
if (last_build == "化工電機")
|
||||||
|
{
|
||||||
|
cell.SetCellValue("化工館總計");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
cell.SetCellValue(last_build + "總計");
|
cell.SetCellValue(last_build + "總計");
|
||||||
|
}
|
||||||
cell.CellStyle = greenCellStyle;
|
cell.CellStyle = greenCellStyle;
|
||||||
|
|
||||||
foreach (var timeStampData in buildingSumData[last_build])
|
foreach (var timeStampData in buildingSumData[last_build])
|
||||||
{
|
{
|
||||||
cell = row.GetCell(columnIndex++) ?? row.CreateCell(columnIndex++);
|
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++;
|
rowIndex++;
|
||||||
@ -1108,6 +1128,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
columnIndex = 0;
|
columnIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//增加總計欄位
|
||||||
if (flag && buildingName != last_build && need_cal_total.Contains(last_build))
|
if (flag && buildingName != last_build && need_cal_total.Contains(last_build))
|
||||||
{
|
{
|
||||||
row = sheet.GetRow(rowIndex) ?? sheet.CreateRow(rowIndex);
|
row = sheet.GetRow(rowIndex) ?? sheet.CreateRow(rowIndex);
|
||||||
@ -1124,11 +1145,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
|
|
||||||
cell = row.GetCell(columnIndex++) ?? row.CreateCell(columnIndex++);
|
cell = row.GetCell(columnIndex++) ?? row.CreateCell(columnIndex++);
|
||||||
|
|
||||||
if (last_build == "化工電機")
|
if (last_build == "學人會館")
|
||||||
{
|
|
||||||
cell.SetCellValue("化工館總計");
|
|
||||||
}
|
|
||||||
else if (last_build == "學人會館")
|
|
||||||
{
|
{
|
||||||
cell.SetCellValue("學人國際總計");
|
cell.SetCellValue("學人國際總計");
|
||||||
}
|
}
|
||||||
@ -1150,6 +1167,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
// continue;
|
// continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//是否需要總計
|
||||||
if (total_flag)
|
if (total_flag)
|
||||||
{
|
{
|
||||||
if (need_green_device.Contains(deviceFullName))
|
if (need_green_device.Contains(deviceFullName))
|
||||||
@ -1306,6 +1324,7 @@ order by e.report_priority, a.priority";
|
|||||||
"教學大樓總盤",
|
"教學大樓總盤",
|
||||||
"電子館分盤",
|
"電子館分盤",
|
||||||
"機械館分盤",
|
"機械館分盤",
|
||||||
|
"化工電機總盤",
|
||||||
"電機館分盤",
|
"電機館分盤",
|
||||||
"學1-4舍餐廳總盤",
|
"學1-4舍餐廳總盤",
|
||||||
"學5舍5眷總盤",
|
"學5舍5眷總盤",
|
||||||
@ -1331,6 +1350,10 @@ order by e.report_priority, a.priority";
|
|||||||
//{
|
//{
|
||||||
// Console.WriteLine("here " + l.device_full_name);
|
// 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))
|
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.device_full_name = full_name;
|
||||||
l.building_name = await backendRepository.GetOneAsync<string>("select full_name from building where building_tag = @building_tag and deleted = 0",
|
l.building_name = await backendRepository.GetOneAsync<string>("select full_name from building where building_tag = @building_tag and deleted = 0",
|
||||||
new { building_tag = l.building_tag });
|
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.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
|
l.price = input.price.HasValue
|
||||||
? (Math.Round(input.price.Value, 2)).ToString()
|
? (Math.Round(input.price.Value, 2)).ToString()
|
||||||
|
Loading…
Reference in New Issue
Block a user