Beispiel #1
0
 public void SetLogInfo(_autoLiftLevelInfo autoLevelInfo)
 {
     m_nShowTime++;
     m_pLiftLevelInfo = autoLevelInfo;
     WriteWorksDoneLog(autoLevelInfo);
     //if (m_pSectonObj.SectionAlarmLevel > 1)
     //{
     //    InitializeControlInfo();
     //    m_soundPlay.AppendSoundAcc();
     //}
     //else
     //{
     //    this.lbSectionName.Text = string.Format("{0}[{1}]", m_pSectonObj.XingBieName, m_pSectonObj.SectionName);
     //    this.lbLevel.Text = Levels[m_pSectonObj.SectionAlarmLevel];
     //    this.lbName.Text = CINIFile.IniReadValue("基本信息", "当前值班负责人", paths.baseInfoPath);
     //    long pre6 = Time.DateTime2DbTime(DateTime.Now) - 6 * 3600;
     //    this.lbTime.Text = m_pSectonObj.PatrolledTime > 0 ? Time.DbTime2DateTime(m_pSectonObj.PatrolledTime).ToString() : (Time.DbTime2DateTime(pre6).ToString());
     //    this.lbBreakTimeCaption.Text = "出巡开始时间";
     //    this.lbLiftTimeCaption.Text = "出巡结束时间";
     //    this.m_pLbOKHandle.Text = "恢复正常";
     //    m_soundPlay.AppendSoundAcc();
     //}
     InitializeControlInfo();
     // m_soundPlay.AppendSoundAcc();
 }
