[後台] 修改系統類別管理
This commit is contained in:
		
							parent
							
								
									d4f0add911
								
							
						
					
					
						commit
						da19a2becc
					
				@ -805,7 +805,7 @@ namespace Backend.Controllers
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                var rawDatas = await backendRepository.GetAllAsync<DeviceImportCheckTempRawData>("import_niagara_tag", null, null, "device_building_tag, device_system_tag, device_floor_tag, device_name_tag");
 | 
			
		||||
                var rawDatas = await backendRepository.GetAllAsync<DeviceImportCheckTempRawData>("import_niagara_tag", "ORDER BY device_building_tag, device_system_tag, device_floor_tag, device_name_tag");
 | 
			
		||||
 | 
			
		||||
                var rawDatas_Group_Building_tag = rawDatas.GroupBy(x => x.Device_building_tag).ToList();
 | 
			
		||||
                List<DeviceImportCheckTempFilter> tempFilters = new List<DeviceImportCheckTempFilter>();
 | 
			
		||||
@ -877,7 +877,8 @@ namespace Backend.Controllers
 | 
			
		||||
	                            di.device_floor_tag,
 | 
			
		||||
	                            di.device_last_name_tag as device_name_tag,
 | 
			
		||||
	                            di.device_serial_tag,
 | 
			
		||||
                                0 as device_disaster,
 | 
			
		||||
                                0 as Device_disasters,
 | 
			
		||||
                                0 as Device_disaster_type_text,
 | 
			
		||||
	                            di.niagara_tags as device_number
 | 
			
		||||
                            FROM
 | 
			
		||||
	                            (
 | 
			
		||||
 | 
			
		||||
@ -13,6 +13,8 @@ namespace Backend.Controllers
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        private readonly IBackendRepository backendRepository;
 | 
			
		||||
        private string main_system_name = "device_system_category_layer2";
 | 
			
		||||
        private string sub_system_name = "device_system_category_layer1";
 | 
			
		||||
 | 
			
		||||
        public SystemCategoryController(IBackendRepository backendRepository)
 | 
			
		||||
        {
 | 
			
		||||
@ -29,15 +31,17 @@ namespace Backend.Controllers
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        public async Task<ApiResult<List<SystemMain>>> SystemMainList()
 | 
			
		||||
        public async Task<ApiResult<List<VariableInfo>>> SystemMainList()
 | 
			
		||||
        {
 | 
			
		||||
            ApiResult<List<SystemMain>> apiResult = new ApiResult<List<SystemMain>>();
 | 
			
		||||
            ApiResult<List<VariableInfo>> apiResult = new ApiResult<List<VariableInfo>>();
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                var sWhere = "deleted = 0";
 | 
			
		||||
                var sWhere = "deleted = 0 AND system_type = @System_type";
 | 
			
		||||
 | 
			
		||||
                var systemMainList = await backendRepository.GetAllAsync<SystemMain>("main_system", sWhere, null, "priority ASC, created_at DESC");
 | 
			
		||||
                var param = new { System_type = main_system_name };
 | 
			
		||||
 | 
			
		||||
                var systemMainList = await backendRepository.GetAllAsync<VariableInfo>("variable", sWhere, param, "system_priority ASC, created_at DESC");
 | 
			
		||||
 | 
			
		||||
                apiResult.Code = "0000";
 | 
			
		||||
                apiResult.Data = systemMainList;
 | 
			
		||||
@ -57,17 +61,17 @@ namespace Backend.Controllers
 | 
			
		||||
        /// <param name="guid"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        public async Task<ApiResult<SystemMain>> GetOneSystemMain(string guid)
 | 
			
		||||
        public async Task<ApiResult<VariableInfo>> GetOneSystemMain(int id)
 | 
			
		||||
        {
 | 
			
		||||
            ApiResult<SystemMain> apiResult = new ApiResult<SystemMain>();
 | 
			
		||||
            ApiResult<VariableInfo> apiResult = new ApiResult<VariableInfo>();
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                string sWhere = @$"deleted = @Deleted AND main_system_guid = @Guid";
 | 
			
		||||
                string sWhere = @$"deleted = @Deleted AND id = @id";
 | 
			
		||||
 | 
			
		||||
                object param = new { Deleted = 0, Guid = guid };
 | 
			
		||||
                object param = new { Deleted = 0, id = id};
 | 
			
		||||
 | 
			
		||||
                var systemMain = await backendRepository.GetOneAsync<SystemMain>("main_system", sWhere, param);
 | 
			
		||||
                var systemMain = await backendRepository.GetOneAsync<VariableInfo>("variable", sWhere, param);
 | 
			
		||||
 | 
			
		||||
                apiResult.Code = "0000";
 | 
			
		||||
                apiResult.Data = systemMain;
 | 
			
		||||
@ -87,81 +91,66 @@ namespace Backend.Controllers
 | 
			
		||||
        /// <param name="post"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        public async Task<ApiResult<string>> SaveSystemMain(SystemMain post)
 | 
			
		||||
        public async Task<ApiResult<string>> SaveSystemMain(VariableInfo post)
 | 
			
		||||
        {
 | 
			
		||||
            ApiResult<string> apiResult = new ApiResult<string>();
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                string sWhere = @$"deleted = @Deleted AND main_system_guid = @Guid";
 | 
			
		||||
                string sWhere = @$"deleted = @Deleted AND id = @id";
 | 
			
		||||
 | 
			
		||||
                object param = new { Deleted = 0, Guid = post.Main_system_guid };
 | 
			
		||||
                object param = new { Deleted = 0, id = post.id };
 | 
			
		||||
 | 
			
		||||
                var systemMain = await backendRepository.GetOneAsync<SystemMain>("main_system", sWhere, param);
 | 
			
		||||
                var systemMain = await backendRepository.GetOneAsync<VariableInfo>("variable", sWhere, param);
 | 
			
		||||
 | 
			
		||||
                if (systemMain == null)
 | 
			
		||||
                {
 | 
			
		||||
                    //新增
 | 
			
		||||
                    //產生一組GUID
 | 
			
		||||
                    var guid = Guid.NewGuid();  //系統大類GUID
 | 
			
		||||
                    //獲取最新的大類
 | 
			
		||||
                    sWhere = @$"deleted = @Deleted AND system_type = @System_type";
 | 
			
		||||
                    param = new { Deleted = 0, System_type = main_system_name };
 | 
			
		||||
                    var sOrder = @"id DESC LIMIT 1";
 | 
			
		||||
                    var latestVariable = await backendRepository.GetOneAsync<VariableInfo>("variable", sWhere, param, sOrder);
 | 
			
		||||
 | 
			
		||||
                    Dictionary<string, object> systemMainDic = new Dictionary<string, object>()
 | 
			
		||||
                    Dictionary<string, object> variableMainDic = new Dictionary<string, object>()
 | 
			
		||||
                    {
 | 
			
		||||
                        { "@main_system_guid", guid},
 | 
			
		||||
                        { "@full_name", post.Full_name},
 | 
			
		||||
                        { "@code", post.Code},
 | 
			
		||||
                        { "@created_by", myUserInfo.Userinfo_guid}
 | 
			
		||||
                        { "@system_type", main_system_name},
 | 
			
		||||
                        { "@system_key", post.System_key},
 | 
			
		||||
                        { "@system_value", post.system_value},
 | 
			
		||||
                        { "@system_remark", "系統類別(第2層)"},
 | 
			
		||||
                        { "@system_priority", latestVariable.system_priority + 1},
 | 
			
		||||
                        { "@created_by", myUserInfo.Userinfo_guid},
 | 
			
		||||
                        { "@created_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}
 | 
			
		||||
                    };
 | 
			
		||||
                    await backendRepository.AddOneByCustomTable(systemMainDic, "main_system");
 | 
			
		||||
                    await backendRepository.AddOneByCustomTable(variableMainDic, "variable");
 | 
			
		||||
 | 
			
		||||
                    apiResult.Code = "0000";
 | 
			
		||||
                    apiResult.Msg = "新增成功";
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    Dictionary<string, object> systemMainDic = new Dictionary<string, object>()
 | 
			
		||||
                    Dictionary<string, object> variableMainDic = new Dictionary<string, object>()
 | 
			
		||||
                    {
 | 
			
		||||
                        { "@full_name", post.Full_name},
 | 
			
		||||
                        { "@code", post.Code},
 | 
			
		||||
                        { "@system_key", post.System_key},
 | 
			
		||||
                        { "@system_value", post.system_value},
 | 
			
		||||
                        { "@updated_by", myUserInfo.Userinfo_guid},
 | 
			
		||||
                        { "@updated_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")},
 | 
			
		||||
                    };
 | 
			
		||||
 | 
			
		||||
                    await backendRepository.UpdateOneByCustomTable(systemMainDic, "main_system", "main_system_guid='" + systemMain.Main_system_guid + "'");
 | 
			
		||||
                    await backendRepository.UpdateOneByCustomTable(variableMainDic, "variable", "id='" + systemMain.id + "' AND deleted = 0");
 | 
			
		||||
 | 
			
		||||
                    var AuthCodes = await backendRepository.GetAllAsync<string>(
 | 
			
		||||
                        @$"select AuthCode from auth_page ap 
 | 
			
		||||
                        join sub_system ss on ss.sub_system_guid = ap.ShowView 
 | 
			
		||||
                        join main_system ms on ms.main_system_guid = ss.main_system_guid 
 | 
			
		||||
                        where ms.main_system_guid = '{systemMain.Main_system_guid}'");
 | 
			
		||||
                        @$"select AuthCode
 | 
			
		||||
                            from auth_page ap
 | 
			
		||||
                            join variable sv on ap.ShowView = sv.system_value and sv.system_type = 'device_system_category_layer1'
 | 
			
		||||
                            where sv.id = '{systemMain.id}'");
 | 
			
		||||
 | 
			
		||||
                    if(AuthCodes.Count > 0)
 | 
			
		||||
                    {
 | 
			
		||||
                        await backendRepository.ExecuteSql($@"UPDATE auth_page
 | 
			
		||||
                        SET MainName = '{post.Full_name}'
 | 
			
		||||
                        SET MainName = '{post.System_key}'
 | 
			
		||||
                        WHERE AuthCode IN @authCode;",new { authCode = AuthCodes });
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    #region 新增至派送資料表
 | 
			
		||||
                    var auth_Pages = await backendRepository.GetAllAsync<Auth_page>("auth_page", "");
 | 
			
		||||
                    List<Dictionary<string, object>> authPagesDics = new List<Dictionary<string, object>>();
 | 
			
		||||
                    foreach (var auth_page in auth_Pages)
 | 
			
		||||
                    {
 | 
			
		||||
                        Dictionary<string, object> authPagesDic = new Dictionary<string, object>()
 | 
			
		||||
                        {
 | 
			
		||||
                            { "@AuthCode", auth_page.AuthCode},
 | 
			
		||||
                            { "@AuthType", auth_page.AuthType},
 | 
			
		||||
                            { "@MainName", auth_page.MainName},
 | 
			
		||||
                            { "@SubName", auth_page.SubName},
 | 
			
		||||
                            { "@building_guid", auth_page.building_guid},
 | 
			
		||||
                            { "@ShowView", auth_page.ShowView},
 | 
			
		||||
                            { "@created_at", auth_page.created_at},
 | 
			
		||||
                        };
 | 
			
		||||
 | 
			
		||||
                        authPagesDics.Add(authPagesDic);
 | 
			
		||||
                    }
 | 
			
		||||
                    await backendRepository.ManualInsertBackgroundServiceTask("", "", "auth_page", "purge_all_insert", authPagesDics);
 | 
			
		||||
                    #endregion
 | 
			
		||||
                    } 
 | 
			
		||||
 | 
			
		||||
                    apiResult.Code = "0000";
 | 
			
		||||
                    apiResult.Msg = "修改成功";
 | 
			
		||||
@ -185,17 +174,17 @@ namespace Backend.Controllers
 | 
			
		||||
        /// <param name="guid"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        public async Task<ApiResult<string>> DeleteOneSystemMain(string guid)
 | 
			
		||||
        public async Task<ApiResult<string>> DeleteOneSystemMain(int id)
 | 
			
		||||
        {
 | 
			
		||||
            ApiResult<string> apiResult = new ApiResult<string>();
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                string sWhere = @$"deleted = @Deleted AND main_system_guid = @Guid";
 | 
			
		||||
                string sWhere = @$"deleted = @Deleted AND id = @id";
 | 
			
		||||
 | 
			
		||||
                object param = new { Deleted = 0, Guid = guid };
 | 
			
		||||
                object param = new { Deleted = 0, id = id };
 | 
			
		||||
 | 
			
		||||
                var systemMain = await backendRepository.GetOneAsync<SystemMain>("main_system", sWhere, param);
 | 
			
		||||
                var systemMain = await backendRepository.GetOneAsync<VariableInfo>("variable", sWhere, param);
 | 
			
		||||
 | 
			
		||||
                if (systemMain == null)
 | 
			
		||||
                {
 | 
			
		||||
@ -208,11 +197,11 @@ namespace Backend.Controllers
 | 
			
		||||
                var sbuildMenu = $@"SELECT
 | 
			
		||||
                                        b.full_name
 | 
			
		||||
                                    FROM building_menu bm
 | 
			
		||||
                                    LEFT JOIN building b ON bm.building_guid = b.building_guid AND b.deleted = 0
 | 
			
		||||
                                    WHERE bm.main_system_guid = @Guid
 | 
			
		||||
                                    LEFT JOIN building b ON bm.building_tag = b.building_tag AND b.deleted = 0
 | 
			
		||||
                                    WHERE bm.main_system_tag = @System_Value
 | 
			
		||||
                                    GROUP BY b.full_name";
 | 
			
		||||
 | 
			
		||||
                var buildMenus = await backendRepository.GetAllAsync<string>(sbuildMenu, new { Guid = guid });
 | 
			
		||||
                var buildMenus = await backendRepository.GetAllAsync<string>(sbuildMenu, new { System_Value = systemMain.system_value });
 | 
			
		||||
                if (buildMenus.Count > 0)
 | 
			
		||||
                {
 | 
			
		||||
                    apiResult.Code = "9997";
 | 
			
		||||
@ -222,19 +211,20 @@ namespace Backend.Controllers
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                //檢查底下是否有未刪除的系統小類
 | 
			
		||||
                string sSubWhere = @$"deleted = @Deleted AND main_system_guid = @Guid";
 | 
			
		||||
                object sub_param = new { Deleted = 0, Guid = systemMain.Main_system_guid };
 | 
			
		||||
                var systemSubs = await backendRepository.GetAllAsync<SystemSub>("sub_system", sWhere, param);
 | 
			
		||||
                string sqlSub = @$"SELECT id FROM variable
 | 
			
		||||
                                    WHERE deleted = @Deleted AND system_parent_id = @id";
 | 
			
		||||
                object sub_param = new { Deleted = 0, id = id };
 | 
			
		||||
                var v = await backendRepository.GetAllAsync<VariableInfo>(sqlSub, sub_param);
 | 
			
		||||
 | 
			
		||||
                if (systemSubs.Count > 0)
 | 
			
		||||
                if (v.Count > 0)
 | 
			
		||||
                {
 | 
			
		||||
                    apiResult.Code = "9997";
 | 
			
		||||
                    apiResult.Msg = "系統小類中尚有小類正在使用系統大類,故無法刪除";
 | 
			
		||||
                    apiResult.Data = string.Join("<br>", systemSubs.Select(x => x.Full_name).ToList());
 | 
			
		||||
                    apiResult.Data = string.Join("<br>", v.Where(x => x.id == id).Select(x => x.System_key).ToList());
 | 
			
		||||
                    return apiResult;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                await backendRepository.DeleteOne(guid, "main_system", "main_system_guid");
 | 
			
		||||
                await backendRepository.DeleteOne(id.ToString(), "variable", "id");
 | 
			
		||||
 | 
			
		||||
                apiResult.Code = "0000";
 | 
			
		||||
                apiResult.Msg = "刪除成功";
 | 
			
		||||
@ -243,7 +233,7 @@ namespace Backend.Controllers
 | 
			
		||||
            {
 | 
			
		||||
                apiResult.Code = "9999";
 | 
			
		||||
                apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
 | 
			
		||||
                Logger.LogError("【" + controllerName + "/" + actionName + "】" + "main_system_guid=" + guid);
 | 
			
		||||
                Logger.LogError("【" + controllerName + "/" + actionName + "】" + "id=" + id);
 | 
			
		||||
                Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -256,18 +246,17 @@ namespace Backend.Controllers
 | 
			
		||||
        /// <param name="main_system_guid"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        public async Task<ApiResult<List<SystemSub>>> SystemSubList(string main_system_guid)
 | 
			
		||||
        public async Task<ApiResult<List<VariableInfo>>> SystemSubList(int id)
 | 
			
		||||
        {
 | 
			
		||||
            ApiResult<List<SystemSub>> apiResult = new ApiResult<List<SystemSub>>();
 | 
			
		||||
            ApiResult<List<VariableInfo>> apiResult = new ApiResult<List<VariableInfo>>();
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                var sWhere = @"deleted = @Deleted AND system_parent_id = @id";
 | 
			
		||||
 | 
			
		||||
                var sWhere = @"deleted = @Deleted AND main_system_guid = @Main_system_guid";
 | 
			
		||||
                object param = new { Deleted = 0, id = id};
 | 
			
		||||
 | 
			
		||||
                object param = new { Deleted = 0, Main_system_guid = main_system_guid };
 | 
			
		||||
 | 
			
		||||
                var systemSubs = await backendRepository.GetAllAsync<SystemSub>("sub_system", sWhere, param, "priority ASC, created_at DESC");
 | 
			
		||||
                var systemSubs = await backendRepository.GetAllAsync<VariableInfo>("variable", sWhere, param, "system_priority ASC, created_at DESC");
 | 
			
		||||
 | 
			
		||||
                apiResult.Code = "0000";
 | 
			
		||||
                apiResult.Data = systemSubs;
 | 
			
		||||
@ -287,17 +276,17 @@ namespace Backend.Controllers
 | 
			
		||||
        /// <param name="guid"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        public async Task<ApiResult<SystemSub>> GetOneSystemSub(string guid)
 | 
			
		||||
        public async Task<ApiResult<VariableInfo>> GetOneSystemSub(int id)
 | 
			
		||||
        {
 | 
			
		||||
            ApiResult<SystemSub> apiResult = new ApiResult<SystemSub>();
 | 
			
		||||
            ApiResult<VariableInfo> apiResult = new ApiResult<VariableInfo>();
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                string sWhere = @$"deleted = @Deleted AND sub_system_guid = @Guid";
 | 
			
		||||
                string sWhere = @$"deleted = @Deleted AND id = @id";
 | 
			
		||||
 | 
			
		||||
                object param = new { Deleted = 0, Guid = guid };
 | 
			
		||||
                object param = new { Deleted = 0, id = id };
 | 
			
		||||
 | 
			
		||||
                var systemSub = await backendRepository.GetOneAsync<SystemSub>("sub_system", sWhere, param);
 | 
			
		||||
                var systemSub = await backendRepository.GetOneAsync<VariableInfo>("variable", sWhere, param);
 | 
			
		||||
 | 
			
		||||
                apiResult.Code = "0000";
 | 
			
		||||
                apiResult.Data = systemSub;
 | 
			
		||||
@ -317,32 +306,40 @@ namespace Backend.Controllers
 | 
			
		||||
        /// <param name="post"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        public async Task<ApiResult<string>> SaveSystemSub(SystemSub post)
 | 
			
		||||
        public async Task<ApiResult<string>> SaveSystemSub(VariableInfo post)
 | 
			
		||||
        {
 | 
			
		||||
            ApiResult<string> apiResult = new ApiResult<string>();
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                string sWhere = @$"deleted = @Deleted AND sub_system_guid = @Guid";
 | 
			
		||||
                string sWhere = @$"deleted = @Deleted AND id = @id";
 | 
			
		||||
 | 
			
		||||
                object param = new { Deleted = 0, Guid = post.Sub_system_guid };
 | 
			
		||||
                object param = new { Deleted = 0, id = post.id };
 | 
			
		||||
 | 
			
		||||
                var systemSub = await backendRepository.GetOneAsync<SystemSub>("sub_system", sWhere, param);
 | 
			
		||||
                var systemSub = await backendRepository.GetOneAsync<VariableInfo>("variable", sWhere, param);
 | 
			
		||||
 | 
			
		||||
                if (systemSub == null)
 | 
			
		||||
                {
 | 
			
		||||
                    //新增
 | 
			
		||||
                    //產生一組GUID
 | 
			
		||||
                    var guid = Guid.NewGuid();  //GUID
 | 
			
		||||
                    //獲取最新的大類
 | 
			
		||||
                    sWhere = @$"deleted = @Deleted AND system_type = @System_type";
 | 
			
		||||
                    param = new { Deleted = 0, System_type = sub_system_name };
 | 
			
		||||
                    var sOrder = @"id DESC LIMIT 1";
 | 
			
		||||
                    var latestVariable = await backendRepository.GetOneAsync<VariableInfo>("variable", sWhere, param, sOrder);
 | 
			
		||||
 | 
			
		||||
                    Dictionary<string, object> systemSubDic = new Dictionary<string, object>()
 | 
			
		||||
                    {
 | 
			
		||||
                        { "@sub_system_guid", guid},
 | 
			
		||||
                        { "@main_system_guid", post.Main_system_guid},
 | 
			
		||||
                        { "@full_name", post.Full_name},
 | 
			
		||||
                        { "@created_by", myUserInfo.Userinfo_guid}
 | 
			
		||||
                        { "@system_type", sub_system_name},
 | 
			
		||||
                        { "@system_key", post.System_key},
 | 
			
		||||
                        { "@system_value", post.system_value},
 | 
			
		||||
                        { "@system_parent_id", post.system_parent_id},
 | 
			
		||||
                        { "@system_remark", "系統類別(第1層)"},
 | 
			
		||||
                        { "@system_priority", latestVariable.system_priority + 1},
 | 
			
		||||
                        { "@created_by", myUserInfo.Userinfo_guid},
 | 
			
		||||
                        { "@created_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}
 | 
			
		||||
                    };
 | 
			
		||||
                    await backendRepository.AddOneByCustomTable(systemSubDic, "sub_system");
 | 
			
		||||
                    await backendRepository.AddOneByCustomTable(systemSubDic, "variable");
 | 
			
		||||
 | 
			
		||||
                    apiResult.Code = "0000";
 | 
			
		||||
                    apiResult.Msg = "新增成功";
 | 
			
		||||
@ -351,45 +348,26 @@ namespace Backend.Controllers
 | 
			
		||||
                {
 | 
			
		||||
                    Dictionary<string, object> systemSubDic = new Dictionary<string, object>()
 | 
			
		||||
                    {
 | 
			
		||||
                        { "@full_name", post.Full_name},
 | 
			
		||||
                        
 | 
			
		||||
                        { "@system_key", post.System_key},
 | 
			
		||||
                        { "@system_value", post.system_value},
 | 
			
		||||
                        { "@updated_by", myUserInfo.Userinfo_guid},
 | 
			
		||||
                        { "@updated_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")},
 | 
			
		||||
                    };
 | 
			
		||||
 | 
			
		||||
                    await backendRepository.UpdateOneByCustomTable(systemSubDic, "sub_system", "sub_system_guid='" + systemSub.Sub_system_guid + "'");
 | 
			
		||||
                    await backendRepository.UpdateOneByCustomTable(systemSubDic, "variable", "id='" + systemSub.id + "'");
 | 
			
		||||
 | 
			
		||||
                    var AuthCodes = await backendRepository.GetAllAsync<string>(
 | 
			
		||||
                        @$"select AuthCode from auth_page ap 
 | 
			
		||||
                        where ap.ShowView = '{systemSub.Sub_system_guid}'");
 | 
			
		||||
                        where ap.ShowView = '{systemSub.id}'");
 | 
			
		||||
 | 
			
		||||
                    if (AuthCodes.Count > 0)
 | 
			
		||||
                    {
 | 
			
		||||
                        await backendRepository.ExecuteSql($@"UPDATE auth_page
 | 
			
		||||
                        SET SubName = '{post.Full_name}'
 | 
			
		||||
                        SET SubName = '{post.System_key}'
 | 
			
		||||
                        WHERE AuthCode IN @authCode;", new { authCode = AuthCodes });
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    #region 新增至派送資料表
 | 
			
		||||
                    var auth_Pages = await backendRepository.GetAllAsync<Auth_page>("auth_page", "");
 | 
			
		||||
                    List<Dictionary<string, object>> authPagesDics = new List<Dictionary<string, object>>();
 | 
			
		||||
                    foreach (var auth_page in auth_Pages)
 | 
			
		||||
                    {
 | 
			
		||||
                        Dictionary<string, object> authPagesDic = new Dictionary<string, object>()
 | 
			
		||||
                        {
 | 
			
		||||
                            { "@AuthCode", auth_page.AuthCode},
 | 
			
		||||
                            { "@AuthType", auth_page.AuthType},
 | 
			
		||||
                            { "@MainName", auth_page.MainName},
 | 
			
		||||
                            { "@SubName", auth_page.SubName},
 | 
			
		||||
                            { "@building_guid", auth_page.building_guid},
 | 
			
		||||
                            { "@ShowView", auth_page.ShowView},
 | 
			
		||||
                            { "@created_at", auth_page.created_at},
 | 
			
		||||
                        };
 | 
			
		||||
 | 
			
		||||
                        authPagesDics.Add(authPagesDic);
 | 
			
		||||
                    }
 | 
			
		||||
                    await backendRepository.ManualInsertBackgroundServiceTask("", "", "auth_page", "purge_all_insert", authPagesDics);
 | 
			
		||||
                    #endregion
 | 
			
		||||
 | 
			
		||||
                    apiResult.Code = "0000";
 | 
			
		||||
                    apiResult.Msg = "修改成功";
 | 
			
		||||
                }
 | 
			
		||||
@ -412,17 +390,17 @@ namespace Backend.Controllers
 | 
			
		||||
        /// <param name="guid"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        public async Task<ApiResult<string>> DeleteOneSystemSub(string guid)
 | 
			
		||||
        public async Task<ApiResult<string>> DeleteOneSystemSub(string id)
 | 
			
		||||
        {
 | 
			
		||||
            ApiResult<string> apiResult = new ApiResult<string>();
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                string sWhere = @$"deleted = @Deleted AND sub_system_guid = @Guid";
 | 
			
		||||
                string sWhere = @$"deleted = @Deleted AND id = @id";
 | 
			
		||||
 | 
			
		||||
                object param = new { Deleted = 0, Guid = guid };
 | 
			
		||||
                object param = new { Deleted = 0, id = id };
 | 
			
		||||
 | 
			
		||||
                var systemSub = await backendRepository.GetOneAsync<SystemSub>("sub_system", sWhere, param);
 | 
			
		||||
                var systemSub = await backendRepository.GetOneAsync<VariableInfo>("variable", sWhere, param);
 | 
			
		||||
 | 
			
		||||
                if (systemSub == null)
 | 
			
		||||
                {
 | 
			
		||||
@ -433,13 +411,14 @@ namespace Backend.Controllers
 | 
			
		||||
 | 
			
		||||
                //檢查是否有未刪除的區域選單
 | 
			
		||||
                var sbuildMenu = $@"SELECT
 | 
			
		||||
                                        CONCAT(b.full_name, ' - ', ms.full_name)
 | 
			
		||||
	                                    CONCAT(b.full_name, ' - ', v2.system_key)
 | 
			
		||||
                                    FROM building_menu bm
 | 
			
		||||
                                    LEFT JOIN building b ON bm.building_guid = b.building_guid AND b.deleted = 0
 | 
			
		||||
                                    LEFT JOIN main_system ms ON bm.main_system_guid = ms.main_system_guid AND ms.deleted = 0
 | 
			
		||||
                                    WHERE bm.sub_system_guid = @Guid";
 | 
			
		||||
                                    LEFT JOIN building b ON bm.building_tag = b.building_tag AND b.deleted = 0
 | 
			
		||||
                                    LEFT JOIN variable v1 ON bm.sub_system_tag = v1.system_value AND v1.deleted = 0
 | 
			
		||||
                                    LEFT JOIN variable v2 ON v1.system_parent_id = v2.id AND v1.deleted = 0
 | 
			
		||||
                                    WHERE v1.id = @id";
 | 
			
		||||
 | 
			
		||||
                var buildMenus = await backendRepository.GetAllAsync<string>(sbuildMenu, new { Guid = guid });
 | 
			
		||||
                var buildMenus = await backendRepository.GetAllAsync<string>(sbuildMenu, new { id = id });
 | 
			
		||||
                if (buildMenus.Count > 0)
 | 
			
		||||
                {
 | 
			
		||||
                    apiResult.Code = "9997";
 | 
			
		||||
@ -450,16 +429,15 @@ namespace Backend.Controllers
 | 
			
		||||
 | 
			
		||||
                //檢查是否有未刪除的系統小類樓層
 | 
			
		||||
                var ssubSystemFloor = $@"SELECT
 | 
			
		||||
                                            CONCAT(b.full_name, ' - ', ms.full_name, ' - ', ss.full_name, ' - ', f.full_name)
 | 
			
		||||
		                                        CONCAT(b.full_name, ' - ', v1.full_name, ' - ', v2.full_name, ' - ', f.full_name)
 | 
			
		||||
                                        FROM sub_system_floor ssf
 | 
			
		||||
                                        LEFT JOIN building b ON ssf.building_guid = b.building_guid AND b.deleted = 0
 | 
			
		||||
                                        LEFT JOIN main_system ms ON ssf.main_system_guid = ms.main_system_guid AND ms.deleted = 0
 | 
			
		||||
                                        LEFT JOIN sub_system ss ON ssf.sub_system_guid = ss.sub_system_guid AND ss.deleted = 0
 | 
			
		||||
                                        LEFT JOIN building b ON ssf.building_tag = b.building_tag AND b.deleted = 0
 | 
			
		||||
                                        LEFT JOIN variable v2 ON v2.system_value = ssf.sub_system_tag AND v2.deleted = 0
 | 
			
		||||
                                        LEFT JOIN variable v1 ON v1.system_parent_id = v1.id AND v1.deleted = 0
 | 
			
		||||
                                        LEFT JOIN floor f ON ssf.floor_guid = f.floor_guid AND f.deleted = 0
 | 
			
		||||
                                        WHERE ssf.sub_system_guid = @Guid 
 | 
			
		||||
                                          AND ssf.deleted = 0";
 | 
			
		||||
                                        WHERE v2.id = @id AND ssf.deleted = 0";
 | 
			
		||||
 | 
			
		||||
                var subSystemFloor = await backendRepository.GetAllAsync<string>(sbuildMenu, new { Guid = guid });
 | 
			
		||||
                var subSystemFloor = await backendRepository.GetAllAsync<string>(sbuildMenu, new { id = id });
 | 
			
		||||
                if (subSystemFloor.Count > 0)
 | 
			
		||||
                {
 | 
			
		||||
                    apiResult.Code = "9997";
 | 
			
		||||
@ -470,12 +448,12 @@ namespace Backend.Controllers
 | 
			
		||||
 | 
			
		||||
                //檢查是否有未刪除的設備項目
 | 
			
		||||
                var sdeviceItem = $@"SELECT 
 | 
			
		||||
                                        di.full_name
 | 
			
		||||
		                                di.full_name
 | 
			
		||||
                                    FROM device_item di
 | 
			
		||||
                                    WHERE di.deleted = 0
 | 
			
		||||
                                      AND di.sub_system_guid = @Guid";
 | 
			
		||||
                                    INNER JOIN variable v on di.device_name_tag = v.system_value
 | 
			
		||||
                                    WHERE v.deleted = 0 AND v.id = @id AND di.deleted = 0";
 | 
			
		||||
 | 
			
		||||
                var deviceItems = await backendRepository.GetAllAsync<string>(sdeviceItem, new { Guid = guid });
 | 
			
		||||
                var deviceItems = await backendRepository.GetAllAsync<string>(sdeviceItem, new { id = id });
 | 
			
		||||
                if (deviceItems.Count > 0)
 | 
			
		||||
                {
 | 
			
		||||
                    apiResult.Code = "9997";
 | 
			
		||||
@ -484,7 +462,7 @@ namespace Backend.Controllers
 | 
			
		||||
                    return apiResult;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                await backendRepository.DeleteOne(guid, "sub_system", "sub_system_guid");
 | 
			
		||||
                await backendRepository.DeleteOne(id, "variable", "id");
 | 
			
		||||
 | 
			
		||||
                apiResult.Code = "0000";
 | 
			
		||||
                apiResult.Msg = "刪除成功";
 | 
			
		||||
@ -493,7 +471,7 @@ namespace Backend.Controllers
 | 
			
		||||
            {
 | 
			
		||||
                apiResult.Code = "9999";
 | 
			
		||||
                apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
 | 
			
		||||
                Logger.LogError("【" + controllerName + "/" + actionName + "】" + "sub_system_guid=" + guid);
 | 
			
		||||
                Logger.LogError("【" + controllerName + "/" + actionName + "】" + "id=" + id);
 | 
			
		||||
                Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -510,10 +488,10 @@ namespace Backend.Controllers
 | 
			
		||||
                //檢查是否有未刪除的區域選單
 | 
			
		||||
                if(device_Item.is_show_riserDiagram == 1)
 | 
			
		||||
                {
 | 
			
		||||
                    var sql_show_riserDiagram = $@"SELECT * FROM device_item di
 | 
			
		||||
                                    WHERE di.sub_system_guid = @SubSystemGuid AND di.deleted = 0 AND is_show_riserDiagram = 1";
 | 
			
		||||
                    var sql_show_riserDiagram = $@"SELECT * FROM device_item di 
 | 
			
		||||
                                                    WHERE di.id = @id AND di.deleted = 0 AND is_show_riserDiagram = 1";
 | 
			
		||||
 | 
			
		||||
                    var is_show_riserDiagram = await backendRepository.GetAllAsync<string>(sql_show_riserDiagram, new { SubSystemGuid = device_Item.sub_system_guid });
 | 
			
		||||
                    var is_show_riserDiagram = await backendRepository.GetAllAsync<string>(sql_show_riserDiagram, new { id = device_Item.id });
 | 
			
		||||
 | 
			
		||||
                    if (is_show_riserDiagram.Count() > 0)
 | 
			
		||||
                    {
 | 
			
		||||
@ -523,16 +501,15 @@ namespace Backend.Controllers
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (device_Item.device_item_guid == null)
 | 
			
		||||
                if (device_Item.id == 0)
 | 
			
		||||
                {
 | 
			
		||||
                    var main_tag = await backendRepository.GetOneAsync<string>($@"SELECT system_value FROM variable WHERE id = @id", new { id = device_Item.device_system_tag });
 | 
			
		||||
                    var sub_tag = await backendRepository.GetOneAsync<string>($@"SELECT system_value FROM variable WHERE id = @id", new { id = device_Item.device_name_tag });
 | 
			
		||||
                    //新增
 | 
			
		||||
                    //產生一組GUID
 | 
			
		||||
                    var guid = Guid.NewGuid();  //GUID
 | 
			
		||||
 | 
			
		||||
                    Dictionary<string, object> Device_itemDic = new Dictionary<string, object>()
 | 
			
		||||
                    {
 | 
			
		||||
                        { "@device_item_guid", guid},
 | 
			
		||||
                        { "@sub_system_guid", device_Item.sub_system_guid},
 | 
			
		||||
                        { "@device_system_tag", main_tag},
 | 
			
		||||
                        { "@device_name_tag", sub_tag},
 | 
			
		||||
                        { "@full_name", device_Item.full_name},
 | 
			
		||||
                        { "@points", device_Item.points},
 | 
			
		||||
                        { "@unit", device_Item.unit},
 | 
			
		||||
@ -540,6 +517,7 @@ namespace Backend.Controllers
 | 
			
		||||
                        { "@is_show_riserDiagram", device_Item.is_show_riserDiagram},
 | 
			
		||||
                        { "@is_controll", device_Item.is_controll},
 | 
			
		||||
                        { "@is_bool", device_Item.is_bool},
 | 
			
		||||
                        { "@is_link", device_Item.is_link},
 | 
			
		||||
                        { "@created_by", myUserInfo.Userinfo_guid},
 | 
			
		||||
                    };
 | 
			
		||||
                    await backendRepository.AddOneByCustomTable(Device_itemDic, "device_item");
 | 
			
		||||
@ -551,7 +529,6 @@ namespace Backend.Controllers
 | 
			
		||||
                {
 | 
			
		||||
                    Dictionary<string, object> Device_itemDic = new Dictionary<string, object>()
 | 
			
		||||
                    {
 | 
			
		||||
                        { "@sub_system_guid", device_Item.sub_system_guid},
 | 
			
		||||
                        { "@full_name", device_Item.full_name},
 | 
			
		||||
                        { "@points", device_Item.points},
 | 
			
		||||
                        { "@unit", device_Item.unit},
 | 
			
		||||
@ -559,11 +536,12 @@ namespace Backend.Controllers
 | 
			
		||||
                        { "@is_show_riserDiagram", device_Item.is_show_riserDiagram},
 | 
			
		||||
                        { "@is_controll", device_Item.is_controll},
 | 
			
		||||
                        { "@is_bool", device_Item.is_bool},
 | 
			
		||||
                        { "@is_link", device_Item.is_link},
 | 
			
		||||
                        { "@updated_by", myUserInfo.Userinfo_guid},
 | 
			
		||||
                        { "@updated_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")},
 | 
			
		||||
                    };
 | 
			
		||||
 | 
			
		||||
                    await backendRepository.UpdateOneByCustomTable(Device_itemDic, "device_item", "device_item_guid='" + device_Item.device_item_guid + "'");
 | 
			
		||||
                    await backendRepository.UpdateOneByCustomTable(Device_itemDic, "device_item", "id='" + device_Item.id + "'");
 | 
			
		||||
 | 
			
		||||
                    apiResult.Code = "0000";
 | 
			
		||||
                    apiResult.Msg = "修改成功";
 | 
			
		||||
@ -582,17 +560,21 @@ namespace Backend.Controllers
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        public async Task<ApiResult<List<Device_item>>> DeviceItemTable(string sub_system_guid)
 | 
			
		||||
        public async Task<ApiResult<List<Device_item>>> DeviceItemTable(int id)
 | 
			
		||||
        {
 | 
			
		||||
            ApiResult<List<Device_item>> apiResult = new ApiResult<List<Device_item>>();
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                var sWhere = @"deleted = @Deleted AND sub_system_guid = @Sub_system_guid";
 | 
			
		||||
                var sql = @"SELECT di.*
 | 
			
		||||
                            FROM device_item di
 | 
			
		||||
                            JOIN variable v1 ON di.device_name_tag = v1.system_value
 | 
			
		||||
                            JOIN variable v2 ON v1.system_parent_id = v2.id AND di.device_system_tag = v2.system_value
 | 
			
		||||
                            WHERE v1.id = @id AND di.deleted = @Deleted";
 | 
			
		||||
 | 
			
		||||
                object param = new { Deleted = 0, Sub_system_guid = sub_system_guid };
 | 
			
		||||
                object param = new { Deleted = 0, id = id };
 | 
			
		||||
 | 
			
		||||
                var systemSubs = await backendRepository.GetAllAsync<Device_item>("device_item", sWhere, param, "created_at DESC");
 | 
			
		||||
                var systemSubs = await backendRepository.GetAllAsync<Device_item>(sql, param);
 | 
			
		||||
 | 
			
		||||
                apiResult.Code = "0000";
 | 
			
		||||
                apiResult.Data = systemSubs;
 | 
			
		||||
@ -607,15 +589,15 @@ namespace Backend.Controllers
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        public async Task<ApiResult<Device_item>> GetOneDeviceItem(string guid)
 | 
			
		||||
        public async Task<ApiResult<Device_item>> GetOneDeviceItem(int id)
 | 
			
		||||
        {
 | 
			
		||||
            ApiResult<Device_item> apiResult = new ApiResult<Device_item>();
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                string sWhere = @$"deleted = @Deleted AND device_item_guid = @Guid";
 | 
			
		||||
                string sWhere = @$"deleted = @Deleted AND id = @id";
 | 
			
		||||
 | 
			
		||||
                object param = new { Deleted = 0, Guid = guid };
 | 
			
		||||
                object param = new { Deleted = 0, id = id };
 | 
			
		||||
 | 
			
		||||
                var Deviceitem = await backendRepository.GetOneAsync<Device_item>("device_item", sWhere, param);
 | 
			
		||||
 | 
			
		||||
@ -632,15 +614,15 @@ namespace Backend.Controllers
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        public async Task<ApiResult<string>> DeleteOneSystemSubDeviceItem(string guid)
 | 
			
		||||
        public async Task<ApiResult<string>> DeleteOneSystemSubDeviceItem(int id)
 | 
			
		||||
        {
 | 
			
		||||
            ApiResult<string> apiResult = new ApiResult<string>();
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                string sWhere = @$"deleted = @Deleted AND device_item_guid = @Guid";
 | 
			
		||||
                string sWhere = @$"deleted = @Deleted AND id = @id";
 | 
			
		||||
 | 
			
		||||
                object param = new { Deleted = 0, Guid = guid };
 | 
			
		||||
                object param = new { Deleted = 0, id = id};
 | 
			
		||||
 | 
			
		||||
                var device_Item = await backendRepository.GetOneAsync<Device_item>("device_item", sWhere, param);
 | 
			
		||||
 | 
			
		||||
@ -651,7 +633,7 @@ namespace Backend.Controllers
 | 
			
		||||
                    return apiResult;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                await backendRepository.DeleteOne(guid, "device_item", "device_item_guid");
 | 
			
		||||
                await backendRepository.DeleteOne(id.ToString(), "device_item", "id");
 | 
			
		||||
 | 
			
		||||
                apiResult.Code = "0000";
 | 
			
		||||
                apiResult.Msg = "刪除成功";
 | 
			
		||||
@ -660,7 +642,7 @@ namespace Backend.Controllers
 | 
			
		||||
            {
 | 
			
		||||
                apiResult.Code = "9999";
 | 
			
		||||
                apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
 | 
			
		||||
                Logger.LogError("【" + controllerName + "/" + actionName + "】" + "device_item_guid=" + guid);
 | 
			
		||||
                Logger.LogError("【" + controllerName + "/" + actionName + "】" + "id=" + id);
 | 
			
		||||
                Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -672,7 +654,13 @@ namespace Backend.Controllers
 | 
			
		||||
            ApiResult<bool> apiResult = new ApiResult<bool>();
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                var point = await backendRepository.GetOneAsync<Device_item>("device_item", $" sub_system_guid = '{post.sub_system_guid}' and points = '{post.points}' and device_item_guid != '{post.device_item_guid}' and deleted = 0");
 | 
			
		||||
                var sql = $@"SELECT *
 | 
			
		||||
                            FROM device_item di
 | 
			
		||||
                            INNER JOIN variable v ON di.device_name_tag = v.system_value
 | 
			
		||||
                            WHERE v.id = @SubId AND di.id != @Id AND points = @Points";
 | 
			
		||||
 | 
			
		||||
                var param = new { SubId = post.subId, Points = post.points, id = post.id };
 | 
			
		||||
                var point = await backendRepository.GetOneAsync<Device_item>(sql, param);
 | 
			
		||||
                if (point != null)
 | 
			
		||||
                {
 | 
			
		||||
                    apiResult.Data = true;
 | 
			
		||||
@ -700,9 +688,9 @@ namespace Backend.Controllers
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                var tags = await backendRepository.GetAllAsync<Tags>(
 | 
			
		||||
                    @$"select * from (select dk.device_building_tag ,dk.device_name_tag,dk.device_system_tag from device_kind dk  where dk.device_normal_point_guid = '{post.guid}') dkn
 | 
			
		||||
                    union(select dk.device_building_tag, dk.device_name_tag, dk.device_system_tag from device_kind dk  where dk.device_close_point_guid = '{post.guid}')
 | 
			
		||||
                    union(select dk.device_building_tag, dk.device_name_tag, dk.device_system_tag from device_kind dk  where dk.device_error_point_guid = '{post.guid}')");
 | 
			
		||||
                    @$"select * from (select dk.device_building_tag ,dk.device_name_tag,dk.device_system_tag from device_kind dk  where dk.device_normal_point_id = @id) dkn
 | 
			
		||||
                    union(select dk.device_building_tag, dk.device_name_tag, dk.device_system_tag from device_kind dk  where dk.device_close_point_id = @id)
 | 
			
		||||
                    union(select dk.device_building_tag, dk.device_name_tag, dk.device_system_tag from device_kind dk  where dk.device_error_point_id = @id)", new { id = post.guid});
 | 
			
		||||
 | 
			
		||||
                if (tags.Count == 0)
 | 
			
		||||
                {
 | 
			
		||||
@ -722,20 +710,24 @@ namespace Backend.Controllers
 | 
			
		||||
                    };
 | 
			
		||||
                    var unionsql = "";
 | 
			
		||||
                    var last = tags.Last();
 | 
			
		||||
                    var sub_system = await backendRepository.GetOneAsync<VariableInfo>($@"SELECT * FROM variable WHERE id = @id", new { id = post.subguid });
 | 
			
		||||
                    foreach (var tag in tags)
 | 
			
		||||
                    {
 | 
			
		||||
                        unionsql += $@"select d.building_guid,d.main_system_guid,d.sub_system_guid,d.device_name_tag from device d where d.sub_system_guid = '{post.subguid}' and d.device_building_tag = '{tag.device_building_tag}' and d.device_system_tag = '{tag.device_system_tag}' and d.device_name_tag = '{tag.device_name_tag}' group by d.building_guid,d.main_system_guid,d.sub_system_guid,d.device_name_tag";
 | 
			
		||||
                        unionsql += $@"select d.building_tag,d.device_system_tag,d.device_name_tag,d.device_last_name from device d where d.device_name_tag = '{sub_system.system_value}' 
 | 
			
		||||
                                        and d.device_building_tag = '{tag.device_building_tag}' and d.device_system_tag = '{tag.device_system_tag}' and d.device_name_tag = '{tag.device_name_tag}' group by d.building_guid,d.main_system_guid,d.sub_system_guid,d.device_name_tag";
 | 
			
		||||
                        if (!last.Equals(tag))
 | 
			
		||||
                        {
 | 
			
		||||
                            unionsql += " union ";
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    var sql = @$"select ms.full_name msname,b.full_name bname,s.full_name subname,de.device_name_tag from 
 | 
			
		||||
                    var sql = @$"select v1.system_key msname, b.full_name bname, v2.system_key subname,de.device_last_name as device_name_tag from 
 | 
			
		||||
                                ({unionsql}) de
 | 
			
		||||
                                left join main_system ms on ms.main_system_guid = de.main_system_guid
 | 
			
		||||
                                left join building b on b.building_guid = de.building_guid
 | 
			
		||||
                                left join sub_system s on s.sub_system_guid = de.sub_system_guid";
 | 
			
		||||
                    var names = await backendRepository.GetAllAsync<GetCheckName>(sql);
 | 
			
		||||
                                left join variable v1 on v1.system_value = de.device_system_tag and v1.system_type = @main_system_type
 | 
			
		||||
                                left join building b on b.building_tag = de.building_tag
 | 
			
		||||
                                left join variable v2 on v2.system_value = de.device_name_tag and v1.system_type = @sub_system_type";
 | 
			
		||||
 | 
			
		||||
                    var param = new { main_system_type = main_system_name, sub_system_type = sub_system_name};
 | 
			
		||||
                    var names = await backendRepository.GetAllAsync<GetCheckName>(sql, param);
 | 
			
		||||
                    var count = 0;
 | 
			
		||||
                    foreach (var name in names)
 | 
			
		||||
                    {
 | 
			
		||||
 | 
			
		||||
@ -9,6 +9,7 @@ namespace Backend.Models
 | 
			
		||||
    public class BuildInfo : Actor
 | 
			
		||||
    {
 | 
			
		||||
        public int Priority { get; set; }
 | 
			
		||||
        public string building_tag { get; set; }
 | 
			
		||||
        public string Building_guid { get; set; }  //區域GUID
 | 
			
		||||
        public string Full_name { get; set; } //區域名稱
 | 
			
		||||
        public string Ip_address { get; set; } //監控主機 IP
 | 
			
		||||
 | 
			
		||||
@ -53,11 +53,12 @@ namespace Backend.Models
 | 
			
		||||
        public string Logo { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class Variable
 | 
			
		||||
    public class Variable : Actor
 | 
			
		||||
    {
 | 
			
		||||
        public string System_type { get; set; }
 | 
			
		||||
        public string System_key { get; set; }
 | 
			
		||||
        public string system_value { get; set; }
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class VariableInfo : Variable
 | 
			
		||||
 | 
			
		||||
@ -30,8 +30,12 @@ namespace Backend.Models
 | 
			
		||||
 | 
			
		||||
    public class Device_item : Actor
 | 
			
		||||
    {
 | 
			
		||||
        public int id { get; set; }
 | 
			
		||||
        public string device_item_guid { get; set; }
 | 
			
		||||
        public string sub_system_guid { get; set; }
 | 
			
		||||
        public string device_area_tag { get; set; }
 | 
			
		||||
        public string device_building_tag { get; set; }
 | 
			
		||||
        public string device_system_tag { get; set; }
 | 
			
		||||
        public string device_name_tag { get; set; }
 | 
			
		||||
        public string full_name { get; set; }
 | 
			
		||||
        public string points { get; set; }
 | 
			
		||||
        public string unit { get; set; }
 | 
			
		||||
@ -39,13 +43,14 @@ namespace Backend.Models
 | 
			
		||||
        public byte is_show_riserDiagram { get; set; }
 | 
			
		||||
        public byte is_controll { get; set; }
 | 
			
		||||
        public byte is_bool { get; set; }
 | 
			
		||||
        public byte is_link { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class Checksame
 | 
			
		||||
    {
 | 
			
		||||
        public string sub_system_guid { get; set; }
 | 
			
		||||
        public int id { get; set; }
 | 
			
		||||
        public string subId { get; set; }
 | 
			
		||||
        public string points { get; set; }
 | 
			
		||||
        public string device_item_guid { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class Tags
 | 
			
		||||
 | 
			
		||||
@ -55,7 +55,7 @@
 | 
			
		||||
                },
 | 
			
		||||
                "columns": [
 | 
			
		||||
                    {
 | 
			
		||||
                        "data": "building_guid",
 | 
			
		||||
                        "data": "building_tag",
 | 
			
		||||
                        "render": function (data, type, row, meta) {
 | 
			
		||||
                            return meta.row + 1;
 | 
			
		||||
                        }
 | 
			
		||||
@ -87,7 +87,7 @@
 | 
			
		||||
                ],
 | 
			
		||||
                //"order": [[2, "desc"]],
 | 
			
		||||
                'createdRow': function (row, data, dataIndex) {
 | 
			
		||||
                    $(row).attr('data-guid', data.building_guid);
 | 
			
		||||
                    $(row).attr('data-guid', data.building_tag);
 | 
			
		||||
                },
 | 
			
		||||
                "ajax": {
 | 
			
		||||
                    "url": "/BuildInfo/BuildInfoList",
 | 
			
		||||
@ -107,13 +107,13 @@
 | 
			
		||||
                        //樓層設定上方選單
 | 
			
		||||
                        $("#BuildList").empty();
 | 
			
		||||
                        $.each(data, function (key, value) {
 | 
			
		||||
                            $("#BuildList").append(`<button type="button" class="btn btn-outline-success waves-effect waves-themed ml-2 mb-2 btn-station" id="${value.building_guid}" onclick="clickBuilding('${value.building_guid}')">${value.full_name}</button>`);
 | 
			
		||||
                            $("#BuildList").append(`<button type="button" class="btn btn-outline-success waves-effect waves-themed ml-2 mb-2 btn-station" id="${value.building_tag}" onclick="clickBuilding('${value.building_tag}')">${value.full_name}</button>`);
 | 
			
		||||
                            @*if (key == 0) {
 | 
			
		||||
                                selected_build_guid_top_name = value.full_name;
 | 
			
		||||
                                $("#BuildList").append(`<button type="button" class="btn btn-success waves-effect waves-themed ml-2 mb-2 btn-station" id="${value.building_guid}" onclick="clickBuilding('${value.building_guid}')">${value.full_name}</button>`);
 | 
			
		||||
                                $("#BuildList").append(`<button type="button" class="btn btn-success waves-effect waves-themed ml-2 mb-2 btn-station" id="${value.building_tag}" onclick="clickBuilding('${value.building_tag}')">${value.full_name}</button>`);
 | 
			
		||||
                            }
 | 
			
		||||
                            else {
 | 
			
		||||
                                $("#BuildList").append(`<button type="button" class="btn btn-outline-success waves-effect waves-themed ml-2 mb-2 btn-station" id="${value.building_guid}" onclick="clickBuilding('${value.building_guid}')">${value.full_name}</button>`);
 | 
			
		||||
                                $("#BuildList").append(`<button type="button" class="btn btn-outline-success waves-effect waves-themed ml-2 mb-2 btn-station" id="${value.building_tag}" onclick="clickBuilding('${value.building_tag}')">${value.full_name}</button>`);
 | 
			
		||||
                            }*@
 | 
			
		||||
                        });
 | 
			
		||||
 | 
			
		||||
@ -129,7 +129,7 @@
 | 
			
		||||
                    var rowData = buildInfoTable.row(diff[i].node).data();
 | 
			
		||||
 | 
			
		||||
                    var obj = {
 | 
			
		||||
                        building_guid: rowData.building_guid,
 | 
			
		||||
                        building_tag: rowData.building_tag,
 | 
			
		||||
                        priority: diff[i].newData
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
@ -253,7 +253,7 @@
 | 
			
		||||
                $("#save-building-btn").html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>').attr("disabled", true);
 | 
			
		||||
                var url = "/BuildInfo/SaveBuildInfo";
 | 
			
		||||
                var send_data = {
 | 
			
		||||
                    Building_guid: selected_build_guid,
 | 
			
		||||
                    building_tag: selected_build_guid,
 | 
			
		||||
                    Full_name: $('#build_name_modal').val(),
 | 
			
		||||
                    Ip_address: $('#ip_address_modal').val(),
 | 
			
		||||
                    Ip_port: $('#ip_port_modal').val()
 | 
			
		||||
@ -557,7 +557,7 @@
 | 
			
		||||
                maps = $('#map_file_modal')[0].files
 | 
			
		||||
 | 
			
		||||
                formData.append("Floor_guid", selected_floor_guid);
 | 
			
		||||
                formData.append("Building_guid", selected_build_guid_top);
 | 
			
		||||
                formData.append("building_tag", selected_build_guid_top);
 | 
			
		||||
                formData.append("Full_name", $('#floor_name_modal').val());
 | 
			
		||||
                if (maps.length > 0) {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -53,10 +53,10 @@
 | 
			
		||||
                        }
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "data": "full_name"
 | 
			
		||||
                        "data": "system_key"
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "data": "code"
 | 
			
		||||
                        "data": "system_value"
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "data": "created_at"
 | 
			
		||||
@ -67,7 +67,7 @@
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                'createdRow': function (row, data, dataIndex) {
 | 
			
		||||
                    $(row).attr('data-guid', data.main_system_guid);
 | 
			
		||||
                    $(row).attr('data-guid', data.id);
 | 
			
		||||
                },
 | 
			
		||||
                //"order": [[2, "desc"]],
 | 
			
		||||
                "ajax": {
 | 
			
		||||
@ -89,12 +89,12 @@
 | 
			
		||||
                        $("#system-main-list").empty();
 | 
			
		||||
                        $.each(data, function (key, value) {
 | 
			
		||||
                            if (key == 0) {
 | 
			
		||||
                                selected_system_main_guid_top_name = value.full_name;
 | 
			
		||||
                                $("#system-main-list").append(`<button type="button" class="btn btn-success waves-effect waves-themed ml-2 mb-2 btn-station" id="${value.main_system_guid}" onclick="clickSystemMain('${value.main_system_guid}')">${value.full_name}</button>`);
 | 
			
		||||
                                $(`#${value.main_system_guid}`).trigger("click");
 | 
			
		||||
                                selected_system_main_guid_top_name = value.system_key;
 | 
			
		||||
                                $("#system-main-list").append(`<button type="button" class="btn btn-success waves-effect waves-themed ml-2 mb-2 btn-station" id="${value.id}" onclick="clickSystemMain('${value.id}')">${value.system_key}</button>`);
 | 
			
		||||
                                $(`#${value.id}`).trigger("click");
 | 
			
		||||
                            }
 | 
			
		||||
                            else {
 | 
			
		||||
                                $("#system-main-list").append(`<button type="button" class="btn btn-outline-success waves-effect waves-themed ml-2 mb-2 btn-station" id="${value.main_system_guid}" onclick="clickSystemMain('${value.main_system_guid}')">${value.full_name}</button>`);
 | 
			
		||||
                                $("#system-main-list").append(`<button type="button" class="btn btn-outline-success waves-effect waves-themed ml-2 mb-2 btn-station" id="${value.id}" onclick="clickSystemMain('${value.id}')">${value.system_key}</button>`);
 | 
			
		||||
                            }
 | 
			
		||||
                        });
 | 
			
		||||
 | 
			
		||||
@ -115,7 +115,7 @@
 | 
			
		||||
                var url = "/SystemCategory/GetOneSystemMain";
 | 
			
		||||
 | 
			
		||||
                var send_data = {
 | 
			
		||||
                    guid: selected_system_main_guid
 | 
			
		||||
                    id: selected_system_main_guid
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $.post(url, send_data, function (rel) {
 | 
			
		||||
@ -129,8 +129,8 @@
 | 
			
		||||
                        return;
 | 
			
		||||
                    }
 | 
			
		||||
                    else {
 | 
			
		||||
                        $("#system_main_name_modal").val(rel.data.full_name);
 | 
			
		||||
                        $("#system_main_code_modal").val(rel.data.code);
 | 
			
		||||
                        $("#system_main_name_modal").val(rel.data.system_key);
 | 
			
		||||
                        $("#system_main_code_modal").val(rel.data.system_value);
 | 
			
		||||
 | 
			
		||||
                        $("#system-main-modal").modal();
 | 
			
		||||
                    }
 | 
			
		||||
@ -157,7 +157,7 @@
 | 
			
		||||
                        if (result.value) {
 | 
			
		||||
                            var url = "/SystemCategory/DeleteOneSystemMain";
 | 
			
		||||
                            var send_data = {
 | 
			
		||||
                                Guid: selected_system_main_guid
 | 
			
		||||
                                id: selected_system_main_guid
 | 
			
		||||
                            }
 | 
			
		||||
                            $.post(url, send_data, function (rel) {
 | 
			
		||||
                                if (rel.code != "0000") {
 | 
			
		||||
@ -226,9 +226,9 @@
 | 
			
		||||
 | 
			
		||||
                var url = "/SystemCategory/SaveSystemMain";
 | 
			
		||||
                var send_data = {
 | 
			
		||||
                    Main_system_guid: selected_system_main_guid,
 | 
			
		||||
                    Full_name: $('#system_main_name_modal').val(),
 | 
			
		||||
                    Code: $('#system_main_code_modal').val()
 | 
			
		||||
                    id: selected_system_main_guid,
 | 
			
		||||
                    System_key: $('#system_main_name_modal').val(),
 | 
			
		||||
                    system_value : $('#system_main_code_modal').val()
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $.post(url, send_data, function (rel) {
 | 
			
		||||
@ -278,7 +278,10 @@
 | 
			
		||||
                        }
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "data": "full_name"
 | 
			
		||||
                        "data": "system_key"
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "data": "system_value"
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "data": "created_at"
 | 
			
		||||
@ -289,14 +292,14 @@
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                'createdRow': function (row, data, dataIndex) {
 | 
			
		||||
                    $(row).attr('data-guid', data.sub_system_guid);
 | 
			
		||||
                    $(row).attr('data-guid', data.id);
 | 
			
		||||
                },
 | 
			
		||||
                //"order": [[2, "desc"]],
 | 
			
		||||
                "ajax": {
 | 
			
		||||
                    "url": "/SystemCategory/SystemSubList",
 | 
			
		||||
                    "type": "POST",
 | 
			
		||||
                    "data": function (d) {
 | 
			
		||||
                        d.Main_system_guid = selected_system_main_guid
 | 
			
		||||
                        d.id = selected_system_main_guid
 | 
			
		||||
                    },
 | 
			
		||||
                    "dataSrc": function (rel) {
 | 
			
		||||
                        if (rel.code == "9999") {
 | 
			
		||||
@ -346,20 +349,23 @@
 | 
			
		||||
                    {
 | 
			
		||||
                        "data": "is_bool"
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "data": "is_link"
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "data": null,
 | 
			
		||||
                        "defaultContent": '<button class="btn btn-primary edit-btn">修改</button> <button class="btn btn-danger del-btn">刪除</button>'
 | 
			
		||||
                    }
 | 
			
		||||
                ],
 | 
			
		||||
                'createdRow': function (row, data, dataIndex) {
 | 
			
		||||
                    $(row).attr('data-guid', data.device_item_guid);
 | 
			
		||||
                    $(row).attr('data-guid', data.id);
 | 
			
		||||
                },
 | 
			
		||||
                //"order": [[2, "desc"]],
 | 
			
		||||
                "ajax": {
 | 
			
		||||
                    "url": "/SystemCategory/DeviceItemTable",
 | 
			
		||||
                    "type": "POST",
 | 
			
		||||
                    "data": function (d) {
 | 
			
		||||
                        d.sub_system_guid = selected_system_sub_guid
 | 
			
		||||
                        d.id = selected_system_sub_guid
 | 
			
		||||
                    },
 | 
			
		||||
                    "dataSrc": function (rel) {
 | 
			
		||||
                        if (rel.code == "9999") {
 | 
			
		||||
@ -397,6 +403,12 @@
 | 
			
		||||
                            } else {
 | 
			
		||||
                                rel.is_bool = "是"
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
                            if (rel.is_link == 0) {
 | 
			
		||||
                                rel.is_link = "否"
 | 
			
		||||
                            } else {
 | 
			
		||||
                                rel.is_link = "是"
 | 
			
		||||
                            }
 | 
			
		||||
                        });
 | 
			
		||||
 | 
			
		||||
                        return data;
 | 
			
		||||
@ -416,7 +428,7 @@
 | 
			
		||||
                var url = "/SystemCategory/GetOneSystemSub";
 | 
			
		||||
 | 
			
		||||
                var send_data = {
 | 
			
		||||
                    guid: selected_system_sub_guid
 | 
			
		||||
                    id: selected_system_sub_guid
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $.post(url, send_data, function (rel) {
 | 
			
		||||
@ -431,7 +443,8 @@
 | 
			
		||||
                    }
 | 
			
		||||
                    else {
 | 
			
		||||
                        $("#system_main_name").html(selected_system_main_guid_top_name)
 | 
			
		||||
                        $("#system_sub_name_modal").val(rel.data.full_name);
 | 
			
		||||
                        $("#system_sub_name_modal").val(rel.data.system_key);
 | 
			
		||||
                        $("#system_sub_code_modal").val(rel.data.system_value);
 | 
			
		||||
 | 
			
		||||
                        $("#system-sub-modal").modal();
 | 
			
		||||
                    }
 | 
			
		||||
@ -458,7 +471,7 @@
 | 
			
		||||
                        if (result.value) {
 | 
			
		||||
                            var url = "/SystemCategory/DeleteOneSystemSub";
 | 
			
		||||
                            var send_data = {
 | 
			
		||||
                                Guid: selected_system_sub_guid
 | 
			
		||||
                                id: selected_system_sub_guid
 | 
			
		||||
                            }
 | 
			
		||||
                            $.post(url, send_data, function (rel) {
 | 
			
		||||
                                if (rel.code != "0000") {
 | 
			
		||||
@ -539,9 +552,10 @@
 | 
			
		||||
 | 
			
		||||
                var url = "/SystemCategory/SaveSystemSub";
 | 
			
		||||
                var send_data = {
 | 
			
		||||
                    Sub_system_guid: selected_system_sub_guid,
 | 
			
		||||
                    Main_system_guid: selected_system_main_guid,
 | 
			
		||||
                    Full_name: $('#system_sub_name_modal').val(),
 | 
			
		||||
                    id: selected_system_sub_guid,
 | 
			
		||||
                    system_parent_id: selected_system_main_guid,
 | 
			
		||||
                    system_key: $('#system_sub_name_modal').val(),
 | 
			
		||||
                    system_value: $('#system_sub_code_modal').val()
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $.post(url, send_data, function (rel) {
 | 
			
		||||
@ -610,9 +624,9 @@
 | 
			
		||||
 | 
			
		||||
                var uurl = "/SystemCategory/HaveSamePoints";
 | 
			
		||||
                var ssend_data = {
 | 
			
		||||
                    sub_system_guid: selected_system_sub_guid,
 | 
			
		||||
                    subId: selected_system_sub_guid,
 | 
			
		||||
                    id: selected_system_device_item_guid,
 | 
			
		||||
                    points: $('#device_sub_points_modal').val(),
 | 
			
		||||
                    device_item_guid: selected_system_device_item_guid,
 | 
			
		||||
                }
 | 
			
		||||
                $.post(uurl, ssend_data, function (rel) {
 | 
			
		||||
                    if (rel.code != "0000") {
 | 
			
		||||
@ -633,8 +647,9 @@
 | 
			
		||||
                        else {
 | 
			
		||||
                            var url = "/SystemCategory/Savedevice_item";
 | 
			
		||||
                            var send_data = {
 | 
			
		||||
                                device_item_guid: selected_system_device_item_guid,
 | 
			
		||||
                                sub_system_guid: selected_system_sub_guid,
 | 
			
		||||
                                id: selected_system_device_item_guid,
 | 
			
		||||
                                device_system_tag: selected_system_main_guid,
 | 
			
		||||
                                device_name_tag: selected_system_sub_guid,
 | 
			
		||||
                                full_name: $('#device_sub_name_modal').val(),
 | 
			
		||||
                                points: $('#device_sub_points_modal').val(),
 | 
			
		||||
                                unit: $('#device_sub_unit_modal').val(),
 | 
			
		||||
@ -686,7 +701,7 @@
 | 
			
		||||
            var url = "/SystemCategory/GetOneDeviceItem";
 | 
			
		||||
 | 
			
		||||
            var send_data = {
 | 
			
		||||
                guid: selected_system_device_item_guid
 | 
			
		||||
                id: selected_system_device_item_guid
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $.post(url, send_data, function (rel) {
 | 
			
		||||
@ -708,6 +723,7 @@
 | 
			
		||||
                    $("input[name='is_show_riserDiagram'][value='" + rel.data.is_show_riserDiagram + "']").prop("checked", true);
 | 
			
		||||
                    $("input[name='is_controll'][value='" + rel.data.is_controll + "']").prop("checked", true);
 | 
			
		||||
                    $("input[name='is_bool'][value='" + rel.data.is_bool + "']").prop("checked", true);
 | 
			
		||||
                    $("input[name='is_link'][value='" + rel.data.is_link+ "']").prop("checked", true);
 | 
			
		||||
 | 
			
		||||
                    $("#device-sub-modal").modal();
 | 
			
		||||
                }
 | 
			
		||||
@ -759,7 +775,7 @@
 | 
			
		||||
                                } else {
 | 
			
		||||
                                    var url = "/SystemCategory/DeleteOneSystemSubDeviceItem";
 | 
			
		||||
                                    var send_data = {
 | 
			
		||||
                                        guid: selected_system_device_item_guid
 | 
			
		||||
                                        id: selected_system_device_item_guid
 | 
			
		||||
                                    }
 | 
			
		||||
                                    $.post(url, send_data, function (rel) {
 | 
			
		||||
                                        if (rel.code != "0000") {
 | 
			
		||||
 | 
			
		||||
@ -17,6 +17,7 @@
 | 
			
		||||
                            <th>序</th>
 | 
			
		||||
                            <th>系統大類</th>
 | 
			
		||||
                            <th>系統小類名稱</th>
 | 
			
		||||
                            <th>系統小類代號</th>
 | 
			
		||||
                            <th>建立時間</th>
 | 
			
		||||
                            <th>功能</th>
 | 
			
		||||
                        </tr>
 | 
			
		||||
@ -50,6 +51,7 @@
 | 
			
		||||
                            <th>是否顯示於昇位圖(僅可擇一顯示)</th>
 | 
			
		||||
                            <th>是否加入 - 設備燈號中的點位選單</th>
 | 
			
		||||
                            <th>是否為布林值</th>
 | 
			
		||||
                            <th>是否與N4同步</th>
 | 
			
		||||
                            <th>功能</th>
 | 
			
		||||
                        </tr>
 | 
			
		||||
                    </thead>
 | 
			
		||||
@ -84,6 +86,10 @@
 | 
			
		||||
                            <label class="form-label" for="system_sub_name_modal"><span class="text-danger">*</span>小類名稱</label>
 | 
			
		||||
                            <input type="text" id="system_sub_name_modal" class="form-control" name="system_sub_name_modal">
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="form-group col-12">
 | 
			
		||||
                            <label class="form-label" for="system_sub_code_modal"><span class="text-danger">*</span>代號</label>
 | 
			
		||||
                            <input type="text" id="system_sub_code_modal" class="form-control" name="system_sub_code_modal">
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </form>
 | 
			
		||||
            </div>
 | 
			
		||||
@ -147,6 +153,13 @@
 | 
			
		||||
                                <label class="custom-control-label" for="is_bool">是否為布林值</label>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="form-group col-12">
 | 
			
		||||
                            <div class="col-12 mb-2 custom-control custom-checkbox align-content-center">
 | 
			
		||||
                                <input type="checkbox" class="custom-control-input" name="is_link" id="is_link" value="1" />
 | 
			
		||||
                                <label class="custom-control-label" for="is_link">是否與N4同步</label>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        
 | 
			
		||||
                    </div>
 | 
			
		||||
                </form>
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user