1. bug fix
2. 背景執行 時間設定 拉出至config
This commit is contained in:
parent
88f6857de4
commit
830937f967
@ -33,6 +33,7 @@ namespace SolarPower.Controllers
|
||||
private IUserRepository userRepository => HttpContext?.RequestServices.GetService<IUserRepository>();
|
||||
private ICompanyRepository companyRepository => HttpContext?.RequestServices.GetService<ICompanyRepository>();
|
||||
private IRoleRepository roleRepository => HttpContext?.RequestServices.GetService<IRoleRepository>();
|
||||
private IPowerStationRepository powerStationRepository => HttpContext?.RequestServices.GetService<IPowerStationRepository>();
|
||||
private IOperatorLogRepository operatorLogRepository => HttpContext?.RequestServices.GetService<IOperatorLogRepository>();
|
||||
|
||||
protected MyUser myUser = null;
|
||||
@ -83,9 +84,23 @@ namespace SolarPower.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
ViewBag.auths = auth_arr;
|
||||
if (myUser.Role.Layer != (int)RoleLayerEnum.PlatformAdmin && !auth_arr.Contains(controllerName))
|
||||
{
|
||||
filterContext.Result = new RedirectToRouteResult(
|
||||
new RouteValueDictionary
|
||||
{
|
||||
{"controller", "Login"},
|
||||
{"action", "Index"}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//取得當前使用者可以查看的電站
|
||||
ViewBag.myPowerStationSummaries = powerStationRepository.GetMyPowerStationSummary(myUser);
|
||||
|
||||
ViewBag.auths = auth_arr;
|
||||
|
||||
ViewBag.myUser = myUser;
|
||||
|
||||
#region 記錄人員操作記錄
|
||||
|
||||
@ -50,14 +50,13 @@ namespace SolarPower.Controllers
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<ApiResult<List<UserSelectItemList>>> GetUserSelectOptionListAsync()
|
||||
public async Task<ApiResult<List<UserSelectItemList>>> GetUserSelectOptionListAsync(int powerStationId)
|
||||
{
|
||||
ApiResult<List<UserSelectItemList>> apiResult = new ApiResult<List<UserSelectItemList>>();
|
||||
try
|
||||
{
|
||||
EDFunction edFunction = new EDFunction();
|
||||
var companyId = Convert.ToInt32(edFunction.AESDecrypt(HttpContext.Session.GetString("CompanyId"))); //將公司id透過AES解密
|
||||
var userSelectItemLists = await userRepository.GetUserSelectOptionListAsync(companyId);
|
||||
var powerStation = await powerStationRepository.GetOneAsync(powerStationId);
|
||||
var userSelectItemLists = await userRepository.GetUserSelectOptionListAsync(powerStation.CompanyId);
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Data = userSelectItemLists;
|
||||
@ -119,7 +118,7 @@ namespace SolarPower.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取得縣市選單
|
||||
/// 取得地區選單
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
@ -186,7 +185,7 @@ namespace SolarPower.Controllers
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
return apiResult;
|
||||
}
|
||||
else if (powerStation.CompanyId != myUser.CompanyId)
|
||||
else if (!IsPlatformLayer(myUser.Role.Layer) && powerStation.CompanyId != myUser.CompanyId)
|
||||
{
|
||||
apiResult.Code = "9993";
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
@ -364,7 +363,7 @@ namespace SolarPower.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
if (powerStation.CompanyId != myUser.CompanyId)
|
||||
if (!IsPlatformLayer(myUser.Role.Layer) && powerStation.CompanyId != myUser.CompanyId)
|
||||
{
|
||||
apiResult.Code = "9993";
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
@ -523,7 +522,7 @@ namespace SolarPower.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
if (powerStation.CompanyId != myUser.CompanyId)
|
||||
if (!IsPlatformLayer(myUser.Role.Layer) && powerStation.CompanyId != myUser.CompanyId)
|
||||
{
|
||||
apiResult.Code = "9993";
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
@ -636,7 +635,7 @@ namespace SolarPower.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
if (powerStation.CompanyId != myUser.CompanyId)
|
||||
if (!IsPlatformLayer(myUser.Role.Layer) && powerStation.CompanyId != myUser.CompanyId)
|
||||
{
|
||||
apiResult.Code = "9993";
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
@ -1453,7 +1452,7 @@ namespace SolarPower.Controllers
|
||||
else
|
||||
{
|
||||
|
||||
if(powerStation.CompanyId != myUser.CompanyId)
|
||||
if(!IsPlatformLayer(myUser.Role.Layer) && powerStation.CompanyId != myUser.CompanyId)
|
||||
{
|
||||
apiResult.Code = "9993";
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
@ -1506,7 +1505,7 @@ namespace SolarPower.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
if (powerStation.CompanyId != myUser.CompanyId)
|
||||
if (!IsPlatformLayer(myUser.Role.Layer) && powerStation.CompanyId != myUser.CompanyId)
|
||||
{
|
||||
apiResult.Code = "9993";
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
@ -1611,7 +1610,7 @@ namespace SolarPower.Controllers
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
if (powerStation.CompanyId != myUser.CompanyId)
|
||||
if (!IsPlatformLayer(myUser.Role.Layer) && powerStation.CompanyId != myUser.CompanyId)
|
||||
{
|
||||
apiResult.Code = "9993";
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
@ -1659,7 +1658,7 @@ namespace SolarPower.Controllers
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
if (powerStation.CompanyId != myUser.CompanyId)
|
||||
if (!IsPlatformLayer(myUser.Role.Layer) && powerStation.CompanyId != myUser.CompanyId)
|
||||
{
|
||||
apiResult.Code = "9993";
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
@ -1749,7 +1748,7 @@ namespace SolarPower.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
if (powerStation.CompanyId != myUser.CompanyId)
|
||||
if (!IsPlatformLayer(myUser.Role.Layer) && powerStation.CompanyId != myUser.CompanyId)
|
||||
{
|
||||
apiResult.Code = "9993";
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
@ -1802,7 +1801,7 @@ namespace SolarPower.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
if (powerStation.CompanyId != myUser.CompanyId)
|
||||
if (!IsPlatformLayer(myUser.Role.Layer) && powerStation.CompanyId != myUser.CompanyId)
|
||||
{
|
||||
apiResult.Code = "9993";
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
@ -1899,7 +1898,7 @@ namespace SolarPower.Controllers
|
||||
{
|
||||
powerStation = await powerStationRepository.GetOneAsync(post.PowerStationId);
|
||||
|
||||
if (powerStation.CompanyId != myUser.CompanyId)
|
||||
if (!IsPlatformLayer(myUser.Role.Layer) && powerStation.CompanyId != myUser.CompanyId)
|
||||
{
|
||||
apiResult.Code = "9993";
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
|
||||
@ -301,7 +301,7 @@ namespace SolarPower.Controllers
|
||||
|
||||
#region 新增使用者
|
||||
//判斷帳號 是否已存在
|
||||
var exist = userRepository.GetOneByAccountAsync(post.Account);
|
||||
var exist = await userRepository.GetOneByAccountAsync(post.Account);
|
||||
if(exist != null)
|
||||
{
|
||||
apiResult.Code = "9986";
|
||||
|
||||
@ -401,30 +401,43 @@ INSERT INTO `area` (`Id`, `CityId`, `Name`, `ZipCode`) VALUES
|
||||
(368, 21, '烏坵鄉', '06');
|
||||
/*!40000 ALTER TABLE `area` ENABLE KEYS */;
|
||||
|
||||
-- 傾印 資料表 solar_power.auth_page 結構
|
||||
-- 傾印 資料表 auth_page 結構
|
||||
CREATE TABLE IF NOT EXISTS `auth_page` (
|
||||
`AuthCode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`MainName` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '大項名稱',
|
||||
`SubName` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '功能名稱',
|
||||
`ControlName` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`AuthCode` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`MainName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '大項名稱',
|
||||
`SubName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '功能名稱',
|
||||
`TagName` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '細項功能名稱',
|
||||
`ControlName` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
PRIMARY KEY (`AuthCode`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='設定權限頁面';
|
||||
|
||||
-- 正在傾印表格 solar_power.auth_page 的資料:~-1 rows (近似值)
|
||||
-- 正在傾印表格 auth_page 的資料
|
||||
DELETE FROM `auth_page`;
|
||||
/*!40000 ALTER TABLE `auth_page` DISABLE KEYS */;
|
||||
INSERT INTO `auth_page` (`AuthCode`, `MainName`, `SubName`, `ControlName`) VALUES
|
||||
('A', '系統管理', '帳號管理', 'User,Role'),
|
||||
('B', '系統管理', '公司管理', 'Company'),
|
||||
('C', '系統管理', '電站資料管理', 'AAA'),
|
||||
('D', '系統管理', '定時任務設定', 'Setting'),
|
||||
('E', '系統管理', '功能清單', 'ASDA'),
|
||||
('F', '總覽', '地圖總覽', 'BBB'),
|
||||
('G', '總攬', '電占總覽', 'CCC'),
|
||||
('H', '總覽', '運為總覽', 'HHH'),
|
||||
('J', '即時告警', '即時告警', 'JJJ'),
|
||||
('K', '交叉分析', '逆變器', 'KKK'),
|
||||
('L', '交叉分析', '電站運轉效率', 'LLL');
|
||||
INSERT INTO `auth_page` (`AuthCode`, `MainName`, `SubName`, `TagName`, `ControlName`) VALUES
|
||||
('A', '總覽', '地圖總覽', NULL, 'MapOverview'),
|
||||
('B', '總覽', '電站總覽', NULL, 'StationOverview'),
|
||||
('C', '總覽', '電站總覽', '即時資訊', 'StationOverview_UpToDate'),
|
||||
('D', '總覽', '電站總覽', '基本資料', 'StationOverview_Info'),
|
||||
('E', '總覽', '電站總覽', '歷史資料', 'StationOverview_History'),
|
||||
('F', '總覽', '電站總覽', '逆變器分析', 'StationOverview_Inverter'),
|
||||
('G', '總覽', '電站總覽', '異常記錄', 'StationOverview_Exception'),
|
||||
('H', '總覽', '電站總覽', '運維記錄', 'StationOverview_OperationRecord'),
|
||||
('J', '總覽', '電站總覽', '顯示發電金額', 'ShowMoney'),
|
||||
('K', '電站資訊', '電站管理', NULL, 'PowerStation'),
|
||||
('L', '交叉分析', '合併電站', NULL, 'Setting'),
|
||||
('M', '交叉分析', '電站交叉分析', NULL, 'ASDA'),
|
||||
('N', '交叉分析', '逆變器交叉分析', NULL, 'BBB'),
|
||||
('P', '報表查詢', '電站報表', NULL, 'CCC'),
|
||||
('Q', '報表查詢', '電廠發電效能統計', NULL, 'HHH'),
|
||||
('R', '報表查詢', '輸入台電售電紀錄', NULL, 'JJJ'),
|
||||
('S', '報表查詢', '報告發送設定', NULL, 'JJJ'),
|
||||
('T', '即時告警', '異常事件查詢', NULL, 'KKK'),
|
||||
('U', '運維管理', '定期計畫建立', NULL, 'Operation'),
|
||||
('V', '運維管理', '運維作業記錄', NULL, 'OperationRecord'),
|
||||
('W', '系統管理', '公司管理', NULL, 'Company'),
|
||||
('X', '系統管理', '帳號管理', NULL, 'User,Role'),
|
||||
('Y', '系統管理', '定時任務設定', NULL, 'LLL');
|
||||
/*!40000 ALTER TABLE `auth_page` ENABLE KEYS */;
|
||||
|
||||
-- 傾印 資料表 solar_power.city 結構
|
||||
@ -1024,24 +1037,6 @@ COMMENT='各電站每月日照度的平均值'
|
||||
COLLATE='utf8mb4_unicode_ci'
|
||||
ENGINE=InnoDB
|
||||
;
|
||||
-- 子DB逆變器新增欄位 20210708
|
||||
ALTER TABLE `inverter`
|
||||
ADD COLUMN `Enabled` tinyint(4) DEFAULT '0' COMMENT '是否啟用,0:未啟用 1:啟用' AFTER `Deleted`,
|
||||
ADD COLUMN `Status` tinyint(4) DEFAULT '0' COMMENT '狀態,0:未啟用 1:正常 2:異常' AFTER `Enabled`,
|
||||
ADD COLUMN `InstallDate` timestamp NULL DEFAULT NULL COMMENT '安裝日期' AFTER `Status`,
|
||||
ADD COLUMN `InverterName` varchar(50) DEFAULT NULL COMMENT '逆變器名稱' AFTER `SerialNumber`,
|
||||
ADD COLUMN `Brand` varchar(50) DEFAULT NULL COMMENT '廠牌' AFTER `ControllerId`,
|
||||
ADD COLUMN `Model` varchar(50) DEFAULT NULL COMMENT '型號' AFTER `Brand`,
|
||||
ADD COLUMN `Capacity` double(10,3) DEFAULT NULL COMMENT '裝置容量 kWp' AFTER `Model`,
|
||||
ADD COLUMN `Pyrheliometer` int(10) DEFAULT NULL COMMENT '日照計設備流水號'AFTER `Capacity`;
|
||||
|
||||
-- 子DB裝置列表新增欄位 20210708
|
||||
ALTER TABLE `device`
|
||||
ADD COLUMN `Enabled` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否啟用, 0:否 1:是' AFTER `PowerStationId`,
|
||||
ADD COLUMN `Status` tinyint(4) DEFAULT '0' COMMENT '狀態,0:未啟用 1:正常 2:異常' AFTER `Enabled`,
|
||||
ADD COLUMN `InstallDate` timestamp NULL DEFAULT NULL COMMENT '安裝日期' AFTER `ColName`,
|
||||
DROP COLUMN `Remark`;
|
||||
|
||||
|
||||
-- 各電站每天的逆變器歷史記錄 20210712
|
||||
CREATE TABLE `inverter_history_day` (
|
||||
|
||||
@ -38,7 +38,6 @@ namespace SolarPower.Helper
|
||||
var passwordStr = ed.AESDecrypt(dbConfig.Password);
|
||||
|
||||
var connStr = $"server={serverStr};port={portStr};database={databaseStr};user={rootStr};password={passwordStr};charset=utf8;";
|
||||
//var connStr = @"server=210.61.91.43;port=10068;database=solar_power_test;user=idafenweb;password=P@ssw0rd;charset=utf8;";
|
||||
|
||||
this._connectionString = connStr;
|
||||
}
|
||||
|
||||
@ -93,6 +93,7 @@ namespace SolarPower.Models.Company
|
||||
public string AuthCode { get; set; }
|
||||
public string MainName { get; set; }
|
||||
public string SubName { get; set; }
|
||||
public string TagName { get; set; }
|
||||
public string ControlName { get; set; }
|
||||
public byte CheckAuth { get; set; }
|
||||
}
|
||||
|
||||
@ -74,6 +74,27 @@ namespace SolarPower.Models
|
||||
public List<string> Auths { get; set; } //可操作頁面
|
||||
}
|
||||
|
||||
public class MyPowerStationInfo
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int CityId { get; set; }
|
||||
public string CityName { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
public class MyPowerStationSummary
|
||||
{
|
||||
public string CityName { get; set; }
|
||||
public int Amount { get; set; }
|
||||
public List<MyPowerStation> MyPowerStations { get; set; }
|
||||
}
|
||||
|
||||
public class MyPowerStation
|
||||
{
|
||||
public int PowerStationId { get; set; }
|
||||
public string PowerStationName { get; set; }
|
||||
}
|
||||
|
||||
public class Variable
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
@ -89,6 +89,7 @@ namespace SolarPower.Models.Role
|
||||
public string CompanyName { get; set; } //公司名稱
|
||||
public string RoleName { get; set; } //角色名稱
|
||||
public string AuthPageSubName { get; set; } //權限功能名稱
|
||||
public string AuthPageTagName { get; set; } //權限功能細項名稱
|
||||
public string CreatorName { get; set; } //建立者名稱
|
||||
}
|
||||
|
||||
@ -106,6 +107,7 @@ namespace SolarPower.Models.Role
|
||||
public string AuthCode { get; set; }
|
||||
public string MainName { get; set; }
|
||||
public string SubName { get; set; }
|
||||
public string TagName { get; set; }
|
||||
}
|
||||
|
||||
public class PostRoleAuth
|
||||
|
||||
@ -58,8 +58,6 @@ namespace SolarPower.Quartz.Jobs
|
||||
calcPowerStation.Id = powerStation.Id;
|
||||
var dateNowDay = DateTimeNow.AddDays(-1).ToString("yyyy-MM-dd");
|
||||
|
||||
dateNowDay = "2021-07-08";
|
||||
|
||||
#region step2-1. 計算該電站的30天平均資料
|
||||
var table_name = String.Format("`{0}`.`{1}01_station`", powerStation.SiteDB, powerStation.Code);
|
||||
var history = await powerStationRepository.CalcAvgPowerStationHistory30day(dateNowDay, table_name);
|
||||
|
||||
@ -29,6 +29,9 @@ namespace SolarPower.Quartz.Jobs
|
||||
{
|
||||
#region step1. 找出所有電站
|
||||
var powerStations = await powerStationRepository.GetAllAsync();
|
||||
|
||||
string json = System.Text.Json.JsonSerializer.Serialize(powerStations);
|
||||
logger.LogError("【{0}】{1}", "CalcPowerStationJob - step1", json);
|
||||
#endregion
|
||||
|
||||
List<PowerStationHistory> powerStationHistoriesHour = new List<PowerStationHistory>();
|
||||
@ -54,12 +57,14 @@ namespace SolarPower.Quartz.Jobs
|
||||
|
||||
var dateTime = DateTimeNow.AddHours(-1).ToString("yyyy-MM-dd HH");
|
||||
|
||||
dateTime = "2021-07-08 12";
|
||||
|
||||
#region step2-1. 取得該電站的當前這小時的歷史資料
|
||||
var table_name = String.Format("`{0}`.{1}01_station", powerStation.SiteDB, powerStation.Code);
|
||||
logger.LogError("【{0}】{1}", "CalcPowerStationJob - time & dataTable", dateTime + "======" + table_name);
|
||||
|
||||
var history = await powerStationRepository.GetPowerStationHistoryPerHour(dateTime, table_name);
|
||||
json = System.Text.Json.JsonSerializer.Serialize(history);
|
||||
logger.LogError("【{0}】{1}", "CalcPowerStationJob - history", json);
|
||||
|
||||
if (history != null)
|
||||
{
|
||||
history.PowerStationId = powerStation.Id;
|
||||
@ -208,6 +213,9 @@ namespace SolarPower.Quartz.Jobs
|
||||
"SolarHour"
|
||||
};
|
||||
|
||||
json = System.Text.Json.JsonSerializer.Serialize(powerStationHistoriesHour);
|
||||
logger.LogError("【{0}】{1}", "CalcPowerStationJob - step3", json);
|
||||
|
||||
await powerStationRepository.AddPowerStationHistory(powerStationHistoriesHour, history_properties);
|
||||
#endregion
|
||||
|
||||
|
||||
@ -444,7 +444,7 @@ namespace SolarPower.Repository.Implement
|
||||
`UpdatedBy` int(10) unsigned DEFAULT NULL,
|
||||
`UpdatedAt` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='控制器';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='控制器';
|
||||
|
||||
-- 傾印 資料表 device 結構
|
||||
CREATE TABLE IF NOT EXISTS `device` (
|
||||
@ -494,7 +494,7 @@ namespace SolarPower.Repository.Implement
|
||||
`UpdatedBy` int(10) DEFAULT NULL,
|
||||
`UpdatedAt` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='逆變器';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='逆變器';
|
||||
|
||||
-- 傾印 資料表 land_building 結構
|
||||
CREATE TABLE IF NOT EXISTS `land_building` (
|
||||
@ -536,56 +536,64 @@ namespace SolarPower.Repository.Implement
|
||||
|
||||
-- 傾印 資料表 power_station 結構
|
||||
CREATE TABLE IF NOT EXISTS `power_station` (
|
||||
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`Deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否刪除, 0:否 1:是',
|
||||
`CompanyId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '公司編號',
|
||||
`CityId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '電站縣市',
|
||||
`AreaId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '電站區域',
|
||||
`Address` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '電站詳細地址',
|
||||
`Name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '名稱',
|
||||
`MainDisplay` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '主要顯示圖片',
|
||||
`Code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '電站代碼,縣市+區域+四碼流水號',
|
||||
`SerialNumber` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '四碼流水號',
|
||||
`IsEscrow` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否為代管,0:否 1:是',
|
||||
`EscrowName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '代管名稱',
|
||||
`ElectricityMeterAt` timestamp NULL DEFAULT NULL COMMENT '台電掛錶日',
|
||||
`EstimatedRecoveryTime` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '預估回收時間',
|
||||
`GeneratingCapacity` decimal(10,1) NOT NULL DEFAULT '0.0' COMMENT '電廠發電容量,單位(千瓦)',
|
||||
`PowerRate` decimal(10,3) NOT NULL DEFAULT '0.000' COMMENT '受電費率',
|
||||
`Coordinate` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '座標',
|
||||
`InverterBrand` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '逆變器廠牌',
|
||||
`InverterProductModel` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '逆變器型號',
|
||||
`InverterAmount` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '逆變器數量',
|
||||
`PhotovoltaicPanelBrand` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '光電板廠牌',
|
||||
`PhotovoltaicPanelProductModel` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '光電板型號',
|
||||
`PhotovoltaicPanelSpecification` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '光電板規格',
|
||||
`PhotovoltaicPanelAmount` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '光電板數量',
|
||||
`BoEFileName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '能源局原檔案名',
|
||||
`BoEFile` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '能源局檔案',
|
||||
`BoEDiscountRate` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '能源局折扣率',
|
||||
`BoEDeviceRegisterNumber` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '能源局設備登記編號',
|
||||
`BoERentRatio` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '能源局租金比率,單位(%)',
|
||||
`TPCContractNumber` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '台電契約編號',
|
||||
`TPCContractAt` timestamp NULL DEFAULT NULL COMMENT '台電簽約日期',
|
||||
`TPCSellDeadline` int(10) unsigned DEFAULT '0' COMMENT '台電售電期限,單位(年)',
|
||||
`TPCMeterReading` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '台電每期抄錶日',
|
||||
`TPCPurchaseElectricityAt` timestamp NULL DEFAULT NULL COMMENT '台電正式購電日',
|
||||
`TPCSellElectricityAt` timestamp NULL DEFAULT NULL COMMENT '台電正式售電日',
|
||||
`SolarType` tinyint(4) NOT NULL DEFAULT '0' COMMENT '電站類型',
|
||||
`kwh` decimal(10,3) unsigned NOT NULL DEFAULT '0.000',
|
||||
`Today_kwh` decimal(10,3) unsigned NOT NULL DEFAULT '0.000' COMMENT '今日發電量',
|
||||
`Total_kwh` decimal(10,3) unsigned NOT NULL DEFAULT '0.000' COMMENT '總發電量',
|
||||
`kwhkwp` decimal(10,3) unsigned NOT NULL DEFAULT '0.000',
|
||||
`PR` decimal(5,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '電站Pr值',
|
||||
`MP` decimal(5,2) unsigned NOT NULL DEFAULT '0.00',
|
||||
`SolarHour` decimal(5,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '總運轉小時',
|
||||
`SiteDB` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '電站 DB name: solar_com',
|
||||
`TodayWeather` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '今日天氣',
|
||||
`TodayWeatherTemp` decimal(5,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '今日溫度',
|
||||
`CreatedBy` int(10) unsigned NOT NULL COMMENT '建立者',
|
||||
`CreatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '建立時間',
|
||||
`UpdatedBy` int(10) unsigned DEFAULT NULL COMMENT '修改者',
|
||||
`UpdatedAt` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改時間',
|
||||
`Id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`Deleted` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '是否刪除, 0:否 1:是',
|
||||
`CompanyId` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '公司編號',
|
||||
`CityId` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '電站縣市',
|
||||
`AreaId` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '電站區域',
|
||||
`HealthStatus` TINYINT(4) UNSIGNED NOT NULL DEFAULT '1' COMMENT '1:設備正常 2:設備斷線 3:設備異常',
|
||||
`Address` VARCHAR(100) NULL DEFAULT NULL COMMENT '電站詳細地址' COLLATE 'utf8mb4_unicode_ci',
|
||||
`Name` VARCHAR(50) NULL DEFAULT NULL COMMENT '名稱' COLLATE 'utf8mb4_unicode_ci',
|
||||
`MainDisplay` VARCHAR(50) NULL DEFAULT NULL COMMENT '主要顯示圖片' COLLATE 'utf8mb4_unicode_ci',
|
||||
`Code` VARCHAR(50) NULL DEFAULT NULL COMMENT '電站代碼,縣市+區域+四碼流水號' COLLATE 'utf8mb4_unicode_ci',
|
||||
`SerialNumber` VARCHAR(4) NULL DEFAULT NULL COMMENT '四碼流水號' COLLATE 'utf8mb4_unicode_ci',
|
||||
`IsEscrow` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '是否為代管,0:否 1:是',
|
||||
`EscrowName` VARCHAR(50) NULL DEFAULT NULL COMMENT '代管名稱' COLLATE 'utf8mb4_unicode_ci',
|
||||
`ElectricityMeterAt` TIMESTAMP NULL DEFAULT NULL COMMENT '台電掛錶日',
|
||||
`EstimatedRecoveryTime` VARCHAR(10) NULL DEFAULT NULL COMMENT '預估回收時間' COLLATE 'utf8mb4_unicode_ci',
|
||||
`GeneratingCapacity` DECIMAL(10,1) NOT NULL DEFAULT '0.0' COMMENT '電廠發電容量,單位(千瓦)',
|
||||
`PowerRate` DECIMAL(10,3) NOT NULL DEFAULT '0.000' COMMENT '受電費率',
|
||||
`Coordinate` VARCHAR(50) NULL DEFAULT NULL COMMENT '座標' COLLATE 'utf8mb4_unicode_ci',
|
||||
`InverterBrand` VARCHAR(50) NULL DEFAULT NULL COMMENT '逆變器廠牌' COLLATE 'utf8mb4_unicode_ci',
|
||||
`InverterProductModel` VARCHAR(50) NULL DEFAULT NULL COMMENT '逆變器型號' COLLATE 'utf8mb4_unicode_ci',
|
||||
`InverterAmount` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '逆變器數量',
|
||||
`PhotovoltaicPanelBrand` VARCHAR(50) NULL DEFAULT NULL COMMENT '光電板廠牌' COLLATE 'utf8mb4_unicode_ci',
|
||||
`PhotovoltaicPanelProductModel` VARCHAR(50) NULL DEFAULT NULL COMMENT '光電板型號' COLLATE 'utf8mb4_unicode_ci',
|
||||
`PhotovoltaicPanelSpecification` VARCHAR(100) NULL DEFAULT NULL COMMENT '光電板規格' COLLATE 'utf8mb4_unicode_ci',
|
||||
`PhotovoltaicPanelAmount` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '光電板數量',
|
||||
`BoEFileName` VARCHAR(255) NULL DEFAULT NULL COMMENT '能源局原檔案名' COLLATE 'utf8mb4_unicode_ci',
|
||||
`BoEFile` VARCHAR(255) NULL DEFAULT NULL COMMENT '能源局檔案' COLLATE 'utf8mb4_unicode_ci',
|
||||
`BoEDiscountRate` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '能源局折扣率',
|
||||
`BoEDeviceRegisterNumber` VARCHAR(50) NULL DEFAULT NULL COMMENT '能源局設備登記編號' COLLATE 'utf8mb4_unicode_ci',
|
||||
`BoERentRatio` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '能源局租金比率,單位(%)',
|
||||
`TPCContractNumber` VARCHAR(50) NULL DEFAULT NULL COMMENT '台電契約編號' COLLATE 'utf8mb4_unicode_ci',
|
||||
`TPCContractAt` TIMESTAMP NULL DEFAULT NULL COMMENT '台電簽約日期',
|
||||
`TPCSellDeadline` INT(10) UNSIGNED NULL DEFAULT '0' COMMENT '台電售電期限,單位(年)',
|
||||
`TPCMeterReading` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '台電每期抄錶日',
|
||||
`TPCPurchaseElectricityAt` TIMESTAMP NULL DEFAULT NULL COMMENT '台電正式購電日',
|
||||
`TPCSellElectricityAt` TIMESTAMP NULL DEFAULT NULL COMMENT '台電正式售電日',
|
||||
`SolarType` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '電站類型',
|
||||
`kwh` DECIMAL(10,3) UNSIGNED NOT NULL DEFAULT '0.000',
|
||||
`Today_kwh` DECIMAL(10,3) UNSIGNED NOT NULL DEFAULT '0.000' COMMENT '今日發電量',
|
||||
`Total_kwh` DECIMAL(10,3) UNSIGNED NOT NULL DEFAULT '0.000' COMMENT '總發電量',
|
||||
`today_kwhkwp` DECIMAL(10,3) NULL DEFAULT NULL COMMENT '今日kwhkwp',
|
||||
`avg_kwhkwp` DECIMAL(10,3) NULL DEFAULT NULL COMMENT '30天平均kwhkwp',
|
||||
`today_monery` DECIMAL(10,2) NULL DEFAULT NULL COMMENT '今日金額',
|
||||
`total_monery` DECIMAL(10,2) NULL DEFAULT NULL COMMENT '總金額',
|
||||
`today_PR` DECIMAL(5,2) NULL DEFAULT NULL COMMENT '電站Pr值',
|
||||
`avg_PR` DECIMAL(5,2) NULL DEFAULT NULL COMMENT '平均Pr值',
|
||||
`today_carbon` DECIMAL(10,2) NULL DEFAULT NULL COMMENT '今日減碳量',
|
||||
`total_carbon` DECIMAL(10,2) NULL DEFAULT NULL COMMENT '總減碳量',
|
||||
`today_irradiance` DECIMAL(5,2) NULL DEFAULT NULL COMMENT '今日日照度',
|
||||
`avg_irradiance` DECIMAL(5,2) NULL DEFAULT NULL COMMENT '平均日照度',
|
||||
`SolarHour` DECIMAL(5,2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '總運轉小時',
|
||||
`SiteDB` VARCHAR(20) NULL DEFAULT NULL COMMENT '電站 DB name: solar_com' COLLATE 'utf8mb4_unicode_ci',
|
||||
`TodayWeather` VARCHAR(20) NULL DEFAULT NULL COMMENT '今日天氣' COLLATE 'utf8mb4_unicode_ci',
|
||||
`TodayWeatherTemp` DECIMAL(5,2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '今日溫度',
|
||||
`CreatedBy` INT(10) UNSIGNED NOT NULL COMMENT '建立者',
|
||||
`CreatedAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '建立時間',
|
||||
`UpdatedBy` INT(10) UNSIGNED NULL DEFAULT NULL COMMENT '修改者',
|
||||
`UpdatedAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改時間',
|
||||
PRIMARY KEY (`Id`),
|
||||
KEY `IDX_01` (`Deleted`),
|
||||
KEY `IDX_02` (`CompanyId`),
|
||||
@ -644,7 +652,7 @@ namespace SolarPower.Repository.Implement
|
||||
`CreatedBy` int(10) unsigned NOT NULL,
|
||||
`CreatedAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='共享設備';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='共享設備';
|
||||
";
|
||||
|
||||
await conn.ExecuteAsync(sql, trans);
|
||||
|
||||
@ -22,6 +22,64 @@ namespace SolarPower.Repository.Implement
|
||||
tableName = "power_station";
|
||||
}
|
||||
|
||||
|
||||
public List<MyPowerStationSummary> GetMyPowerStationSummary(MyUser myUser)
|
||||
{
|
||||
List<MyPowerStationSummary> results = new List<MyPowerStationSummary>();
|
||||
|
||||
using (IDbConnection conn = this._databaseHelper.GetConnection())
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = @"SELECT ps.Id, ps.CityId, c.Name AS CityName, ps.Name
|
||||
FROM power_station ps
|
||||
LEFT JOIN city c ON ps.CityId = c.Id";
|
||||
|
||||
if(myUser.Role.Layer == 2)
|
||||
{ //公司管理員
|
||||
sql += @" WHERE ps.Deleted = 0 AND ps.CompanyId = @CompanyId";
|
||||
}
|
||||
else if (myUser.Role.Layer == 3)
|
||||
{
|
||||
sql += @" LEFT JOIN power_station_operation_personnel ps.Id = op.PowerStationId
|
||||
WHERE ps.Deleted = 0 AND op.Deleted = 0 AND op.UserId = @UserId ";
|
||||
}
|
||||
else
|
||||
{
|
||||
sql += @" WHERE ps.Deleted = 0";
|
||||
}
|
||||
|
||||
var myPowerStationInfos = conn.Query<MyPowerStationInfo>(sql, new { CompanyId = myUser.CompanyId, UserId = myUser.Id }).ToList();
|
||||
|
||||
var myPowerStationInfos_group = myPowerStationInfos.GroupBy(x => x.CityId);
|
||||
|
||||
foreach (var myPowerStationInfo in myPowerStationInfos_group)
|
||||
{
|
||||
MyPowerStationSummary myPowerStationSummary = new MyPowerStationSummary();
|
||||
myPowerStationSummary.CityName = myPowerStationInfo.First().CityName;
|
||||
myPowerStationSummary.Amount = myPowerStationInfo.Count();
|
||||
myPowerStationSummary.MyPowerStations = new List<MyPowerStation>();
|
||||
foreach (var info in myPowerStationInfo)
|
||||
{
|
||||
MyPowerStation myPowerStation = new MyPowerStation();
|
||||
myPowerStation.PowerStationId = info.Id;
|
||||
myPowerStation.PowerStationName = info.Name;
|
||||
|
||||
myPowerStationSummary.MyPowerStations.Add(myPowerStation);
|
||||
}
|
||||
|
||||
results.Add(myPowerStationSummary);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查詢縣市列表
|
||||
/// </summary>
|
||||
@ -2186,12 +2244,12 @@ namespace SolarPower.Repository.Implement
|
||||
{
|
||||
var sql = $@"SELECT *
|
||||
FROM {db_name}.device d
|
||||
WHERE d.PowerStationId = @PowerStationId AND d.`Type` = 'PYR' AND d.Deleted = 0
|
||||
WHERE d.PowerStationId = @PowerStationId AND d.`Type` = 'PYR' AND d.Deleted = 0 AND d.Enabled = 1 AND d.Status != 0
|
||||
UNION
|
||||
SELECT d.*
|
||||
FROM {db_name}.sharedevice sd
|
||||
LEFT JOIN {db_name}.device d ON sd.DeviceId = d.Id
|
||||
WHERE sd.PowerStationId = @PowerStationId AND d.`Type` = 'PYR' AND d.Deleted = 0
|
||||
WHERE sd.PowerStationId = @PowerStationId AND d.`Type` = 'PYR' AND d.Deleted = 0 AND d.Enabled = 1 AND d.Status != 0
|
||||
";
|
||||
|
||||
result = (await conn.QueryAsync<DeviceInfo>(sql, new { PowerStationId = powerStationId })).ToList();
|
||||
@ -2213,12 +2271,12 @@ namespace SolarPower.Repository.Implement
|
||||
{
|
||||
var sql = $@"SELECT *
|
||||
FROM {db_name}.device d
|
||||
WHERE d.PowerStationId = @PowerStationId AND d.`Type` = 'MTR' AND d.Deleted = 0
|
||||
WHERE d.PowerStationId = @PowerStationId AND d.`Type` = 'MTR' AND d.Deleted = 0 AND d.Enabled = 1 AND d.Status != 0
|
||||
UNION
|
||||
SELECT d.*
|
||||
FROM {db_name}.sharedevice sd
|
||||
LEFT JOIN {db_name}.device d ON sd.DeviceId = d.Id
|
||||
WHERE sd.PowerStationId = @PowerStationId AND d.`Type` = 'MTR' AND d.Deleted = 0
|
||||
WHERE sd.PowerStationId = @PowerStationId AND d.`Type` = 'MTR' AND d.Deleted = 0 AND d.Enabled = 1 AND d.Status != 0
|
||||
";
|
||||
|
||||
result = (await conn.QueryAsync<DeviceInfo>(sql, new { PowerStationId = powerStationId })).ToList();
|
||||
@ -2259,7 +2317,7 @@ namespace SolarPower.Repository.Implement
|
||||
sql_per_device.Add(str);
|
||||
}
|
||||
|
||||
var sql = @$"SELECT a.TIMESTAMP, AVG(a.SENSOR) AS {typename} FROM(" + string.Join(" UNION ", sql_per_device) + @") a GROUP BY TIMESTAMP";
|
||||
var sql = @$"SELECT a.TIMESTAMP, AVG(a.SENSOR) AS {typename} FROM(" + string.Join(" UNION ", sql_per_device) + @") a GROUP BY `TIMESTAMP`";
|
||||
|
||||
result = await conn.QueryFirstOrDefaultAsync<PyrheliometerHistory>(sql, new { DateTime = dateTime });
|
||||
}
|
||||
@ -2802,7 +2860,7 @@ namespace SolarPower.Repository.Implement
|
||||
|
||||
if (myUser.Role.Layer == (int)RoleLayerEnum.CompanyAdmin)
|
||||
{
|
||||
sql += @$"SELECT ps.Id FROM power_station ps WHERE ps.Deleted = 0 AND ComapnyId = @ComapnyId";
|
||||
sql += @$"SELECT ps.Id FROM power_station ps WHERE ps.Deleted = 0 AND ps.CompanyId = @CompanyId";
|
||||
}
|
||||
else if (myUser.Role.Layer == (int)RoleLayerEnum.CompanyUser)
|
||||
{
|
||||
|
||||
@ -30,7 +30,7 @@ namespace SolarPower.Repository.Implement
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = $"SELECT Id AS Value, Name AS Text FROM {tableName} WHERE Deleted = 0 AND CompanyId = @CompanyId";
|
||||
var sql = $"SELECT Id AS Value, Name AS Text FROM `{tableName}` WHERE Deleted = 0 AND CompanyId = @CompanyId";
|
||||
|
||||
result = (await conn.QueryAsync<RoleSelectItemList>(sql, new { CompanyId = companyId })).ToList();
|
||||
}
|
||||
@ -55,7 +55,7 @@ namespace SolarPower.Repository.Implement
|
||||
conn.Open();
|
||||
try
|
||||
{
|
||||
var sql = $"SELECT * FROM {tableName} WHERE Deleted = 0 AND Id = @Id";
|
||||
var sql = $"SELECT * FROM `{tableName}` WHERE Deleted = 0 AND Id = @Id";
|
||||
|
||||
result = conn.QueryFirstOrDefault<MyRole>(sql, new { Id = id });
|
||||
|
||||
@ -91,7 +91,7 @@ namespace SolarPower.Repository.Implement
|
||||
conn.Open();
|
||||
try
|
||||
{
|
||||
var sql = $"SELECT * FROM {tableName} WHERE Deleted = 0 AND Id = @Id";
|
||||
var sql = $"SELECT * FROM `{tableName}` WHERE Deleted = 0 AND Id = @Id";
|
||||
|
||||
result = await conn.QueryFirstOrDefaultAsync<Role>(sql, new { Id = id });
|
||||
}
|
||||
@ -123,7 +123,7 @@ namespace SolarPower.Repository.Implement
|
||||
r.*,
|
||||
c.Name AS CompanyName,
|
||||
u.Name AS CreatorName
|
||||
FROM {tableName} r
|
||||
FROM `{tableName}` r
|
||||
LEFT JOIN company c ON r.CompanyId = c.Id
|
||||
LEFT JOIN user u ON r.CreatedBy = u.Id
|
||||
WHERE r.Deleted = 0
|
||||
@ -195,9 +195,10 @@ namespace SolarPower.Repository.Implement
|
||||
r.Name AS RoleName,
|
||||
c.Name AS CompanyName,
|
||||
u.Name AS CreatorName,
|
||||
ap.SubName AS AuthPageSubName
|
||||
ap.SubName AS AuthPageSubName,
|
||||
ap.TagName AS AuthPageTagName
|
||||
FROM role_auth ra
|
||||
LEFT JOIN role r ON ra.Id = r.Id
|
||||
LEFT JOIN `role` r ON ra.Id = r.Id
|
||||
LEFT JOIN auth_page ap ON ra.AuthCode = ap.AuthCode
|
||||
LEFT JOIN user u ON ra.CreatedBy = u.Id
|
||||
LEFT JOIN company c ON r.CompanyId = c.Id
|
||||
@ -257,10 +258,10 @@ namespace SolarPower.Repository.Implement
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = @$"SELECT ap2.AuthCode, ap2.MainName, ap2.SubName
|
||||
var sql = @$"SELECT ap2.AuthCode, ap2.MainName, ap2.SubName, ap2.TagName
|
||||
FROM
|
||||
(
|
||||
SELECT cap.CompanyId, cap.AuthCode, ap.MainName, ap.SubName, ap.ControlName
|
||||
SELECT cap.CompanyId, cap.AuthCode, ap.MainName, ap.SubName, ap.TagName , ap.ControlName
|
||||
FROM company_auth_page cap
|
||||
LEFT JOIN auth_page ap ON cap.AuthCode = ap.AuthCode
|
||||
WHERE cap.CompanyId = @CompanyId
|
||||
|
||||
@ -30,7 +30,7 @@ namespace SolarPower.Repository.Implement
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = $"SELECT * FROM {tableName} WHERE deleted = 0 AND status = @Status AND account = @Account";
|
||||
var sql = $"SELECT * FROM `{tableName}` WHERE deleted = 0 AND status = @Status AND account = @Account";
|
||||
|
||||
result = await conn.QueryFirstOrDefaultAsync<User>(sql, new { Status = UserStatusEnum.Normal, Account = account });
|
||||
}
|
||||
@ -55,7 +55,7 @@ namespace SolarPower.Repository.Implement
|
||||
conn.Open();
|
||||
try
|
||||
{
|
||||
var sql = $"SELECT * FROM {tableName} WHERE deleted = 0 AND status = @Status AND email = @Email";
|
||||
var sql = $"SELECT * FROM `{tableName}` WHERE deleted = 0 AND status = @Status AND email = @Email";
|
||||
|
||||
result = await conn.QueryFirstOrDefaultAsync<User>(sql, new { Status = UserStatusEnum.Normal, Email = email });
|
||||
}
|
||||
@ -86,7 +86,7 @@ namespace SolarPower.Repository.Implement
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = $"UPDATE {tableName} SET password = @Password WHERE id = @Id";
|
||||
var sql = $"UPDATE `{tableName}` SET password = @Password WHERE id = @Id";
|
||||
|
||||
await conn.ExecuteAsync(sql, new { Password = password, Id = id }, trans);
|
||||
|
||||
@ -118,7 +118,7 @@ namespace SolarPower.Repository.Implement
|
||||
conn.Open();
|
||||
try
|
||||
{
|
||||
var sql = $"SELECT * FROM {tableName} WHERE deleted = 0 AND status = @Status AND account = @Account";
|
||||
var sql = $"SELECT * FROM `{tableName}` WHERE deleted = 0 AND status = @Status AND account = @Account";
|
||||
|
||||
result = conn.QueryFirstOrDefault<MyUser>(sql, new { Status = UserStatusEnum.Normal, Account = account });
|
||||
}
|
||||
@ -150,7 +150,7 @@ namespace SolarPower.Repository.Implement
|
||||
var sql = @$"SELECT
|
||||
u.*,
|
||||
c.Name AS CompanyName
|
||||
FROM {tableName} u
|
||||
FROM `{tableName}` u
|
||||
LEFT JOIN company c ON u.CompanyId = c.Id
|
||||
WHERE u.Deleted = 0 AND u.Id = @Id";
|
||||
|
||||
@ -254,9 +254,9 @@ namespace SolarPower.Repository.Implement
|
||||
c.Name AS CompanyName,
|
||||
r.Name AS RoleName,
|
||||
opc.SPStationAmount
|
||||
FROM {tableName} u
|
||||
FROM `{tableName}` u
|
||||
LEFT JOIN company c ON u.CompanyId = c.Id
|
||||
LEFT JOIN role r ON u.RoleId = r.Id
|
||||
LEFT JOIN `role` r ON u.RoleId = r.Id
|
||||
LEFT JOIN (SELECT op.UserId, COUNT(*) AS SPStationAmount FROM power_station_operation_personnel op WHERE op.Deleted = 0 GROUP BY op.UserId) opc ON u.Id = opc.UserId
|
||||
WHERE u.Deleted = 0";
|
||||
|
||||
@ -299,7 +299,7 @@ namespace SolarPower.Repository.Implement
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = $"SELECT Id AS Value, Name AS Text FROM {tableName} WHERE Deleted = 0";
|
||||
var sql = $"SELECT Id AS Value, Name AS Text FROM `{tableName}` WHERE Deleted = 0";
|
||||
if (companyId != 0)
|
||||
{
|
||||
sql += @" AND CompanyId=@companyId";
|
||||
|
||||
@ -11,6 +11,13 @@ namespace SolarPower.Repository.Interface
|
||||
public interface IPowerStationRepository : IRepositoryBase<PowerStation>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 取得當前使用者可操作的電站
|
||||
/// </summary>
|
||||
/// <param name="myUser"></param>
|
||||
/// <returns></returns>
|
||||
List<MyPowerStationSummary> GetMyPowerStationSummary(MyUser myUser);
|
||||
|
||||
/// <summary>
|
||||
/// 查詢縣市列表
|
||||
/// </summary>
|
||||
|
||||
@ -101,7 +101,7 @@ namespace SolarPower
|
||||
#region 計算電站發電量等資訊(每整點5分執行)
|
||||
services.AddSingleton<CalcPowerStationJob>();
|
||||
services.AddSingleton(
|
||||
new JobSchedule(jobType: typeof(CalcPowerStationJob), cronExpression: "0 5 * * * ?")
|
||||
new JobSchedule(jobType: typeof(CalcPowerStationJob), cronExpression: Configuration.GetValue<string>("BackgroundServiceCron:CalcPowerStationJob"))
|
||||
//new JobSchedule(jobType: typeof(CalcPowerStationJob), cronExpression: "0/10 * * * * ?")
|
||||
);
|
||||
#endregion
|
||||
@ -109,7 +109,7 @@ namespace SolarPower
|
||||
#region 計算電站日照量、PR、kWP 30日平均、(每天凌晨2點執行)
|
||||
services.AddSingleton<CalcAvgPowerStationJob>();
|
||||
services.AddSingleton(
|
||||
new JobSchedule(jobType: typeof(CalcAvgPowerStationJob), cronExpression: "0 0 2 * * ?")
|
||||
new JobSchedule(jobType: typeof(CalcAvgPowerStationJob), cronExpression: Configuration.GetValue<string>("BackgroundServiceCron:CalcAvgPowerStationJob"))
|
||||
//new JobSchedule(jobType: typeof(CalcAvgPowerStationJob), cronExpression: "0/10 * * * * ?")
|
||||
);
|
||||
#endregion
|
||||
|
||||
@ -168,6 +168,7 @@
|
||||
@*<th>編號</th>*@
|
||||
<th>功能大項</th>
|
||||
<th>功能名稱</th>
|
||||
<th>功能細項名稱</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -247,7 +248,7 @@
|
||||
'orderable': false,
|
||||
'className': 'dt-body-center',
|
||||
'render': function (data, type, full, meta) {
|
||||
return '<img src="' + data + '?v=' + Date.now() + '" class="img-fluid">';
|
||||
return '<img src="' + data + '?v=' + Date.now() + '" width="200px" height="40px">';
|
||||
}
|
||||
}],
|
||||
"language": {
|
||||
@ -318,6 +319,8 @@
|
||||
"data": "mainName"
|
||||
}, {
|
||||
"data": "subName"
|
||||
}, {
|
||||
"data": "tagName"
|
||||
}],
|
||||
"columnDefs": [{
|
||||
'targets': 0,
|
||||
|
||||
@ -16,51 +16,55 @@
|
||||
<div class="card">
|
||||
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap">
|
||||
<h4 class="mb-0 font-weight-bold"><span class="fal fa-bolt mr-1"></span> 發電量</h4>
|
||||
<div class="ml-auto">kwh</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>總發電量</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_kwh">126,161.72</span> kWh</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_kwh">126,161.72</span></p>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>平均發電量</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="total_kwh">4,069.73</span> kWh</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="total_kwh">4,069.73</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap">
|
||||
<h4 class="mb-0 font-weight-bold"><span class="fal fa-sun mr-1"></span> 日照度</h4>
|
||||
<div class="ml-auto">kw/m<sup>2</sup></div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>即時平均日照度</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_irradiance">126,161.72</span> kW/m<sup>2</sup></p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_irradiance">126,161.72</span></p>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>平均日照度(30天)</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="avg_irradiance">4,069.73</span> kW/m<sup>2</sup></p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="avg_irradiance">4,069.73</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap">
|
||||
<h4 class="mb-0 font-weight-bold"><span class="fal fa-bolt mr-1"></span> PR值</h4>
|
||||
<div class="ml-auto">%</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>即時平均 PR 值</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_PR">119.04</span> hr</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_PR">119.04</span></p>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>平均 PR 值(30天)</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="avg_PR">3.84</span> hr</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="avg_PR">3.84</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap">
|
||||
<h4 class="mb-0 font-weight-bold"><span class="fal fa-sun mr-1"></span> kWh / kWp</h4>
|
||||
<div class="ml-auto">hr</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
@ -76,15 +80,16 @@
|
||||
<div class="card">
|
||||
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap">
|
||||
<h4 class="mb-0 font-weight-bold"><span class="fal fa-cow mr-1"></span> 減碳量</h4>
|
||||
<div class="ml-auto">kG</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>今日減碳量</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_carbon">6,091.78</span> KG</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_carbon">6,091.78</span></p>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>總減碳量</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="total_carbon">985.98</span> KG</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="total_carbon">985.98</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -33,27 +33,27 @@
|
||||
<ul class="nav nav-tabs mb-5" role="tablist" id="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link fs-lg px-4 active" data-toggle="tab" href="#tab-station-info" role="tab">
|
||||
<i class="fal fa-home text-success"></i> <span class="hidden-sm-down ml-1">電站資料</span>
|
||||
<i class="fal fa-server text-success"></i> <span class="hidden-sm-down ml-1">電站資料</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-device-setting" role="tab">
|
||||
<i class="fal fa-home text-success"></i> <span class="hidden-sm-down ml-1">裝置列表</span>
|
||||
<i class="fal fa-list-alt text-success"></i> <span class="hidden-sm-down ml-1">裝置列表</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-operation-firm" role="tab">
|
||||
<i class="fal fa-home text-success"></i> <span class="hidden-sm-down ml-1">維運廠商</span>
|
||||
<i class="fal fa-hands-helping text-success"></i> <span class="hidden-sm-down ml-1">維運廠商</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-upload-image" role="tab">
|
||||
<i class="fal fa-home text-success"></i> <span class="hidden-sm-down ml-1">資料上傳</span>
|
||||
<i class="fal fa-upload text-success"></i> <span class="hidden-sm-down ml-1">資料上傳</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-exception" role="tab">
|
||||
<i class="fal fa-home text-success"></i> <span class="hidden-sm-down ml-1">異常設定</span>
|
||||
<i class="fal fa-sensor-alert text-success"></i> <span class="hidden-sm-down ml-1">異常設定</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@ -708,7 +708,10 @@
|
||||
|
||||
//#region 預先載入運維人員下拉式選單select_option
|
||||
var url_user_select_option = "/PowerStation/GetUserSelectOptionList";
|
||||
$.get(url_user_select_option, function (rel) {
|
||||
var send_data = {
|
||||
powerStationId: stationId
|
||||
}
|
||||
$.get(url_user_select_option, send_data, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
@ -745,8 +748,10 @@
|
||||
$.each(rel.data, function (index, val) {
|
||||
$("#ShareDevice_PowerStationId_modal").append($("<option />").val(val.value).text(val.text));
|
||||
});
|
||||
|
||||
if (rel.data.length > 0)
|
||||
{
|
||||
DeviceUIDList($("#ShareDevice_PowerStationId_modal").val());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -861,6 +866,9 @@
|
||||
$.each(rel.data, function (index, val) {
|
||||
$("#ShareDevice_UID_modal").append($("<option />").val(val.value).text(val.text));
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@ -956,7 +964,7 @@
|
||||
}
|
||||
formData.append("BoEDiscountRate", $("#BoE_discount_rate").val());
|
||||
formData.append("BoEDeviceRegisterNumber", $("#BoE_device_register_number").val());
|
||||
formData.append("BoERentRatio", $("#BoE_discount_rate").val());
|
||||
formData.append("BoERentRatio", $("#BoE_rent_ratio").val());
|
||||
formData.append("TPCContractNumber", $("#TPC_contract_number").val());
|
||||
formData.append("TPCContractAt", $("#TPC_contract_at").val());
|
||||
formData.append("TPCSellDeadline", $("#TPC_sell_deadline").val());
|
||||
@ -1379,9 +1387,9 @@
|
||||
//#endregion
|
||||
|
||||
//#region 能源局與台電資料 input
|
||||
$("#BoE_discount_rate").val(powerStationData.boeEiscountRate);
|
||||
$("#BoE_discount_rate").val(powerStationData.boEDiscountRate);
|
||||
$("#BoE_device_register_number").val(powerStationData.boEDeviceRegisterNumber);
|
||||
$("#BoE_discount_rate").val(powerStationData.boERentRatio);
|
||||
$("#BoE_rent_ratio").val(powerStationData.boERentRatio);
|
||||
|
||||
$("#TPC_contract_number").val(powerStationData.tpcContractNumber);
|
||||
$("#TPC_contract_at").val(powerStationData.tpcContractAt);
|
||||
@ -1425,7 +1433,7 @@
|
||||
|
||||
var appendStr = "";
|
||||
appendStr += '<div class="card border mb-g w-100" data-land-building-id="' + value.id + '">' +
|
||||
'<div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">' +
|
||||
'<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap justify-content-between">' +
|
||||
'<div class="card-title font-weight-bold">土地房屋資料</div>' +
|
||||
'<div class="text-right">' +
|
||||
'<button class="btn btn-sm btn-warning ml-auto waves-effect waves-themed save-land-building-info-btn" style="display:none" data-land-building-id="' + value.id + '" id="save-land-building-info-btn-' + value.id + '">' +
|
||||
@ -1529,7 +1537,7 @@
|
||||
function CreateAddLandBuildingCard(dom) {
|
||||
var appendStr = "";
|
||||
appendStr += '<div class="card border mb-g w-100" id="add-land-building-card">' +
|
||||
'<div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">' +
|
||||
'<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap justify-content-between">' +
|
||||
'<div class="card-title font-weight-bold">土地房屋資料</div>' +
|
||||
'<div class="text-right">' +
|
||||
'<button class="btn btn-sm btn-success ml-auto waves-effect waves-themed" id="add-land-building-info-btn">' +
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<div class="row mb-5">
|
||||
<div class="card border mb-g w-100">
|
||||
<div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<!-- we wrap header title inside a div tag with utility padding -->
|
||||
<div class="card-title font-weight-bold">控制器</div>
|
||||
<div class="text-right ">
|
||||
@ -28,7 +28,7 @@
|
||||
</div>
|
||||
|
||||
<div class="card border mb-g w-100">
|
||||
<div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<!-- we wrap header title inside a div tag with utility padding -->
|
||||
<div class="card-title font-weight-bold">逆變器</div>
|
||||
<div class="text-right">
|
||||
@ -63,7 +63,7 @@
|
||||
</div>
|
||||
|
||||
<div class="card border mb-g w-100">
|
||||
<div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<!-- we wrap header title inside a div tag with utility padding -->
|
||||
<div class="card-title font-weight-bold">裝置設定</div>
|
||||
<div class="text-right">
|
||||
@ -101,7 +101,7 @@
|
||||
</div>
|
||||
|
||||
<div class="card border mb-g w-100">
|
||||
<div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<!-- we wrap header title inside a div tag with utility padding -->
|
||||
<div class="card-title font-weight-bold">共用裝置</div>
|
||||
<div class="text-right">
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<div class="row mb-5">
|
||||
<div class="card border mb-g w-100">
|
||||
<!-- notice the additions of utility paddings and display properties on .card-header -->
|
||||
<div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<!-- we wrap header title inside a div tag with utility padding -->
|
||||
<div class="card-title font-weight-bold">電站基本資料</div>
|
||||
<div class="text-right">
|
||||
@ -106,7 +106,7 @@
|
||||
<label class="col-xl-4 form-label" id="estimated_recovery_time_label" for="estimated_recovery_time">預計回收年限</label>
|
||||
<div class="col-xl-8">
|
||||
<label id="estimated_recovery_time_text" class="color-info-600"></label>
|
||||
<input type="text" id="estimated_recovery_time" name="estimated_recovery_time" class="form-control">
|
||||
<input type="number" step="1" id="estimated_recovery_time" name="estimated_recovery_time" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-3 row justify-content-center align-items-center">
|
||||
@ -197,7 +197,7 @@
|
||||
<label class="col-xl-4 form-label" id="photovoltaic_panel_amount_label" for="photovoltaic_panel_amount">數量</label>
|
||||
<div class="col-xl-8">
|
||||
<label id="photovoltaic_panel_amount_text" class="color-info-600"></label>
|
||||
<input type="text" id="photovoltaic_panel_amount" name="photovoltaic_panel_amount" class="form-control">
|
||||
<input type="number" step="1" id="photovoltaic_panel_amount" name="photovoltaic_panel_amount" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-4 mb-3 row">
|
||||
@ -217,7 +217,7 @@
|
||||
<div class="row mb-5" id="BoEPart">
|
||||
<div class="card border mb-g w-100">
|
||||
<!-- notice the additions of utility paddings and display properties on .card-header -->
|
||||
<div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<!-- we wrap header title inside a div tag with utility padding -->
|
||||
<div class="card-title font-weight-bold">經濟部能源局與台電資訊</div>
|
||||
<div class="text-right">
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<div class="row mb-5">
|
||||
<div class="card border mb-5 w-100">
|
||||
<!-- notice the additions of utility paddings and display properties on .card-header -->
|
||||
<div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<!-- we wrap header title inside a div tag with utility padding -->
|
||||
<div class="card-title font-weight-bold">圖片上傳</div>
|
||||
<div class="text-right">
|
||||
@ -36,7 +36,7 @@
|
||||
<div class="row mb-5">
|
||||
<div class="card border mb-g w-100" >
|
||||
<!-- notice the additions of utility paddings and display properties on .card-header -->
|
||||
<div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<!-- we wrap header title inside a div tag with utility padding -->
|
||||
<div class="card-title font-weight-bold">單線圖</div>
|
||||
<div class="text-right">
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
@using SolarPower.Models.Role
|
||||
@model RoleLayerEnum
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-Hant-TW">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
@ -91,31 +93,61 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-title">Navigation Title</li>-->
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("MapOverview") || ViewBag.auths.Contains("StationOverview"))
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "1" ? "active open" : "")">
|
||||
<a href="#" title="Category" data-filter-tags="category">
|
||||
<i class="fal fa-ballot-check"></i>
|
||||
<span class="nav-link-text" data-i18n="nav.category">總覽</span>
|
||||
</a>
|
||||
<ul>
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("MapOverview"))
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "1" && ViewData["SubNum"] == "1" ? "active" : "")">
|
||||
<a asp-controller="MapOverview" asp-action="Index" title="地圖總覽" data-filter-tags="utilities disabled item">
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">地圖總覽</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview"))
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "1" && ViewData["SubNum"] == "2" ? "active" : "")">
|
||||
<a asp-controller="StationOverview" asp-action="Index" title="電站總覽" data-filter-tags="utilities disabled item">
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">電站總覽</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
<!-- Example of open and active states -->
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("PowerStation"))
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "2" ? "active open" : "")">
|
||||
<a href="#" title="Category" data-filter-tags="category">
|
||||
<a href="javascript:void(0);" title="Category" data-filter-tags="category">
|
||||
<i class="fal fa-file"></i>
|
||||
<span class="nav-link-text" data-i18n="nav.category">電站資訊</span>
|
||||
</a>
|
||||
<ul>
|
||||
@foreach (var myPowerStationSummary in ViewBag.myPowerStationSummaries)
|
||||
{
|
||||
<li>
|
||||
<a href="javascript:void(0);" title="Category" data-filter-tags="utilities menu child sublevel item">
|
||||
<span class="nav-link-text" data-i18n="nav.category">@myPowerStationSummary.CityName</span>
|
||||
<span class="dl-ref bg-primary-500 hidden-nav-function-minify hidden-nav-function-top">@myPowerStationSummary.Amount</span>
|
||||
</a>
|
||||
<ul>
|
||||
@foreach (var myPowerStation in myPowerStationSummary.MyPowerStations)
|
||||
{
|
||||
<li>
|
||||
<a asp-controller="PowerStation" asp-action="Edit" asp-route-stationId="@myPowerStation.PowerStationId" title="Sublevel Item" data-filter-tags="utilities menu child sublevel item">
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_menu_child_sublevel_item">@myPowerStation.PowerStationName</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
<li class="@(ViewData["MainNum"] == "2" && ViewData["SubNum"] == "1" ? "active" : "")">
|
||||
<a asp-controller="PowerStation" asp-action="Index" title="電站管理" data-filter-tags="utilities disabled item">
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">電站管理</span>
|
||||
@ -123,6 +155,9 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("PowerStation"))@*TODO:修改成交叉分析的權限*@
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "3" ? "active open" : "")">
|
||||
<a href="#" title="Category" data-filter-tags="category">
|
||||
<i class="fal fa-crosshairs"></i>
|
||||
@ -146,6 +181,9 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("PowerStation"))@*TODO:修改成報表的權限*@
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "4" ? "active open" : "")">
|
||||
<a href="#" title="Category" data-filter-tags="category">
|
||||
<i class="fal fa-file-chart-line"></i>
|
||||
@ -169,7 +207,10 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("PowerStation"))@*TODO:修改成即時告警的權限*@
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "5" ? "active open" : "")">
|
||||
<a href="#" title="Category" data-filter-tags="category">
|
||||
<i class="fal fa-siren-on"></i>
|
||||
@ -183,53 +224,80 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("Operation") || ViewBag.auths.Contains("OperationRecord"))
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "6" ? "active open" : "")">
|
||||
<a href="#" title="Category" data-filter-tags="category">
|
||||
<i class="fal fa-rabbit-fast"></i>
|
||||
<span class="nav-link-text" data-i18n="nav.category">運維管理</span>
|
||||
</a>
|
||||
<ul>
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("Operation"))
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "6" && ViewData["SubNum"] == "1" ? "active" : "")">
|
||||
<a asp-controller="Operation" asp-action="Index" title="定期計畫建立" data-filter-tags="utilities disabled item">
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">定期計畫建立</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("OperationRecord"))
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "6" && ViewData["SubNum"] == "2" ? "active" : "")">
|
||||
<a asp-controller="Operation" asp-action="Record" title="運維作業記錄" data-filter-tags="utilities disabled item">
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">運維作業記錄</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("Company") || ViewBag.auths.Contains("User") || ViewBag.auths.Contains("Role") || ViewBag.auths.Contains("User"))@*TODO修改定時任務權限*@
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "7" ? "active open" : "")">
|
||||
<a href="#" title="Category" data-filter-tags="category">
|
||||
<i class="fal fa-cog"></i>
|
||||
<span class="nav-link-text" data-i18n="nav.category">系統管理</span>
|
||||
</a>
|
||||
<ul>
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("Company"))
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "7" && ViewData["SubNum"] == "1" ? "active" : "")">
|
||||
<a asp-controller="Company" asp-action="Index" title="公司管理" data-filter-tags="utilities disabled item">
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">公司管理</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("User"))
|
||||
{
|
||||
<li class="@(ViewData["MainNum"] == "7" && ViewData["SubNum"] == "2" ? "active" : "")">
|
||||
<a asp-controller="User" asp-action="Index" title="帳號管理" data-filter-tags="utilities disabled item">
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">帳號管理</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
@if (ViewBag.auths.Contains("User"))
|
||||
{
|
||||
<li class="">
|
||||
<a href="javascript:void(0);" title="功能清單" data-filter-tags="utilities disabled item">
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">功能清單</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
@if (ViewBag.auths.Contains("User"))
|
||||
{
|
||||
<li class="">
|
||||
<a href="javascript:void(0);" title="定時任務設定" data-filter-tags="utilities disabled item">
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">定時任務設定</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
|
||||
</ul>
|
||||
<div class="filter-message js-filter-message bg-success-600"></div>
|
||||
</nav>
|
||||
|
||||
@ -80,36 +80,39 @@
|
||||
<div class="card">
|
||||
<div class="card-header bg-fusion-25 pr-3 d-flex align-items-center flex-wrap">
|
||||
<h4 class="mb-0 font-weight-bold"><span class="fal fa-bolt mr-1"></span> 發電量</h4>
|
||||
<div class="ml-auto">kWh</div>
|
||||
</div>
|
||||
<div class="card-body" style="min-height: 148px;">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>今日發電量</p>
|
||||
<p><span class="color-info-700" id="today_kwh">126,161.72</span> kWh</p>
|
||||
<p><span class="color-info-700" id="today_kwh">126,161.72</span></p>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>累積發電量</p>
|
||||
<p><span class="color-info-700" id="total_kwh">4,069.73</span> kWh</p>
|
||||
<p><span class="color-info-700" id="total_kwh">4,069.73</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header bg-fusion-25 pr-3 d-flex align-items-center flex-wrap">
|
||||
<h4 class="mb-0 font-weight-bold"><span class="fal fa-sun mr-1"></span> 日照度</h4>
|
||||
<div class="ml-auto">kW/m<sup>2</sup></div>
|
||||
</div>
|
||||
<div class="card-body" style="min-height: 148px;">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>即時平均日照度</p>
|
||||
<p><span class="color-info-700" id="today_irradiance">126,161.72</span> kW/m<sup>2</sup></p>
|
||||
<p><span class="color-info-700" id="today_irradiance">126,161.72</span></p>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>平均日照度(30天)</p>
|
||||
<p><span class="color-info-700" id="avg_irradiance">4,069.73</span> kW/m<sup>2</sup></p>
|
||||
<p><span class="color-info-700" id="avg_irradiance">4,069.73</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header bg-fusion-25 pr-3 d-flex align-items-center flex-wrap">
|
||||
<h4 class="mb-0 font-weight-bold"><span class="fal fa-bolt mr-1"></span> PR值</h4>
|
||||
<div class="ml-auto">%</div>
|
||||
</div>
|
||||
<div class="card-body" style="min-height: 148px;">
|
||||
<div class="d-flex justify-content-between">
|
||||
@ -125,6 +128,7 @@
|
||||
<div class="card">
|
||||
<div class="card-header bg-fusion-25 pr-3 d-flex align-items-center flex-wrap">
|
||||
<h4 class="mb-0 font-weight-bold"><span class="fal fa-sun mr-1"></span> kWh / kWp</h4>
|
||||
<div class="ml-auto">hr</div>
|
||||
</div>
|
||||
<div class="card-body" style="min-height: 148px;">
|
||||
<div class="d-flex justify-content-between">
|
||||
@ -140,15 +144,16 @@
|
||||
<div class="card">
|
||||
<div class="card-header bg-fusion-25 pr-3 d-flex align-items-center flex-wrap">
|
||||
<h4 class="mb-0 font-weight-bold"><span class="fal fa-bolt mr-1"></span> 減碳量</h4>
|
||||
<div class="ml-auto">kG</div>
|
||||
</div>
|
||||
<div class="card-body" style="min-height: 148px;">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>今日減碳量</p>
|
||||
<p><span class="color-info-700" id="today_carbon">6,091.78</span> kG</p>
|
||||
<p><span class="color-info-700" id="today_carbon">6,091.78</span></p>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>累積減碳量</p>
|
||||
<p><span class="color-info-700" id="total_carbon">985.98</span> kG</p>
|
||||
<p><span class="color-info-700" id="total_carbon">985.98</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
ViewData["SubNum"] = "2";
|
||||
ViewData["Title"] = "電站總覽";
|
||||
}
|
||||
@using SolarPower.Models.Role
|
||||
@model RoleLayerEnum
|
||||
|
||||
<ol class="breadcrumb page-breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="javascript:void(0);">總覽</a></li>
|
||||
@ -33,61 +35,102 @@
|
||||
</div>
|
||||
</div>
|
||||
<ul class="nav nav-tabs mb-5" role="tablist">
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_UpToDate"))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link fs-lg px-4 active" data-toggle="tab" href="#tab-overview-uptodate" role="tab">
|
||||
<i class="fal fa-monitor-heart-rate text-success"></i> <span class="hidden-sm-down ml-1">即時資訊</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_Info"))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-overview-info" role="tab">
|
||||
<i class="fal fa-info-square text-success"></i> <span class="hidden-sm-down ml-1">基本資料</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_History"))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-overview-history" role="tab">
|
||||
<i class="fal fa-history text-success"></i> <span class="hidden-sm-down ml-1">歷史資料</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_Inverter"))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-overview-inverter" role="tab">
|
||||
<i class="fal fa-analytics text-success"></i> <span class="hidden-sm-down ml-1">逆變器分析</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_Exception"))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-overview-exception" role="tab">
|
||||
<i class="fal fa-sensor-alert text-success"></i> <span class="hidden-sm-down ml-1">異常記錄</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_OperationRecord"))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-overview-operationRecord" role="tab">
|
||||
<i class="fal fa-digital-tachograph text-success"></i> <span class="hidden-sm-down ml-1">運維記錄</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
<div class="tab-content p-3">
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_UpToDate"))
|
||||
{
|
||||
<div class="tab-pane fade show active" id="tab-overview-uptodate" role="tabpanel" aria-labelledby="tab-overview-uptodate">
|
||||
@Html.Partial("_UpToDate")
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_Info"))
|
||||
{
|
||||
<div class="tab-pane fade" id="tab-overview-info" role="tabpanel" aria-labelledby="tab-overview-info">
|
||||
@Html.Partial("_Info")
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_History"))
|
||||
{
|
||||
<div class="tab-pane fade" id="tab-overview-history" role="tabpanel" aria-labelledby="tab-overview-history">
|
||||
@Html.Partial("_History")
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_Inverter"))
|
||||
{
|
||||
<div class="tab-pane fade" id="tab-overview-inverter" role="tabpanel" aria-labelledby="tab-overview-inverter">
|
||||
@Html.Partial("_Inverter")
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_Exception"))
|
||||
{
|
||||
<div class="tab-pane fade" id="tab-overview-exception" role="tabpanel" aria-labelledby="tab-overview-exception">
|
||||
@Html.Partial("_Exception")
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_OperationRecord"))
|
||||
{
|
||||
<div class="tab-pane fade" id="tab-overview-operationRecord" role="tabpanel" aria-labelledby="tab-overview-operationRecord">
|
||||
@Html.Partial("_OperationRecord")
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -546,7 +589,12 @@
|
||||
|
||||
//#region 預先載入運維人員下拉式選單select_option
|
||||
var url_user_select_option = "/PowerStation/GetUserSelectOptionList";
|
||||
$.get(url_user_select_option, function (rel) {
|
||||
|
||||
var send_data = {
|
||||
powerStationId: stationId
|
||||
}
|
||||
|
||||
$.get(url_user_select_option, send_data, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<div class="row mb-5">
|
||||
<div class="card border mb-g w-100">
|
||||
<!-- notice the additions of utility paddings and display properties on .card-header -->
|
||||
<div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<!-- we wrap header title inside a div tag with utility padding -->
|
||||
<div class="card-title font-weight-bold">電站基本資料</div>
|
||||
</div>
|
||||
@ -161,7 +161,7 @@
|
||||
<div class="row mb-5" id="BoEPart">
|
||||
<div class="card border mb-g w-100">
|
||||
<!-- notice the additions of utility paddings and display properties on .card-header -->
|
||||
<div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<!-- we wrap header title inside a div tag with utility padding -->
|
||||
<div class="card-title font-weight-bold">經濟部能源局與台電資訊</div>
|
||||
</div>
|
||||
@ -256,7 +256,7 @@
|
||||
<div class="row mb-5">
|
||||
<div class="card border mb-g w-100">
|
||||
<!-- notice the additions of utility paddings and display properties on .card-header -->
|
||||
<div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap justify-content-between">
|
||||
<!-- we wrap header title inside a div tag with utility padding -->
|
||||
<div class="card-title font-weight-bold">單線圖</div>
|
||||
</div>
|
||||
|
||||
@ -123,88 +123,7 @@
|
||||
UpdateRegisterNumber($(this).val());
|
||||
|
||||
//查詢該公司的角色
|
||||
var url_company_role_select_option = "/Role/GetRoleSelectOptionList";
|
||||
|
||||
send_data = {
|
||||
CompanyId: $(this).val()
|
||||
}
|
||||
|
||||
$.get(url_company_role_select_option, send_data, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
//#region 帳號管理Tab - 角色下拉式選單(搜尋)
|
||||
if (rel.data.length > 0) {
|
||||
$("#select_company_role_userManager_tab").empty();
|
||||
$("#select_company_role_userManager_tab").append($("<option />").val(0).text("全部"));
|
||||
|
||||
$.each(rel.data, function (index, val) {
|
||||
$("#select_company_role_userManager_tab").append($("<option />").val(val.value).text(val.text));
|
||||
});
|
||||
|
||||
//預設查詢第一個
|
||||
$("#select_company_role_userManager_tab").val($("#select_company_role_userManager_tab option:first").val()).trigger('change');
|
||||
|
||||
//更新帳號管理DataTable
|
||||
if (selected_tab == "#tab-user-manager") {
|
||||
userTable.ajax.reload();
|
||||
}
|
||||
} else {
|
||||
$("#select_company_role_userManager_tab").empty();
|
||||
$("#select_company_role_userManager_tab").append('<option value="0" disabled>請先新增角色</option>');
|
||||
|
||||
$("#select_company_role_userManager_tab").val($("#select_company_role_userManager_tab option:first").val()).trigger('change');
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 帳號管理Tab - 人員基本資料新增/修改 modal
|
||||
if (rel.data.length > 0) {
|
||||
$('#user_role_modal').empty();
|
||||
|
||||
$.each(rel.data, function (index, val) {
|
||||
$("#user_role_modal").append($("<option />").val(val.value).text(val.text));
|
||||
});
|
||||
|
||||
//預設查詢第一個
|
||||
$("#user_role_modal").val($("#user_role_modal option:first").val()).trigger('change');
|
||||
} else {
|
||||
$("#user_role_modal").empty();
|
||||
$("#user_role_modal").append('<option value="0" disabled>請先新增角色</option>');
|
||||
|
||||
$("#user_role_modal").val($("#user_role_modal option:first").val()).trigger('change');
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 角色權限Tab - 角色下拉是選單(搜尋)
|
||||
if (rel.data.length > 0) {
|
||||
$("#select_roleId_roleAuth_tab").empty();
|
||||
|
||||
$.each(rel.data, function (index, val) {
|
||||
$("#select_roleId_roleAuth_tab").append($("<option />").val(val.value).text(val.text));
|
||||
});
|
||||
|
||||
//預設查詢第一個
|
||||
$("#select_roleId_roleAuth_tab").val($("#select_roleId_roleAuth_tab option:first").val()).trigger('change');
|
||||
|
||||
//更新角色權限DataTable
|
||||
if (selected_tab == "#tab-role-auth") {
|
||||
roleAuthTable.ajax.reload();
|
||||
}
|
||||
} else {
|
||||
$("#select_roleId_roleAuth_tab").empty();
|
||||
$("#select_roleId_roleAuth_tab").append('<option value="0" disabled>請先新增角色</option>');
|
||||
|
||||
$("#select_roleId_roleAuth_tab").val($("#select_roleId_roleAuth_tab option:first").val()).trigger('change');
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//更新角色管理DataTable
|
||||
if (selected_tab == "#tab-role-manager") {
|
||||
roleTable.ajax.reload();
|
||||
}
|
||||
});
|
||||
UpdateCompanyRoleSelectOption($(this).val());
|
||||
|
||||
|
||||
});
|
||||
@ -413,6 +332,8 @@
|
||||
"data": "roleName"
|
||||
}, {
|
||||
"data": "authPageSubName"
|
||||
}, {
|
||||
"data": "authPageTagName"
|
||||
}, {
|
||||
"data": "creatorName"
|
||||
}, {
|
||||
@ -497,6 +418,8 @@
|
||||
"data": "mainName"
|
||||
}, {
|
||||
"data": "subName"
|
||||
}, {
|
||||
"data": "tagName"
|
||||
}],
|
||||
"columnDefs": [{
|
||||
'targets': 0,
|
||||
@ -1028,6 +951,7 @@
|
||||
toast_ok(rel.msg);
|
||||
$('#role-modal').modal('hide');
|
||||
|
||||
UpdateCompanyRoleSelectOption($("#role_companyId_modal").val())
|
||||
roleTable.ajax.reload();
|
||||
}, 'json');
|
||||
}
|
||||
@ -1163,6 +1087,90 @@
|
||||
|
||||
//#endregion
|
||||
|
||||
function UpdateCompanyRoleSelectOption(companyId) {
|
||||
var url_company_role_select_option = "/Role/GetRoleSelectOptionList";
|
||||
|
||||
send_data = {
|
||||
CompanyId: companyId
|
||||
}
|
||||
|
||||
$.get(url_company_role_select_option, send_data, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
//#region 帳號管理Tab - 角色下拉式選單(搜尋)
|
||||
if (rel.data.length > 0) {
|
||||
$("#select_company_role_userManager_tab").empty();
|
||||
$("#select_company_role_userManager_tab").append($("<option />").val(0).text("全部"));
|
||||
|
||||
$.each(rel.data, function (index, val) {
|
||||
$("#select_company_role_userManager_tab").append($("<option />").val(val.value).text(val.text));
|
||||
});
|
||||
|
||||
//預設查詢第一個
|
||||
$("#select_company_role_userManager_tab").val($("#select_company_role_userManager_tab option:first").val()).trigger('change');
|
||||
|
||||
//更新帳號管理DataTable
|
||||
if (selected_tab == "#tab-user-manager") {
|
||||
userTable.ajax.reload();
|
||||
}
|
||||
} else {
|
||||
$("#select_company_role_userManager_tab").empty();
|
||||
$("#select_company_role_userManager_tab").append('<option value="0" disabled>請先新增角色</option>');
|
||||
|
||||
$("#select_company_role_userManager_tab").val($("#select_company_role_userManager_tab option:first").val()).trigger('change');
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 帳號管理Tab - 人員基本資料新增/修改 modal
|
||||
if (rel.data.length > 0) {
|
||||
$('#user_role_modal').empty();
|
||||
|
||||
$.each(rel.data, function (index, val) {
|
||||
$("#user_role_modal").append($("<option />").val(val.value).text(val.text));
|
||||
});
|
||||
|
||||
//預設查詢第一個
|
||||
$("#user_role_modal").val($("#user_role_modal option:first").val()).trigger('change');
|
||||
} else {
|
||||
$("#user_role_modal").empty();
|
||||
$("#user_role_modal").append('<option value="0" disabled>請先新增角色</option>');
|
||||
|
||||
$("#user_role_modal").val($("#user_role_modal option:first").val()).trigger('change');
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 角色權限Tab - 角色下拉是選單(搜尋)
|
||||
if (rel.data.length > 0) {
|
||||
$("#select_roleId_roleAuth_tab").empty();
|
||||
|
||||
$.each(rel.data, function (index, val) {
|
||||
$("#select_roleId_roleAuth_tab").append($("<option />").val(val.value).text(val.text));
|
||||
});
|
||||
|
||||
//預設查詢第一個
|
||||
$("#select_roleId_roleAuth_tab").val($("#select_roleId_roleAuth_tab option:first").val()).trigger('change');
|
||||
|
||||
//更新角色權限DataTable
|
||||
if (selected_tab == "#tab-role-auth") {
|
||||
roleAuthTable.ajax.reload();
|
||||
}
|
||||
} else {
|
||||
$("#select_roleId_roleAuth_tab").empty();
|
||||
$("#select_roleId_roleAuth_tab").append('<option value="0" disabled>請先新增角色</option>');
|
||||
|
||||
$("#select_roleId_roleAuth_tab").val($("#select_roleId_roleAuth_tab option:first").val()).trigger('change');
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//更新角色管理DataTable
|
||||
if (selected_tab == "#tab-role-manager") {
|
||||
roleTable.ajax.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
}
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
<th>公司</th>
|
||||
<th>角色</th>
|
||||
<th>功能名稱</th>
|
||||
<th>功能細項名稱</th>
|
||||
<th>建立人</th>
|
||||
<th>建立時間</th>
|
||||
<th>功能</th>
|
||||
@ -68,6 +69,7 @@
|
||||
</th>
|
||||
<th>功能大項</th>
|
||||
<th>功能名稱</th>
|
||||
<th>功能細項名稱</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@ -14,6 +14,17 @@
|
||||
"Root": "mWlR2HshQNhRRE34jg4kdg==",
|
||||
"Password": "y4uPqlH9ncTgR/I07qpwaA=="
|
||||
},
|
||||
//"DBConfig": {
|
||||
// "Server": "AVXfxd+IRlLtJ0MCi9HU1g==",
|
||||
// "port": "CrEmevYrUsSo7Mkb7Gxn8A==",
|
||||
// "Database": "CEyYZnO8B5+yTXQcFSsiBA==",
|
||||
// "Root": "Aph7AzoiwAmmBHCfS1rqeQ==",
|
||||
// "Password": "8WMHBEWuT0XoAB4kzduQHA=="
|
||||
//},
|
||||
"BackgroundServiceCron": {
|
||||
"CalcPowerStationJob": "0 5 * * * ?",
|
||||
"CalcAvgPowerStationJob": "0 0 2 * * ?"
|
||||
},
|
||||
"SMTPConfig": {
|
||||
"Host": "smtp.gmail.com",
|
||||
"Port": 25,
|
||||
|
||||
@ -8,12 +8,19 @@
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"LoginExpireMinute": 60, //登入到期時間,單位(分)
|
||||
//"DBConfig": {
|
||||
// "Server": "MVgHWzR3rGDgD57TUoFunA==",
|
||||
// "port": "r4AoXMUDodcQjIzofGNCcg==",
|
||||
// "Database": "Lxlx7Hae506yu/zopo2npw==",
|
||||
// "Root": "mWlR2HshQNhRRE34jg4kdg==",
|
||||
// "Password": "y4uPqlH9ncTgR/I07qpwaA=="
|
||||
//},
|
||||
"DBConfig": {
|
||||
"Server": "MVgHWzR3rGDgD57TUoFunA==",
|
||||
"port": "r4AoXMUDodcQjIzofGNCcg==",
|
||||
"Database": "Lxlx7Hae506yu/zopo2npw==",
|
||||
"Root": "mWlR2HshQNhRRE34jg4kdg==",
|
||||
"Password": "y4uPqlH9ncTgR/I07qpwaA=="
|
||||
"Server": "AVXfxd+IRlLtJ0MCi9HU1g==",
|
||||
"port": "CrEmevYrUsSo7Mkb7Gxn8A==",
|
||||
"Database": "CEyYZnO8B5+yTXQcFSsiBA==",
|
||||
"Root": "Aph7AzoiwAmmBHCfS1rqeQ==",
|
||||
"Password": "8WMHBEWuT0XoAB4kzduQHA=="
|
||||
},
|
||||
"SMTPConfig": {
|
||||
"Host": "smtp.gmail.com",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user