Exemplo n.º 1
0
        private void InsertGRAlarmDataToDB(int grStId, GRAlarmData ad)
        {
            GRAlarmData GRAlarm = ad;

            SqlConnection con = new SqlConnection(XGConfig.Default.ConnectionString);

            con.Open();

            SqlCommand cmd = new SqlCommand("AddGRAlarm", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@p_grstation_id", grStId); //,i);//

            cmd.Parameters.Add("@p_time", DateTime.Now);
            cmd.Parameters.Add("@p_oneGiveTempLow", GRAlarm.oneGiveTemp_lo);
            cmd.Parameters.Add("@p_twoGiveTempHigh", GRAlarm.twoGiveTemp_hi);
            cmd.Parameters.Add("@p_oneGivePressLow", GRAlarm.oneGivePress_lo);
            cmd.Parameters.Add("@p_twoGivePressHigh", GRAlarm.twoGivePress_hi);
            cmd.Parameters.Add("@p_twoBackPressHigh", GRAlarm.twoBackPress_hi);
            cmd.Parameters.Add("@p_twoBackPressLow", GRAlarm.twoBackPress_lo);
            cmd.Parameters.Add("@p_WatLevelLow", GRAlarm.watLevel_lo);
            cmd.Parameters.Add("@p_WatLevelHigh", GRAlarm.watLevel_hi);
            cmd.Parameters.Add("@p_pumpAlarm1", GRAlarm.cycPump1);
            cmd.Parameters.Add("@p_pumpAlarm2", GRAlarm.cycPump2);
            cmd.Parameters.Add("@p_pumpAlarm3", GRAlarm.cycPump3);
            cmd.Parameters.Add("@p_addPumpAlarm1", GRAlarm.recruitPump1);
            cmd.Parameters.Add("@p_addPumpAlarm2", GRAlarm.recruitPump2);
            cmd.Parameters.Add("@p_NoPower", GRAlarm.powerOff);
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            con.Close();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 判断从供热实时数据中获取的报警数据中是否包含报警值
        /// </summary>
        /// <remarks>
        /// 供热实时数据中包含报警数据(同自动上报的报警数据),该报警数据中可能包含或不包含报警数据。
        /// 不包含报警值时,报警数据不存入数据库,
        /// 包含报警值时,处理同自动上报的报警数据。
        /// </remarks>
        /// <param name="ad"></param>
        /// <returns></returns>
        private bool IsIncludeAlarm(GRAlarmData ad)
        {
            ArgumentChecker.CheckNotNull(ad);
            if (ad.cycPump1 || ad.cycPump2 || ad.cycPump3)
            {
                return(true);
            }
            if (ad.oneGivePress_lo || ad.oneGiveTemp_lo)
            {
                return(true);
            }
            if (ad.powerOff || ad.recruitPump1 || ad.recruitPump2)
            {
                return(true);
            }
            if (ad.twoBackPress_hi || ad.twoBackPress_lo || ad.twoGivePress_hi || ad.twoGiveTemp_hi)
            {
                return(true);
            }
            if (ad.watLevel_hi || ad.watLevel_lo)
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="remoteIP"></param>
        /// <param name="address"></param>
        /// <param name="ad"></param>
        public void InsertGRAlarmDataToDb(string remoteIP, int address, GRAlarmData ad)
        {
            ArgumentChecker.CheckNotNull(ad);
            int grStId = XGDB.GetGRStationID(remoteIP, address);

            if (grStId != -1)
            {
                InsertGRAlarmDataToDB(grStId, ad);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 处理由自动上报数据处理器接收到的供热实时数据
        /// </summary>
        /// <param name="remoteIP"></param>
        /// <param name="address"></param>
        /// <param name="rd"></param>
        public void ProcessGRRealData(string remoteIP, int address, GRRealData rd)
        {
            ArgumentChecker.CheckNotNull(rd);

            InsertGRRealDataToDb(remoteIP, address, rd);

            GRAlarmData adFromRealData = rd.GrAlarmData;

            if (IsIncludeAlarm(adFromRealData))
            {
                ARDProcessor.Default.InsertGRAlarmDataToDb(remoteIP, address, adFromRealData);
            }

            Singles.S.GRStRds.ChangeWithRemoteIP(remoteIP, address, rd);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 处理供热自动上报报警数据
        /// </summary>
        /// <param name="source"></param>
        /// <param name="address"></param>
        /// <param name="innerDatas"></param>
        /// <returns></returns>
        //public GRAlarmData ProcessGRARD( int sourceCommPort, int address, byte[] innerDatas )
        public GRAlarmData ProcessGRARD(string remoteIP, int address, byte[] innerDatas)
        {
            GRAlarmData alarm = GRAlarmData.Parse(innerDatas, address);

            InsertGRAlarmDataToDb(remoteIP, address, alarm);
            //TODO:
            //
            string grStName = XGDB.GetGRStationName(remoteIP);

            frmGRAlarmDataPopUp f = frmGRAlarmDataPopUp.Default;

            f.AddGrAlarmData(grStName, remoteIP, address, alarm);
            // f = new frmGRAlarmDataPopUp();


            return(alarm);
        }
Exemplo n.º 6
0
        //private void ProcessGRRealDataCmd( int commPort , Communication.GRCtrl.GRRealDataCommand realDataCmd )
        /// <summary>
        /// 处理供热实时采集数据
        /// </summary>
        /// <param name="remoteIP"></param>
        /// <param name="realDataCmd"></param>
        private void ProcessGRRealDataCmd(string remoteIP, Communication.GRCtrl.GRRealDataCommand realDataCmd)
        {
            // save gr real data to db
            //
            GRRealData rd   = realDataCmd.GRRealData;
            int        addr = realDataCmd.Station.Address;

            // Save( commPort, addr, rd );
            InsertGRRealDataToDb(remoteIP, addr, rd);

            // Update Singles.S.OutSideTemperature
            //
            GRStation grSt = (GRStation)realDataCmd.Station;

            if (grSt.OSTWorkMode == OutSideTempWorkMode.CollByControllor)
            {
                Singles.S.OutSideTemperature = rd.OutSideTemp;
                //TODO: Write out side temperature to DB
                //
            }

            // process grAlarmData in grRealData
            //
            GRAlarmData adFromRealData = rd.GrAlarmData;

            if (IsIncludeAlarm(adFromRealData))
            {
                ARDProcessor.Default.InsertGRAlarmDataToDb(remoteIP, addr, adFromRealData);
            }

            // 2007.03.03 Added to singles.GrStRds
            //
//            GRStationLastRealData last = new GRStationLastRealData( grSt, rd );
//            Singles.S.GRStRds.Add( last );
            Singles.S.GRStRds.ChangeWithRemoteIP(grSt.DestinationIP, grSt.Address, rd);
        }
Exemplo n.º 7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="grStName"></param>
        /// <param name="rd"></param>
        public void AddGrAlarmData(string grStName, string remoteIP, int address, GRAlarmData ad)
        {
            //假定上报报警数据中不包含报警
            //
            this._isIncludeAlarm = false;

            ArgumentChecker.CheckNotNull(ad);
            _grStName = grStName;
            _remoteIP = remoteIP;
            _address  = address;

            if (ad.cycPump1)
            {
                AddLvi(CYCLE_PUMP_1, ALARM_FAULT);
            }
            if (ad.cycPump2)
            {
                AddLvi(CYCLE_PUMP_2, ALARM_FAULT);
            }
            if (ad.cycPump3)
            {
                AddLvi(CYCLE_PUMP_3, ALARM_FAULT);
            }
            if (ad.oneGivePress_lo)
            {
                AddLvi(ONE_GIVE_PRESS, ALARM_LO_PRESS);
            }
            if (ad.oneGiveTemp_lo)
            {
                AddLvi(ONE_GIVE_TEMP, ALARM_LO_TEMP);
            }
            if (ad.powerOff)
            {
                AddLvi(POWER, ALARM_POWEROFF);
            }
            if (ad.recruitPump1)
            {
                AddLvi(RECRUIT_PUMP_1, ALARM_FAULT);
            }
            if (ad.recruitPump2)
            {
                AddLvi(RECRUIT_PUMP_2, ALARM_FAULT);
            }
            if (ad.twoBackPress_hi)
            {
                AddLvi(TWO_BACK_PRESS, ALARM_HI_PRESS);
            }
            if (ad.twoBackPress_lo)
            {
                AddLvi(TWO_BACK_PRESS, ALARM_LO_PRESS);
            }
            if (ad.twoGivePress_hi)
            {
                AddLvi(TWO_GIVE_PRESS, ALARM_HI_PRESS);
            }
            if (ad.twoGiveTemp_hi)
            {
                AddLvi(TWO_GIVE_TEMP, ALARM_HI_TEMP);
            }
            if (ad.watLevel_hi)
            {
                AddLvi(WATER_BOX_WL, ALARM_HI_WL);
            }
            if (ad.watLevel_lo)
            {
                AddLvi(WATER_BOX_WL, ALARM_LO_WL);
            }


            if (!_isIncludeAlarm)
            {
                AddLviNoAlarm("无", "报警解除");
            }

            if (!this.Visible)
            {
                this.Show();
            }

            if (_activeWhenAlarm)
            {
                this.Activate();
            }

            if (_isIncludeAlarm)
            {
                PlaySound();
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="row"></param>
 /// <returns></returns>
 private GRAlarmData CreateGRAlarmData(DataRow row)
 {
     GRAlarmData a = new GRAlarmData(
         Convert.ToDateTime(row["DT"]),
         row[DataColumnNames.DisplayName].ToString(),
         row["Content"].ToString());
     return a;
 }
Exemplo n.º 9
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="grad"></param>
 /// <returns></returns>
 private string GetGRAlarmDataText(GRAlarmData grad)
 {
     string s = string.Format("{0} {1}", grad.DT, grad.Content);
     return s;
 }