[FE API] 更新 各分盤總表匯出功能 新增總壇儲存格變綠色 更新 excel 模板

This commit is contained in:
keke 2023-08-31 14:54:25 +08:00
parent 46cc5a5b5b
commit 1547cb5a6e
2 changed files with 22 additions and 5 deletions

View File

@ -970,6 +970,23 @@ namespace FrontendWebApi.ApiControllers
"第二校區總盤", "第二校區總盤",
"薄膜分盤" "薄膜分盤"
}; };
List<string> need_green_device = new List<string>
{
"第一校區總盤",
"圖資大樓總盤",
"教學大樓總盤",
"教學大樓總盤",
"電子館分盤",
"機械館分盤",
"電機館分盤",
"學5舍總盤",
"8眷舍分盤",
"企教分盤",
"7眷舍分盤",
"第二校區總盤",
"薄膜一館分盤",
"薄膜二館分盤"
};
int count_index = 1; int count_index = 1;
string last_build = ""; string last_build = "";
string last_device = ""; string last_device = "";
@ -1026,12 +1043,12 @@ namespace FrontendWebApi.ApiControllers
string deviceFullName = r.device_full_name; string deviceFullName = r.device_full_name;
columnIndex = 0; columnIndex = 0;
if (last_device == "電機館分盤") if (last_device == "電機館分盤" || last_device == "薄膜分盤")
{ {
flag = false; flag = false;
} }
if (flag && buildingName == "化工館" && deviceFullName == "電機館分盤") if ((flag && buildingName == "化工館" && deviceFullName == "電機館分盤") || (flag && buildingName == "綠能中心" && deviceFullName == "薄膜分盤"))
{ {
row = sheet.GetRow(rowIndex) ?? sheet.CreateRow(rowIndex); row = sheet.GetRow(rowIndex) ?? sheet.CreateRow(rowIndex);
cell = row.GetCell(columnIndex++) ?? row.CreateCell(columnIndex++); cell = row.GetCell(columnIndex++) ?? row.CreateCell(columnIndex++);
@ -1046,7 +1063,7 @@ namespace FrontendWebApi.ApiControllers
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); cell.SetCellValue(timeStampData.Value.ToString());
} }
rowIndex++; rowIndex++;
@ -1096,7 +1113,7 @@ namespace FrontendWebApi.ApiControllers
cell = row.GetCell(columnIndex++) ?? row.CreateCell(columnIndex++); cell = row.GetCell(columnIndex++) ?? row.CreateCell(columnIndex++);
cell.SetCellValue(deviceFullName); cell.SetCellValue(deviceFullName);
if (total_flag) if (total_flag || need_green_device.Contains(deviceFullName))
{ {
cell.CellStyle = greenCellStyle; cell.CellStyle = greenCellStyle;
} }
@ -1260,7 +1277,7 @@ order by e.report_priority, a.priority";
{ {
timeStamp = "last year different", // 或者是您所需的日期格式 timeStamp = "last year different", // 或者是您所需的日期格式
device_number = x.device_number, device_number = x.device_number,
avg_rawdata = Math.Round(double.Parse(x.searchM) - double.Parse(x.lastY), 2).ToString() avg_rawdata = Math.Round(double.Parse(x.searchM) - double.Parse(x.lastY)).ToString()
}) })
); );