hxb
2022-09-20 f8f87a4fe67a1539b6fb85a54e4c178474792285
HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -24,10 +24,20 @@
        /// 定义一个变量,记录选中状态
        /// </summary>
        private string selectedState = "unknown";
        /// <summary>
        /// 是不是再次编辑
        /// </summary>
        private bool mEdit;
        /// <summary>
        /// 输入条件列表索引值
        /// </summary>
        private int mIndex;
        public void Show(Entity.Function device, int index, bool edit)
        {
            this.function = device;
            this.mEdit = edit;
            this.mIndex = index;
            #region 界面布局
            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
            LogicView.TopView topView = new LogicView.TopView();
@@ -61,7 +71,6 @@
                //空调
                case SPK.AcStandard:
                case SPK.HvacAC:
                case SPK.HvacCac://毛细空调
                //地热
                case SPK.FloorHeatStandard:
                case SPK.HvacFloorHeat:
@@ -79,22 +88,6 @@
                        view.btnClick.MouseUpEventHandler += (sender, e) =>
                        {
                            DeviceView(device, view.btnState, StringId.onLogic, StringId.offLogic);
                        };
                        if (edit)
                        {
                            GetEditState(device, index, view.btnState, null, null, null);
                        }
                    }
                    break;
                //紧急呼叫
                case SPK.SensorHelp:
                    {
                        LogicView.FunTypeView view = new LogicView.FunTypeView();
                        view.btnText.TextID = StringId.qiujiuandzhengchang;
                        fLayout.AddChidren(view.FLayoutView());
                        view.btnClick.MouseUpEventHandler += (sender, e) =>
                        {
                            DeviceView(device, view.btnState, StringId.qiujiu, StringId.zhengchang);
                        };
                        if (edit)
                        {
@@ -217,8 +210,64 @@
                        }
                    }
                    break;
                //毫米波传感器
                //毫米波传感器(自研北邮)
                case SPK.SenesorMegahealth:
                    {
                        int intValue =0;
                        if (edit)
                        {
                            Input inputs = Logic.currlogic.input[index];
                            var dicList = inputs.condition;
                            foreach (var dic in dicList)
                            {
                                if (dic["key"] == "target_status")
                                {
                                    intValue = 1;
                                }
                                else
                                {
                                    intValue = 2;
                                }
                                break;
                            }
                        }
                        LogicView.FunTypeView view1= new LogicView.FunTypeView();
                        view1.btnText.TextID = StringId.diedaobaojing;
                        view1.btnState.Name = Language.StringByID(StringId.diedaobaojing);
                        fLayout.AddChidren(view1.FLayoutView());
                        view1.btnClick.MouseUpEventHandler += (sender, e) =>
                        {
                            DeviceView(device, view1.btnState, StringId.shi, StringId.offLogic, 1);
                        };
                        LogicView.FunTypeView view2 = new LogicView.FunTypeView();
                        view2.frameLayout.Y = view1.frameLayout.Bottom;
                        view2.btnText.TextID = StringId.yourenbaojing;
                        view2.btnState.Name = Language.StringByID(StringId.yourenbaojing);
                        fLayout.AddChidren(view2.FLayoutView());
                        if (intValue==1) {
                            view2.frameLayout.Visible = false;
                        }
                        if (intValue == 2)
                        {
                            view2.frameLayout.Y = Application.GetRealHeight(0);
                        }
                        view2.btnClick.MouseUpEventHandler += (sender, e) =>
                        {
                            DeviceView(device, view2.btnState, StringId.youren, StringId.wuren, 2);
                        };
                        if (edit)
                        {
                            GetEditState(device, index, view1.btnState, view2.btnState, null, null);
                        }
                    }
                    break;
                //毫米波传感器(兆观专用云云对接)
                case SPK.SenesorMegahealth2:
                    {
                        LogicView.FunTypeView view = new LogicView.FunTypeView();
@@ -377,6 +426,7 @@
                //tvoc
                case SPK.SensorTVOC:
                    {
                        ///tvoc
                        LogicView.FunTypeView tvocView = new LogicView.FunTypeView();
                        tvocView.btnText.TextID = StringId.tvoc;
@@ -516,7 +566,6 @@
                    case SPK.SensorGas:
                    case SPK.SensorWater:
                    case SPK.SensorSmoke:
                    case SPK.SensorHelp:
                        {
                            keyVlaue = "status";
                            if (!Is_SpkAttribute(keyVlaue)) {
@@ -549,6 +598,23 @@
                        }
                        break;
                    case SPK.SenesorMegahealth:
                        {
                            if (button != null)
                            {
                                if (button.Name == Language.StringByID(StringId.yourenbaojing))
                                {
                                    keyVlaue = "people_status";
                                }
                                else
                                {
                                    keyVlaue = "target_status";
                                }
                            }
                        }
                        break;
                    case SPK.SenesorMegahealth2:
                        {
                            keyVlaue = "action_state";
@@ -596,7 +662,7 @@
                        break;
                    case StringId.wuren:
                        {
                            if (device.spk == SPK.SenesorMegahealth || device.spk == SPK.SenesorMegahealth2)
                            if (device.spk == SPK.SenesorMegahealth2)
                            {
                                value = "uninhabited";
                            }
@@ -607,6 +673,25 @@
                        }
                        break;
                    case StringId.shi:
                        {
                            value = "open";
                            if (button != null)
                            {
                                if (button.Name == Language.StringByID(StringId.yourenbaojing))
                                {
                                    //状态(有人)
                                    value = "true";
                                }
                                else if(button.Name == Language.StringByID(StringId.diedaobaojing))
                                {
                                    //跌倒
                                    value = "4";
                                }
                            }
                        }
                        break;
                    case StringId.kaiqi:
                        {
                            value = "open";
@@ -638,6 +723,17 @@
                button.TextID = intValue;
                selectedState = device.spk + "_" + value;
                AddDictionary(keyVlaue, value, "string");
                if (button != null)
                {
                    if (button.Name == Language.StringByID(StringId.yourenbaojing)
                    || (button.Name == Language.StringByID(StringId.diedaobaojing)))
                    {
                        //只有毫米波传感器(自研)
                        Save(device, mIndex, mEdit);
                    }
                }
            });
@@ -709,7 +805,7 @@
        /// <param name="stateValue">编辑之前的状态值,默认为""</param>
        public void PmCo2TvocAction(FrameLayout frame, Entity.Function device, string key, int title, int index, bool edit, string stateValue = "")
        {
            if (edit)
            if (edit)
            {
                ///
                this.function = device;
@@ -723,12 +819,14 @@
                }
            }
            PublicInterface view = new PublicInterface();
            var listStr = view.GetViewList(key);
            view.SingleSelectionShow(frame, listStr, Language.StringByID(title), view.GetString(key, stateValue)
            //var listStr = view.GetViewList(key);
            var listStr = view.GetSensorLevelList(device);//2022年05月25日10:01:33 产品经理君煌要求改成动态
            view.SingleSelectionShow(frame, listStr, Language.StringByID(title), view.GetSensorLevelText(device, stateValue,true)
               , (text) =>
               {
                  
                   var value = view.GetValue(key, text);
                   //var value = view.GetValue(key, text);
                   var values = view.GetSensorLevelText(device,text,false);
                   selectedState = device.spk + "_" + key;
                   switch (device.spk)
                   {
@@ -746,7 +844,7 @@
                           }
                           break;
                   }
                   AddDictionary(key, value, "integer", "in");
                   AddDictionary(key, values, "integer", "in");
                   Save(device, index, edit);
               });
        }