using Newtonsoft.Json;
using SqlSugar;
using WIDESEA_Core.DB.Models;
namespace WIDESEA_Model.Models
{
    /// 
    /// 表示生产过程中的料框属性和相关工序信息的模型。
    /// 
    [SugarTable("ProductionModel", "料框属性")]
    public class ProductionModel : BaseEntity
    {
        /// 
        /// 备  注:主键,自动增长
        /// 
        [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主键,自动增长")]
        public int Id { get; set; }
        /// 
        /// 料框属性,用于标识料框的唯一属性。
        /// 
        [SugarColumn(ColumnName = "TrayBarcodeProperty", ColumnDescription = "料框属性", IsNullable = false)]
        public string TrayBarcodeProperty { get; set; }
        /// 
        /// 工序集合,包含所有相关的工序代码。
        /// 
        [SugarColumn(ColumnName = "ProcessCodes", ColumnDescription = "工序集合", IsNullable = false, Length = int.MaxValue)]
        public string ProcessCodes { get; set; }
        /// 
        /// 适用物料编码/工艺型号集合,包含所有相关的物料编码或工艺型号。
        /// 
        [SugarColumn(ColumnName = "ProductTypes", ColumnDescription = "适用物料编码", IsNullable = false, Length = int.MaxValue)]
        public string ProductTypes { get; set; }
        /// 
        /// 托盘容量,表示料框可以承载的最大物品数量。
        /// 
        [SugarColumn(ColumnName = "Capacity", ColumnDescription = "托盘容量", IsNullable = false)]
        public int Capacity { get; set; }
        /// 
        /// 获取或设置工序集合,反序列化JSON字符串为List。
        /// 
        [SugarColumn(IsIgnore = true)]
        public List GetProcessCodes
        {
            get { return JsonConvert.DeserializeObject>(ProcessCodes); }
            set { ProcessCodes = JsonConvert.SerializeObject(value); }
        }
        /// 
        /// 获取或设置适用物料编码/工艺型号集合,反序列化JSON字符串为List。
        /// 
        [SugarColumn(IsIgnore = true)]
        public List GetProductTypes
        {
            get { return JsonConvert.DeserializeObject>(ProductTypes); }
            set { ProductTypes = JsonConvert.SerializeObject(value); }
        }
    }
    public class ProcessCodesDTO
    {
        /// 
        /// 工序
        /// 
        public string ProcessCode { get; set; }
    }
    public class ProductTypesDTO
    {
        /// 
        /// 适用物料编码/工艺型号
        /// 
        public string ProductType { get; set; }
    }
}