123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- using Edge.Core.Parser.BinaryParser.Attributes;
- using Edge.Core.Parser.BinaryParser.MessageEntity;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- namespace FuRen_Sinopec_IcCardReader
- {
- /// <summary>
- /// 加油站通用信息
- /// </summary>
- public class StationGenericInfo : MessageTemplateBase
- {
- private byte _Ver;
- /// <summary>
- /// 版本 , 0,1~255 0: 数据无效
- /// </summary>
- [Format(1, EncodingType.BIN, 1)]
- public byte Ver
- {
- get { return this._Ver; }
- set
- {
- this._Ver = value > 255 ? (byte)1 : value;
- }
- }
- /// <summary>
- /// 石化编码规范中地区编码的头两个数字
- /// </summary>
- [Format(1, EncodingType.BCD, 2)]
- [Range(@"^\d{1,2}$", RegexOptions.IgnoreCase, "Prov_省代号 value {0} does not match regex requirment.")]
- public byte Prov_省代号 { get; set; }
- /// <summary>
- /// 石化编码规范中地区编码的中间两个数字
- /// </summary>
- [Format(1, EncodingType.BCD, 3)]
- [Range(@"^\d{1,2}$", RegexOptions.IgnoreCase, "City_地市代码 value {0} does not match regex requirment.")]
- public byte City_地市代码 { get; set; }
- /// <summary>
- /// 同石化编码
- /// </summary>
- [Format(4, EncodingType.BcdString, 4)]
- [Range(@"^\d{1,8}$", RegexOptions.IgnoreCase, "Superior_上级单位代号 value {0} does not match regex requirment.")]
- public string Superior_上级单位代号 { get; set; }
- /// <summary>
- /// 同石化编码
- /// </summary>
- [Format(4, EncodingType.BcdString, 5)]
- [Range(@"^\d{1,8}$", RegexOptions.IgnoreCase, "S_ID_加油站ID value {0} does not match regex requirment.")]
- public string S_ID_加油站ID { get; set; }
- /// <summary>
- /// 通讯终端逻辑编号 0-249
- /// </summary>
- [Format(1, EncodingType.BCD, 6)]
- [Range(0, 249, "0-249 ")]
- public byte POS_P_通讯终端逻辑编号 { get; set; }
- /// <summary>
- ///
- /// </summary>
- [Format(1, EncodingType.BIN, 7)]
- public byte GUN_N_油枪数 { get; set; }
- [EnumerableFormat("GUN_N_油枪数", 8, EncodingType = EncodingType.BIN)]
- public List<byte> MZN_单个油枪 { get; set; }
- public override bool Equals(object obj)
- {
- var target = obj as StationGenericInfo;
- if (this.Prov_省代号 != target?.Prov_省代号) return false;
- if (this.City_地市代码 != target.City_地市代码) return false;
- if (this.Superior_上级单位代号 != target.Superior_上级单位代号) return false;
- if (this.S_ID_加油站ID != target.S_ID_加油站ID) return false;
- if (this.GUN_N_油枪数 != target.GUN_N_油枪数) return false;
- if (this.POS_P_通讯终端逻辑编号 != target.POS_P_通讯终端逻辑编号) return false;
- if (this.MZN_单个油枪 != null ^ target.MZN_单个油枪 != null) return false;
- //if (this.NozzleBelongToPumpSide != null ^ target.NozzleBelongToPumpSide != null) return false;
- if (this.MZN_单个油枪 != null)
- {
- if (this.MZN_单个油枪.Count != target.MZN_单个油枪.Count) return false;
- for (int i = 0; i < this.MZN_单个油枪.Count; i++)
- {
- if (this.MZN_单个油枪[i] != target.MZN_单个油枪[i]) return false;
- }
- }
- //if (this.NozzleBelongToPumpSide != null)
- //{
- // if (this.NozzleBelongToPumpSide.Count != target.NozzleBelongToPumpSide.Count) return false;
- // for (int i = 0; i < this.NozzleBelongToPumpSide.Count; i++)
- // {
- // if (this.NozzleBelongToPumpSide[i] != target.NozzleBelongToPumpSide[i]) return false;
- // }
- //}
- return true;
- }
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
- }
- }
|