合併衝突
This commit is contained in:
		
						commit
						af7d66e5ee
					
				@ -234,9 +234,9 @@ namespace Backend.Services.Implement
 | 
				
			|||||||
                        row.parent_path = stationName;
 | 
					                        row.parent_path = stationName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        //full_name 其實是點位名稱 point_name 
 | 
					                        //full_name 其實是點位名稱 point_name 
 | 
				
			||||||
                        row.full_name = conPoint.Where(x => x.name == tagName).Select(x => x.displayName).FirstOrDefault();
 | 
					                        row.full_name = conPoint.Where(x => x.name == tagName.Replace('_', '/') && !x.isHistory).Select(x => x.displayName).FirstOrDefault();
 | 
				
			||||||
                        if (conPoint.Where(x => x.name == tagName).FirstOrDefault() != null)
 | 
					                        if (conPoint.Where(x => x.name == tagName.Replace('_', '/') && !x.isHistory).FirstOrDefault() != null)
 | 
				
			||||||
                            conPoint.Where(x => x.name == tagName).FirstOrDefault().isHistory = true;
 | 
					                            conPoint.Where(x => x.name == tagName.Replace('_', '/') && !x.isHistory).FirstOrDefault().isHistory = true;
 | 
				
			||||||
                        row.isHistory = true;
 | 
					                        row.isHistory = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        result.Add(row);
 | 
					                        result.Add(row);
 | 
				
			||||||
@ -263,9 +263,9 @@ namespace Backend.Services.Implement
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                        row.parent_path = stationName;
 | 
					                        row.parent_path = stationName;
 | 
				
			||||||
                        //full_name 其實是點位名稱 point_name 
 | 
					                        //full_name 其實是點位名稱 point_name 
 | 
				
			||||||
                        row.full_name = conPoint.Where(x => x.name.Contains(tagName) && !x.isHistory).Select(x => x.displayName).FirstOrDefault();
 | 
					                        row.full_name = conPoint.Where(x => x.name.Contains(tagName.Replace('_', '/')) && !x.isHistory).Select(x => x.displayName).FirstOrDefault();
 | 
				
			||||||
                        if (conPoint.Where(x => x.name.Contains(tagName) && !x.isHistory).FirstOrDefault() != null)
 | 
					                        if (conPoint.Where(x => x.name.Contains(tagName.Replace('_', '/')) && !x.isHistory).FirstOrDefault() != null)
 | 
				
			||||||
                            conPoint.Where(x => x.name.Contains(tagName) && !x.isHistory).FirstOrDefault().isHistory = true;
 | 
					                            conPoint.Where(x => x.name.Contains(tagName.Replace('_', '/')) && !x.isHistory).FirstOrDefault().isHistory = true;
 | 
				
			||||||
                        row.isHistory = true;
 | 
					                        row.isHistory = true;
 | 
				
			||||||
                        result.Add(row);
 | 
					                        result.Add(row);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@ -321,7 +321,7 @@ namespace Backend.Services.Implement
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return result;
 | 
					            return result.Where(x => x.full_name != null).ToList();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        //private static void getRefData(string urlString, string encoded, List<control_point> conPoint, List<ImpNiaItem> result, Welcome data ) //obixHistory data
 | 
					        //private static void getRefData(string urlString, string encoded, List<control_point> conPoint, List<ImpNiaItem> result, Welcome data ) //obixHistory data
 | 
				
			||||||
        //{
 | 
					        //{
 | 
				
			||||||
 | 
				
			|||||||
