Exemple #1
0
        public TimeInfoOneVm(int areaId, SluTimeScheme.SluTimeSchemeItem info)
        {
            CmdPwmValueStrs        = "0%";
            UsedSluCount           = info.SluCtrls.Count;
            this.SchemeDesc        = info.SchemeDesc;
            this.SchemeId          = info.SchemeId;
            this.SchemeName        = info.SchemeName;
            this.CmdType           = info.SluTimePlanInfo.CmdType;
            this.IsSluOrCtrlScheme = info.IsSluOrCtrlScheme;
            this.IsNotUsed         = info.IsNotUsed;

            //this.OperationArgu = info.OperationArgu;

            if (LightUsedRtuIdColl.Count > 0)
            {
                CurrentSelectLightUsedRtuId = LightUsedRtuIdColl[0];
            }
            foreach (var g in LightUsedRtuIdColl)
            {
                if (g.Value == info.SluTimePlanInfo.LightUsedRtuId)
                {
                    CurrentSelectLightUsedRtuId = g;
                    break;
                }
            }

            this.OperationMethod = info.SluTimePlanInfo.OperationMethod;
            if (info.SluTimePlanInfo.OperationMethod == 1)
            {
                this.OperationArguHour   = info.SluTimePlanInfo.OperationArgu / 60;
                this.OperationArguMinute = info.SluTimePlanInfo.OperationArgu % 60;
            }
            if (info.SluTimePlanInfo.OperationMethod == 2)
            {
                this.OperationArguOffset = info.SluTimePlanInfo.OperationArgu;
            }
            //if (info.OperationMethod == 12)
            //{
            //    this.OperationArguOffset = info.OperationArgu;
            //}
            if (info.SluTimePlanInfo.OperationMethod == 11)
            {
                this.OperationArguLightStart = info.SluTimePlanInfo.OperationArgu / 10000;

                this.OperationArguLightEnd = info.SluTimePlanInfo.OperationArgu % 10000;
            }

            this.OperationOrder       = info.SluTimePlanInfo.OperationOrder + 1;
            this.LightEndEffectHour   = info.SluTimePlanInfo.LightEndEffect / 60;
            this.LightEndEffectMinute = info.SluTimePlanInfo.LightEndEffect % 60;

            this.LightStartEffectHour   = info.SluTimePlanInfo.LightStartEffect / 60;
            this.LightStartEffectMinute = info.SluTimePlanInfo.LightStartEffect % 60;

            //this.LightEndEffect = info.LightEndEffect;
            //this.LightStartEffect = info.LightStartEffect;
            // this.LightUsedRtuId = info.LightUsedRtuId;
            foreach (var g in this.OperationWeekSet)
            {
                if (info.SluTimePlanInfo.OperationWeekSet.Contains(g.Value))
                {
                    g.IsSelected = true;
                }
                else
                {
                    g.IsSelected = false;
                }
            }

            if (info.SluTimePlanInfo.CmdMix.Count > 3)
            {
                CmdMix1 = info.SluTimePlanInfo.CmdMix[0] + 1;
                CmdMix2 = info.SluTimePlanInfo.CmdMix[1] + 1;
                CmdMix3 = info.SluTimePlanInfo.CmdMix[2] + 1;
                CmdMix4 = info.SluTimePlanInfo.CmdMix[3] + 1;
            }



            CmdPwmValue = info.SluTimePlanInfo.CmdPwmScaleValue;


            for (int i = 0; i < 4; i++)
            {
                CmdPwmSel[i].IsSelected = info.SluTimePlanInfo.CmdPwmScale.Contains(i + 1);
            }

            if (info.SluTimePlanInfo.OperationMethod == 2 && info.SluTimePlanInfo.CmdType == 4)
            {
                bool openlight  = false;
                bool closelight = false;
                foreach (var g in info.SluTimePlanInfo.CmdMix)
                {
                    if (g == 4)
                    {
                        closelight = true;
                    }
                    if (g == 1 || g == 2 || g == 3)
                    {
                        openlight = true;
                    }
                }
                if (openlight == closelight)
                {
                    this.OperationMethod = 2;
                }
                else
                {
                    if (openlight)
                    {
                        this.OperationMethod = 2;
                    }
                    else
                    {
                        this.OperationMethod = 12;
                    }
                }
            }


            OnChanged();


            Ctrls = new Dictionary <int, SluTimeScheme.SluTimeSchemeItem.SluTimeCtrlSluOne>();
            var tu = new Tuple <int, int>(areaId, info.SchemeId);//lvfff

            foreach (
                var t in TimeInfos.MySelf.Info[tu].SluCtrls)   //var tu = new Tuple<int, int>(AreaId , g.GrpId);
            {
                if (Ctrls.ContainsKey(t.SluId))
                {
                    Ctrls[t.SluId] = t;
                }
                else
                {
                    Ctrls.Add(t.SluId, t);
                }
            }
            UsedSluCount = Ctrls.Count;
            UpdateOperatorAboutTime();
        }
        public TimeInfoOneQueryVm(int areaId, SluTimeScheme.SluTimeSchemeItem info, SluTimeScheme.SluTimeSchemeItem.SluTimeCtrlSluOne ctrls)
            : base(areaId, info)
        {
            bool is485 = false;

            var holdinf =
                Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(ctrls.SluId);

            if (holdinf != null)
            {
                if (holdinf.RtuFid == 0)
                {
                    is485 = false;
                }
                else
                {
                    is485 = true;
                }
            }

            if (info.IsNotUsed)
            {
                Status = "停用";
            }
            else
            {
                Status = "使用";
            }


            if (ctrls.OperatorType == 101)
            {
                CtrlInfos = "无操作";
            }
            if (ctrls.OperatorType == 10)
            {
                CtrlInfos = "全部节点";
            }
            if (ctrls.OperatorType == 21)
            {
                CtrlInfos = "单数节点";
            }
            if (ctrls.OperatorType == 20)
            {
                CtrlInfos = "双数节点";
            }
            if (ctrls.OperatorType == 31)
            {
                CtrlInfos = "隔二亮一";
            }
            if (ctrls.OperatorType == 41)
            {
                CtrlInfos = "隔三亮一";
            }
            if (ctrls.OperatorType == 51)
            {
                CtrlInfos = "隔四亮一";
            }
            if (ctrls.OperatorType == 4)
            {
                CtrlInfos = "分组:";

                foreach (var g in ctrls.CtrlPhys)
                {
                    CtrlInfos += g + "-";
                }

                CtrlInfos = CtrlInfos.Substring(0, CtrlInfos.Length - 1);
            }
        }
