From 592974441a4df95fffd9167c90192da1a390b1c2 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 06 六月 2023 11:51:12 +0800
Subject: [PATCH] Merge branch 'Dev-Branch'

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs |  258 ++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 241 insertions(+), 17 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index 5953a75..014f3bb 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -140,7 +140,7 @@
                             //鐢╯id鎵惧埌璁惧锛�
                             var device = LogicMethod.Current.GetDevice(inputCondition.sid);
                             //鐢ㄨ澶囩殑functionType绫诲瀷鎵惧埌瀵瑰簲鍥炬爣锛�
-                            inputView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetIconPath(device.spk);
+                            inputView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetDeviceIconPath(device);
                             //鏄剧ず璁惧鍚嶇О
                             inputView.btnText.Text = device.name;
                             //鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害
@@ -162,6 +162,7 @@
                                 //绌鸿皟
                                 case SPK.AcStandard:
                                 case SPK.HvacAC:
+                                case SPK.AcIr:
                                 //鍦扮儹
                                 case SPK.HvacFloorHeat:
                                 case SPK.FloorHeatStandard:
@@ -246,7 +247,7 @@
                                         {
                                             inputView.btnState.Text = Language.StringByID(StringId.kaiqi);
                                         }
-                                       
+
                                     }
                                     break;
                                 case SPK.SensorUtrasonic:
@@ -281,6 +282,7 @@
                                     }
                                     break;
                                 case SPK.SenesorMegahealth:
+                                case SPK.SensorMmvPose:
                                     {
                                         string key = this.GetKey(dicList);
                                         string value = this.GetValue(dicList);
@@ -305,12 +307,14 @@
                                     {
                                         string value = this.GetValue(dicList);
                                         inputView.btnState.Text = Language.StringByID(StringId.wuren);
-                                        if (value == "fall") {
+                                        if (value == "fall")
+                                        {
                                             inputView.btnState.Text = Language.StringByID(StringId.diedao);
                                         }
                                     }
                                     break;
                                 case SPK.SensorEnvironment:
+                                case SPK.SensorEnvironmentHailin:
                                 case SPK.SensorEnvironment2:
                                 case SPK.SensorEnvironment3:
                                     {
@@ -374,7 +378,7 @@
                                 case SPK.SensorTemperature:
                                     {
 
-                                        string str =this.GetText(dicList, "temperature");
+                                        string str = this.GetText(dicList, "temperature");
                                         inputView.btnState.Text = str;
                                     }
                                     break;
@@ -385,6 +389,7 @@
 
                                     }
                                     break;
+                                case SPK.SensorPm10:
                                 case SPK.SensorCO2:
                                 case SPK.SensorPm25:
                                 case SPK.SensorTVOC:
@@ -404,18 +409,87 @@
                                         }
                                     }
                                     break;
