public _RFLog GetTrackBreakRecords(string uuid)
        {
            _RFLog log = new _RFLog();

            System.Data.DataSet ds = new System.Data.DataSet();
            string sql             = string.Format("select * from section_log_rain where  uuid ='{0}' ", uuid);

            if (m_sqliteManager.QueryBySql(sql, ds) > 0)
            {
                System.Data.DataTable dt = ds.Tables[0];
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    log.uuid       = dr[0].ToString();
                    log.section_id = dr[1].ToString();
                    log.site_id    = dr[2].ToString();
                    log.logtime    = long.Parse(dr[3].ToString());
                    log.tm1        = long.Parse(dr[4].ToString());
                    log.tm2        = long.Parse(dr[5].ToString());
                    log.note       = dr[6].ToString();
                    log.lift_time  = dr[7].ToString();
                    log.lift_value = dr[8].ToString();
                    log.level      = dr[9].ToString();
                }
            }
            return(log);
        }
示例#2
0
        private void InitializeControlInfo()
        {
            rlog = new _RFLog();
            rlog = DbHelper.GetTrackBreakRecords(m_pLiftLevelInfo.uuid);
            if (string.IsNullOrEmpty(rlog.uuid))
            {
                MessageBox.Show(string.Format("没有找到区间:{0}的报警记录,数据错误!", m_pSectonObj.SectionName), "解除提示", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                StopRegLift();
                return;
            }

            this.lbSectionName.Text = string.Format("{0}[{1}]", m_pSectonObj.XingBieName, m_pSectonObj.SectionName);
            this.lbLevel.Text       = Levels[int.Parse(rlog.level)];
            this.lbName.Text        = rlog.note;
            this.lbTime.Text        = Time.DbTime2DateTime(rlog.tm1).ToString();
            if (rlog.level.Equals("1"))
            {
                this.lbBreakTimeCaption.Text = "出巡开始时间";
                this.lbLiftTimeCaption.Text  = "出巡恢复时间";
                this.m_pLbOKHandle.Text      = "出巡解除,班次巡查";
            }
            else if (rlog.level.Equals("2"))
            {
                this.lbBreakTimeCaption.Text = "限速开始时间";
                this.lbLiftTimeCaption.Text  = "限速恢复时间";
                this.m_pLbOKHandle.Text      = "恢复常速";
            }
            else
            {
                this.lbBreakTimeCaption.Text = "断道封锁时间";
                this.lbLiftTimeCaption.Text  = "断道开通时间";
                this.m_pLbOKHandle.Text      = rlog.level.Equals("3") ? "解除客车封锁" : "解除货车封锁";
            }
        }
        public bool WriteRFlog(_RFLog log)
        {
            string sql    = string.Format("insert into section_log_rain values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", log.uuid, log.section_id, log.site_id, log.logtime, log.tm1, log.tm2, log.note, log.lift_time, log.lift_value, log.level);
            string szData = string.Format("{0}&{1}&{2}&{3}&{4}&{5}&{6}&{7}&{8}&ZE", log.section_id, log.site_id, log.logtime, log.tm1, log.tm2, log.note, log.lift_time, log.lift_value, log.level);

            WriteToTempDB(szData);
            m_sqliteManager.ExcuteSql(sql);
            return(true);
        }
示例#4
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            log.name = this.labPerson.Text;
            if (log.name == "单击选择")
            {
                return;
            }
            this.Hide();
            m_rainfallsDbHelper.WriteWorksDoneLog(log);

            if (m_nLevel == 1)
            {
                m_rainfallsDbHelper.WriteSms(sms, m_levelInfo);
            }
            else
            {
                _RFLog rlog = new _RFLog();
                rlog.site_id    = m_levelInfo.site_id;
                rlog.logtime    = Time.DateTime2DbTime(System.DateTime.Now);
                rlog.railLine   = null;
                rlog.km         = m_pSectonObj.SectionName;
                rlog.note       = labPerson.Text;
                rlog.dir        = null;
                rlog.lift_time  = m_levelInfo.liftTime.ToString();
                rlog.lift_value = m_levelInfo.liftValue.ToString();
                rlog.level      = m_levelInfo.level.ToString();
                string   startTime = this.lbTime.Text;
                DateTime dt        = DateTime.Parse(startTime);

                if (m_nLevel == 2)
                {
                    rlog.limit_start = Time.DateTime2DbTime(dt);
                }
                else
                {
                    rlog.brk_close = Time.DateTime2DbTime(dt);
                }
                m_rainfallsDbHelper.WriteRFlog(rlog);

                _SMS sms = new _SMS();
                sms.siteId    = m_levelInfo.site_id;
                sms.railLine  = rlog.railLine;
                sms.km        = rlog.km;
                sms.tm1       = m_levelInfo.t1;
                sms.tm2       = m_levelInfo.t2;
                sms.value     = m_levelInfo.delta;
                sms.typelevel = (m_levelInfo.tag << 16) | m_levelInfo.level;
                sms.hourValue = m_levelInfo.hValue;
                m_rainfallsDbHelper.WriteSms(sms, m_levelInfo);
                m_rainfallsDbHelper.WriteRunLogInfoDB(m_pSectonObj.SectionName + "登记=" + m_levelInfo.level.ToString(), m_pSectonObj.SectionName + "登记报警:当前级别=" + m_levelInfo.level.ToString());
            }
            //   m_sectionSubject.saveLevel(m_nLevel);
            //CAlarm.G_CAlarm.soundOff(true);
            m_soundPlay.RemoveSoundAcc(m_nShowTime);
            m_nShowTime = 0;
        }
        public bool UpDateRFlogDb(_RFLog log)
        {
            string sql    = string.Format("update section_log_rain set tm2 = '{0}' where uuid = '{1}' ", log.tm2, log.uuid);
            string szData = string.Format("{0}&{1}&{2}&{3}&{4}&{5}&{6}&{7}&{8}&ZE", log.section_id, log.site_id, log.logtime, log.tm1, log.tm2, log.note, log.lift_time, log.lift_value, log.level);

            WriteToTempDB(szData);

            m_sqliteManager.ExcuteSql(sql);
            return(true);
        }
        public _RFLog[] GetTrackBreakRecords(out int N, ASectionObj obj)
        {
            _RFLog[] log      = new _RFLog[64];
            long     stopTime = 0;
            long     t;

            System.Data.DataSet ds = new System.Data.DataSet();
            string sql             = string.Format("select * from section_log_rain where tm2 == 0 and secid ='{0}' order by log_time", obj.ID);

            N = 0;
            if (m_sqliteManager.QueryBySql(sql, ds) > 0)
            {
                System.Data.DataTable dt = ds.Tables[0];
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    t = long.Parse(dr[3].ToString());
                    if (t > 0)
                    {
                        foreach (AVirtualSection av in obj.VirtualSectionList)
                        {
                            if (dr[2].ToString().Equals(av.SiteID))
                            {
                                stopTime = av.SiteObj.getStopTime(t);
                            }
                        }

                        if (Time.DateTime2DbTime(System.DateTime.Now) - stopTime < 24 * 3600)
                        {
                            log[N].uuid       = dr[0].ToString();
                            log[N].section_id = dr[1].ToString();
                            log[N].site_id    = dr[2].ToString();
                            log[N].logtime    = long.Parse(dr[3].ToString());
                            log[N].tm1        = long.Parse(dr[4].ToString());
                            log[N].tm2        = long.Parse(dr[5].ToString());
                            log[N].note       = dr[6].ToString();
                            log[N].lift_time  = dr[7].ToString();
                            log[N].lift_value = dr[8].ToString();
                            log[N].level      = dr[9].ToString();
                            N++;
                        }
                    }
                }
            }
            return(log);
        }
