MaterialCodeMatch.cs 2.4 KB
using System;

namespace Model
{
    /// <summary>
    /// 物料模板条码匹配条件
    /// </summary>
    public class MaterialCodeMatch
    {
        public int CodeID { get; set; } = -1;
        public string Keyword { get; set; } = "";
        /// <summary>
        /// 是否匹配开头
        /// </summary>
        public bool MatchStart { get; set; } = false;
        /// <summary>
        /// 匹配中间
        /// </summary>
        public bool MatchMiddle { get; set; } = false;
        /// <summary>
        /// 是否匹配结尾
        /// </summary>
        public bool MatchEnd { get; set; } = false;
        /// <summary>
        /// 是否使用分隔字符
        /// </summary>
        public bool MatchSplit { get; set; } = false;
        /// <summary>
        /// 是否检查条码类型
        /// </summary>
        public bool CheckCodeType { get; set; } = false;
        /// <summary>
        /// 条码类型
        /// </summary>
        public string CodeType { get; set; } = "";
        public string StartText { get; set; } = "";
        public string MiddleText { get; set; } = "";
        public int MatchMiddleType { get; set; } = -1;
        public int MiddleTextCount { get; set; } = 1;
        public string EndText { get; set; } = "";
        public string SplitText { get; set; } = "";
        /// <summary>
        /// 大小写敏感
        /// </summary>
        public bool CaseSensitive { get; set; } = false;
        public bool MatchMinLength { get; set; } = false;
        public bool MatchMaxLength { get; set; } = false;
        public int MinLength { get; set; } = 0;
        public int MaxLength { get; set; } = 0;
        public int SubstringStart { get; set; } = 0;
        public int SubstringLength { get; set; } = 1;
        public int SplitPart { get; set; } = 1;
        public bool MatchISNumber { get; set; } = false;

        /// <summary>
        /// 特征条码
        /// </summary>
        public bool Characteristic { get; set; } = false;
        public MaterialCodeMatch Clone()
        {
            MaterialCodeMatch node = new();
            System.Reflection.PropertyInfo[] destination = node.GetType().GetProperties();
            System.Reflection.PropertyInfo[] orgin = GetType().GetProperties();
            for (int i = 0; i < destination.Length; i++)
                destination[i].SetValue(node, orgin[i].GetValue(this));
            return node;
        }
    }
}