private void ReqLowMaxInfo()
        {
            var info = Wlst.Sr.ProtocolPhone.LxRtu.wst_ldl_sxx_avg_set;

            //.ServerListen.wlst_cnt_wj3090_request_ldl_loop_current_avg;
            info.WstRtuLdlSxxAvgSet.Op = 14;


            MyTextboxShow mtest = new MyTextboxShow();



            foreach (var f in Items)
            {
                if (f.isCanEdit == false)
                {
                    continue;
                }
                info.WstRtuLdlSxxAvgSet.SxxItems.Add(new RtuSets.RtuLoopSxx()
                {
                    RtuId     = RtuId,
                    LoopId    = f.LoopId,
                    SxDefault = f.Upper,
                    XxDefault = f.Lower,
                    Sx1       = 0,
                    Xx1       = 0,
                    Avg       = f.RefA,
                    Avg2      = 0
                });
            }



            SndOrderServer.OrderSnd(info, 10, 4);
            tbremark.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 更新已经提交,修改后的上下限信息将在客户端下次登录后更新...";
            lastSavetime  = DateTime.Now.Ticks;
            //mtest.show = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 更新已经提交,修改后的上下限信息将在客户端下次登录后更新...";
            //tbremark.DataContext = mtest;
        }
        private void RequestOrUpdateFaultTypeInfo(string session, Wlst.mobile.MsgWithMobile infos)
        {
            if (isViewActive == false)
            {
                return;
            }
            var data = infos.WstRtuLdlSxxAvgSet;

            if (data == null)
            {
                return;
            }
            MyTextboxShow mtest = new MyTextboxShow();

            if (data.Op != 14)
            {
                return;
            }



            //var dic = new Dictionary<int, List<RtuSets.RtuLoopSxx>>();
            //foreach (var f in data .SxxItems ){
            //    if (dic.ContainsKey(f.RtuId) == false) dic.Add(f.RtuId, new List<RtuSets.RtuLoopSxx>());
            //    dic[f.RtuId].Add(f);
            //}

            //foreach (var f in dic)
            //{
            //    var tmpequ = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f.Key);
            //    var tmpequ2 = tmpequ as Wlst.Sr.EquipmentInfoHolding.Model.Wj3005Rtu;
            //    if (tmpequ2 == null) continue;
            //    foreach (var g in f.Value)
            //    {
            //        if (tmpequ2.WjLoops.ContainsKey(g.LoopId))
            //        {
            //            tmpequ2.WjLoops[g.LoopId].CurrentAlarmUpperlimit = g.SxDefault;
            //            tmpequ2.WjLoops[g.LoopId].CurrentAlarmLowerlimit = g.XxDefault;

            //        }
            //    }
            //}


            var ntg = (from t in data.SxxItems where t.RtuId == RtuId orderby t.LoopId select t).ToList();

            if (ntg.Count == 0)
            {
                return;
            }
            foreach (var g in ntg)
            {
                if (Sr.EquipmentInfoHolding.Services.RunningInfoHold.Info.ContainsKey(g.RtuId) == false)
                {
                    return;
                }

                //if (Wlst.Sr.EquipmentInfoHolding.Services.RunningInfoHold.Info[g.RtuId].RtuNewData.LstNewLoopsData.Count <= g.LoopId - 1)
                //    return;

                //lvf 2019年3月27日08:44:40  更新最新数据中的上下限和额定电流
                foreach (var t in Wlst.Sr.EquipmentInfoHolding.Services.RunningInfoHold.Info[g.RtuId].RtuNewData.LstNewLoopsData)
                {
                    if (t.LoopId == g.LoopId)
                    {
                        t.Upper       = g.SxDefault;
                        t.Lower       = g.XxDefault;
                        t.AvgOf7daysA = g.Avg;
                    }
                }



                //Wlst.Sr.EquipmentInfoHolding.Services.RunningInfoHold.Info[g.RtuId].RtuNewData.LstNewLoopsData[ g.LoopId-1]
                //    .Upper = g.SxDefault;
                //Wlst.Sr.EquipmentInfoHolding.Services.RunningInfoHold.Info[g.RtuId].RtuNewData.LstNewLoopsData[g.LoopId-1]
                //    .Lower = g.XxDefault;
                //Wlst.Sr.EquipmentInfoHolding.Services.RunningInfoHold.Info[g.RtuId].RtuNewData.LstNewLoopsData[
                //    g.LoopId - 1]
                //    .AvgOf7daysA = g.Avg;
            }


            //var run = Wlst.Sr.EquipmentInfoHolding.Services.RunningInfoHold.GetRunInfo(RtuIdNeedUpdate);
            //if (run != null && run.RtuNewData != null)
            //{
            //    foreach (var t in ntg)
            //    {
            //       run.RtuNewData.LstNewLoopsData[0].Upper
            //    }
            //}
            if (DateTime.Now.Ticks - lastSavetime < 10 * 10000000L)
            {
                tbremark.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 终端额定电流、上下限设置成功.";
            }
            else
            {
                tbremark.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 终端额定电流、上下限设置已经更新,若需设置,请重新进入该界面";
                foreach (var f in Items)
                {
                    f.isCanEdit = false;
                }
            }



            //var dirc = new Dictionary<Tuple<int, int>, Tuple<double, int, int>>();
            //var dirc2 = new Dictionary<Tuple<int, int>, Tuple<double, int, int>>();
            //foreach (var f in data.SxxItems)
            //{
            //    var tu = new Tuple<int, int>(f.RtuId, f.LoopId);
            //    if (dirc.ContainsKey(tu)) continue;
            //    var tu2 = new Tuple<double, int, int>(f.Avg, f.SxDefault, f.XxDefault);
            //    dirc.Add(tu, tu2);

            //    if (f.Avg2 > 0)
            //    {
            //        if (dirc2.ContainsKey(tu)) continue;
            //        var tu3 = new Tuple<double, int, int>(f.Avg2, f.Sx1, f.Xx1);
            //        dirc2.Add(tu, tu3);
            //    }
            //}

            //foreach (var f in this.Items)
            //{
            //    ////if (f.ValueString2.Contains("屏蔽")) continue;
            //    //var flg = false;
            //    //var flg2 = false;
            //    //foreach (var t in f.ChildTreeItems)
            //    //{
            //    //    var tu = new Tuple<int, int>(t.Rtuid, t.ValueInt1);
            //    //    if (dirc.ContainsKey(tu))
            //    //    {
            //    //        t.ValueString3 = dirc[tu].Item1.ToString("f2");
            //    //        t.ValueInt3 = dirc[tu].Item2;
            //    //        t.ValueInt2 = dirc[tu].Item3;
            //    //        flg = true;
            //    //        cancmdupdatecurrent = true;
            //    //    }
            //    //    if (dirc2.ContainsKey(tu))
            //    //    {
            //    //        t.ValueString4 = dirc2[tu].Item1.ToString("f2");
            //    //        t.ValueInt5 = dirc2[tu].Item2;
            //    //        t.ValueInt4 = dirc2[tu].Item3;
            //    //        flg2 = true;
            //    //    }
            //    //}
            //    //if (flg) f.ValueString3 = "√";
            //    //if (flg2) f.ValueString4 = "√";
            //}
        }