示例#7
0
        private void SaveLogInfo()
        {
            SaveDataNotify("[正在保存报警数据...]");
            m_pRainfallsDbHelper.WriteWorksDoneLog(m_pWorksDoneLog);

            if (m_pLevelInfo.level == 1 && m_pLevelInfo.liftValue == 0)
            {
                m_pLevelInfo.liftValue = 2;
            }
            _RFLog rlog = new _RFLog();

            rlog.uuid       = System.Guid.NewGuid().ToString("N");
            rlog.section_id = m_pSectonObj.ID;
            rlog.site_id    = m_pLevelInfo.site_id;
            rlog.logtime    = Time.DateTime2DbTime(System.DateTime.Now);
            string   startTime = this.lbTime.Text;
            DateTime dt        = DateTime.Parse(startTime);

            rlog.tm1        = Time.DateTime2DbTime(dt);
            rlog.note       = CINIFile.IniReadValue("基本信息", "当前值班负责人", paths.baseInfoPath);
            rlog.lift_time  = m_pLevelInfo.liftTime.ToString();
            rlog.lift_value = m_pLevelInfo.liftValue.ToString();
            rlog.level      = m_pLevelInfo.level.ToString();


            m_pRainfallsDbHelper.WriteRFlog(rlog);

            _SMS sms = new _SMS();

            sms.siteId    = m_pLevelInfo.site_id;
            sms.railLine  = rlog.note;
            sms.km        = m_pSectonObj.ID;
            sms.tm1       = m_pLevelInfo.t1;
            sms.tm2       = m_pLevelInfo.t2;
            sms.value     = m_pLevelInfo.delta;
            sms.typelevel = m_pWorksDoneLog.typelevel;
            sms.hourValue = m_pLevelInfo.hValue;
            m_pRainfallsDbHelper.WriteSms(sms, m_pLevelInfo);


            m_pSectonObj.SaveLevelInfo(m_pLevelInfo);

            InspectorsLab.getInstance().AddNewInspectorTaskAlarm(m_pLevelInfo.level);
        }
