Пример #1
0
 void IDataRecive.Receive(object sender, DataNotifyEventArgs args)
 {
     // 取字符串第一位标识,来判断是否属于温度计的操作;
     if (args.Value.Substring(0, 1).Equals("W"))
     {
         var db = new DataProcessingDB(args.ConnectionString);
         // 取字符串第一二位标识,获得该温度计ID,温度计的上、下限值;
         var  temperature = db.QueryTemperatureIDByNo(args.Value.Substring(0, 2));
         long numberId    = temperature.id;
         var  _min        = temperature.minTemperature;
         var  _max        = temperature.maxTemperature;
         // 取字符串长度;
         int length = args.Value.Length;
         // 获得温度数据;
         string str = args.Value.Substring(2, length - 2);
         // 将温度值存入数据库中;
         db.InsertTemperatureHistory(new TemperatureHistory()
         {
             tId            = numberId,
             value          = decimal.Parse(str),
             maxTemperature = _max,
             minTemperature = _min
         });
     }
 }
Пример #2
0
        /// <summary>
        /// 触发事件函数
        /// </summary>
        /// <param name="args"></param>
        protected virtual void OnDataRecived(DataNotifyEventArgs args)
        {
            var delegateHandles = NotifyEventHandler.GetInvocationList();

            foreach (Delegate item in delegateHandles)
            {
                try
                {
                    item.DynamicInvoke(this, args);
                }
                catch
                {
                }
            }
        }
Пример #3
0
 public void Receive(object sender, DataNotifyEventArgs args)
 {
     // 取字符串第一位标识,来判断是否属于液位仪的操作;
     if (args.Value.Substring(0, 1).Equals("Y"))
     {
         var db = new DataProcessingDB(args.ConnectionString);
         // 取字符串第一二位标识,获得该液位仪ID;
         long numberId = db.QueryLiquidPositionIDByNo(args.Value.Substring(0, 2));
         // 取字符串长度;
         int length = args.Value.Length;
         // 获得液位数据;
         string str = args.Value.Substring(2, length - 2);
         // 将液位累计值存入数据库中;
         db.InsertPositionHistory(new LiquidPositionHistory()
         {
             lpnId = numberId, value = decimal.Parse(str)
         });
     }
 }
Пример #4
0
        public void Receive(object sender, DataNotifyEventArgs args)
        {
            // 取字符串第一位标识,来判断是否属于乳化沥青的操作;
            if (args.Value.Substring(0, 1).Equals("r"))
            {
                var db  = new DataProcessingDB(args.ConnectionString);
                var egp = new EmulsificationGatherProduceLog();

                var entity = db.QueryEquipmentIDByNo("r");
                // 查询乳化沥青机ID;
                egp.eiId = entity.id;
                // 获得乳化沥青机数据;
                string str = args.Value.Remove(0, 1);
                // 将乳化沥青机值存入数据库中;
                egp.quantity         = decimal.Parse(str.Substring(0, str.IndexOf(",")));
                str                  = str.Remove(0, str.IndexOf(",") + 1);
                egp.asphaltumConsume = decimal.Parse(str.Substring(0, str.IndexOf(",")));
                str                  = str.Remove(0, str.IndexOf(",") + 1);
                egp.inputDate        = Convert.ToDateTime(str.Substring(0, str.Length));
                db.InsertEmulGatherProduceLog(egp);
            }
        }
Пример #5
0
        public void Receive(object sender, DataNotifyEventArgs args)
        {
            // 取字符串第一位标识,来判断是否属于煤称重的操作;
            if (args.Value.Substring(0, 1).Equals("M"))
            {
                var db     = new DataProcessingDB(args.ConnectionString);
                var entity = db.QueryEquipmentIDByNo("M");
                // 查询热油炉ID;
                long numberId = entity.id;

                // 获得煤称重数据;
                int    i   = args.Value.IndexOf("C");
                string str = args.Value.Remove(0, i + 1);
                // 获得上次煤称重数据;
                decimal old_value = db.QueryLastDeepFat(numberId);

                // 注当数据大于99999.9公斤后,数据被清零;
                decimal new_old = 0;
                if (decimal.Parse(str) < old_value)
                {
                    new_old = 100000 - old_value + decimal.Parse(str);
                }
                else
                {
                    new_old = decimal.Parse(str) - old_value;
                }

                // 将煤称重数据存入数据库中;
                db.InsertDeepFatDetail(new DeepFatConsumeDailyStatisticsDetail()
                {
                    eiId          = numberId
                    , fuelWastage = decimal.Parse(str)
                    , value       = new_old
                });
            }
        }
Пример #6
0
        public void Receive(object sender, DataNotifyEventArgs args)
        {
            // 取字符串第一位标识,来判断是否属于流量的操作;
            if ((args.Value.Substring(0, 1).Equals("s")) || (args.Value.Substring(0, 1).Equals("a")))
            {
                var    db     = new DataProcessingDB(args.ConnectionString);
                string estate = args.Value.Substring(0, 1);
                var    entity = db.QueryEquipmentIDByNo(estate);

                ProduceMeasureMonitor pmm = new ProduceMeasureMonitor();
                pmm.eiId = Convert.ToInt64(entity.id);

                string _string = args.Value.Remove(0, 1);
                // 以‘,’将字符串分割成数据;
                string[] value = _string.Split(',');

                for (int i = 0; i < value.Length; i++)
                {
                    string state  = value[i].Substring(0, 2);
                    string _value = value[i].Substring(2, value[i].Length - 2);

                    #region switch(state)判断是什么材料
                    switch (state)
                    {
                    case "S1":
                    {
                        // 石料1;
                        pmm.realMaterialWeight1 = Convert.ToDouble(_value);
                        break;
                    }

                    case "S2":
                    {
                        // 石料2;
                        pmm.realMaterialWeight2 = Convert.ToDouble(_value);
                        break;
                    }

                    case "S3":
                    {
                        // 石料3;
                        pmm.realMaterialWeight3 = Convert.ToDouble(_value);
                        break;
                    }

                    case "S4":
                    {
                        // 石料4;
                        pmm.realMaterialWeight4 = Convert.ToDouble(_value);
                        break;
                    }

                    case "S5":
                    {
                        // 石料5;
                        pmm.realMaterialWeight5 = Convert.ToDouble(_value);
                        break;
                    }

                    case "S6":
                    {
                        // 石料6;
                        pmm.realMaterialWeight6 = Convert.ToDouble(_value);
                        break;
                    }

                    case "F1":
                    {
                        // 矿粉;
                        pmm.blockWeight = Convert.ToDouble(_value);
                        break;
                    }

                    case "L1":
                    {
                        // 沥青;
                        pmm.asphaltumWeight = Convert.ToDouble(_value);
                        break;
                    }

                    case "G1":
                    {
                        // 混合料量;
                        pmm.sumWeight = decimal.Parse(_value);
                        break;
                    }

                    case "T1":
                    {
                        // 温度;
                        pmm.temperature = decimal.Parse(_value);
                        break;
                    }

                    case "DT":
                    {
                        // 日期;
                        pmm.inputDate = Convert.ToDateTime(_value);
                        break;
                    }
                    }

                    #endregion
                }
                db.InsertProduceMeasure(pmm);
            }
        }