public bool Execute()
        {
            try
            {
                DateTime time          = ConverUtil.Time(_content, 0);        //设备时间。
                string   DeviceTypeStr = ConverUtil.ByteToStr_2(_content, 7); //设备类型
                string   DeviceIdStr   = ConverUtil.ByteToStr_4(_content, 9); //设备Id

                byte     DeviceState    = _content[14];                       //设备状态
                string[] BitStr         = DataJM.GetBitStr(DeviceState);
                string   OpenCloseState = BitStr[0];
                string   HLW8012State   = BitStr[1];

                string PowerNumStr = _content[15].ToString();  //功率因素

                string timeStr = time.ToString("yyyy-M-d HH:mm:ss");
                QiYeFangHuDal.Insert_XinTiao(DeviceTypeStr, DeviceIdStr, PowerNumStr, "", timeStr, HLW8012State);
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(Name + "错误:" + ex.Message + " 原始代码:" + OriginalCode);
            }

            return(true);
        }
Esempio n. 2
0
        public bool Execute()
        {
            try
            {
                DateTime time                 = ConverUtil.Time(_content, 0);         //设备时间。
                string   DeviceTypeStr        = ConverUtil.ByteToStr_2(_content, 7);  //设备类型
                string   DeviceIdStr          = ConverUtil.ByteToStr_4(_content, 9);  // 设备Id
                string   DeviceStateStr       = _content[14].ToString();              //设备状态
                string   DustConcentrationStr = ConverUtil.ByteToStr_2(_content, 16); //粉尘浓度
                string   timeStr              = time.ToString("yyyy-M-d HH:mm:ss");

                QiYeFangHuDal.Insert_XinTiao(DeviceTypeStr, DeviceIdStr, DustConcentrationStr, "", timeStr, DeviceStateStr);
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(Name + "错误:" + ex.Message + " 原始代码:" + OriginalCode);
            }

            return(true);
        }
Esempio n. 3
0
        public bool Execute()
        {
            try
            {
                DateTime time           = ConverUtil.Time(_content, 0);        //设备时间。
                string   DeviceTypeStr  = ConverUtil.ByteToStr_2(_content, 7); //设备类型
                string   DeviceIdStr    = ConverUtil.ByteToStr_4(_content, 9); // 设备Id
                byte     DeviceState    = _content[14];                        //设备状态
                string[] BitStr         = DataJM.GetBitStr(DeviceState);
                string   SmokeFeelState = BitStr[0];
                string   TemperatureAndHumidityState = BitStr[1];
                string   temperatureStr = _content[16].ToString(); //设备温度
                string   HumidityStr    = _content[17].ToString(); //设备湿度
                string   timeStr        = time.ToString("yyyy-M-d HH:mm:ss");

                QiYeFangHuDal.Insert_XinTiao(DeviceTypeStr, DeviceIdStr, temperatureStr, HumidityStr, timeStr, TemperatureAndHumidityState);
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(Name + "错误:" + ex.Message + " 原始代码:" + OriginalCode);
            }

            return(true);
        }
Esempio n. 4
0
        public bool Execute()
        {
            try
            {
                if (_content.Length < 6)
                {
                    MyLibrary.Log.Debug(Name + "长度错误:" + " 原始代码:" + OriginalCode);
                    return(false);
                }


                DateTime time   = ConverUtil.Time(_content, 0); //设备时间。
                string   Result = QiYeFangHuDal.update_XinTiao(StationId.ToString(), time);
                if (Result == "0")
                {
                    MyLibrary.Log.Debug(Name + "出错:原始代码: " + OriginalCode);
                }
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(Name + "错误:" + ex.Message + " 原始代码:" + OriginalCode);
            }
            return(true);
        }