//0000 0071 前四个字节暂时不用
        public override void execute(Tag tag, String devCode, CellTag cellTag,
                                     SystemDateTag systemDateTag, CasicSession session)
        {
            //TODO LIST:解析井盖传感器数据并保存
            UploadTag wellTag    = tag as UploadTag;
            int       itv        = wellTag.CollectInter;
            String    collecTime = wellTag.CollectTime;
            int       len        = wellTag.Len;
            String    dataValue  = wellTag.DataValue;

            session.Logger.Info("井盖数据上传TAG:oid:" + wellTag.Oid + " 采集间隔: " +
                                itv + "采集时间:" + collecTime + "上传数值:" + dataValue);

            int num = len / 1; //上传的井盖数据个数
            List <Model.WellSensorInfo> djs = new List <WellSensorInfo>();

            //井盖数据tag之前,无系统日期tag数据
            // DateTime baseTime = Convert.ToDateTime(CasicCmd.currentSystemDate + " " + collecTime);
            for (int i = 0; i < num; i++)
            {
                //上传的有状态数据、设备ID、可能有电池电量等数据
                WellSensorInfo wellInfo = new WellSensorInfo();
                wellInfo.DEVID   = devCode;
                wellInfo.LOGTIME = DateTime.Now;
                byte   btStatus = byte.Parse(dataValue, System.Globalization.NumberStyles.HexNumber);
                string descn    = "";
                switch (btStatus)
                {
                case 0:
                    descn = "状态正常";
                    new BLL.WellInfo().saveDeviceStatus(wellInfo.DEVID, WellAlarmEnum.NORMAL);
                    break;

                case 1:
                    descn = "井盖开启";
                    saveWellAlarm(wellInfo.DEVID, session);
                    break;

                case 2:
                    descn = "时钟故障";
                    new BLL.WellInfo().saveDeviceStatus(wellInfo.DEVID, WellAlarmEnum.SYS_ERROR);
                    break;

                case 3:
                    descn = "低电压";
                    new BLL.WellInfo().saveDeviceStatus(wellInfo.DEVID, WellAlarmEnum.BATTERY_LOW);
                    break;

                default:
                    descn = "未知状态";
                    break;
                }
                wellInfo.DESCN  = descn;
                wellInfo.STATUS = btStatus + "";
                djs.Add(wellInfo);
            }
            new BLL.WellInfo().insert(djs);
            session.Logger.Info("井盖数据保存成功");
        }
        public override bool isThisTag(Tag tag)
        {
            if (!(tag is UploadTag))
            {
                return(false);
            }

            UploadTag uploadTag = tag as UploadTag;

            return(uploadTag.BizType == 4 ? true : false);
        }
        public override void execute(Tag tag, String devCode, CellTag cellTag,
                                     SystemDateTag systemDateTag, CasicSession session)
        {
            //TODO LIST:解析腐蚀速率数据,保存腐蚀速率

            UploadTag fsslTag    = tag as UploadTag;
            int       itv        = fsslTag.CollectInter;
            String    collecTime = fsslTag.CollectTime;
            int       len        = fsslTag.Len;
            String    dataValue  = fsslTag.DataValue;

            session.Logger.Info("腐蚀速率数据上传TAG:oid:" + fsslTag.Oid + " 采集间隔: " +
                                itv + "采集时间:" + collecTime + "上传数值:" + dataValue);

            int num = len / 20; //上传的腐蚀速率的组数,1组5个数据,1个数据4个字节

            /*
             * 开路电位OCP:单位V
             * 溶液电阻Rs:单位Ω.cm2
             * 极化电阻Rp:单位Ω.cm2
             * 腐蚀电流密度Icorr:单位mA/cm2
             * 腐蚀速率Vcorr:单位mm/a
             * */
            List <Model.AKFSSLInfo> djs = new List <Model.AKFSSLInfo>();

            DateTime baseTime = Convert.ToDateTime(systemDateTag.CollectDate + " " + collecTime);

            for (int i = 0; i < num; i++)
            {
                Model.AKFSSLInfo fssl           = new Model.AKFSSLInfo();
                String           openCircultVol = strHexToFloat(dataValue.Substring(i * 40, 8)).ToString("f4");
                String           ryResist       = strHexToFloat(dataValue.Substring(i * 40 + 8, 8)).ToString("f4");
                String           jhResist       = strHexToFloat(dataValue.Substring(i * 40 + 16, 8)).ToString("f4");
                String           concurDen      = strHexToFloat(dataValue.Substring(i * 40 + 24, 8)).ToString("f4");
                String           errosionRate   = strHexToFloat(dataValue.Substring(i * 40 + 32, 8)).ToString("f4");

                fssl.Cell        = (cellTag == null ? "" : cellTag.Cell);
                fssl.OpenCir     = openCircultVol;
                fssl.RyResist    = ryResist;
                fssl.JhResist    = jhResist;
                fssl.CurrentDen  = concurDen;
                fssl.ErrosionRat = errosionRate;
                fssl.LogTime     = DateTime.Now;
                fssl.UpTime      = baseTime.AddMinutes(i * itv);
                fssl.DEVCODE     = devCode;
                djs.Add(fssl);
            }
            new BLL.AKFSSL().insert(djs);
            new BLL.AKFSSL().saveAlarmInfo(djs);
            //  new BLL.DjLiquid().updateDevStatus(CasicCmd.devCode);
            session.Logger.Info("腐蚀速率数据保存成功");
        }
        public override void execute(Tag tag, String devCode, CellTag cellTag,
                                     SystemDateTag systemDateTag, CasicSession session)
        {
            //TODO LIST:处理对应的心跳上传数据
            UploadTag heartBeatTag = tag as UploadTag;
            int       itv          = heartBeatTag.CollectInter;
            String    collecTime   = heartBeatTag.CollectTime;
            int       len          = heartBeatTag.Len;
            String    dataValue    = heartBeatTag.DataValue;

            session.Logger.Info("心跳上传TAG:oid:" + heartBeatTag.Oid + " 采集间隔: " +
                                itv + "采集时间:" + collecTime + "上传数值:" + dataValue);
        }
        //0000 0071 前四个字节暂时不用
        public override void execute(Tag tag, String devCode, CellTag cellTag,
                                     SystemDateTag systemDateTag, CasicSession session)
        {
            //TODO LIST:解析流量数据保存流量数据
            UploadTag noiseTag   = tag as UploadTag;
            int       itv        = noiseTag.CollectInter;
            String    collecTime = noiseTag.CollectTime;
            int       len        = noiseTag.Len;
            String    dataValue  = noiseTag.DataValue;

            session.Logger.Info("噪声数据上传TAG:oid:" + noiseTag.Oid + " 采集间隔: " +
                                itv + "采集时间:" + collecTime + "上传数值:" + dataValue);

            int num = len / 4; //上传的流量数据个数,修改未2个字节//yxw修改为4个字节,加频率
            List <Model.SlNoiseInfo> djs = new List <SlNoiseInfo>();

            DateTime baseTime = Convert.ToDateTime(systemDateTag.CollectDate + " " + collecTime);

            for (int i = 0; i < num; i++)
            {
                // DjNoiseInfo noiseInfo = new DjNoiseInfo();
                SlNoiseInfo slNoiseInfo = new SlNoiseInfo();
                //TODO LIST:密集开始时间、密集间隔、密集样本数、无线开启时间、
                //无线关闭时间、密集噪声、电池电量
                slNoiseInfo.CELL    = (cellTag == null ? "" : cellTag.Cell);
                slNoiseInfo.LOGTIME = DateTime.Now;
                slNoiseInfo.UPTIME  = baseTime.AddMinutes(i * itv);
                slNoiseInfo.SRCID   = devCode;
                slNoiseInfo.DSTID   = "FFFF";
                String dStr      = dataValue.Substring(i * 8 + 0, 4);
                String frequency = dataValue.Substring(i * 8 + 4, 4);

                slNoiseInfo.DENSEDATA = int.Parse(dStr.Substring(0, 2) + dStr.Substring(2, 2), System.Globalization.NumberStyles.HexNumber).ToString();
                slNoiseInfo.FREQUENCY = int.Parse(frequency.Substring(0, 2) + frequency.Substring(2, 2), System.Globalization.NumberStyles.HexNumber).ToString();
                djs.Add(slNoiseInfo);
            }
            new BLL.SlNoise().insert(djs);
            new BLL.SlNoise().SaveZZAlarmInfo(djs);
            new BLL.SlNoise().updateDevStatus(devCode);

            session.Logger.Info("噪声数据保存成功");
        }
        public override void execute(Tag tag, String devCode, CellTag cellTag,
                                     SystemDateTag systemDateTag, CasicSession session)
        {
            //TODO LIST:解析压力数据保存压力数据
            UploadTag pressTag   = tag as UploadTag;
            int       itv        = pressTag.CollectInter;
            String    collecTime = pressTag.CollectTime;
            int       len        = pressTag.Len;
            String    dataValue  = pressTag.DataValue;

            session.Logger.Info("压力数据上传TAG:oid:" + pressTag.Oid + " 采集间隔: " +
                                itv + "采集时间:" + collecTime + "上传数值:" + dataValue);

            int num = len / 4; //上传的液位数据个数
            //List<Model.CasicPress> djs = new List<Model.CasicPress>();
            List <Model.DjPressInfo> djs = new List <Model.DjPressInfo>();

            DateTime baseTime = Convert.ToDateTime(systemDateTag.CollectDate + " " + collecTime);

            for (int i = 0; i < num; i++)
            {
                DjPressInfo pressInfo = new DjPressInfo();
                String      press     = strHexToFloat(dataValue.Substring(i * 8, 8)).ToString();

                //TODO LIST:电池电量
                pressInfo.CELL      = (cellTag == null ? "" : cellTag.Cell);
                pressInfo.PRESSDATA = press;
                pressInfo.LOGTIME   = DateTime.Now;
                pressInfo.UPTIME    = baseTime.AddMinutes(i * itv);
                pressInfo.DEVID     = devCode;

                djs.Add(pressInfo);
            }

            new BLL.DjPress().insert(djs);
            //new BLL.DjPress().saveAlarmInfo(djs);
            new BLL.DjPress().updateDevStatus(devCode);
            session.Logger.Info("压力数据保存成功");
        }
        public override void execute(Tag tag, String devCode, CellTag cellTag,
                                     SystemDateTag systemDateTag, CasicSession session)
        {
            //TODO LIST:解析压力数据保存压力数据
            UploadTag rqTag      = tag as UploadTag;
            int       itv        = rqTag.CollectInter;
            String    collecTime = rqTag.CollectTime;
            int       len        = rqTag.Len;
            String    dataValue  = rqTag.DataValue;

            session.Logger.Info("燃气数据上传TAG:oid:" + rqTag.Oid + " 采集间隔: " +
                                itv + "采集时间:" + collecTime + "上传数值:" + dataValue);

            int num = len / 4; //上传的燃气数据个数
            List <Model.RQPeriodInfo> rqs = new List <Model.RQPeriodInfo>();

            DateTime baseTime = Convert.ToDateTime(systemDateTag.CollectDate + " " + collecTime);

            for (int i = 0; i < num; i++)
            {
                String density = strHexToFloat(dataValue.Substring(i * 8, 8)).ToString();

                Model.RQPeriodInfo rq = new Model.RQPeriodInfo();
                rq.ADDRESS     = devCode;
                rq.INPRESS     = "0";
                rq.OUTPRESS    = "0";
                rq.FLOW        = "0";
                rq.STRENGTH    = density;
                rq.TEMPERATURE = "0";
                rq.CELL        = (cellTag == null ? "" : cellTag.Cell);
                rq.UPTIME      = baseTime.AddMinutes(i * itv);
                rq.LOGTIME     = DateTime.Now;
                rqs.Add(rq);
            }
            BLL.RQPeriod bll = new BLL.RQPeriod();
            bll.insert(rqs);
            bll.saveAlarmInfo(rqs);
            session.Logger.Info("燃气数据保存成功");
        }
