schangxiang@126.com
2024-06-11 2954a2dd4529679ff30c1fd08870895c29d507f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using iWare.Wms.Core.Enum;
 
namespace iWare.Wms.Core
{
    /// <summary>
    /// 物料信息
    /// </summary>
    [Table("wms_material")]
    [Comment("物料信息")]
    public class WmsMaterial:DEntityBase, IEntityTypeBuilder<WmsMaterial>
    {
 
        /// <summary>
        /// 物料名称
        /// </summary>
        [Comment("物料名称")]
        [Required]
 
        [MaxLength(50)]
        public string MaterialName { get; set; }
 
        /// <summary>
        /// 物料编号
        /// </summary>
        [Comment("物料编号")]
        [Required]
 
        [MaxLength(50)]
        public string MaterialNo { get; set; }
 
        /// <summary>
        /// 物料批次
        /// </summary>
        [Comment("物料批次")]
        [Required]
 
        [MaxLength(50)]
        public string MaterialBatch { get; set; }
 
        /// <summary>
        /// 描述
        /// </summary>
        [Comment("描述")]
 
        [MaxLength(500)]
        public string Description { get; set; }
 
        /// <summary>
        /// 检验方式;数据字典
        /// </summary>
        [Comment("检验方式")]
        [Required]
 
        public MaterialInspection InspectionMethod { get; set; }
 
        /// <summary>
        /// 物料类别;数据字典
        /// </summary>
        [Comment("物料类别")]
        [Required]
 
        public MaterialType MaterialType { get; set; }
 
        /// <summary>
        /// 物料规格
        /// </summary>
        [Comment("物料规格")]
        [Required]
 
        [MaxLength(50)]
        public string MaterialSpec { get; set; }
 
        /// <summary>
        /// 单位类别;数据字典
        /// </summary>
        [Comment("单位类别")]
        [Required]
 
        public UnitType UnitType { get; set; }
 
        /// <summary>
        /// 单位编号;数据字典
        /// </summary>
        [Comment("单位编号")]
        [Required]
 
        public UnitnoType UnitNo { get; set; }
 
        /// <summary>
        /// 安全存量
        /// </summary>
        [Comment("安全存量")]
 
        public decimal Safeqty { get; set; }
 
        /// <summary>
        /// 是否关键物料;数据字典
        /// </summary>
        [Comment("是否关键物料")]
 
        public YesOrNot Keymaterials { get; set; }
 
        /// <summary>
        /// Erp单号
        /// </summary>
        [Comment("Erp单号")]
 
        [MaxLength(50)]
        public string ErpNo { get; set; }
 
        /// <summary>
        /// 图号
        /// </summary>
        [Comment("图号")]
 
        [MaxLength(50)]
        public string GraphNo { get; set; }
 
        /// <summary>
        /// 品管类别
        /// </summary>
        [Comment("品管类别")]
 
        [MaxLength(50)]
        public string Qccategory { get; set; }
 
        /// <summary>
        /// 保质期
        /// </summary>
        [Comment("保质期")]
 
        public decimal Warranty { get; set; }
 
        /// <summary>
        /// 最大存量
        /// </summary>
        [Comment("最大存量")]
 
        public decimal MaxImumqty { get; set; }
 
        /// <summary>
        /// 最小库龄
        /// </summary>
        [Comment("最小库龄")]
 
        public decimal MinstorageAge { get; set; }
 
        /// <summary>
        /// 最大库龄
        /// </summary>
        [Comment("最大库龄")]
 
        public decimal MaxstorageAge { get; set; }
 
        public ICollection<WmsMaterialContainer> WmsMaterialContainers { get; set; }
 
 
        /// <summary>
        /// 构建一对多的关系
        /// </summary>
        /// <param name="entityBuilder"></param>
        /// <param name="dbContext"></param>
        /// <param name="dbContextLocator"></param>
        public void Configure(EntityTypeBuilder<WmsMaterial> entityBuilder, DbContext dbContext, Type dbContextLocator)
        {
            entityBuilder.HasMany(x => x.WmsMaterialContainers)
                .WithOne(x => x.WmsMaterial)
                .HasForeignKey(x => x.MaterialId).IsRequired(false);
        }
    }
}