base_equipment.cs 6.06 KB
using System;
using SqlSugar;
using System.ComponentModel.DataAnnotations.Schema;
using System.Collections.Generic;

namespace Hh.Mes.POJO.Entity
{
    public partial class base_equipment : base_Entity
    {
        /// <summary>
        /// 
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int id { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public int workshopId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public int factoryId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public int lineId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public int? workStationId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public int equipmentTypeId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public int? stationGroupIndex { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public int? equipmentMaintainRuleId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public int roadWay { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public int stationIndex { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public int rowIndex1 { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public int rowIndex2 { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public int columnIndex { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public int layerIndex { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public DateTime? createTime { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public DateTime? updateTime { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public bool disable { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public bool enable { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string code { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string name { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string lineCode { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string workStationCode { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string ip { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string connectName { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string destinationGroup { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string createBy { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string updateBy { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string outAddress { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string goAddress { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string stationGroup { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string description { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string fork1AvailableStation { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string fork2AvailableStation { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string warehouseCode { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string ledip { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string scanIp { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string destinationArea { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string basePlcDB { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string selfAddress { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string backAddress { get; set; }



        [SugarColumn(IsIgnore = true)]
        public base_equipment_type EquipmentType { get; set; }

        [SugarColumn(IsIgnore = true)]
        public List<base_equipment_prop> m_equipmentProps { get; set; }

        /// <summary>
        /// 逻辑外键实体-设备属性                
        /// </summary>

        [SugarColumn(IsIgnore = true)]
        public List<base_equipment_prop> EquipmentProps
        {
            get { return m_equipmentProps; }
            set
            {
                m_equipmentProps = value;
                if (value != null)
                {
                    var maps = new Dictionary<string, base_equipment_prop>(value.Count);
                    foreach (var item in value)
                    {
                        if (item.EquipmentTypePropTemplate == null) item.EquipmentTypePropTemplate = new base_equipment_type_template();

                        maps.Add(item.equipmentTypeTemplateCode, item);
                    }
                    m_propMaps = maps;
                }
            }
        }


        #region 添加数据字典 键值只需要执行一次初始化 后续不需要再Find 
        [SugarColumn(IsIgnore = true)]
        private IDictionary<string, base_equipment_prop> m_propMaps { get; set; }
        /// <summary>
        /// 获取设备属性
        /// </summary>
        /// <param name="key">设备属性code </param>
        /// <returns></returns>
        [NotMapped]
        [SugarColumn(IsIgnore = true)]
        public base_equipment_prop this[string key]
        {
            get
            {
                m_propMaps.TryGetValue(key, out base_equipment_prop prop);
                return prop;
            }
        }

        #endregion

    }
}