Example #8
0
        public static Tag create(String oid, int len, String value)
        {
            Tag tag;

            if (UploadTag.isUploadTag(oid))
            {
                tag = new UploadTag(oid, len, value);
            }
            else if (oid == SystemDateTag.SYSTEM_DATE_OID)
            {
                tag = new SystemDateTag(oid, len, value);
            }
            else if (oid == SystemTimeTag.SYSTEM_TIME_OID)
            {
                tag = new SystemTimeTag(oid, len, value);
            }
            else if (oid == WakeUpTag.WAKEUP_TAG_OID)
            {
                tag = new WakeUpTag(oid, len, value);
            }
            else if (oid == CellTag.CELL_TAG_OID)
            {
                tag = new CellTag(oid, len, value);
            }
            else if (oid == SensorException0Tag.SENSOR_EXCEP0_TAG_OID)
            {
                tag = new SensorException0Tag(oid, len, value);
            }
            else if (oid == SensorException1Tag.SENSOR_EXCEP1_TAG_OID)
            {
                tag = new SensorException1Tag(oid, len, value);
            }
            else
            {
                tag = new NormalTag(oid, len, value);
            }
            return(tag);
        }
Example #9
0
        public override void execute(Tag tag, String devCode, CellTag cellTag,
                                     SystemDateTag systemDateTag, CasicSession session)
        {
            //TODO LIST:解析水表数据,保存水表欧数据
            UploadTag tempTag    = tag as UploadTag;
            int       itv        = tempTag.CollectInter;
            String    collecTime = tempTag.CollectTime;
            int       len        = tempTag.Len;
            String    dataValue  = tempTag.DataValue;

            session.Logger.Info("水表数据上传TAG:oid:" + tempTag.Oid + " 采集间隔: " +
                                itv + "采集时间:" + collecTime + "上传数值:" + dataValue);

            int num = len / 4; //上传的温度数据个数
            List <Model.CasicWaterMeter> djs = new List <Model.CasicWaterMeter>();

            DateTime baseTime = Convert.ToDateTime(systemDateTag.CollectDate + " " + collecTime);

            for (int i = 0; i < num; i++)
            {
                Model.CasicWaterMeter tempInfo = new CasicWaterMeter();
                String temp = strHexToInt32(dataValue.Substring(i * 8, 8)).ToString();

                //TODO LIST:电池电量
                tempInfo.Cell    = (cellTag == null ? "" : cellTag.Cell);
                tempInfo.Data    = temp;
                tempInfo.LogTime = DateTime.Now;
                tempInfo.UpTime  = baseTime.AddMinutes(i * itv);
                tempInfo.DEVCODE = devCode;
                djs.Add(tempInfo);
            }
            new BLL.CasicWaterMeter().insert(djs);
            new BLL.CasicWaterMeter().saveAlarmInfo(djs);
            new BLL.CasicWaterMeter().updateDevStatus(devCode);
            session.Logger.Info("水表数据保存成功");
        }
