Example #1
0
 /// <summary>
 /// 取得告警列表
 /// </summary>
 /// <returns></returns>
 public void GetFaultList()
 {
     if (this.listTcpbug != null && listTcpbug.Count > 0)
     {
         Fault fault        = null;
         int   colllectorID = GetCollectorId();
         foreach (Bug bug in listTcpbug)
         {
             fault           = new Fault();
             fault.address   = bug.deviceAddress.ToString();
             fault.errorCode = bug.faultType;
             ErrorItem errorItem = ErrorItem.getErrotItemByCode(bug.faultType);
             fault.errorTypeCode = errorItem == null?ErrorType.ERROR_TYPE_FAULT:errorItem.errorType;
             fault.sendTime      = bug.faultTime;
             fault.collectorID   = colllectorID;
             fault.confirm       = false;
             int deviceID = this.GetDeviceId(colllectorID, bug.deviceAddress);
             fault.device = new Device()
             {
                 id = deviceID
             };
             faultList.Add(fault);
         }
     }
 }
Example #2
0
        /// <summary>
        /// 取得状态值,没有则返回原来的值
        /// </summary>
        /// <param name="monitorCode"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        private string getStatusValue(int monitorCode, string value)
        {
            //判断该值是否为状态类型值
            if (DeviceData.statusMonitorList.Contains(monitorCode))
            {
                if ((monitorCode == MonitorType.MIC_INVERTER_DEVICESTATUS) && DateTime.Now.AddDays(-1) > updateTime)
                {
                    return(LanguageUtil.getDesc("DEVICESTATUSTYPE_" + DeviceStatusType.device_offline));
                }
                else
                {
                    //工作状态先从故障码map中解析对应值
                    try
                    {
                        int code = int.Parse(value);
                        if (ErrorItem.errorItemMap.ContainsKey(code))
                        {
                            return(ErrorItem.getErrotItemByCode(code).name);
                        }
                    }
                    catch (Exception e) {
                    }

                    IList <DeviceStatusType> stList = DeviceData.monitorStatusMap[monitorCode];
                    foreach (DeviceStatusType dst in stList)
                    {
                        if (dst.code == int.Parse(value))
                        {
                            value = dst.name;
                            break;
                        }
                    }
                }
            }
            return(value);
        }
Example #3
0
        /// <summary>
        /// 判断是否运行故障,包括超过两天无数据,和设备本身错误状态
        /// “运行 停机 初始待机  按键关机 待机 紧急停机 启动中 关机中”不属于警告状态
        /// </summary>
        /// <returns></returns>
        public bool isFault()
        {
            string rundatastr = this.rundatastr;

            string[] rundatas = rundatastr.Split('#');
            string[] datas    = null;
            if (DateTime.Now.AddDays(-1) > updateTime)
            {
                return(true);
            }

            foreach (string data in rundatas)
            {
                datas = data.Split(':');

                //MonitorType mt = MonitorType.getMonitorTypeByCode(int.Parse(datas[0]));
                if (int.Parse(datas[0]) == MonitorType.MIC_INVERTER_DEVICESTATUS)
                {
                    int sts = int.Parse(datas[1]);
                    //if (sts != DeviceStatusType.inverter_status_run
                    //    && sts != DeviceStatusType.inverter_status_run
                    //    && sts != DeviceStatusType.inverter_status_ajgj
                    //    && sts != DeviceStatusType.inverter_status_chshidj
                    //    && sts != DeviceStatusType.inverter_status_daiji
                    //    && sts != DeviceStatusType.inverter_status_jjtj
                    //    && sts != DeviceStatusType.inverter_status_startuping
                    //    && sts != DeviceStatusType.inverter_status_tingji)
                    //{
                    //    return true;
                    //}
                    //20120816改为从故障那里取
                    ErrorItem errorItem = ErrorItem.getErrotItemByCode(sts);
                    if (errorItem != null && (errorItem.errorType == ErrorType.ERROR_TYPE_ERROR || errorItem.errorType == ErrorType.ERROR_TYPE_FAULT))
                    {
                        return(true);
                    }
                }
                //add by qhn in 20120828 增加
                //周辉 14:21:33
                //过80度要告警的,红色
                //工作状态和数字输入老钱 14:25:13 这样只要有一个红灯 就名字红色?
                if (int.Parse(datas[0]) == MonitorType.MIC_BUSBAR_JNTEMPRATURE)
                {
                    float value = float.Parse(datas[1]);
                    if (value > 80)
                    {
                        return(true);
                    }
                }
                //判断数字输入
                if (int.Parse(datas[0]) == MonitorType.MIC_BUSBAR_DIGITALINPUT || int.Parse(datas[0]) == MonitorType.MIC_BUSBAR_STATUS)
                {
                    bool fault = adjustDetail(int.Parse(datas[0]), datas[1]);
                    if (fault)
                    {
                        return(fault);
                    }
                }
            }

            return(false);
        }