diff --git a/Frontend/_historyData.html b/Frontend/_historyData.html
new file mode 100644
index 0000000..aedb623
--- /dev/null
+++ b/Frontend/_historyData.html
@@ -0,0 +1,162 @@
+
+
+
+
+
歷史資料瀏覽
+
+
+
+
+
+
+
+
+
+ 設備名稱 |
+ 數值 |
+ 紀錄時間 |
+
+
+
+
+ 儲冰設備A01 |
+ 27.0 |
+ 2021-08-01 23:55:00 |
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Frontend/index.html b/Frontend/index.html
index f7bd99e..af5ffcf 100644
--- a/Frontend/index.html
+++ b/Frontend/index.html
@@ -1147,7 +1147,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
diff --git a/FrontendWebApi/ApiControllers/DeviceManageController.cs b/FrontendWebApi/ApiControllers/DeviceManageController.cs
index ad78366..135e395 100644
--- a/FrontendWebApi/ApiControllers/DeviceManageController.cs
+++ b/FrontendWebApi/ApiControllers/DeviceManageController.cs
@@ -61,16 +61,16 @@ namespace FrontendWebApi.ApiControllers
{
var dbsub = await frontendRepository.GetAllAsync(
@$"select distinct v1.system_key main_name, v1.system_value main_system_tag, v2.system_key sub_name, v2.system_value sub_system_tag, v1.system_priority, v2.system_priority,
- dk.device_normal_color, dk.device_close_color, dk.device_error_color,
- di.full_name as device_item_name, di.points as device_item_points, di.unit as device_item_unit, di.is_show_riserDiagram as device_item_is_show_riserDiagram,
- di.is_controll as device_item_is_controll, di.is_bool as device_item_is_bool, di.is_link as device_item_is_link
+ dk.device_normal_color, dk.device_close_color, dk.device_error_color
+ -- di.full_name as device_item_name, di.points as device_item_points, di.unit as device_item_unit, di.is_show_riserDiagram as device_item_is_show_riserDiagram,
+ -- di.is_controll as device_item_is_controll, di.is_bool as device_item_is_bool, di.is_link as device_item_is_link
from role_auth a
join auth_page b on a.AuthCode = b.AuthCode
join userinfo c on c.role_guid = a.role_guid
join variable v2 on b.ShowView = v2.id and v2.system_type = @sub_system_type
join variable v1 on v1.id = v2.system_parent_id and v1.system_type = @main_system_type
left join device_kind dk on v1.system_value = dk.device_system_tag and v2.system_value = dk.device_name_tag and dk.device_building_tag = @building_tag
- left join device_item di on v2.system_value = di.device_name_tag and v1.system_value = di.device_system_tag and di.deleted = 0
+ -- left join device_item di on v2.system_value = di.device_name_tag and v1.system_value = di.device_system_tag and di.deleted = 0
where c.account = @account
order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type, @building_tag = fd.building_tag });
var mains = dbsub.GroupBy(a => a.main_system_tag).ToList();
diff --git a/FrontendWebApi/ApiControllers/HistoryController.cs b/FrontendWebApi/ApiControllers/HistoryController.cs
index 649b40c..9daf30a 100644
--- a/FrontendWebApi/ApiControllers/HistoryController.cs
+++ b/FrontendWebApi/ApiControllers/HistoryController.cs
@@ -91,11 +91,6 @@ namespace FrontendWebApi.ApiControllers
sheet.SetColumnWidth(0, 4 * 160 * 12);
sheet.SetColumnWidth(1, 4 * 160 * 12);
sheet.SetColumnWidth(2, 4 * 160 * 12);
- sheet.SetColumnWidth(3, 4 * 160 * 12);
- sheet.SetColumnWidth(4, 4 * 160 * 12);
- sheet.SetColumnWidth(5, 4 * 160 * 12);
- sheet.SetColumnWidth(6, 4 * 160 * 12);
- sheet.SetColumnWidth(7, 4 * 160 * 12);
ICell cell = row.CreateCell(0);
cell.SetCellValue("設備名稱");
cell.CellStyle = styleLine12;
@@ -152,7 +147,7 @@ namespace FrontendWebApi.ApiControllers
///
[HttpPost]
[Route("api/History/GetMainSub")]
- public async Task>> GetMainSub()
+ public async Task>> GetMainSub([FromBody] HistoryFind hf)
{
ApiResult apiResult = new ApiResult(jwt_str);
if (!jwtlife)
@@ -160,6 +155,13 @@ namespace FrontendWebApi.ApiControllers
apiResult.Code = "5000";
return BadRequest(apiResult);
}
+ else if (string.IsNullOrEmpty(hf.building_tag))
+ {
+ apiResult.Code = "0002";
+ apiResult.Msg = "必須選擇東別";
+ return apiResult;
+ }
+
try
{
var dbsub = await frontendRepository.GetAllAsync(
@@ -176,9 +178,9 @@ namespace FrontendWebApi.ApiControllers
join auth_page b on a.AuthCode = b.AuthCode
join userinfo c on c.role_guid = a.role_guid
join building d on d.building_tag = b.building_tag
- where c.account = '{myUser.account}'
+ where c.account = @account and d.building_tag = @building_tag
order by d.priority
- ", new { @account = myUser.account });
+ ", new { @account = myUser.account, @building_tag = hf.building_tag });
var mains = dbsub.GroupBy(a => a.main_system_tag).ToList();
apiResult.Data = new History_MainSubBuildFloor();
apiResult.Data.history_Main_Systems = new List();
@@ -189,12 +191,12 @@ namespace FrontendWebApi.ApiControllers
history_Main_System.full_name = main.Select(a => a.main_name).FirstOrDefault();
history_Main_System.History_Sub_systems = new List();
- var subs = main.GroupBy(a => a.main_system_tag).ToList();
+ var subs = dbsub.Where(x => x.main_system_tag == main.Select(m => m.main_system_tag).FirstOrDefault()).ToList();
foreach (var sub in subs)
{
History_Sub_system history_Sub_System = new History_Sub_system();
- history_Sub_System.full_name = sub.Select(a => a.sub_name).FirstOrDefault();
- history_Sub_System.sub_system_tag = sub.Select(a => a.sub_system_tag).FirstOrDefault();
+ history_Sub_System.full_name = sub.sub_name;
+ history_Sub_System.sub_system_tag = sub.sub_system_tag;
history_Main_System.History_Sub_systems.Add(history_Sub_System);
}
apiResult.Data.history_Main_Systems.Add(history_Main_System);
diff --git a/FrontendWebApi/Models/HistoryClass.cs b/FrontendWebApi/Models/HistoryClass.cs
index 519ea79..802dea2 100644
--- a/FrontendWebApi/Models/HistoryClass.cs
+++ b/FrontendWebApi/Models/HistoryClass.cs
@@ -72,6 +72,10 @@ namespace FrontendWebApi.Models
public byte device_item_is_link { get; set; }
}
+ public class HistoryFind
+ {
+ public string building_tag { get; set; }
+ }
public class BuildingFloorRawData
{
public string building_guid { get; set; }