Example #10
0
        public override void execute(Tag tag, String devCode, CellTag cellTag,
                                     SystemDateTag systemDateTag, CasicSession session)
        {
            //TODO LIST:解析腐蚀环境数据,保存腐蚀环境数据
            UploadTag fshjTag    = tag as UploadTag;
            int       itv        = fshjTag.CollectInter;
            String    collecTime = fshjTag.CollectTime;
            int       len        = fshjTag.Len;
            String    dataValue  = fshjTag.DataValue;

            session.Logger.Info("腐蚀环境数据上传TAG:oid:" + fshjTag.Oid + " 采集间隔: " +
                                itv + "采集时间:" + collecTime + "上传数值:" + dataValue);

            int num = len / (2 * 16); //上传的数据组数,1组16个数据,每个数据4个字节
            List <Model.AKFSHJInfo> djs = new List <Model.AKFSHJInfo>();

            DateTime baseTime = Convert.ToDateTime(systemDateTag.CollectDate + " " + collecTime);

            for (int i = 0; i < num; i++)
            {
                Model.AKFSHJInfo fshjInfo = new  Model.AKFSHJInfo();

                String underVol1 = strHexToInt(dataValue.Substring(i * 64, 4)).ToString();
                String underVol2 = strHexToInt(dataValue.Substring(i * 64 + 4, 4)).ToString();
                String underVol3 = strHexToInt(dataValue.Substring(i * 64 + 8, 4)).ToString();
                String underVol4 = strHexToInt(dataValue.Substring(i * 64 + 12, 4)).ToString();
                String underVol5 = strHexToInt(dataValue.Substring(i * 64 + 16, 4)).ToString();
                String underVol6 = strHexToInt(dataValue.Substring(i * 64 + 20, 4)).ToString();


                String under_temp1  = (strHexToInt(dataValue.Substring(i * 64 + 24, 4)) / 10.0).ToString();
                String under_temp2  = (strHexToInt(dataValue.Substring(i * 64 + 28, 4)) / 10.0).ToString();
                String outter_temp1 = (strHexToInt(dataValue.Substring(i * 64 + 32, 4)) / 10.0).ToString();
                String outter_temp2 = (strHexToInt(dataValue.Substring(i * 64 + 36, 4)) / 10.0).ToString();

                String underWater1 = strHexToInt(dataValue.Substring(i * 64 + 40, 4)).ToString();
                String underWater2 = strHexToInt(dataValue.Substring(i * 64 + 44, 4)).ToString();
                String underWater3 = strHexToInt(dataValue.Substring(i * 64 + 48, 4)).ToString();
                String underWater4 = strHexToInt(dataValue.Substring(i * 64 + 52, 4)).ToString();
                String underWater5 = strHexToInt(dataValue.Substring(i * 64 + 56, 4)).ToString();
                String underWater6 = strHexToInt(dataValue.Substring(i * 64 + 60, 4)).ToString();

                fshjInfo.UnderTemp1  = under_temp1;
                fshjInfo.UnderTemp2  = under_temp2;
                fshjInfo.OutterTemp1 = outter_temp1;
                fshjInfo.OutterTemp2 = outter_temp2;
                fshjInfo.UnderVo11   = underVol1;
                fshjInfo.UnderVo12   = underVol2;
                fshjInfo.UnderVo13   = underVol3;
                fshjInfo.UnderVo14   = underVol4;
                fshjInfo.UnderVo15   = underVol5;
                fshjInfo.UnderVo16   = underVol6;

                fshjInfo.UnderWaterIn1 = underWater1;
                fshjInfo.UnderWaterIn2 = underWater2;
                fshjInfo.UnderWaterIn3 = underWater3;
                fshjInfo.UnderWaterIn4 = underWater4;
                fshjInfo.UnderWaterIn5 = underWater5;
                fshjInfo.UnderWaterIn6 = underWater6;

                fshjInfo.Cell    = (cellTag == null ? "" : cellTag.Cell);
                fshjInfo.LogTime = DateTime.Now;
                fshjInfo.UpTime  = baseTime.AddMinutes(i * itv);
                fshjInfo.DEVCODE = devCode;
                djs.Add(fshjInfo);
            }
            new BLL.AKFSHJ().insert(djs);
            String pipeType = new BLL.AKFSHJ().getHeatPipeTypeByDevCode(devCode);

            new BLL.AKFSHJ().saveAlarmInfo(djs, pipeType);
            //new BLL.AKFSHJ().saveAlarmInfo(djs);//todo list:生成报警规则
            session.Logger.Info("腐蚀环境数据保存成功");
        }