+                                case SPK.VideoDoorLock:
+                                    {
+                                        string s = string.Empty;
+                                        string tag = string.Empty;
+                                        for (int b = 0; b < dicList.Count; b++)
+                                        {
+                                            var dic = dicList[b];
+                                            //var userId = dic["value"].ToString();
+                                            //var FaceItem = this.GetVideoDoorLockUserItem(userId, device);
+                                            //s += FaceItem.userName;
+                                            //s += ",";
+                                            //tag += FaceItem.userId;
+                                            //tag += "_";
+                                            var userName = dic["value"].ToString();
+                                            s += userName;
+                                            s += ",";
+                                        }
+                                        inputView.btnState.Text = s;
+                                    }
+                                    break;
                                 case SPK.doorgate:
                                     {
+                                        string s = string.Empty;
                                         if (inputCondition.identifier == "door_call_cloud_event")
                                         {
-                                            inputView.btnState.Text = Language.StringByID(StringId.shipintonghuahujiao);
+                                            s = Language.StringByID(StringId.shipintonghuahujiao);
                                         }
                                         else
                                         {
-                                            string userId = this.GetKeyValue("user_id",dicList);
-                                            var FaceItem = this.GetFaceItem(userId, device.deviceId);
-                                            inputView.btnState.Text = FaceItem.userName;
+                                            for (int b = 0; b < dicList.Count; b++)
+                                            {
+                                                var dic = dicList[b];
+                                                var key = dic["key"].ToString();
+                                                if (key != "user_id")
+                                                {
+                                                    continue;
+                                                }
+                                                var userId = dic["value"].ToString();
+                                                var FaceItem = this.GetFaceItem(userId, device.deviceId);
+                                                s += FaceItem.userName;
+                                                s += ",";
+
+
+                                            }
+
                                         }
+                                        inputView.btnState.Text = s;
+                                    }
+                                    break;
+                                case SPK.IpCam_Imou:
+                                    {
+                                        if (inputCondition.identifier == "door_caipcam_region_alram_eventll_cloud_event")
+                                        {
+                                            inputView.btnState.Text = Language.StringByID(StringId.quyuruqingaojing);
+                                        }
+
+                                    }
+                                    break;
+                                case SPK.SensorPirHold:
+                                    {
+                                        string value = this.GetKeyValue("people_status", dicList);
+                                        if (string.IsNullOrEmpty(value))
+                                        {
+                                            inputView.btnState.Text = inputCondition.hold_time + "s";
+                                            break;
+
+                                        }
+                  
+                                        inputView.btnState.Text = Language.StringByID(StringId.wuren);
+                                        if (value == "true")
+                                        {
+                                            inputView.btnState.Text = Language.StringByID(StringId.youren);
+
+                                        }
+                                        if (!string.IsNullOrEmpty(inputCondition.hold_time) && int.Parse(inputCondition.hold_time) > 0)
+                                        {
+
+                                            inputView.btnState.Text += "鎸佺画" + inputCondition.hold_time + "s";
+                                        }
+
+
                                     }
                                     break;
                             }
