Example #1
0
        /// <summary>
        /// 处理设备的开关机信息
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="equipment"></param>
        /// <param name="terminal"></param>
        private void Handle0x5000(TX300 obj, TB_Equipment equipment, TB_Terminal terminal)
        {
            // 发动机启动/关闭信息
            _0x5000 x5000 = new _0x5000();

            x5000.Content = obj.MsgContent;
            x5000.Unpackage();
            if (null != equipment)
            {
                EquipmentInstance.Update(f => f.id == equipment.id, act =>
                {
                    act.Voltage = string.Format("G{0}", ((int)Math.Floor(x5000.GeneratorVoltage * 10)).ToString("0000"));

                    if (x5000.GPSInfo.Available)
                    {
                        act.Latitude   = x5000.GPSInfo.Latitude;
                        act.Longitude  = x5000.GPSInfo.Longitude;
                        act.GpsUpdated = false;
                    }
                });
            }
            if (x5000.GPSInfo.Available)
            {
                SaveGpsInfo(x5000.GPSInfo, equipment, obj.TerminalID, "0x5000");
            }
        }
Example #2
0
        /// <summary>
        /// 处理设备的开关机信息
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="equipment"></param>
        /// <param name="terminal"></param>
        private void Handle0x5000(TX300 obj, TB_Equipment equipment, TB_Terminal terminal)
        {
            // 发动机启动/关闭信息
            _0x5000 x5000 = new _0x5000();

            x5000.Type    = obj.TerminalType;
            x5000.Content = obj.MsgContent;
            x5000.Unpackage();
            HandleEquipmentRuntime(equipment, x5000.WorkTime);
            if (null != equipment)
            {
                string vol = format("G{0}0", ((int)Math.Floor(x5000.GeneratorVoltage * 10)).ToString("000"));
                using (var bll = new EquipmentBLL())
                {
                    bll.Update(f => f.id == equipment.id, act =>
                    {
                        act.Voltage = vol;
                        if (x5000.GeneratorVoltage > 20.0)
                        {
                            // 开机的时候清空报警信息  2015/09/24 08:00
                            act.Alarm = ALARM;
                        }

                        if (x5000.GeneratorVoltage < 20)
                        {
                            act.Rpm = 0;
                        }

                        act.Runtime             = equipment.Runtime;
                        act.AccumulativeRuntime = equipment.AccumulativeRuntime;
                        //if (x5000.WorkTime > 0)
                        //{
                        //    // 如果总运转时间大于等于当前服务器中保存的时间则更新,否则不更新
                        //    if (x5000.WorkTime >= act.Runtime)
                        //    {
                        //        act.Runtime = (int)x5000.WorkTime;
                        //    }
                        //}
                        if (x5000.GPSInfo.Available)
                        {
                            act.Latitude   = x5000.GPSInfo.Latitude;
                            act.Longitude  = x5000.GPSInfo.Longitude;
                            act.GpsUpdated = false;
                        }
                    });
                }
            }
            if (x5000.GPSInfo.Available)
            {
                SaveGpsInfo(x5000.GPSInfo, equipment, obj.TerminalID, "Eng.: " + x5000.State + GetPackageType(obj.ProtocolType));
            }
        }