zs
2025-04-30 3933f3629ec6282e5f070923f04bbf2c1add6687
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
using System;
using Microsoft.EntityFrameworkCore.Migrations;
 
#nullable disable
 
namespace CMS.Plugin.HIAWms.MySQL.Migrations
{
    public partial class InitialCreate : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterDatabase()
                .Annotation("MySql:CharSet", "utf8mb4");
 
            migrationBuilder.CreateTable(
                name: "scms_wmsareas",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    AreaNo = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "库区编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AreaName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "库区名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AreaDesc = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "描述")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AreaStatus = table.Column<int>(type: "int", nullable: false, comment: "库区状态"),
                    AreaType = table.Column<int>(type: "int", nullable: false, comment: "库区类型"),
                    RedundantField1 = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "冗余字段1 - 预留扩展用途")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RedundantField2 = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "冗余字段2 - 预留扩展用途")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RedundantField3 = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "冗余字段3 - 预留扩展用途")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    StoreCode = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "仓库代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    StoreName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "仓库名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    Remark = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsDisabled = table.Column<bool>(type: "tinyint(1)", nullable: true, comment: "是否禁用"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_scms_wmsareas", x => x.Id);
                },
                comment: "库区表")
                .Annotation("MySql:CharSet", "utf8mb4");
 
            migrationBuilder.CreateTable(
                name: "scms_wmscontainers",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    ContainerNo = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "托盘编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ContainerType = table.Column<int>(type: "int", nullable: false, comment: "托盘类型"),
                    ContainerStatus = table.Column<int>(type: "int", nullable: false, comment: "托盘状态"),
                    SpecLength = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: true, comment: "长度"),
                    SpecWidth = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: true, comment: "宽度"),
                    SpecHeight = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: true, comment: "高度"),
                    LimitLength = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: true, comment: "限长"),
                    LimitWidth = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: true, comment: "限宽"),
                    LimitHeight = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: true, comment: "限高"),
                    MaxWeight = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: true, comment: "载重上限"),
                    ExceptionNumber = table.Column<int>(type: "int", nullable: true, comment: "异常数量"),
                    MaterialNumber = table.Column<int>(type: "int", nullable: true, comment: "物料数量"),
                    RedundantField1 = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "冗余字段1 - 预留扩展用途")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RedundantField2 = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "冗余字段2 - 预留扩展用途")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RedundantField3 = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "冗余字段3 - 预留扩展用途")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    Remark = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsDisabled = table.Column<bool>(type: "tinyint(1)", nullable: true, comment: "是否禁用"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_scms_wmscontainers", x => x.Id);
                },
                comment: "托盘信息表")
                .Annotation("MySql:CharSet", "utf8mb4");
 
            migrationBuilder.CreateTable(
                name: "scms_wmsmaterials",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    MaterialCode = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "物料编码(唯一标识)")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MaterialName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false, comment: "物料名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PurchaseType = table.Column<int>(type: "int", nullable: false, comment: "采购类型(枚举值)"),
                    MaterialType = table.Column<int>(type: "int", nullable: false, comment: "物料类型(枚举值)"),
                    PrimaryUnit = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "主单位(如:kg、m、个)")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Standard = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true, comment: "规格/标准(如:GB/T 8163-2018)")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OuterDiameter = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "外径(单位:mm)"),
                    WallThickness = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "壁厚(单位:mm)"),
                    MaterialQuality = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true, comment: "材质(如:304不锈钢)")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Length = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "长度(单位:m)"),
                    IsMainBranch = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否为主支管"),
                    Factory = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true, comment: "生产工厂")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Certification = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true, comment: "证书编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RedundantField1 = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true, comment: "冗余字段1 - 预留扩展用途")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RedundantField2 = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true, comment: "冗余字段2 - 预留扩展用途")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RedundantField3 = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true, comment: "冗余字段3 - 预留扩展用途")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false, defaultValue: 0, comment: "排序"),
                    Remark = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsDisabled = table.Column<bool>(type: "tinyint(1)", nullable: true, defaultValue: false, comment: "是否禁用"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_scms_wmsmaterials", x => x.Id);
                },
                comment: "物料基础信息表")
                .Annotation("MySql:CharSet", "utf8mb4");
 
            migrationBuilder.CreateTable(
                name: "scms_wmsplaces",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    PlaceNo = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    StorageTypeNo = table.Column<int>(type: "int", nullable: false, comment: "货位类型"),
                    PlaceStatus = table.Column<int>(type: "int", nullable: false, comment: "货位状态"),
                    AreaCode = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "所在库区")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Aisle = table.Column<int>(type: "int", nullable: false, comment: "巷道"),
                    RowNo = table.Column<int>(type: "int", nullable: false, comment: "排"),
                    ColumnNo = table.Column<int>(type: "int", nullable: false, comment: "列"),
                    LayerNo = table.Column<int>(type: "int", nullable: false, comment: "层"),
                    Islock = table.Column<int>(type: "int", nullable: false, comment: "是否锁定"),
                    EmptyContainer = table.Column<int>(type: "int", nullable: false, comment: "是否空托"),
                    RedundantField1 = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "冗余字段1 - 预留扩展用途")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RedundantField2 = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "冗余字段2 - 预留扩展用途")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RedundantField3 = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "冗余字段3 - 预留扩展用途")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    Remark = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsDisabled = table.Column<bool>(type: "tinyint(1)", nullable: true, comment: "是否禁用"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_scms_wmsplaces", x => x.Id);
                },
                comment: "库位表")
                .Annotation("MySql:CharSet", "utf8mb4");
 
            migrationBuilder.CreateTable(
                name: "scms_wmsstores",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    StoreCode = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "仓库代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    StoreName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "仓库名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RedundantField1 = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "冗余字段1 - 预留扩展用途")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RedundantField2 = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "冗余字段2 - 预留扩展用途")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RedundantField3 = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "冗余字段3 - 预留扩展用途")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false, comment: "排序"),
                    IsDisabled = table.Column<bool>(type: "tinyint(1)", nullable: true, comment: "是否禁用"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_scms_wmsstores", x => x.Id);
                },
                comment: "仓库信息表")
                .Annotation("MySql:CharSet", "utf8mb4");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsareas_AreaName",
                table: "scms_wmsareas",
                column: "AreaName");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmscontainers_ContainerNo",
                table: "scms_wmscontainers",
                column: "ContainerNo",
                unique: true);
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmscontainers_ContainerStatus",
                table: "scms_wmscontainers",
                column: "ContainerStatus");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmscontainers_ContainerType",
                table: "scms_wmscontainers",
                column: "ContainerType");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsmaterials_MaterialCode",
                table: "scms_wmsmaterials",
                column: "MaterialCode",
                unique: true);
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsmaterials_MaterialName",
                table: "scms_wmsmaterials",
                column: "MaterialName");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsmaterials_MaterialType",
                table: "scms_wmsmaterials",
                column: "MaterialType");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsmaterials_PurchaseType",
                table: "scms_wmsmaterials",
                column: "PurchaseType");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsplaces_AreaCode",
                table: "scms_wmsplaces",
                column: "AreaCode");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsplaces_PlaceNo",
                table: "scms_wmsplaces",
                column: "PlaceNo",
                unique: true);
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsplaces_PlaceStatus",
                table: "scms_wmsplaces",
                column: "PlaceStatus");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsplaces_StorageTypeNo",
                table: "scms_wmsplaces",
                column: "StorageTypeNo");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsstores_StoreName",
                table: "scms_wmsstores",
                column: "StoreName");
        }
 
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "scms_wmsareas");
 
            migrationBuilder.DropTable(
                name: "scms_wmscontainers");
 
            migrationBuilder.DropTable(
                name: "scms_wmsmaterials");
 
            migrationBuilder.DropTable(
                name: "scms_wmsplaces");
 
            migrationBuilder.DropTable(
                name: "scms_wmsstores");
        }
    }
}