Ejemplo n.º 1
0
 public OneItemTemporary()
 {
     InitEvent();
     SchemeName       = "新建方案";
     LightOffOffset   = -15;
     LightOnOffset    = 15;
     LuxEffective     = 30;
     LuxOffValue      = 15;
     LuxOnValue       = 15;
     CurrentSelectLux = new IdNameDesc
     {
         Id       = LuxCollection.First().Id,
         Name     = LuxCollection.First().Name,
         NameDesc = LuxCollection.First().NameDesc
     };
     CurrentSelectLux2 = new IdNameDesc
     {
         Id       = LuxCollection2.First().Id,
         Name     = LuxCollection2.First().Name,
         NameDesc = LuxCollection2.First().NameDesc
     };
     DtEndTime   = DateTime.Now.Date.AddDays(1);
     DtStartTime = DateTime.Now.Date;
 }
Ejemplo n.º 2
0
        public TunnelInformation(int areaId, TunnelControlPlan.TunnelControlOnePlan info)
        {
            AreaId              = areaId;
            SchemeId            = info.PlanId;
            SchemeName          = info.PlanName;
            TunnelName          = info.TunnelName;
            ProtectTime         = info.TimeProtect;
            IsLuxOrTime         = info.IsLightControl;
            ControlMode         = info.IsLightControl == 1 ? "光控" : "时控";
            IsSelectlightEnable = info.IsLightControl == 1;
            IsSelectTimeEnable  = info.IsLightControl == 2;
            SubOperationCount   = info.ItemPlan.Count;

            List <int> needAddRtu = new List <int>();


            var currentLux  = new IdNameDesc();
            var currentLux2 = new IdNameDesc();

            foreach (var x in LuxGetServer.GetAllLuxEquipment)
            {
                if (info.LuxId == x.Value)
                {
                    currentLux.Id       = x.Value;
                    currentLux.Name     = x.Name;
                    currentLux.NameDesc = x.Value2.ToString("d4") + "-" + x.Name;
                }
                if (info.LuxIdBackup == x.Value)
                {
                    currentLux2.Id       = x.Value;
                    currentLux2.Name     = x.Name;
                    currentLux2.NameDesc = x.Value2.ToString("d4") + "-" + x.Name;
                }
            }

            CurrentSelectLux  = currentLux;
            CurrentSelectLux2 = currentLux2;

            var terminalItem = new ObservableCollection <OneItemTerminal>();

            foreach (var t in info.RtusBelongThisTunnel)
            {
                var itemsInfo    = new ObservableCollection <TimeInfoName>();
                var itemsInfoNew = new ObservableCollection <TimeInfoName>();
                var lst          = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(t);
                var para         = lst as Wj3005Rtu;
                if (para == null)
                {
                    continue;
                }
                var name     = new List <string>();
                var wjswouts = (from tt in para.WjSwitchOuts orderby tt.Key select tt).ToList();

                foreach (var l in wjswouts)
                {
                    name.Add(l.Value.SwitchName);
                }


                for (int i = 0; i < 8; i++)
                {
                    itemsInfo.Add(new TimeInfoName()
                    {
                        IsCheckSwitch = false,//f.SwitchOutNeedOpen.Contains(i + 1),
                        IsEnabledOn   = i + 1 <= para.WjSwitchOuts.Count,
                        TimeTableName = i + 1 <= para.WjSwitchOuts.Count ? name[i] : null
                    });
                    itemsInfoNew.Add(new TimeInfoName()
                    {
                        IsCheckSwitch = false,//f.SwitchOutNeedOpen.Contains(i + 1),
                        IsEnabledOn   = i + 1 <= para.WjSwitchOuts.Count,
                        TimeTableName = i + 1 <= para.WjSwitchOuts.Count ? name[i] : null
                    });
                }

                terminalItem.Add(new OneItemTerminal()
                {
                    RtuId    = t,
                    RtuName  = lst.RtuName,
                    Items    = itemsInfo,
                    IsEnable = false
                });

                //加载隧道所属终端
                CurrentSelectedTerminalItems.Add(new OneItemTerminal()
                {
                    //RtuId = t,
                    //IsSelected = true,
                    RtuId    = t,
                    RtuName  = lst.RtuName,
                    Items    = itemsInfoNew,
                    IsEnable = false
                });
                needAddRtu.Add(t);
            }



            //操作
            foreach (var t in info.ItemPlan)
            {
                ObservableCollection <OneItemTerminal> terminalItemOne = new ObservableCollection <OneItemTerminal>();

                foreach (var g in terminalItem)
                {
                    for (int i = 0; i < 8; i++)
                    {
                        g.Items[i].IsCheckSwitch = false;
                    }

                    terminalItemOne.Add(new OneItemTerminal()
                    {
                        RtuId   = g.RtuId,
                        RtuName = g.RtuName,
                        Items   = g.Items,
                    });
                }


                foreach (var f in t.ItemRtuOpe)
                {
                    foreach (var ong in terminalItemOne)
                    {
                        if (ong.RtuId == f.RtuId)
                        {
                            for (int i = 0; i < 8; i++)
                            {
                                ong.Items[i].IsCheckSwitch = f.SwitchOutNeedOpen.Contains(i + 1);
                            }
                            ong.IsEnable = true;
                        }
                    }
                    //var itemsInfo=new ObservableCollection<TimeInfoName>();
                    //var lst = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f.RtuId);
                    //var para = lst as Wj3005Rtu;
                    //if (para == null) continue;
                    //var name = new List<string>();
                    //var wjswouts = (from tt in para.WjSwitchOuts orderby tt.Key select tt).ToList();

                    //foreach (var l in wjswouts)
                    //{
                    //    name.Add(l.Value.SwitchName);
                    //}


                    //for(int i=0;i<8;i++)
                    //{

                    //    itemsInfo.Add(new TimeInfoName()
                    //                      {
                    //                          IsCheckSwitch = f.SwitchOutNeedOpen.Contains(i + 1),
                    //                          IsEnabledOn = i + 1 <= para.WjSwitchOuts.Count,
                    //                          TimeTableName = i + 1 <= para.WjSwitchOuts.Count ? name[i] : null

                    //                      });
                    //}
                }

                ObservableCollection <OneItemTerminal> tmp = new ObservableCollection <OneItemTerminal>();

                var oneItem = (from tt in terminalItemOne orderby tt.PhyId select tt).ToList();

                foreach (var g in oneItem)
                {
                    var ttitem = new ObservableCollection <TimeInfoName>();
                    foreach (var tt in g.Items)
                    {
                        ttitem.Add(new TimeInfoName()
                        {
                            IsCheckSwitch = tt.IsCheckSwitch,
                            IsEnabledOn   = tt.IsEnabledOn,
                            TimeTableName = tt.TimeTableName
                        });
                    }

                    tmp.Add(new OneItemTerminal()
                    {
                        RtuId    = g.RtuId,
                        RtuName  = g.RtuName,
                        Items    = ttitem,
                        IsEnable = g.IsEnable
                    });
                }


                OperationItems.Add(new OneItemOperation(tmp)
                {
                    OperationName = t.OpeName,
                    OperationDesc = t.OpeDesc,
                    //CurrentSelectLux = currentLux,
                    //CurrentSelectLux2 = currentLux2,
                    MaxLux         = t.MaxValue,
                    LastTimeHour   = t.MaxValue / 60,
                    LastTimeMinute = t.MaxValue % 60,
                    SelectedItems  = tmp
                });
            }
        }