CommunicationConfig.cs 2.24 KB
using FreeSql.DataAnnotations;
using HHECS.DataContract;
using System.ComponentModel.DataAnnotations;

namespace HHECS.DAQClient.Model
{
    [Table(Name = nameof(CommunicationConfig))]
    [Index($"idx_{nameof(CommunicationConfig)}_{nameof(Code)}", $"{nameof(Code)}", true)]
    public class CommunicationConfig : BaseEntity<int>
    {
        /// <summary>
        /// 编号
        /// </summary>
        public string Code { get; set; } = null!;

        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; } = null!;

        /// <summary>
        /// 类型
        /// </summary>
        [Column(DbType = "varchar(50)", MapType = typeof(string))]
        public CommunicationTypeConst CommunicationType { get; set; } = CommunicationTypeConst.None;

        /// <summary>
        /// IP地址
        /// </summary>
        /// <remarks><see cref="Equipment"/> 使用IpAddress匹配通讯配置</remarks>
        public string IpAddress { get; set; } = null!;

        /// <summary>
        /// 端口号
        /// </summary>
        public int Port { get; set; }

        /// <summary>
        /// 是否禁用
        /// </summary>
        public bool Disable { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        public DateTime? CreateTime { get; set; }

        public DateTime? UpdatedTime { get; set; }
    }

    /// <summary>
    /// 通讯方式
    /// </summary>
    public enum CommunicationTypeConst
    {
        /// <summary>
        /// 无
        /// </summary>
        [Display(Name = "未配置")]
        None = 0,

        /// <summary>
        /// Kuka 机器人代理
        /// </summary>
        [Display(Name = "Kuka 机器人代理")]
        KukaVarProxy = 1,

        /// <summary>
        /// Tcp 客户端
        /// </summary>
        [Display(Name = "Tcp 客户端")]
        TcpClient = 2,

        /// <summary>
        /// Fanuc 机器人
        /// </summary>
        [Display(Name = "Fanuc")]
        Fanuc = 3,

        [Display(Name = "Siemens S1500")]
        Siemens_S1500 = 4,

        [Display(Name = "Siemens S1200")]
        Siemens_S1200 = 5,

        [Display(Name ="ModbusTcp")]
        ModbusTcp = 6,
    }
}