wjc
2023-03-28 a9d1161b1df96e7ddad566335989a1444e433ef5
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -140,7 +140,7 @@
                            //用sid找到设备;
                            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;
                            //改变设备名称显示控件宽度
@@ -281,6 +281,7 @@
                                    }
                                    break;
                                case SPK.SenesorMegahealth:
                                case SPK.SensorMmvPose:
                                    {
                                        string key = this.GetKey(dicList);
                                        string value = this.GetValue(dicList);
@@ -310,7 +311,7 @@
                                        }
                                    }
                                    break;
                                case SPK.SensorEnvironment:
                                case SPK.SensorEnvironment:case SPK.SensorEnvironmentHailin:
                                case SPK.SensorEnvironment2:
                                case SPK.SensorEnvironment3:
                                    {
@@ -385,6 +386,7 @@
                                    }
                                    break;
                                case SPK.SensorPm10:
                                case SPK.SensorCO2:
                                case SPK.SensorPm25:
                                case SPK.SensorTVOC:
@@ -416,6 +418,15 @@
                                            var FaceItem = this.GetFaceItem(userId, device.deviceId);
                                            inputView.btnState.Text = FaceItem.userName;
                                        }
                                    }
                                    break;
                                case SPK.IpCam_Imou:
                                    {
                                        if (inputCondition.identifier == "door_caipcam_region_alram_eventll_cloud_event")
                                        {
                                            inputView.btnState.Text = Language.StringByID(StringId.quyuruqingaojing);
                                        }
                                    }
                                    break;
                            }
@@ -661,7 +672,7 @@
                            {
                                //用sid找到设备;
                                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 +757,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 +930,7 @@
                            //用sid找到设备;
                            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 +939,27 @@
                            //区别不同设备,显示不同设备状态
                            switch (device.spk)
                            {
                                //插座(有USB)
                                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 +999,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";
                                            }
                                        }
                                    }
@@ -1274,12 +1315,15 @@
                                case SPK.MusicStandard:
                                case SPK.AvMusic:
                                    {
                                        foreach (var dic in dicList)
                                        string song_name = GetKeyValue("song_name", dicList);
                                        string volume = GetKeyValue("volume", dicList);
                                        stateStr = song_name + ";" +Language.StringByID(StringId.volumeMusic)+volume;
                                        if (stateStr.StartsWith(";"))
                                        {
                                            if (dic["key"] == "song_name")
                                            {
                                                stateStr = dic["value"]?.ToString();
                                            }
                                            stateStr = stateStr.Substring(1, stateStr.Length - 1);
                                        }else if (stateStr.EndsWith(Language.StringByID(StringId.volumeMusic)))
                                        {
                                            stateStr = stateStr.Substring(0, stateStr.Length - 3);
                                        }
                                    }
                                    break;
@@ -1426,12 +1470,29 @@
        {
            switch (device.spk)
            {
                //插座
                //插座(有USB)
                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)
                        {
@@ -1477,6 +1538,16 @@
                                            break;
                                        }
                                        button2.Text = value + "%";
                                    }
                                    break;
                                case "cct":
                                    {
                                        if (button3 == null)
                                        {
                                            //怕调试软件乱上东西导致抛异常
                                            break;
                                        }
                                        button3.Text = value + "k";
                                    }
                                    break;
                            }
@@ -1994,6 +2065,7 @@
                    }
                    break;
                case SPK.SenesorMegahealth:
                case SPK.SensorMmvPose:
                    {
                        foreach (var dic in dicList)
                        {
@@ -2065,6 +2137,10 @@
                            {
                                button1.Text = dic["value"]?.ToString();
                            }
                            else if (dic["key"] == "volume")
                            {
                                button2.Text = dic["value"]?.ToString();
                            }
                        }
                    }
                    break;
@@ -2074,6 +2150,7 @@
                        button2.Text = this.GetFaceItem(value, device.deviceId).userName;
                    }
                    break;
            }
        }
        /// <summary>
@@ -2182,6 +2259,7 @@
                            //区别不同设备,显示不同设备状态
                            switch (device.spk)
                            {
                                case SPK.MechanicalArm:
                                case SPK.AirSwitch:
                                case SPK.LightSwitch:
                                    {//开关灯
@@ -2366,7 +2444,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;
@@ -2440,6 +2520,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);
@@ -2466,8 +2551,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)
@@ -2506,6 +2592,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);