public override void execute(Tag tag)
        {
            //TODO LIST:解析压力数据,保存压力数据
            UploadTag pressTag   = tag as UploadTag;
            int       itv        = pressTag.CollectInter;
            String    collecTime = pressTag.CollectTime;
            int       len        = pressTag.Len;
            String    dataValue  = pressTag.DataValue;

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

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

            DateTime baseTime = Convert.ToDateTime(AdlerCmd.currentSystemDate + " " + collecTime);

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

                //TODO LIST:电池电量
                pressInfo.PRESSDATA = press;
                pressInfo.LOGTIME   = DateTime.Now;
                pressInfo.UPTIME    = baseTime.AddMinutes(i * itv);
                pressInfo.DEVID     = AdlerCmd.devCode;

                djs.Add(pressInfo);
            }
            new BLL.DjPress().insert(djs);
            new BLL.DjPress().saveAlarmInfo(djs);
            new BLL.DjPress().updateDevStatus(AdlerCmd.devCode);
            AdlerCmd.adlerSession.Logger.Info("压力数据保存成功");
        }
示例#2
0
        //0000 0071 前四个字节暂时不用
        public override void execute(Tag tag)
        {
            //TODO LIST:解析流量数据保存流量数据
            UploadTag noiseTag   = tag as UploadTag;
            int       itv        = noiseTag.CollectInter;
            String    collecTime = noiseTag.CollectTime;
            int       len        = noiseTag.Len;
            String    dataValue  = noiseTag.DataValue;

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

            int num = len / 4; //上传的流量数据个数
            List <Model.DjNoiseInfo> djs = new List <DjNoiseInfo>();

            DateTime baseTime = Convert.ToDateTime(AdlerCmd.currentSystemDate + " " + collecTime);

            for (int i = 0; i < num; i++)
            {
                DjNoiseInfo noiseInfo = new DjNoiseInfo();
                //TODO LIST:密集开始时间、密集间隔、密集样本数、无线开启时间、
                //无线关闭时间、密集噪声、电池电量
                noiseInfo.LOGTIME = DateTime.Now;
                noiseInfo.UPTIME  = baseTime.AddMinutes(i * itv);
                noiseInfo.DEVID   = AdlerCmd.devCode;
                String dStr = dataValue.Substring(i * 8 + 4, 4);
                noiseInfo.DDATA = int.Parse("0" + dStr.Substring(1, 1) + dStr.Substring(2, 2), System.Globalization.NumberStyles.HexNumber).ToString();
                djs.Add(noiseInfo);
            }
            new BLL.DjNoise().insert(djs);
            new BLL.DjNoise().saveAlarmInfo(djs);
            new BLL.DjNoise().updateDevStatus(AdlerCmd.devCode);
            AdlerCmd.adlerSession.Logger.Info("噪声数据保存成功");
        }
        public override void execute(Tag tag)
        {
            //TODO LIST:解析液位数据,保存液位数据
            UploadTag liquidTag  = tag as UploadTag;
            int       itv        = liquidTag.CollectInter;
            String    collecTime = liquidTag.CollectTime;
            int       len        = liquidTag.Len;
            String    dataValue  = liquidTag.DataValue;

            AdlerCmd.adlerSession.Logger.Info("液位数据上传TAG:oid:" + liquidTag.Oid + " 采集间隔: " +
                                              itv + "采集时间:" + collecTime + "上传数值:" + dataValue);

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

            DateTime baseTime = Convert.ToDateTime(AdlerCmd.currentSystemDate + " " + collecTime);

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

                //TODO LIST:电池电量
                liquidInfo.LIQUIDDATA = liquid;
                liquidInfo.LOGTIME    = DateTime.Now;
                liquidInfo.UPTIME     = baseTime.AddMinutes(i * itv);
                liquidInfo.DEVID      = AdlerCmd.devCode;
                djs.Add(liquidInfo);
            }
            new BLL.DjLiquid().insert(djs);
            AdlerCmd.adlerSession.Logger.Info("液位数据保存成功");
        }
        public override bool isThisTag(Tag tag)
        {
            if (!(tag is UploadTag))
            {
                return(false);
            }

            UploadTag uploadTag = tag as UploadTag;

            return(uploadTag.BizType == 2 ? true : false);
        }
示例#5
0
        public override void execute(Tag tag)
        {
            //TODO LIST:解析流量数据保存流量数据
            UploadTag flowTag    = tag as UploadTag;
            int       itv        = flowTag.CollectInter;
            String    collecTime = flowTag.CollectTime;
            int       len        = flowTag.Len;
            String    dataValue  = flowTag.DataValue;

            AdlerCmd.adlerSession.Logger.Info("流量数据上传TAG:oid:" + flowTag.Oid + " 采集间隔: " +
                                              itv + "采集时间:" + collecTime + "上传数值:" + dataValue);

            int num = len / 12; //上传的流量数据个数
            List <Model.DjFlowInfo> djs = new List <DjFlowInfo>();

            DateTime baseTime = Convert.ToDateTime(AdlerCmd.currentSystemDate + " " + collecTime);

            for (int i = 0; i < num; i++)
            {
                DjFlowInfo flowInfo = new DjFlowInfo();
                String     insFlow  = strHexToFloat(dataValue.Substring(i * 24, 8)).ToString();
                String     posFlow  = strHexToFloat(dataValue.Substring(i * 24 + 8, 8)).ToString();
                String     negFlow  = strHexToFloat(dataValue.Substring(i * 24 + 16, 8)).ToString();
                flowInfo.INSDATA = insFlow;
                flowInfo.POSDATA = posFlow;
                flowInfo.NEGDATA = negFlow;
                flowInfo.NETDATA = (float.Parse(posFlow) + float.Parse(negFlow)) + "";

                //TODO LIST:电池电量的获取
                flowInfo.LOGTIME = DateTime.Now;
                flowInfo.UPTIME  = baseTime.AddMinutes(i * itv);
                flowInfo.DEVID   = AdlerCmd.devCode;

                djs.Add(flowInfo);
            }
            new BLL.DjFlow().insert(djs);
            new BLL.DjFlow().saveAlarmInfo(djs);
            new BLL.DjFlow().updateDevStatus(AdlerCmd.devCode);

            AdlerCmd.adlerSession.Logger.Info("流量数据保存成功");
        }
示例#6
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
            {
                tag = new NormalTag(oid, len, value);
            }
            return(tag);
        }