コード例 #1
0
        /// <summary>
        /// 写报警记录,包括异常清除写入
        /// </summary>
        /// <param name="type"></param>
        /// <param name="len"></param>
        /// <param name="temp"></param>
        /// <param name="GroupNo"></param>
        public void WriteErrWithCheck(int type, int len, String temp, decimal GroupNo)
        {
            String deviceNo = "" + len;
            string lastInfo = xml.ReadLastInfo(deviceNo);// fileOper.ReadLastInfo(deviceNo).Trim();
            string compStrs;
            string rese = string.Empty;
            //高低位反转
            //temp.Reverse().ToList().ForEach(s => { rese += s; });
            List <OperationChar> lst      = UnionBit.Union(lastInfo, temp, out compStrs);
            List <OperationChar> lstWhere = lst.Where(w => w.op != Oper.None).ToList();

            foreach (OperationChar item in lstWhere)
            {
                if (item.bit >= 0 && item.bit <= 7)
                {
                    String errMsg = item.val == "0" ? string.Format("消除{0}", getErrMsg(item.bit)) : getErrMsg(item.bit);
                    ErrListService.Add(deviceNo, GroupNo, 40, errMsg, item.val);
                    AlarmsInfo info = new AlarmsInfo {
                        DeviceNo = len, DeviceName = deviceNo, ErrInfo = errMsg
                    };
                    AlarmsHandler(info);
                    Downtime(info, errMsg, temp);
                }
            }
            //fileOper.Write(compStrs, deviceNo);
            xml.write(new AlarmsFileModel {
                DeviceNo = deviceNo, AlarmsValue = temp
            });
        }
コード例 #2
0
 /// <summary>
 /// 处理宕机异常
 /// </summary>
 /// <param name="info"></param>
 /// <param name="errMsg"></param>
 /// <param name="temp"></param>
 private void Downtime(AlarmsInfo info, string errMsg, string temp)
 {
     char[] ReverseArray = temp.ToArray();
     Array.Reverse(ReverseArray);
     if (ReverseArray.Count() > 7 && ReverseArray[7] == '1')//报警信息中的第七位宕机异常,另外对宕机异常处理。
     {
         _marchineList.Add(new AlarmsInfo
         {
             DeviceName = info.DeviceName,
             DeviceNo   = info.DeviceNo,
             ErrInfo    = errMsg
         });
         DowntimeHandler(info, _marchineList);
     }
 }
コード例 #3
0
        /// <summary>
        /// 写日志
        /// </summary>
        /// <param name="type"></param>
        /// <param name="len"></param>
        /// <param name="temp"></param>
        /// <param name="GroupNo"></param>
        public void WriteErrToDB(int type, int len, String temp, decimal GroupNo)
        {
            String deviceNo = "" + len;

            for (int i = 1; i <= temp.Length; i++)
            {
                if (temp.ElementAt(i - 1) == '1')
                {
                    String errMsg = getErrMsg(temp.Length - i);
                    ErrListService.Add(deviceNo, GroupNo, 10, errMsg, temp.ElementAt(i - 1).ToString());
                    AlarmsInfo info = new AlarmsInfo {
                        DeviceNo = len, DeviceName = deviceNo, ErrInfo = errMsg
                    };
                    AlarmsHandler(info);
                    Downtime(info, errMsg, temp);
                }
            }
        }