Exemplo n.º 1
0
        /// <summary>
        /// 查询设备的运转时间
        /// </summary>
        /// <returns></returns>
        private string HandleEquipment6004()
        {
            var ret = "{}";
            var id  = ParseInt(Utility.Decrypt(data));
            var obj = EquipmentInstance.Find(f => f.id == id && f.Deleted == false);

            if (null != obj)
            {
                var date     = DateTime.Parse(GetParamenter("date") + " 23:59:59");
                var runtimes = DataInstance.FindList(f => f.mac_id.Equals(EquipmentInstance.GetFullNumber(obj)) &&
                                                     f.command_id.Equals("0x6004") && f.receive_time < date).OrderByDescending(o => o.receive_time).FirstOrDefault();
                if (null != runtimes)
                {
                    _0x6004DX x6004 = new _0x6004DX();
                    x6004.Command     = "0x6004";
                    x6004.HexContent  = runtimes.message_content;
                    x6004.DataType    = doosan.DX;
                    x6004.MacID       = obj.TB_EquipmentModel.Code + obj.Number;
                    x6004.ReceiveTime = runtimes.receive_time.Value;
                    x6004.SimNo       = runtimes.terminal_id;
                    x6004.Unpackage();
                    ret = JsonConverter.ToJson(x6004);
                }
            }
            return(ret);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 处理运转时间消息
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="equipment"></param>
        /// <param name="terminal"></param>
        private void Handle0x6004(TX300 obj, TB_Equipment equipment, TB_Terminal terminal)
        {
            _0x6004DX x6004 = new _0x6004DX();

            x6004.Type    = obj.TerminalType;
            x6004.Content = obj.MsgContent;
            x6004.Unpackage();
            HandleEquipmentRuntime(equipment, x6004.TotalWorkTime);
            if (null != equipment)
            {
                using (var bll = new EquipmentBLL())
                {
                    bll.Update(f => f.id == equipment.id, act =>
                    {
                        act.Runtime             = equipment.Runtime;
                        act.AccumulativeRuntime = equipment.AccumulativeRuntime;
                        if (obj.TerminalType == Protocol.TerminalTypes.DH || obj.TerminalType == Protocol.TerminalTypes.DX)
                        {
                            // EPOS命令时清空报警  2015/09/24 08:00
                            act.Alarm = ALARM;
                        }
                    });
                }
            }
        }