@@ -661,7 +735,7 @@
                             {
                                 //鐢╯id鎵惧埌璁惧锛�
                                 var device = LogicMethod.Current.GetDevice(inputCondition.sid);
-                                if (device.spk == SPK.SensorEnvironment
+                                if (device.spk == SPK.SensorEnvironment || device.spk == SPK.SensorEnvironmentHailin
                                 || device.spk == SPK.SensorEnvironment2
                                 || device.spk == SPK.SensorEnvironment3
                                 )
@@ -746,6 +820,12 @@
                                 {
 
                                     this.SensorView(thisView, device, "co2", indexVulae);
+
+                                }
+                                else if (device.spk == SPK.SensorPm10)
+                                {
+
+                                    this.SensorView(thisView, device, "pm10", indexVulae);
 
                                 }
                                 else if (device.spk == SPK.SensorPm25)
@@ -913,7 +993,7 @@
                             //鐢╯id鎵惧埌璁惧锛�
                             var device = LogicMethod.Current.GetDevice(outputTarget.sid);
                             //鐢ㄨ澶囩殑functionType绫诲瀷鎵惧埌瀵瑰簲鍥炬爣锛�
-                            targetView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetIconPath(device.spk);
+                            targetView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetDeviceIconPath(device);
                             //鏄剧ず璁惧鍚嶇О
                             targetView.btnText.Text = device.name;
                             //鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害
@@ -922,11 +1002,27 @@
                             //鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬�
                             switch (device.spk)
                             {
+
+                                //鎻掑骇(鏈塙SB)
+                                case SPK.PanelSocket:
+                                    {
+                                        string on_off = GetKeyValue("on_off_master", dicList);
+                                        if (on_off == "on")
+                                        {
+                                            stateStr = Language.StringByID(StringId.onLogic);
+                                        }
+                                        else
+                                        {
+                                            stateStr = stateStr = Language.StringByID(StringId.offLogic);
+                                        }
+                                    }
+                                    break;
                                 case SPK.AirSwitch:
                                 case SPK.LightSwitch:
                                 //鎻掑骇
-                                case SPK.PanelSocket:
                                 case SPK.ElectricSocket:
+                                //鏈烘鎵�
+                                case SPK.MechanicalArm:
                                     {//寮�鍏�
 
                                         foreach (var dic in dicList)
@@ -966,6 +1062,14 @@
                                         else if (brightness != "")
                                         {
                                             stateStr = brightness + "%";
+                                        }
+                                        if (device.spk == SPK.LightCCT)
+                                        {
+                                            //鑹叉俯杩欎釜灞炴�ф墠鏈夋晥
+                                            if (stateStr != Language.StringByID(StringId.offLogic) && GetKeyValue("cct", dicList) != "")
+                                            {
+                                                stateStr += "," +GetKeyValue("cct", dicList) + "k";
+                                            }
                                         }
 
                                     }
@@ -1040,6 +1144,7 @@
                                     break;
                                 case SPK.AcStandard:
                                 case SPK.HvacAC:
+                                case SPK.AcIr:
                                     {
                                         string on_off = GetKeyValue("on_off", dicList);
                                         string set_temp = GetKeyValue("set_temp", dicList);
@@ -1429,12 +1534,29 @@
         {
             switch (device.spk)
             {
-                //鎻掑骇
+                //鎻掑骇(鏈塙SB)
                 case SPK.PanelSocket:
+                    {
+                        foreach (var dic in dicList)
+                        {
+                            string value = dic["value"];
+                            if (value == "on")
+                            {
+                                button1.Text = Language.StringByID(StringId.onLogic);
+                            }
+                            else
+                            {
+                                button1.Text = Language.StringByID(StringId.offLogic);
+                            }
+                        }
+                    }
+                    break;
                 case SPK.ElectricSocket:
                 //寮�鍏崇伅鍏�
                 case SPK.AirSwitch:
                 case SPK.LightSwitch:
+                //鏈烘鎵�
+                case SPK.MechanicalArm:
                     {
                         foreach (var dic in dicList)
                         {
@@ -1480,6 +1602,16 @@
                                             break;
                                         }
                                         button2.Text = value + "%";
+                                    }
+                                    break;
+                                case "cct":
+                                    {
+                                        if (button3 == null)
+                                        {
+                                            //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+                                            break;
+                                        }
+                                        button3.Text = value + "k";
                                     }
                                     break;
                             }
@@ -1594,6 +1726,7 @@
                     break;
                 case SPK.AcStandard:
                 case SPK.HvacAC:
+                case SPK.AcIr:
                     {
                         foreach (var dic in dicList)
                         {
@@ -1872,6 +2005,7 @@
                         }
                     }
                     break;
+              
                 case SPK.SensorGas:
                 case SPK.SensorSmoke:
                     {
@@ -1940,6 +2074,23 @@
                         }
                     }
                     break;
+                case SPK.SensorPirHold:
+                    {
+                        foreach (var dic in dicList)
+                        {
+                            string value = dic["value"];
+                            if (value == "true")
+                            {
+                                button1.Text = Language.StringByID(StringId.youren);
+                            }
+                            else
+                            {
+                                button1.Text = Language.StringByID(StringId.wuren);
+                            }
+                        }
+
+                    }
+                    break;
                 case SPK.SensorDoorWindow:
                     {
                         foreach (var dic in dicList)
@@ -1997,6 +2148,7 @@
                     }
                     break;
                 case SPK.SenesorMegahealth:
+                case SPK.SensorMmvPose:
                     {
                         foreach (var dic in dicList)
                         {
@@ -2059,6 +2211,27 @@
                         }
                     }
                     break;
+                case SPK.VideoDoorLock:
+                    {
+                        string s = string.Empty;
+                        string tag = string.Empty;
+                        for (int b = 0; b < dicList.Count; b++)
+                        {
+                            var dic = dicList[b];
+                            //var userId = dic["value"].ToString();
+                            //var FaceItem = this.GetVideoDoorLockUserItem(userId, device);
+                            //s += FaceItem.userName;
+                            //s += ",";
+                            //tag += FaceItem.userId;
+                            //tag += "_";
+                            var userName = dic["value"].ToString();
+                            s += userName;
+                            s += ",";
+                        }
+                        button1.Text = s;
+                        button1.Tag = tag;
+                    }
+                    break;
                 case SPK.MusicStandard:
                 case SPK.AvMusic:
                     {
@@ -2077,10 +2250,28 @@
                     break;
                 case SPK.doorgate:
                     {
-                        string value = this.GetKeyValue("user_id", dicList);
-                        button2.Text = this.GetFaceItem(value, device.deviceId).userName;
+                        string s = string.Empty;
+                        string tag = string.Empty;
+                        for (int b = 0; b < dicList.Count; b++)
+                        {
+                            var dic = dicList[b];
+                            var key = dic["key"].ToString();
+                            if (key != "user_id")
+                            {
+                                continue;
+                            }
+                            var userId = dic["value"].ToString();
+                            var FaceItem = this.GetFaceItem(userId, device.deviceId);
+                            s += FaceItem.userName;
+                            s += ",";
+                            tag += FaceItem.userId;
+                            tag += "_";
+                        }
+                        button2.Text = s;
+                        button2.Tag = tag;
                     }
                     break;
+
             }
         }
         /// <summary>
@@ -2189,6 +2380,7 @@
                             //鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬�
                             switch (device.spk)
                             {
+                                case SPK.MechanicalArm:
                                 case SPK.AirSwitch:
                                 case SPK.LightSwitch:
                                     {//寮�鍏崇伅
@@ -2256,6 +2448,7 @@
                                     break;
                                 case SPK.AcStandard:
                                 case SPK.HvacAC:
+                                case SPK.AcIr:
                                 case SPK.FloorHeatStandard:
                                 case SPK.HvacFloorHeat:
                                     {
@@ -2373,7 +2566,9 @@
         /// <returns></returns>
         private string GetTimeText(string strTimeValue)
         {
-            var timeValue = int.Parse(strTimeValue);
+            //鍥犱负璋冭瘯杞欢涓婁紶涓虹┖杩�;
+            string intTimeValue = string.IsNullOrEmpty(strTimeValue) ? "0" : strTimeValue;
+            var timeValue = int.Parse(intTimeValue);
             string state = "";
             var minutes = timeValue / 60;
             var seconds = timeValue % 60;
@@ -2447,6 +2642,11 @@
                             strtext = Language.StringByID(StringId.co2) + new PublicInterface { }.GetString("co2", value);
                         }
                         break;
+                    case "pm10":
+                        {
+                            strtext = Language.StringByID(StringId.pm10) + new PublicInterface { }.GetString("pm25", value);
+                        }
+                        break;
                     case "pm25":
                         {
                             strtext = Language.StringByID(StringId.pm25) + new PublicInterface { }.GetString("pm25", value);
@@ -2473,8 +2673,9 @@
             Input inputedit = Logic.currlogic.input[indexVulae];
             ///鐘舵�佸��
             string stateValue = "";
-            foreach (var dic in inputedit.condition)
+            for (int i=0;i<inputedit.condition.Count;i++)
             {
+                var dic = inputedit.condition[i];
                 string comparator = dic["comparator"];
                 stateValue = dic["value"];
                 switch (key)
@@ -2513,6 +2714,11 @@
                             ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "co2", StringId.co2, indexVulae, true, stateValue);
                         }
                         break;
+                    case "pm10":
+                        {
+                            ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "pm10", StringId.pm10, indexVulae, true, stateValue);
+                        }
+                        break;
                     case "pm25":
                         {
                             ConditionDeviceFunList.Current.PmCo2TvocAction(thisView, device, "pm25", StringId.pm25, indexVulae, true, stateValue);
@@ -2532,7 +2738,7 @@
             }
         }
         /// <summary>
-        /// 鏌ユ壘鎸囧畾userId
+        /// 鏌ユ壘鎸囧畾鍙瀵硅userId
         /// </summary>
         /// <param name="userId"></param>
         /// <returns></returns> 
@@ -2549,6 +2755,24 @@
             }
             return face;
         }
+        /// <summary>
+        /// 鏌ユ壘鎸囧畾钀ょ煶瑙嗛闂ㄩ攣userId
+        /// </summary>
+        /// <param name="userId"></param>
+        /// <returns></returns> 
+        public Face GetVideoDoorLockUserItem(string userId, Function device)
+        {
+            if (Send.Current.VideoDoorLockUserListInfo.Count == 0)
+            {
+                Send.Current.GetVideoDoorLockUserListInfo(device);
+            }
+            var face = Send.Current.VideoDoorLockUserListInfo.Find((o) => { return o.userId == userId; });
+            if (face == null)
+            {
+                face = new Face();
+            }
+            return face;
+        }
 
     }
 }

--
Gitblit v1.8.0