diff --git a/SolarPower/DBSchema/solar_power_schema.sql b/SolarPower/DBSchema/solar_power_schema.sql index 4a788f6..4ac3873 100644 --- a/SolarPower/DBSchema/solar_power_schema.sql +++ b/SolarPower/DBSchema/solar_power_schema.sql @@ -1024,8 +1024,22 @@ 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 `InstallDate` timestamp NULL DEFAULT NULL COMMENT '安裝日期' AFTER `ColName`, + DROP COLUMN `Remark`, /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; diff --git a/SolarPower/Repository/Implement/CompanyRepository.cs b/SolarPower/Repository/Implement/CompanyRepository.cs index 7bc0119..0d30095 100644 --- a/SolarPower/Repository/Implement/CompanyRepository.cs +++ b/SolarPower/Repository/Implement/CompanyRepository.cs @@ -452,8 +452,10 @@ namespace SolarPower.Repository.Implement `Deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否刪除, 0:否 1:是', `UID` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '設備編號,縣市 +區域+電廠流水號(0001~9999)+設備類別(字母:3碼) + SN(設備流水號;3碼)', `PowerStationId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所屬電站編號', - `SerialNumber` varchar(4) COLLATE utf8mb4_unicode_ci DEFAULT '0' COMMENT '設備流水號', - `Name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '名稱', + `Enabled` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否啟用, 0:否 1:是', + `Status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '狀態 ,0:未啟用 1:正常 2:異常', + `SerialNumber` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '0' COMMENT '設備流水號', + `Name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '設備名稱', `Type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '類型', `TypeName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '類型名稱', `ControllerId` int(10) unsigned DEFAULT NULL COMMENT '控制器Id', @@ -462,7 +464,7 @@ namespace SolarPower.Repository.Implement `DBName` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `TableName` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `ColName` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `Remark` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '備註', + `InstallDate` timestamp NULL DEFAULT NULL COMMENT '安裝日期', `CreatedBy` int(10) unsigned NOT NULL COMMENT '建立者', `CreatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '建立時間', `UpdatedBy` int(10) unsigned DEFAULT NULL COMMENT '修改者', @@ -476,9 +478,17 @@ namespace SolarPower.Repository.Implement CREATE TABLE IF NOT EXISTS `inverter` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '流水號', `Deleted` tinyint(4) DEFAULT '0' COMMENT '是否刪除', + `Enabled` tinyint(4) DEFAULT '0' COMMENT '是否啟用,0:未啟用 1:啟用', + `Status` tinyint(4) DEFAULT '0' COMMENT '狀態,0:未啟用 1:正常 2:異常', + `InstallDate` timestamp NULL DEFAULT NULL COMMENT '安裝日期', `SerialNumber` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '逆變器流水號(用控制器排序)', + `InverterName` varchar(50) DEFAULT NULL COMMENT '逆變器名稱', `InverterId` varchar(50) DEFAULT NULL COMMENT '逆變器UID', `ControllerId` int(10) DEFAULT NULL COMMENT '所屬控制器', + `Brand` varchar(50) DEFAULT NULL COMMENT '廠牌', + `Model` varchar(50) DEFAULT NULL COMMENT '型號', + `Capacity` double(10,3) DEFAULT NULL COMMENT '裝置容量 kWp', + `Pyrheliometer` int(10) DEFAULT NULL COMMENT '日照計設備流水號', `CreatedBy` int(10) unsigned NOT NULL, `CreatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `UpdatedBy` int(10) DEFAULT NULL,