zs
2025-05-15 edba4ede85a3d82a7f0a0a7dccddbc8281862888
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
using System;
using Microsoft.EntityFrameworkCore.Migrations;
 
#nullable disable
 
namespace CMS.Plugin.HIAWms.MySQL.Migrations
{
    public partial class InitialCreate8 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<int>(
                name: "IsMainBranch",
                table: "scms_wmsmaterials",
                type: "int",
                nullable: false,
                defaultValue: 0,
                comment: "是否为主支管",
                oldClrType: typeof(int),
                oldType: "int",
                oldDefaultValue: 2,
                oldComment: "是否为主支管");
 
            migrationBuilder.CreateTable(
                name: "scms_wmsinoutstockorder",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    OrderNo = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OrderStatus = table.Column<int>(type: "int", nullable: false, comment: "单据状态"),
                    MaterialName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "物料名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MaterialNo = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "物料件号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MaterialModel = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "型号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MaterialBatch = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "批次号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OrderType = table.Column<int>(type: "int", nullable: false, comment: "单据类型"),
                    StockType = table.Column<int>(type: "int", nullable: false, comment: "操作类型(枚举值)"),
                    MaterialNumber = table.Column<int>(type: "int", nullable: false, comment: "单据数量"),
                    DistributeNumber = table.Column<int>(type: "int", nullable: false, defaultValue: 0, comment: "下发数量"),
                    CompleteNumber = table.Column<int>(type: "int", nullable: false, defaultValue: 0, comment: "完成数量"),
                    Priority = table.Column<int>(type: "int", nullable: false, defaultValue: 1, comment: "优先级"),
                    PlanNo = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "关联计划编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OperateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "操作时间"),
                    Remark = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false, defaultValue: 0, comment: "排序"),
                    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_wmsinoutstockorder", x => x.Id);
                },
                comment: "出入库单据表")
                .Annotation("MySql:CharSet", "utf8mb4");
 
            migrationBuilder.CreateTable(
                name: "scms_wmsinoutstockorderdetail",
                columns: table => new
                {
                    OrderNo = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MaterialId = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "物料唯一码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OrderType = table.Column<int>(type: "int", nullable: false, comment: "单据类型(枚举值)"),
                    MaterialNo = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "物料件号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MaterialName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "物料名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ContainerNo = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "容器编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MaterialModel = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "机型")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MaterialBatch = table.Column<int>(type: "int", nullable: true, comment: "物料批次")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_scms_wmsinoutstockorderdetail", x => new { x.OrderNo, x.MaterialId });
                },
                comment: "出入库单据明细表")
                .Annotation("MySql:CharSet", "utf8mb4");
 
            migrationBuilder.CreateTable(
                name: "scms_wmsmaterialcontainer",
                columns: table => new
                {
                    ContainerNo = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "托盘编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MaterialId = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "物料ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Sort = table.Column<int>(type: "int", nullable: false),
                    IsDisabled = table.Column<bool>(type: "tinyint(1)", nullable: true),
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    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_wmsmaterialcontainer", x => new { x.MaterialId, x.ContainerNo });
                },
                comment: "物料容器关系表")
                .Annotation("MySql:CharSet", "utf8mb4");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsinoutstockorder_MaterialBatch",
                table: "scms_wmsinoutstockorder",
                column: "MaterialBatch");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsinoutstockorder_MaterialNo",
                table: "scms_wmsinoutstockorder",
                column: "MaterialNo");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsinoutstockorder_OperateTime",
                table: "scms_wmsinoutstockorder",
                column: "OperateTime");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsinoutstockorder_OrderNo",
                table: "scms_wmsinoutstockorder",
                column: "OrderNo",
                unique: true);
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsinoutstockorder_PlanNo",
                table: "scms_wmsinoutstockorder",
                column: "PlanNo");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsinoutstockorderdetail_ContainerNo",
                table: "scms_wmsinoutstockorderdetail",
                column: "ContainerNo");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsinoutstockorderdetail_MaterialId",
                table: "scms_wmsinoutstockorderdetail",
                column: "MaterialId");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsinoutstockorderdetail_MaterialNo",
                table: "scms_wmsinoutstockorderdetail",
                column: "MaterialNo");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsinoutstockorderdetail_OrderNo",
                table: "scms_wmsinoutstockorderdetail",
                column: "OrderNo");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsinoutstockorderdetail_OrderNo_OrderType",
                table: "scms_wmsinoutstockorderdetail",
                columns: new[] { "OrderNo", "OrderType" });
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsmaterialcontainer_ContainerNo",
                table: "scms_wmsmaterialcontainer",
                column: "ContainerNo");
 
            migrationBuilder.CreateIndex(
                name: "IX_scms_wmsmaterialcontainer_MaterialId",
                table: "scms_wmsmaterialcontainer",
                column: "MaterialId");
        }
 
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "scms_wmsinoutstockorder");
 
            migrationBuilder.DropTable(
                name: "scms_wmsinoutstockorderdetail");
 
            migrationBuilder.DropTable(
                name: "scms_wmsmaterialcontainer");
 
            migrationBuilder.AlterColumn<int>(
                name: "IsMainBranch",
                table: "scms_wmsmaterials",
                type: "int",
                nullable: false,
                defaultValue: 2,
                comment: "是否为主支管",
                oldClrType: typeof(int),
                oldType: "int",
                oldDefaultValue: 0,
                oldComment: "是否为主支管");
        }
    }
}