@ -393,46 +393,46 @@
 | 
				
			|||||||
                // console.log("loadTable",pageAct.devicePoiName.split(" ")[0])
 | 
					                // console.log("loadTable",pageAct.devicePoiName.split(" ")[0])
 | 
				
			||||||
                v.type = pageAct.devicePoiName.split(" ")[0];
 | 
					                v.type = pageAct.devicePoiName.split(" ")[0];
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								let tag = "#historyTable";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								let column_defs = [
 | 
				
			||||||
 | 
									{ "targets": [0], "width": "20%", "sortable": true },
 | 
				
			||||||
 | 
									{ "targets": [1], "width": "20%", "sortable": true },
 | 
				
			||||||
 | 
									{ "targets": [2], "width": "20%", "sortable": true }
 | 
				
			||||||
 | 
								];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								let columns = [
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"title": "類別",
 | 
				
			||||||
 | 
										"data": "type"
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"title": "設備名稱",
 | 
				
			||||||
 | 
										"data": "deviceName",
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"title": "數值",
 | 
				
			||||||
 | 
										"data": "value",
 | 
				
			||||||
 | 
										"render": function (data) {
 | 
				
			||||||
 | 
											if (isNaN(data.toString())) {
 | 
				
			||||||
 | 
												return data
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
											return data.roundDecimal(2);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										"title": "紀錄時間",
 | 
				
			||||||
 | 
										"data": "timestamp",
 | 
				
			||||||
 | 
										"render": function (data) {
 | 
				
			||||||
 | 
											// console.log(data)
 | 
				
			||||||
 | 
											return displayDate(data, "datetime");
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								historyTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
        let tag = "#historyTable";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        let column_defs = [
 | 
					 | 
				
			||||||
            { "targets": [0], "width": "20%", "sortable": true },
 | 
					 | 
				
			||||||
            { "targets": [1], "width": "20%", "sortable": true },
 | 
					 | 
				
			||||||
            { "targets": [2], "width": "20%", "sortable": true }
 | 
					 | 
				
			||||||
        ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        let columns = [
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                "title": "類別",
 | 
					 | 
				
			||||||
                "data": "type"
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                "title": "設備名稱",
 | 
					 | 
				
			||||||
                "data": "deviceName",
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                "title": "數值",
 | 
					 | 
				
			||||||
                "data": "value",
 | 
					 | 
				
			||||||
                "render": function (data) {
 | 
					 | 
				
			||||||
                    if (isNaN(data.toString())) {
 | 
					 | 
				
			||||||
                        return data
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    return data.roundDecimal(2);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                "title": "紀錄時間",
 | 
					 | 
				
			||||||
                "data": "timestamp",
 | 
					 | 
				
			||||||
                "render": function (data) {
 | 
					 | 
				
			||||||
                    // console.log(data)
 | 
					 | 
				
			||||||
                    return displayDate(data, "datetime");
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        historyTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi");
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function exportExcel() {
 | 
					    function exportExcel() {
 | 
				
			||||||
 | 
				
			|||||||
@ -532,6 +532,7 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
                                    left join device_master dm ON d.device_building_tag = dm.device_building_tag 
 | 
					                                    left join device_master dm ON d.device_building_tag = dm.device_building_tag 
 | 
				
			||||||
                                                              AND d.device_name_tag = dm.device_name_tag
 | 
					                                                              AND d.device_name_tag = dm.device_name_tag
 | 
				
			||||||
                                    left join device_item di ON d.device_name_tag = di.device_name_tag 
 | 
					                                    left join device_item di ON d.device_name_tag = di.device_name_tag 
 | 
				
			||||||
 | 
					                                                              AND di.device_building_tag = '{post.building_tag}'
 | 
				
			||||||
                                                              AND di.deleted = 0 
 | 
					                                                              AND di.deleted = 0 
 | 
				
			||||||
                                                              AND di.is_show_riserDiagram = 1
 | 
					                                                              AND di.is_show_riserDiagram = 1
 | 
				
			||||||
                                    left join floor f on d.device_floor_tag = f.full_name and f.deleted = 0
 | 
					                                    left join floor f on d.device_floor_tag = f.full_name and f.deleted = 0
 | 
				
			||||||
 | 
				
			|||||||
@ -9,6 +9,8 @@ using FrontendWebApi.Models;
 | 
				
			|||||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
 | 
					using Microsoft.CodeAnalysis.CSharp.Syntax;
 | 
				
			||||||
using Repository.BackendRepository.Interface;
 | 
					using Repository.BackendRepository.Interface;
 | 
				
			||||||
using System.Linq;
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Threading;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// <summary>
 | 
					/// <summary>
 | 
				
			||||||
/// HiNet 企業簡訊 API for .NetCore 2.0
 | 
					/// HiNet 企業簡訊 API for .NetCore 2.0
 | 
				
			||||||
@ -120,7 +122,7 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
    /// <summary>
 | 
					    /// <summary>
 | 
				
			||||||
    /// HiNet企業簡訊 Hiair .Net Core API
 | 
					    /// HiNet企業簡訊 Hiair .Net Core API
 | 
				
			||||||
    /// </summary>
 | 
					    /// </summary>
 | 
				
			||||||
    public class HiNetController : MyBaseApiController<GraphManageController>
 | 
					    public class HiNetController : MyBaseApiController<HiNetController>
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        private readonly IBackendRepository backendRepository;
 | 
					        private readonly IBackendRepository backendRepository;
 | 
				
			||||||
        public Socket socket;
 | 
					        public Socket socket;
 | 
				
			||||||
@ -767,11 +769,11 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
        public ActionResult<ApiResult<string>> HiNetMsg([FromBody] HiNetInput input)
 | 
					        public ActionResult<ApiResult<string>> HiNetMsg([FromBody] HiNetInput input)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            ApiResult<string> apiResult = new ApiResult<string>(jwt_str);
 | 
					            ApiResult<string> apiResult = new ApiResult<string>(jwt_str);
 | 
				
			||||||
            //if (!jwtlife)
 | 
					            if (!jwtlife)
 | 
				
			||||||
            //{
 | 
					            {
 | 
				
			||||||
            //    apiResult.Code = "5000";
 | 
					                apiResult.Code = "5000";
 | 
				
			||||||
            //    return BadRequest(apiResult);
 | 
					                return BadRequest(apiResult);
 | 
				
			||||||
            //}
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@ -789,8 +791,25 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
                    //發送文字簡訊並回傳狀態碼
 | 
					                    //發送文字簡訊並回傳狀態碼
 | 
				
			||||||
                    retCode = this.SendMsg(input.Number, input.Msg);
 | 
					                    retCode = this.SendMsg(input.Number, input.Msg);
 | 
				
			||||||
                    //取得messageID或文字描述
 | 
					                    //取得messageID或文字描述
 | 
				
			||||||
                    retContent = this.Get_Message();
 | 
					                    retContent = this.Get_Message(); //return id when sent message
 | 
				
			||||||
                    apiResult.Data = retCode + " : " + retContent;
 | 
					                    apiResult.Data = retCode.ToString();
 | 
				
			||||||
 | 
					                    Dictionary<string, object> hiNetMsg = new Dictionary<string, object>();
 | 
				
			||||||
 | 
					                    if (retCode == 0)
 | 
				
			||||||
 | 
					                        hiNetMsg.Add("@MsgId", retContent);
 | 
				
			||||||
 | 
					                    else
 | 
				
			||||||
 | 
					                        hiNetMsg.Add("@ErrMessage", retCode + " : " + retContent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    hiNetMsg.Add("@deleted", 0);
 | 
				
			||||||
 | 
					                    hiNetMsg.Add("@Number", input.Number);
 | 
				
			||||||
 | 
					                    hiNetMsg.Add("@Message", input.Msg);
 | 
				
			||||||
 | 
					                    hiNetMsg.Add("@status", retCode);
 | 
				
			||||||
 | 
					                    hiNetMsg.Add("@created_at", DateTime.Now);
 | 
				
			||||||
 | 
					                    hiNetMsg.Add("@created_by", myUser.userinfo_guid);
 | 
				
			||||||
 | 
					                    backendRepository.AddOneByCustomTableReturnId(hiNetMsg, "hinet_message");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    //Thread.Sleep(5000);
 | 
				
			||||||
 | 
					                    //retCode = this.QueryMsg(retContent);
 | 
				
			||||||
 | 
					                    //retContent = this.Get_Message(); //return success status id(Successful:20230517103949") when querymsg status
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                else
 | 
					                else
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
 | 
				
			|||||||
@ -1148,21 +1148,24 @@ namespace FrontendWebApi.ApiControllers
 | 
				
			|||||||
                {
 | 
					                {
 | 
				
			||||||
                    var device_number = hi.Device_number_point.Split(":")[0];
 | 
					                    var device_number = hi.Device_number_point.Split(":")[0];
 | 
				
			||||||
                    var point = hi.Device_number_point.Split(":")[1];
 | 
					                    var point = hi.Device_number_point.Split(":")[1];
 | 
				
			||||||
                    //var tableName = await backgroundServiceMsSqlRepository.GetAllAsync<string>($"select table_name from INFORMATION_SCHEMA.TABLES where table_name like '%{device_number}%'");
 | 
					                    var tableName = await backgroundServiceMsSqlRepository.GetOneAsync<string>($"select table_name from INFORMATION_SCHEMA.TABLES where table_name like '%{device_number}_{point}%'");
 | 
				
			||||||
                    var device_item_infos = await frontendRepository.GetAllAsync<DeviceItemInfo>(sqlDeviceItemInfo, new { Device_number = device_number });
 | 
					                    if (!string.IsNullOrEmpty(tableName))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        var device_item_infos = await frontendRepository.GetAllAsync<DeviceItemInfo>(sqlDeviceItemInfo, new { Device_number = device_number });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    var device_item_info = device_item_infos.Where(x => x.Device_number == device_number && x.Points == point).FirstOrDefault();
 | 
					                        var device_item_info = device_item_infos.Where(x => x.Device_number == device_number && x.Points == point).FirstOrDefault();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    var sql = $@"select '{device_item_info.Building_name}' as Building_name, '{device_item_info.Main_system_name}' as Main_system_name,
 | 
					                        var sql = $@"select '{device_item_info.Building_name}' as Building_name, '{device_item_info.Main_system_name}' as Main_system_name,
 | 
				
			||||||
                                        '{device_item_info.Sub_system_name}' as Sub_system_name, '{device_item_info.Device_number}' as Device_number, 
 | 
					                                            '{device_item_info.Sub_system_name}' as Sub_system_name', {device_item_info.Device_number}' as Device_number, 
 | 
				
			||||||
                                        '{device_item_info.Device_name}' as Device_name, '{device_item_info.Item_name}' as Item_name, '{device_item_info.Points}' as Points,
 | 
					                                            '{device_item_info.Device_name}' as Device_name, '{device_item_info.Item_name}' as Item_name, '{device_item_info.Points}' as Points,
 | 
				
			||||||
                                        '{device_item_info.Unit}' as Unit, timestamp as Timestamp, round(value, 2) as Value
 | 
					                                            '{device_item_info.Unit}' as Unit, timestamp as Timestamp, round(value, 2) as Value
 | 
				
			||||||
                                from FIC_CENTER_{device_number}_{point}
 | 
					                                    from FIC_CENTER_{device_number}_{point}
 | 
				
			||||||
                                where replace(convert(varchar, [timestamp], 111), '/', '-') >= @startTime 
 | 
					                                    where replace(convert(varchar, [timestamp], 111), '/', '-') >= @startTime 
 | 
				
			||||||
                                    and replace(convert(varchar, [timestamp], 111), '/', '-') <= @endTime order by timestamp";
 | 
					                                        and replace(convert(varchar, [timestamp], 111), '/', '-') <= @endTime order by timestamp";
 | 
				
			||||||
                    apiResult.Data.AddRange(
 | 
					                        apiResult.Data.AddRange(
 | 
				
			||||||
                        await backgroundServiceMsSqlRepository.GetAllAsync<HistoryRawData>(sql, new { startTime = input.Start_timestamp, endTime = input.End_timestamp })
 | 
					                            await backgroundServiceMsSqlRepository.GetAllAsync<HistoryRawData>(sql, new { startTime = input.Start_timestamp, endTime = input.End_timestamp })
 | 
				
			||||||
                    );
 | 
					                        );
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                    //foreach (var tn in tableName)
 | 
					                    //foreach (var tn in tableName)
 | 
				
			||||||
                    //{
 | 
					                    //{
 | 
				
			||||||
                    //}
 | 
					                    //}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user