示例#8
0
        protected override void ReadJson()
        {
            if (m_pAlarmRecordlogs.Count > 0)
            {
                _RFLog r = m_pAlarmRecordlogs.Peek();
                m_pSectionSerializer.LiftId      = r.site_id;
                m_pSectionSerializer.LiftValue   = int.Parse(r.lift_value);
                m_pSectionSerializer.LastLevel   = int.Parse(r.level);
                m_pSectionSerializer.WarningTime = r.tm1;
                m_pSectionSerializer.UUID        = r.uuid;
                SectionAlarmLevel = m_pSectionSerializer.LastLevel;
            }
            else
            {
                SectionAlarmLevel = 0;
                m_pSectionSerializer.Clear();
            }
            LevelFormat = worksdone[SectionAlarmLevel];
            HadMeasure  = todo[SectionAlarmLevel];

            //if (File.Exists(m_pJsonPath))
            //{
            //    StreamReader sr = new StreamReader(m_pJsonPath);
            //    string json = sr.ReadToEnd();
            //    JavaScriptSerializer js = new JavaScriptSerializer();
            //    m_pSectionSerializer = js.Deserialize<CSectionSerializer>(json);
            //    SectionAlarmLevel = m_pSectionSerializer.LastLevel;
            //    LevelFormat = worksdone[SectionAlarmLevel];
            //    HadMeasure = todo[SectionAlarmLevel];
            //    sr.Close();
            //}
            //else
            //{
            //    LevelFormat = worksdone[SectionAlarmLevel];
            //    HadMeasure = todo[SectionAlarmLevel];
            //}
        }
示例#9
0
        public void Initialize(bool bRealtime, string historytm)
        {
            int[] _start_mm = new int[48];
            int[] _mm       = new int[48];

            if (bRealtime)
            {
                setlbDtTxt();
            }
            else
            {
                setlbDtTxt(historytm);
            }
            //////////////
            long     now            = Time.DateTime2DbTime(DateTime.Now);
            long     oneDayBefore   = Time.DateTime2DbTime(DateTime.Parse(lbTime.Text)) - 24 * 3600;
            long     d              = 0;
            DateTime dt_now         = Time.DbTime2DateTime(now);
            DateTime dt_oneDayBefor = Time.DbTime2DateTime(oneDayBefore);

            if (dt_now.Day == dt_oneDayBefor.Day &&
                dt_now.Month == dt_oneDayBefor.Month &&
                dt_now.Year == dt_oneDayBefor.Year &&
                dt_now.Hour > 18)
            {
                d = now;
            }
            else
            {
                d = oneDayBefore;
            }
            DateTime dt = Time.DbTime2DateTime(d);

            dt = new DateTime(dt.Year, dt.Month, dt.Day, 19, 0, 0);
            long t0 = Time.DateTime2DbTime(dt);

            ////////////////
            _maxunit[] mu = new _maxunit[25];
            m_siteRainCalc.getMMByHour(t0, 25, _start_mm, _mm, m_pCurSite);
            m_siteRainCalc.getMaxUnits(t0, 600, mu, m_pCurSite);
            rainLogCtrl.logCtrl._maxunit [] mu2 = new rainLogCtrl.logCtrl._maxunit[25];
            for (int i = 0; i < 25; i++)
            {
                mu2[i].start     = mu[i].start;
                mu2[i].end       = mu[i].end;
                mu2[i].max       = mu[i].max;
                mu2[i].idx_start = mu[i].idx_start;
                mu2[i].idx_end   = mu[i].idx_end;
            }
            _RFLog[] log = new _RFLog[64];
            int      N   = m_dbHelper.GetRainLogRecords(log, t0, m_pCurSite.SiteID);

            rainLogCtrl.logCtrl._RFLog[] rLog = new rainLogCtrl.logCtrl._RFLog[64];
            for (int i = 0; i < N; i++)
            {
                if (log[i].level.Equals("1"))
                {
                    continue;
                }
                if (log[i].level.Equals("2"))
                {
                    rLog[i].limit_restore = log[i].tm2;
                    rLog[i].limit_start   = log[i].tm1;
                    rLog[i].brk_close     = 0;
                    rLog[i].brk_open      = 0;
                }
                if (log[i].level.Equals("3") || log[i].level.Equals("4"))
                {
                    rLog[i].limit_restore = 0;
                    rLog[i].limit_start   = 0;
                    rLog[i].brk_close     = log[i].tm2;
                    rLog[i].brk_open      = log[i].tm1;
                }

                rLog[i].dir   = (m_siteRainCalc.getXingbieName(log[i].section_id).Split('~'))[1];
                rLog[i].km    = m_siteRainCalc.getQjName(log[i].section_id);
                rLog[i].level = log[i].level;

                rLog[i].logtime  = log[i].logtime;
                rLog[i].note     = log[i].note;
                rLog[i].railLine = m_siteRainCalc.getLineName(log[i].section_id);
                rLog[i].site_id  = log[i].site_id;
            }
            rainlogCtrl.SetRainLog(_start_mm, _mm, mu2, now, t0, rLog, N);
        }