Exemple #3
0
        public SluTimeScheme.SluTimeSchemeItem BackToSluTimeSchemeOne()
        {
            var infof = new SluTimeScheme.SluTimeSchemeItem()
            {
                SluTimePlanInfo = new SluTimeScheme.SluTimeSchemeItem.SluTimePlan()
                {
                    CmdType          = this.CmdType,
                    LightEndEffect   = LightEndEffectHour * 60 + LightEndEffectMinute,
                    LightStartEffect = LightStartEffectHour * 60 + LightStartEffectMinute,
                    LightUsedRtuId   =
                        CurrentSelectLightUsedRtuId == null ? 0 : CurrentSelectLightUsedRtuId.Value,
                    OperationOrder   = OperationOrder - 1,
                    CmdMix           = new List <int>(),
                    CmdPwmScale      = new List <int>(),
                    OperationWeekSet = new List <int>(),
                    OperationArgu    = 0,
                    OperationMethod  = OperationMethod
                },
                IsSluOrCtrlScheme = IsSluOrCtrlScheme,
                Nindex            = 0,
                // SluCtrls =Ctrls ,
                SchemeName    = SchemeName,
                SchemeDesc    = SchemeDesc,
                SchemeId      = SchemeId,
                SchemeDescSec = "",
                IsNotUsed     = this.IsNotUsed,
                SluCtrls      = new List <SluTimeScheme.SluTimeSchemeItem.SluTimeCtrlSluOne>(),
            };

            if (OperationMethod == 12)
            {
                infof.SluTimePlanInfo.OperationMethod = 2;
            }
            infof.SluTimePlanInfo.CmdMix.Add(CmdMix1 - 1);
            infof.SluTimePlanInfo.CmdMix.Add(CmdMix2 - 1);
            infof.SluTimePlanInfo.CmdMix.Add(CmdMix3 - 1);
            infof.SluTimePlanInfo.CmdMix.Add(CmdMix4 - 1);
            //   int pwmvalue = CmdPwmValue - 1;
            foreach (var g in CmdPwmSel)
            {
                if (g.IsSelected)
                {
                    infof.SluTimePlanInfo.CmdPwmScale.Add(g.Value);
                }
            }
            infof.SluTimePlanInfo.CmdPwmScaleValue = CmdPwmValue;

            foreach (var g in OperationWeekSet)
            {
                if (g.IsSelected)
                {
                    infof.SluTimePlanInfo.OperationWeekSet.Add(g.Value);
                }
            }
            if (OperationMethod == 1)
            {
                infof.SluTimePlanInfo.OperationArgu = OperationArguHour * 60 + OperationArguMinute;
            }
            if (OperationMethod == 2 || OperationMethod == 12)
            {
                infof.SluTimePlanInfo.OperationArgu = OperationArguOffset;
            }
            if (OperationMethod == 11)
            {
                infof.SluTimePlanInfo.OperationArgu = OperationArguLightStart * 10000 + OperationArguLightEnd;
            }
            foreach (var g in Ctrls)
            {
                infof.SluCtrls.Add(g.Value);
            }


            return(infof);
        }