From 08953f8048b60cc10694f20bbfd508b925a3407b Mon Sep 17 00:00:00 2001 From: dev02 Date: Tue, 8 Nov 2022 16:57:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9modal,=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=8D=B3=E6=99=82=E5=91=8A=E8=AD=A6=E5=8C=AF=E5=87=BA,=20?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=A1=AF=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ishi_v03.ndm2 => BIMS_Mitsubishi_v04.ndm2} | 1930 ++++++++++++++++- .../ApiControllers/AlertController.cs | 200 ++ .../ApiControllers/OperationController.cs | 1 + FrontendWebApi/Models/Alert.cs | 14 + FrontendWebApi/Models/Device.cs | 9 - 5 files changed, 2144 insertions(+), 10 deletions(-) rename Backend/App_Data/{BIMS_Mitsubishi_v03.ndm2 => BIMS_Mitsubishi_v04.ndm2} (90%) create mode 100644 FrontendWebApi/ApiControllers/AlertController.cs create mode 100644 FrontendWebApi/Models/Alert.cs delete mode 100644 FrontendWebApi/Models/Device.cs diff --git a/Backend/App_Data/BIMS_Mitsubishi_v03.ndm2 b/Backend/App_Data/BIMS_Mitsubishi_v04.ndm2 similarity index 90% rename from Backend/App_Data/BIMS_Mitsubishi_v03.ndm2 rename to Backend/App_Data/BIMS_Mitsubishi_v04.ndm2 index 9b9b9f7..7f59286 100644 --- a/Backend/App_Data/BIMS_Mitsubishi_v03.ndm2 +++ b/Backend/App_Data/BIMS_Mitsubishi_v04.ndm2 @@ -19,7 +19,790 @@ { "objectType": "Schema_MYSQL", "name": "Default", - "tables": [], + "tables": [ + { + "objectType": "Table_MYSQL", + "name": "graph_manage", + "comment": "圖資管理", + "engine": "", + "characterSet": "", + "collation": "", + "autoIncrement": 0, + "tablespace": "", + "storage": "", + "insertMethod": "", + "connection": "", + "checksum": false, + "rowFormat": "", + "avgRowLength": 0, + "maxRows": 0, + "minRows": 0, + "keyBlockSize": 0, + "packKeys": "", + "delayKeyWrite": false, + "dataDirectory": "", + "indexDirectory": "", + "statsAutoRecalc": "", + "statsPersistent": "", + "statsSamplePages": 0, + "union": "", + "pageCheckSum": false, + "transactional": false, + "compression": "", + "oldName": "", + "encryption": false, + "createOptions": "", + "createTime": "", + "checkTime": "", + "dataFree": 0, + "dataLength": 0, + "indexLength": 0, + "maxDataLength": 0, + "rows": 0, + "updateTime": "", + "DDL": "", + "partitionBy": "", + "partitionByExpr": "", + "partitions": 0, + "partitionKeyAlgorithm": "", + "subPartitionBy": "", + "subPartitionByExpr": "", + "subPartitions": 0, + "subPartitionKeyAlgorithm": "", + "fields": [ + { + "objectType": "TableField_MYSQL", + "name": "code", + "type": "varchar", + "length": 50, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "圖資序號", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "code" + }, + { + "objectType": "TableField_MYSQL", + "name": "sub_system_tag", + "type": "varchar", + "length": 50, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "圖資小類別tag", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "sub_system_tag" + }, + { + "objectType": "TableField_MYSQL", + "name": "main_system_tag", + "type": "varchar", + "length": 50, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "圖資小類別tag", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "main_system_tag" + }, + { + "objectType": "TableField_MYSQL", + "name": "name", + "type": "varchar", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "圖資名稱", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "name" + }, + { + "objectType": "TableField_MYSQL", + "name": "oriOrgName", + "type": "varchar", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "原設計圖名稱", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "oriOrgName" + }, + { + "objectType": "TableField_MYSQL", + "name": "oriSavName", + "type": "varchar", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "原設計圖儲存名稱(GUID)", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "oriSavName" + }, + { + "objectType": "TableField_MYSQL", + "name": "donOrgName", + "type": "varchar", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "竣工圖名稱", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "donOrgName" + }, + { + "objectType": "TableField_MYSQL", + "name": "donSavName", + "type": "varchar", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "竣工圖儲存名稱(GUID)", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "donSavName" + }, + { + "objectType": "TableField_MYSQL", + "name": "deleted", + "type": "tinyint", + "length": 4, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "是否刪除 0:否 1:是", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "deleted" + }, + { + "objectType": "TableField_MYSQL", + "name": "priority", + "type": "tinyint", + "length": 11, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "優先程度", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "priority" + } + ], + "indexes": [], + "primaryKey": { + "objectType": "PrimaryKey_MYSQL", + "name": "", + "fields": [ + { + "objectType": "IndexField_MYSQL", + "name": "code", + "keyLength": -2147483648, + "order": "", + "oldName": "" + }, + { + "objectType": "IndexField_MYSQL", + "name": "sub_system_tag", + "keyLength": -2147483648, + "order": "", + "oldName": "" + }, + { + "objectType": "IndexField_MYSQL", + "name": "main_system_tag", + "keyLength": -2147483648, + "order": "", + "oldName": "" + } + ], + "oldName": "", + "indexMethod": "", + "comment": "" + }, + "foreignKeys": [], + "triggers": [], + "tablePartitions": [] + }, + { + "objectType": "Table_MYSQL", + "name": "operation_firm", + "comment": "運維廠商", + "engine": "", + "characterSet": "", + "collation": "", + "autoIncrement": 0, + "tablespace": "", + "storage": "", + "insertMethod": "", + "connection": "", + "checksum": false, + "rowFormat": "", + "avgRowLength": 0, + "maxRows": 0, + "minRows": 0, + "keyBlockSize": 0, + "packKeys": "", + "delayKeyWrite": false, + "dataDirectory": "", + "indexDirectory": "", + "statsAutoRecalc": "", + "statsPersistent": "", + "statsSamplePages": 0, + "union": "", + "pageCheckSum": false, + "transactional": false, + "compression": "", + "oldName": "", + "encryption": false, + "createOptions": "", + "createTime": "", + "checkTime": "", + "dataFree": 0, + "dataLength": 0, + "indexLength": 0, + "maxDataLength": 0, + "rows": 0, + "updateTime": "", + "DDL": "", + "partitionBy": "", + "partitionByExpr": "", + "partitions": 0, + "partitionKeyAlgorithm": "", + "subPartitionBy": "", + "subPartitionByExpr": "", + "subPartitions": 0, + "subPartitionKeyAlgorithm": "", + "fields": [ + { + "objectType": "TableField_MYSQL", + "name": "id", + "type": "int", + "length": 10, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": true, + "comment": "", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "id" + }, + { + "objectType": "TableField_MYSQL", + "name": "deleted", + "type": "tinyint", + "length": 4, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "是否刪除 0:否 1:是", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "deleted" + }, + { + "objectType": "TableField_MYSQL", + "name": "device_system_category_layer2", + "type": "varchar", + "length": 50, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "系統類別(第2層)", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "device_system_category_layer2" + }, + { + "objectType": "TableField_MYSQL", + "name": "device_system_category_layer3", + "type": "varchar", + "length": 100, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "系統類別(第3層);多選多號分隔; ex:8, 9, 12, 28", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "device_system_category_layer3" + }, + { + "objectType": "TableField_MYSQL", + "name": "name", + "type": "varchar", + "length": 50, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "名稱", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "name" + }, + { + "objectType": "TableField_MYSQL", + "name": "contact_person", + "type": "varchar", + "length": 50, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "聯絡人", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "contact_person" + }, + { + "objectType": "TableField_MYSQL", + "name": "phone", + "type": "varchar", + "length": 20, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "電話", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "phone" + }, + { + "objectType": "TableField_MYSQL", + "name": "email", + "type": "varchar", + "length": 100, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "email", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "email" + }, + { + "objectType": "TableField_MYSQL", + "name": "tax_id_num", + "type": "tinyint", + "length": 8, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "統一編號", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "tax_id_num" + }, + { + "objectType": "TableField_MYSQL", + "name": "remark", + "type": "tinyint", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "備注", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "remark" + }, + { + "objectType": "TableField_MYSQL", + "name": "created_by", + "type": "int", + "length": 10, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "創建者", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "created_by" + }, + { + "objectType": "TableField_MYSQL", + "name": "created_at", + "type": "datetime", + "length": -2147483648, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "創建時間", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "created_at" + }, + { + "objectType": "TableField_MYSQL", + "name": "updated_by", + "type": "int", + "length": 10, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "編輯者", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "updated_by" + }, + { + "objectType": "TableField_MYSQL", + "name": "updated_at", + "type": "datetime", + "length": -2147483648, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "編輯時間", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "updated_at" + } + ], + "indexes": [], + "primaryKey": { + "objectType": "PrimaryKey_MYSQL", + "name": "", + "fields": [ + { + "objectType": "IndexField_MYSQL", + "name": "id", + "keyLength": -2147483648, + "order": "", + "oldName": "" + } + ], + "oldName": "", + "indexMethod": "", + "comment": "" + }, + "foreignKeys": [], + "triggers": [], + "tablePartitions": [] + } + ], "views": [] }, { @@ -17489,6 +18272,1003 @@ "foreignKeys": [], "triggers": [], "tablePartitions": [] + }, + { + "objectType": "Table_MYSQL", + "name": "operation_record", + "comment": "運維作業紀錄", + "engine": "InnoDB", + "characterSet": "utf8", + "collation": "utf8_general_ci", + "autoIncrement": 310, + "tablespace": "", + "storage": "", + "insertMethod": "", + "connection": "", + "checksum": false, + "rowFormat": "DYNAMIC", + "avgRowLength": 0, + "maxRows": 0, + "minRows": 0, + "keyBlockSize": 0, + "packKeys": "", + "delayKeyWrite": false, + "dataDirectory": "", + "indexDirectory": "", + "statsAutoRecalc": "", + "statsPersistent": "", + "statsSamplePages": 0, + "union": "", + "pageCheckSum": false, + "transactional": false, + "compression": "", + "oldName": "operation_record", + "encryption": false, + "createOptions": "row_format=DYNAMIC", + "createTime": "2022-11-04 04:47:58", + "checkTime": "", + "dataFree": 0, + "dataLength": 16384, + "indexLength": 16384, + "maxDataLength": 0, + "rows": 0, + "updateTime": "", + "DDL": "CREATE TABLE `operation_record` (\n `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '流水號',\n `deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否刪除 0:否 1:是',\n `formId` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '表單號 (ex: op + 西元年月日 8 码+當日流水號3碼)',\n `location` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '位置(區域-棟別-樓層)',\n `location_code` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '位置編號(區域-棟別-樓層)(from N4 ack)',\n `device_system_category_layer2` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '系統類別(第2層)(系統大類)',\n `device_system_category_layer3` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '系統類別(第3層)(系統小類)',\n `work_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '工作項目, 1:保養 2:維修',\n `error_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '異常代號(from N4 )',\n `fix_do_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '維修項目代碼(設備編號)(8段tag)(from N4 ack)',\n `fix_firm` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '負責廠商',\n `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '狀態 0:未完成 1:完成 2:未完成-過期 3:完成-過期',\n `work_person_id` int(10) NOT NULL DEFAULT '0' COMMENT '工作人員編號(from userinfo)',\n `start_time` datetime DEFAULT NULL COMMENT '預計開始時間',\n `end_time` datetime DEFAULT NULL COMMENT '預計結束時間',\n `work_time` datetime DEFAULT NULL COMMENT '實際開始時間',\n `finish_time` datetime DEFAULT NULL COMMENT '實際完成時間',\n `notice` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '注意事項',\n `description` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '結果描述',\n `created_by` int(10) NOT NULL COMMENT '創建者',\n `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '創建時間',\n `updated_by` int(10) DEFAULT NULL COMMENT '編輯者',\n `updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '編輯時間',\n PRIMARY KEY (`id`) USING BTREE,\n KEY `IDX_01` (`deleted`,`formId`,`work_person_id`) USING BTREE\n) ENGINE=InnoDB AUTO_INCREMENT=310 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='運維作業紀錄'", + "partitionBy": "", + "partitionByExpr": "", + "partitions": 0, + "partitionKeyAlgorithm": "", + "subPartitionBy": "", + "subPartitionByExpr": "", + "subPartitions": 0, + "subPartitionKeyAlgorithm": "", + "fields": [ + { + "objectType": "TableField_MYSQL", + "name": "id", + "type": "int", + "length": 10, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": true, + "comment": "流水號", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "id" + }, + { + "objectType": "TableField_MYSQL", + "name": "deleted", + "type": "tinyint", + "length": 4, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "0", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "是否刪除 0:否 1:是", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "deleted" + }, + { + "objectType": "TableField_MYSQL", + "name": "formId", + "type": "varchar", + "length": 20, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "utf8mb4", + "collation": "utf8mb4_unicode_ci", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "表單號 (ex: op + 西元年月日 8 码+當日流水號3碼)", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "formId" + }, + { + "objectType": "TableField_MYSQL", + "name": "location", + "type": "varchar", + "length": 50, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "utf8", + "collation": "utf8_general_ci", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "'0'", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "位置(區域-棟別-樓層)", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "location" + }, + { + "objectType": "TableField_MYSQL", + "name": "location_code", + "type": "varchar", + "length": 20, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "utf8", + "collation": "utf8_general_ci", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "位置編號(區域-棟別-樓層)(from N4 ack)", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "location_code" + }, + { + "objectType": "TableField_MYSQL", + "name": "device_system_category_layer2", + "type": "varchar", + "length": 50, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "utf8mb4", + "collation": "utf8mb4_unicode_ci", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "'0'", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "系統類別(第2層)(系統大類)", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "device_system_category_layer2" + }, + { + "objectType": "TableField_MYSQL", + "name": "device_system_category_layer3", + "type": "varchar", + "length": 50, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "utf8mb4", + "collation": "utf8mb4_unicode_ci", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "'0'", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "系統類別(第3層)(系統小類)", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "device_system_category_layer3" + }, + { + "objectType": "TableField_MYSQL", + "name": "work_type", + "type": "tinyint", + "length": 4, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "0", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "工作項目, 1:保養 2:維修", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "work_type" + }, + { + "objectType": "TableField_MYSQL", + "name": "error_code", + "type": "varchar", + "length": 50, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "utf8mb4", + "collation": "utf8mb4_unicode_ci", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "異常代號(from N4 )", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "error_code" + }, + { + "objectType": "TableField_MYSQL", + "name": "fix_do_code", + "type": "varchar", + "length": 50, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "utf8mb4", + "collation": "utf8mb4_unicode_ci", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "維修項目代碼(設備編號)(8段tag)(from N4 ack)", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "fix_do_code" + }, + { + "objectType": "TableField_MYSQL", + "name": "fix_firm", + "type": "int", + "length": 10, + "decimals": -2147483648, + "isUnsigned": true, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "0", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "負責廠商", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "fix_firm" + }, + { + "objectType": "TableField_MYSQL", + "name": "status", + "type": "tinyint", + "length": 4, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "0", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "狀態 0:未完成 1:完成 2:未完成-過期 3:完成-過期", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "status" + }, + { + "objectType": "TableField_MYSQL", + "name": "work_person_id", + "type": "int", + "length": 10, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "0", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "工作人員編號(from userinfo)", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "work_person_id" + }, + { + "objectType": "TableField_MYSQL", + "name": "start_time", + "type": "datetime", + "length": -2147483648, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "預計開始時間", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "start_time" + }, + { + "objectType": "TableField_MYSQL", + "name": "end_time", + "type": "datetime", + "length": -2147483648, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "預計結束時間", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "end_time" + }, + { + "objectType": "TableField_MYSQL", + "name": "work_time", + "type": "datetime", + "length": -2147483648, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "實際開始時間", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "work_time" + }, + { + "objectType": "TableField_MYSQL", + "name": "finish_time", + "type": "datetime", + "length": -2147483648, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "實際完成時間", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "finish_time" + }, + { + "objectType": "TableField_MYSQL", + "name": "notice", + "type": "mediumtext", + "length": -2147483648, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "utf8mb4", + "collation": "utf8mb4_unicode_ci", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "注意事項", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "notice" + }, + { + "objectType": "TableField_MYSQL", + "name": "description", + "type": "mediumtext", + "length": -2147483648, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "utf8mb4", + "collation": "utf8mb4_unicode_ci", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "結果描述", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "description" + }, + { + "objectType": "TableField_MYSQL", + "name": "created_by", + "type": "int", + "length": 10, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "創建者", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "created_by" + }, + { + "objectType": "TableField_MYSQL", + "name": "created_at", + "type": "datetime", + "length": -2147483648, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "CURRENT_TIMESTAMP", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "創建時間", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "created_at" + }, + { + "objectType": "TableField_MYSQL", + "name": "updated_by", + "type": "int", + "length": 10, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "編輯者", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "updated_by" + }, + { + "objectType": "TableField_MYSQL", + "name": "updated_at", + "type": "datetime", + "length": -2147483648, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": true, + "isAutoInc": false, + "comment": "編輯時間", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "updated_at" + } + ], + "indexes": [ + { + "objectType": "Index_MYSQL", + "name": "IDX_01", + "type": "NORMAL", + "method": "BTREE", + "comment": "", + "oldName": "IDX_01", + "online": false, + "keyBlockSize": 0, + "parser": "", + "algorithm": "", + "lock": "", + "collation": "A", + "cardinality": "0", + "packed": "", + "fields": [ + { + "objectType": "IndexField_MYSQL", + "name": "deleted", + "keyLength": 0, + "order": "", + "oldName": "deleted" + }, + { + "objectType": "IndexField_MYSQL", + "name": "formId", + "keyLength": 0, + "order": "", + "oldName": "formId" + }, + { + "objectType": "IndexField_MYSQL", + "name": "work_person_id", + "keyLength": 0, + "order": "", + "oldName": "work_person_id" + } + ] + } + ], + "primaryKey": { + "objectType": "PrimaryKey_MYSQL", + "name": "", + "fields": [ + { + "objectType": "IndexField_MYSQL", + "name": "id", + "keyLength": 0, + "order": "", + "oldName": "id" + } + ], + "oldName": "", + "indexMethod": "BTREE", + "comment": "" + }, + "foreignKeys": [], + "triggers": [], + "tablePartitions": [] + }, + { + "objectType": "Table_MYSQL", + "name": "operation_record_file", + "comment": "運維紀錄 檔案 or 圖片", + "engine": "InnoDB", + "characterSet": "utf8", + "collation": "utf8_general_ci", + "autoIncrement": 76, + "tablespace": "", + "storage": "", + "insertMethod": "", + "connection": "", + "checksum": false, + "rowFormat": "DYNAMIC", + "avgRowLength": 0, + "maxRows": 0, + "minRows": 0, + "keyBlockSize": 0, + "packKeys": "", + "delayKeyWrite": false, + "dataDirectory": "", + "indexDirectory": "", + "statsAutoRecalc": "", + "statsPersistent": "", + "statsSamplePages": 0, + "union": "", + "pageCheckSum": false, + "transactional": false, + "compression": "", + "oldName": "operation_record_file", + "encryption": false, + "createOptions": "row_format=DYNAMIC", + "createTime": "2022-11-04 05:19:00", + "checkTime": "", + "dataFree": 0, + "dataLength": 16384, + "indexLength": 16384, + "maxDataLength": 0, + "rows": 0, + "updateTime": "", + "DDL": "CREATE TABLE `operation_record_file` (\n `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '序號',\n `deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否刪除, 0:否 1:是',\n `record_id` int(10) NOT NULL COMMENT '主表流水號',\n `ori_file_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '原始檔案名稱',\n `save_file_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '儲存檔案名稱(guid)',\n `created_by` int(10) unsigned NOT NULL COMMENT '創建者',\n `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '創建時間',\n PRIMARY KEY (`id`) USING BTREE,\n KEY `IDX_01` (`record_id`,`deleted`) USING BTREE\n) ENGINE=InnoDB AUTO_INCREMENT=76 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='運維紀錄 檔案 or 圖片'", + "partitionBy": "", + "partitionByExpr": "", + "partitions": 0, + "partitionKeyAlgorithm": "", + "subPartitionBy": "", + "subPartitionByExpr": "", + "subPartitions": 0, + "subPartitionKeyAlgorithm": "", + "fields": [ + { + "objectType": "TableField_MYSQL", + "name": "id", + "type": "int", + "length": 10, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": true, + "comment": "序號", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "id" + }, + { + "objectType": "TableField_MYSQL", + "name": "deleted", + "type": "tinyint", + "length": 4, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "0", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "是否刪除, 0:否 1:是", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "deleted" + }, + { + "objectType": "TableField_MYSQL", + "name": "record_id", + "type": "int", + "length": 10, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "主表流水號", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "record_id" + }, + { + "objectType": "TableField_MYSQL", + "name": "ori_file_name", + "type": "varchar", + "length": 100, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "utf8", + "collation": "utf8_general_ci", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "原始檔案名稱", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "ori_file_name" + }, + { + "objectType": "TableField_MYSQL", + "name": "save_file_name", + "type": "varchar", + "length": 100, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "utf8", + "collation": "utf8_general_ci", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "儲存檔案名稱(guid)", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "save_file_name" + }, + { + "objectType": "TableField_MYSQL", + "name": "created_by", + "type": "int", + "length": 10, + "decimals": -2147483648, + "isUnsigned": true, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "創建者", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "created_by" + }, + { + "objectType": "TableField_MYSQL", + "name": "created_at", + "type": "timestamp", + "length": -2147483648, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "CURRENT_TIMESTAMP", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "創建時間", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "created_at" + } + ], + "indexes": [ + { + "objectType": "Index_MYSQL", + "name": "IDX_01", + "type": "NORMAL", + "method": "BTREE", + "comment": "", + "oldName": "IDX_01", + "online": false, + "keyBlockSize": 0, + "parser": "", + "algorithm": "", + "lock": "", + "collation": "A", + "cardinality": "0", + "packed": "", + "fields": [ + { + "objectType": "IndexField_MYSQL", + "name": "record_id", + "keyLength": 0, + "order": "", + "oldName": "record_id" + }, + { + "objectType": "IndexField_MYSQL", + "name": "deleted", + "keyLength": 0, + "order": "", + "oldName": "deleted" + } + ] + } + ], + "primaryKey": { + "objectType": "PrimaryKey_MYSQL", + "name": "", + "fields": [ + { + "objectType": "IndexField_MYSQL", + "name": "id", + "keyLength": 0, + "order": "", + "oldName": "id" + } + ], + "oldName": "", + "indexMethod": "BTREE", + "comment": "" + }, + "foreignKeys": [], + "triggers": [], + "tablePartitions": [] } ], "views": [] @@ -18340,6 +20120,154 @@ "y": 360 } ] + }, + { + "type": "table", + "schemaName": "Default", + "tableName": "graph_manage", + "x": 1440, + "y": 890, + "width": 240, + "height": 280, + "isBold": false, + "titleColor": { + "r": 55, + "g": 131, + "b": 192, + "a": 1 + } + }, + { + "type": "arrow", + "name": "Arrow 1 Copy 1 Copy 1 Copy 3 Copy 1 Copy 1 Copy 1", + "opacity": 1.0, + "lineWidth": 3, + "dashStyle": "solid", + "capStyle": "flat", + "joinStyle": "miter", + "beginStyle": "none", + "endStyle": "normal", + "vertices": [ + { + "x": 1630, + "y": 810 + }, + { + "x": 1630, + "y": 890 + } + ] + }, + { + "type": "arrow", + "name": "Arrow 1 Copy 1 Copy 1 Copy 3 Copy 1 Copy 1 Copy 1 Copy 1", + "opacity": 1.0, + "lineWidth": 3, + "dashStyle": "solid", + "capStyle": "flat", + "joinStyle": "miter", + "beginStyle": "none", + "endStyle": "normal", + "vertices": [ + { + "x": 1760, + "y": 810 + }, + { + "x": 1760, + "y": 890 + } + ] + }, + { + "type": "table", + "schemaName": "Default", + "tableName": "operation_firm", + "x": 1710, + "y": 890, + "width": 240, + "height": 280, + "isBold": false, + "titleColor": { + "r": 55, + "g": 131, + "b": 192, + "a": 1 + } + }, + { + "type": "table", + "schemaName": "bims_mitsubishi", + "tableName": "operation_record", + "x": 2030, + "y": 900, + "width": 287, + "height": 510, + "isBold": false, + "titleColor": { + "r": 55, + "g": 131, + "b": 192, + "a": 1 + } + }, + { + "type": "table", + "schemaName": "bims_mitsubishi", + "tableName": "operation_record_file", + "x": 1730, + "y": 1250, + "width": 204, + "height": 190, + "isBold": false, + "titleColor": { + "r": 55, + "g": 131, + "b": 192, + "a": 1 + } + }, + { + "type": "arrow", + "name": "Arrow 1 Copy 1 Copy 1 Copy 1 Copy 2", + "opacity": 1.0, + "lineWidth": 3, + "dashStyle": "solid", + "capStyle": "flat", + "joinStyle": "miter", + "beginStyle": "none", + "endStyle": "normal", + "vertices": [ + { + "x": 1950, + "y": 1030 + }, + { + "x": 2030, + "y": 1030 + } + ] + }, + { + "type": "arrow", + "name": "Arrow 1 Copy 1 Copy 1 Copy 3 Copy 1 Copy 1 Copy 1 Copy 1 Copy 1", + "opacity": 1.0, + "lineWidth": 3, + "dashStyle": "solid", + "capStyle": "flat", + "joinStyle": "miter", + "beginStyle": "none", + "endStyle": "normal", + "vertices": [ + { + "x": 1830, + "y": 1170 + }, + { + "x": 1830, + "y": 1250 + } + ] } ], "layers": [], diff --git a/FrontendWebApi/ApiControllers/AlertController.cs b/FrontendWebApi/ApiControllers/AlertController.cs new file mode 100644 index 0000000..510b35c --- /dev/null +++ b/FrontendWebApi/ApiControllers/AlertController.cs @@ -0,0 +1,200 @@ +using FrontendWebApi.Models; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using NPOI.SS.UserModel; +using NPOI.XSSF.UserModel; +using Repository.BackendRepository.Interface; +using System.Collections.Generic; +using System; +using System.IO; +using System.Data.SqlTypes; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; + +namespace FrontendWebApi.ApiControllers +{ + [Route("api/[controller]")] + [ApiController] + public class AlertController : MyBaseApiController + { + private readonly IBackendRepository backendRepository; + + public AlertController(IBackendRepository backendRepository) + { + this.backendRepository = backendRepository; + } + + [HttpPost] + public FileResult OpeExportExcel(List alerts) + { + var workbook = new XSSFWorkbook(); + #region excel設定 + IFont font12 = workbook.CreateFont(); + font12.FontName = "新細明體"; + font12.FontHeightInPoints = 12; + ICellStyle style12 = workbook.CreateCellStyle(); + style12.SetFont(font12); + style12.Alignment = HorizontalAlignment.Center; + style12.VerticalAlignment = VerticalAlignment.Center; + IFont font12Times = workbook.CreateFont(); + font12Times.FontName = "Times New Roman"; + font12Times.FontHeightInPoints = 12; + IFont font18 = workbook.CreateFont(); + font18.FontName = "新細明體"; + font18.FontHeightInPoints = 18; + font18.IsBold = true; + ICellStyle styleTitle18 = workbook.CreateCellStyle(); + styleTitle18.SetFont(font18); + styleTitle18.Alignment = HorizontalAlignment.Center; + styleTitle18.VerticalAlignment = VerticalAlignment.Center; + ICellStyle styleLeft12 = workbook.CreateCellStyle(); + styleLeft12.SetFont(font12); + styleLeft12.Alignment = HorizontalAlignment.Left; + styleLeft12.VerticalAlignment = VerticalAlignment.Center; + ICellStyle styleLine12 = workbook.CreateCellStyle(); + styleLine12.SetFont(font12); + styleLine12.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center; + styleLine12.VerticalAlignment = VerticalAlignment.Center; + styleLine12.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin; + styleLine12.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin; + styleLine12.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin; + styleLine12.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin; + ICellStyle stylein12 = workbook.CreateCellStyle(); + stylein12.SetFont(font12Times); + stylein12.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Left; + stylein12.VerticalAlignment = VerticalAlignment.Center; + stylein12.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin; + stylein12.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin; + stylein12.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin; + stylein12.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin; + stylein12.WrapText = true; + #endregion + + var sheet = workbook.CreateSheet("即時告警"); + int RowPosition = 0; + #region set cell + IRow row = sheet.CreateRow(RowPosition); + 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; + cell = row.CreateCell(1); + cell.SetCellValue("異常ID"); + cell.CellStyle = styleLine12; + cell = row.CreateCell(2); + cell.SetCellValue("發生時間"); + cell.CellStyle = styleLine12; + cell = row.CreateCell(3); + cell.SetCellValue("異常類別"); + cell.CellStyle = styleLine12; + cell = row.CreateCell(4); + cell.SetCellValue("設備編號"); + cell.CellStyle = styleLine12; + cell = row.CreateCell(5); + cell.SetCellValue("異常原因"); + cell.CellStyle = styleLine12; + cell = row.CreateCell(6); + cell.SetCellValue("Ack 確認"); + cell.CellStyle = styleLine12; + cell = row.CreateCell(7); + cell.SetCellValue("派工/維運單號"); + cell.CellStyle = styleLine12; + #endregion + + if (alerts.Count > 0) + { + foreach (var a in alerts) + { + var sqlString = $@"select formId from operation_record where error_code = @error_code"; + var formId = backendRepository.GetOneAsync(sqlString, new { @error_code = a.error_code }); + RowPosition += 1; + row = sheet.CreateRow(RowPosition); + for (var i = 0; i < 8; i++) + { + cell = row.CreateCell(i); + if (i == 0) + { + cell.SetCellValue(a.building_tag + a.floor_tag); + } + if (i == 1) + { + cell.SetCellValue(a.error_code); + } + if (i == 2) + { + cell.SetCellValue(a.Created_at); + } + if (i == 3) + { + cell.SetCellValue(a.error_type); + } + if (i == 4) + { + cell.SetCellValue(a.device_number); + } + if (i == 5) + { + cell.SetCellValue(a.error_reason); + } + if (i == 6) + { + cell.SetCellValue(a.ACKconfirm); + } + if (i == 7) + { + cell.SetCellValue(formId.Result); + } + + cell.CellStyle = style12; + } + } + } + + var ms = new NpoiMemoryStream + { + AllowClose = false + }; + workbook.Write(ms); + ms.Flush(); + ms.Seek(0, SeekOrigin.Begin); + + return File(ms, "application/vnd.ms-excel", "廠商資料.xlsx"); + } + + [HttpPost] + public async Task>> AlertList(List alerts) + { + ApiResult> apiResult = new ApiResult>(); + try + { + if(alerts.Count > 0) + { + foreach(var a in alerts) + { + var sqlString = $@"select * from operation_record where error_code = @error_code"; + var formId = await backendRepository.GetOneAsync(sqlString, new { @error_code = a.error_code }); + a.formId = formId; + } + } + apiResult.Code = "0000"; + apiResult.Data = alerts; + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + string json = System.Text.Json.JsonSerializer.Serialize(alerts); + Logger.LogError("【" + controllerName + "/" + actionName + "】" + json); + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + } + return apiResult; + } + } +} diff --git a/FrontendWebApi/ApiControllers/OperationController.cs b/FrontendWebApi/ApiControllers/OperationController.cs index e696406..113a99e 100644 --- a/FrontendWebApi/ApiControllers/OperationController.cs +++ b/FrontendWebApi/ApiControllers/OperationController.cs @@ -224,6 +224,7 @@ namespace FrontendWebApi.ApiControllers IRow row = sheet.CreateRow(RowPosition); 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); diff --git a/FrontendWebApi/Models/Alert.cs b/FrontendWebApi/Models/Alert.cs new file mode 100644 index 0000000..b287da2 --- /dev/null +++ b/FrontendWebApi/Models/Alert.cs @@ -0,0 +1,14 @@ +namespace FrontendWebApi.Models +{ + public class Alert : Actor + { + public string building_tag { get; set; } + public string floor_tag { get; set; } + public string error_code { get; set; } + public string error_type { get; set; } + public string device_number { get; set; } + public string error_reason { get; set; } + public string ACKconfirm { get; set; } + public string formId { get; set; } + } +} diff --git a/FrontendWebApi/Models/Device.cs b/FrontendWebApi/Models/Device.cs deleted file mode 100644 index 5a78821..0000000 --- a/FrontendWebApi/Models/Device.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace FrontendWebApi.Models -{ - -}