Beispiel #2
0
        /// <summary>
        /// 手动解除
        /// </summary>
        /// <returns></returns>
        public override bool ManualLiftComputer()
        {
            _autoLiftLevelInfo li = new _autoLiftLevelInfo();
            bool IsCanLiftSection = false;
            int  m_nLevel         = SectionAlarmLevel;

            if (m_nLevel > 0)
            {
                //检查报警站点雨量是否满足解除条件
                foreach (AVirtualSection avs in VirtualSectionList)
                {
                    if (avs.SiteID.Equals(m_pSectionSerializer.LiftId))
                    {
                        if (avs.DoCanLiftLevel(m_pSectionSerializer.LastLevel, m_pSectionSerializer.LiftValue, m_pSectionSerializer.WarningTime))
                        {
                            IsCanLiftSection = true;
                            li = avs.GetLiftLevelInof();
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
                //如果报警站点满足解除条件,判断区间内其它采集点的雨量是否满足解除条件
                if (IsCanLiftSection)
                {
                    foreach (AVirtualSection avs in VirtualSectionList)
                    {
                        if (!avs.SiteID.Equals(m_pSectionSerializer.LiftId))
                        {
                            IsCanLiftSection &= avs.DoCanLiftLevel(m_pSectionSerializer.LastLevel, m_pSectionSerializer.LiftValue, m_pSectionSerializer.WarningTime);
                        }
                    }
                }
                if (IsCanLiftSection)
                {
                    if (m_nLevel == SectionAlarmLevel)
                    {
                        li.secName    = SectionName;
                        li.secid      = ID;
                        li.uuid       = m_pSectionSerializer.UUID;
                        LiftLevelInfo = li;

                        HadMeasure = todo[li.level];
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }
        //void m_liftLevelManager_onShowLiftButtonEvent(bool b)
        //{
        //    if (this.InvokeRequired)
        //    {
        //        Action<Control> setCtrlVisible = (X) =>
        //        {
        //            if (b)
        //            {
        //                if (X.Visible != b)
        //                {
        //                    m_soundPlay.AppendSoundAcc();
        //                    X.Visible = b;
        //                }
        //            }
        //            else
        //            {
        //                if (X.Visible != b)
        //                {
        //                    m_soundPlay.RemoveSoundAcc();
        //                    X.Visible = b;
        //                }
        //            }
        //        };
        //        Invoke(setCtrlVisible, lbLiftLevel);
        //    }
        //    else
        //    {
        //        if (b)
        //        {
        //            if (lbLiftLevel.Visible != b)
        //            {
        //                m_soundPlay.AppendSoundAcc();
        //                lbLiftLevel.Visible = b;
        //            }
        //        }
        //        else
        //        {
        //            if (lbLiftLevel.Visible != b)
        //            {
        //                m_soundPlay.RemoveSoundAcc();
        //                lbLiftLevel.Visible = b;
        //            }
        //        }


        //    }


        //}
        #region 解除窗体操作
        void onNotifyLiftWindowEvent(_autoLiftLevelInfo liftLevelInfo, _RFLog[] rlog)
        {
            m_liftLevelInfo = liftLevelInfo;
            m_rLog          = rlog;

            try
            {
                this.BeginInvoke(showAutoLiftDlgEvent, liftLevelInfo);
            }
            catch
            {
            }
        }
Beispiel #4
0
        private void WriteWorksDoneLog(_autoLiftLevelInfo autoLevelInfo)
        {
            /*
             * r.typelevel >> 16, r.typelevel & 0xffff
             */
            string reason = null;

            CWorksDoneReg.GetWorksReason(autoLevelInfo.t1, autoLevelInfo.t2, autoLevelInfo.value, TagType.tag_open, autoLevelInfo.level, ref reason, 0);
            this.labReason.Text = reason;
            CWorksDoneReg.GetWorksDone(autoLevelInfo.level, ref reason);
            this.lbTime.Text        = reason;
            this.lbSectionName.Text = autoLevelInfo.secName;
            log.siteId    = autoLevelInfo.siteid;
            log.tm1       = autoLevelInfo.t1;
            log.tm2       = autoLevelInfo.t2;
            log.value     = autoLevelInfo.value;
            log.typelevel = (TagType.tag_open << 16) | autoLevelInfo.level;
            log.hourValue = 0;
            log.name      = string.Format("{0},{1}", CINIFile.IniReadValue("基本信息", "当前值班负责人", paths.baseInfoPath), m_pSectonObj.SectionName);
            m_dbHelper.WriteRunLogInfoDB(autoLevelInfo.secName + "解除=" + autoLevelInfo.level.ToString(), autoLevelInfo.secName + "解除警戒:警戒级别=" + autoLevelInfo.level.ToString());
            m_dbHelper.WriteWorksDoneLog(log);
        }
 void showAutoLiftDlg(_autoLiftLevelInfo li)
 {
     //SetToolTip(li.level);
     System.Diagnostics.Debug.WriteLine(li.secName);
     if (m_frmAutoWindow.IsDisposed)
     {
         m_frmAutoWindow = new frmAutoWindow();
         m_frmAutoWindow.onInvokeWindowEvent    += new InvokeLiftWindowHandler(InvokeLiftWindow);
         m_frmAutoWindow.onContinueToCheckEvent += new InvokeLiftWindowHandler(ContinueToCheck);
         //m_frmReg.btnClickEvent += new onBtnClickHandler(frmReg_btnClickEvent);
     }
     if (m_frmAutoWindow.DbHelper == null)
     {
         m_frmAutoWindow.DbHelper = m_rainfallsDBHelper;
     }
     if (!m_frmAutoWindow.Visible && !m_frmLiftDlg.Visible)
     {
         m_frmAutoWindow.setObject(li.secName);
         m_frmAutoWindow.setLocation(m_nOffsetX, m_nOffsetY);
         m_frmAutoWindow.SetLogInfo(li);
         m_frmAutoWindow.Show();
     }
 }
Beispiel #6
0
        public override bool DoCanLiftLevel(long warningtime, int level, int liftvalue, ref _autoLiftLevelInfo liftinfo)
        {
            int timespan = 3600;

            switch (level)
            {
            case 1:
                timespan = 1 * 3600;
                break;

            case 2:
                timespan = 1 * 3600;
                break;

            case 3:
                timespan = 1 * 3600 + 3600 / 2;
                break;

            case 4:
                timespan = 1 * 3600 + 3600 / 2;
                break;
            }
            long t  = Time.DateTime2DbTime(DateTime.Now);
            long t1 = warningtime;

            if (t - t1 < timespan)
            {
                return(false);
            }
            else
            {
                t1 = t - timespan;
            }
            long N       = g_nRecords;
            long _record = 0;

            if (N <= 0)
            {
                return(true);
            }

            while (N > 1)
            {
                if (g_pList[N - 1].tm <= t && g_pList[N - 1].tm >= t1)
                {
                    _record++;
                    N--;
                }
                else
                {
                    break;
                }
            }

            if (_record <= liftvalue * 10)
            {
                liftinfo.siteid = SiteID;
                liftinfo.t1     = t1;
                liftinfo.t2     = t;
                liftinfo.isAuto = true;
                liftinfo.level  = (-level);
                liftinfo.value  = liftvalue * 10;
                //加个区间ID;
                return(true);
            }
            return(false);
        }
Beispiel #7
0
        /// <summary>
        /// 自动判断线程
        /// </summary>
        void AutoLiftComputer()
        {
            _autoLiftLevelInfo li = new _autoLiftLevelInfo();

            for (; ;)
            {
                Thread.Sleep(5 * 1000);
                bool IsCanLiftSection = false;
                int  m_nLevel         = SectionAlarmLevel;
                if (m_nLevel > 0)
                {
                    //检查报警站点雨量是否满足解除条件
                    foreach (AVirtualSection avs in VirtualSectionList)
                    {
                        if (avs.SiteID.Equals(m_pSectionSerializer.LiftId))
                        {
                            if (avs.DoCanLiftLevel(m_pSectionSerializer.LastLevel, m_pSectionSerializer.LiftValue, m_pSectionSerializer.WarningTime))
                            {
                                IsCanLiftSection = true;
                                li = avs.GetLiftLevelInof();
                            }
                            else
                            {
                                IsCanLiftSection = false; //PostShowOpenNotifyControlMessage(0);
                                HadMeasure       = todo[SectionAlarmLevel]; PostRefreshSectionGridViewMessage();
                            }
                        }
                    }
                    //如果报警站点满足解除条件,判断区间内其它采集点的雨量是否满足解除条件
                    if (IsCanLiftSection)
                    {
                        bool b = true;
                        foreach (AVirtualSection avs in VirtualSectionList)
                        {
                            if (!avs.SiteID.Equals(m_pSectionSerializer.LiftId))
                            {
                                b = avs.DoCanLiftLevel(m_pSectionSerializer.LastLevel, m_pSectionSerializer.LiftValue, m_pSectionSerializer.WarningTime);
                                if (b == false)
                                {
                                    IsCanLiftSection = false;
                                }
                            }
                        }
                    }
                    if (IsCanLiftSection)
                    {
                        if (m_nLevel == SectionAlarmLevel)
                        {
                            //li.secName = SectionName;
                            //li.secid = ID;
                            //LiftLevelInfo = li;
                            HadMeasure = todo[li.level]; PostRefreshSectionGridViewMessage();
                            //PostShowLiftControlMessage();
                        }
                        else
                        {
                            //PostHideLiftControlMessage();
                            HadMeasure = todo[SectionAlarmLevel]; PostRefreshSectionGridViewMessage();
                        }
                    }
                    else
                    {
                        //PostHideLiftControlMessage();
                        HadMeasure = todo[SectionAlarmLevel]; PostRefreshSectionGridViewMessage();
                    }
                }
            }
        }
Beispiel #8
0
 public abstract bool DoCanLiftLevel(long warningtime, int level, int liftvalue, ref _autoLiftLevelInfo liftinfo);