Blame view

yudao-module-mes/src/test/resources/sql/create_tables.sql 33.1 KB
cba32552   YunaiV   ✨ feat(mes): 添加 M...
1
  -- ----------------------------
0635d13d   YunaiV   ✨ feat(mes): 更新单白...
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
  -- MES 排班计划
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_cal_plan" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "code" varchar(64) DEFAULT NULL,
      "name" varchar(255) DEFAULT NULL,
      "calendar_type" tinyint DEFAULT NULL,
      "start_date" timestamp DEFAULT NULL,
      "end_date" timestamp DEFAULT NULL,
      "shift_type" tinyint DEFAULT NULL,
      "shift_method" tinyint DEFAULT NULL,
      "shift_count" int DEFAULT NULL,
      "status" tinyint DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 排班计划班次
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_cal_plan_shift" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "plan_id" bigint DEFAULT NULL,
      "sort" int DEFAULT NULL,
      "name" varchar(64) DEFAULT NULL,
      "start_time" varchar(10) DEFAULT NULL,
      "end_time" varchar(10) DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 排班计划班组
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_cal_plan_team" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "plan_id" bigint DEFAULT NULL,
      "team_id" bigint DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 班组排班
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_cal_team_shift" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "plan_id" bigint DEFAULT NULL,
      "team_id" bigint DEFAULT NULL,
      "shift_id" bigint DEFAULT NULL,
      "day" timestamp DEFAULT NULL,
      "sort" int DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
33c90a7a   YunaiV   fix(mes): 修复排班连班与...
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
  -- MES 假期设置
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_cal_holiday" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "day" timestamp DEFAULT NULL,
      "type" tinyint DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
cba32552   YunaiV   ✨ feat(mes): 添加 M...
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
  -- MES 编码规则表
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_md_auto_code_rule" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "code" varchar(64) NOT NULL,
      "name" varchar(64) NOT NULL,
      "description" varchar(255) DEFAULT NULL,
      "max_length" int DEFAULT NULL,
      "padded" bit NOT NULL DEFAULT FALSE,
      "padded_char" varchar(1) DEFAULT NULL,
      "padded_method" tinyint DEFAULT NULL,
      "status" tinyint NOT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 编码规则组成表
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_md_auto_code_part" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "rule_id" bigint NOT NULL,
      "sort" int NOT NULL,
      "type" tinyint NOT NULL,
      "length" int NOT NULL,
      "date_format" varchar(20) DEFAULT NULL,
      "fix_character" varchar(64) DEFAULT NULL,
      "serial_start_no" int DEFAULT NULL,
      "serial_step" int DEFAULT NULL,
      "cycle_flag" bit DEFAULT FALSE,
      "cycle_method" tinyint DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 编码生成记录表
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_md_auto_code_record" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "rule_id" bigint NOT NULL,
      "result" varchar(64) DEFAULT NULL,
e3774878   YunaiV   ✨ feat(mes): 修改流水...
154
      "serial_no" bigint DEFAULT NULL,
cba32552   YunaiV   ✨ feat(mes): 添加 M...
155
156
157
158
159
160
161
162
163
      "input_char" varchar(64) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
dbccfbab   YunaiV   ✅ test(iqc): 添加 I...
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
  
  -- ----------------------------
  -- MES 到货通知单
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_wm_arrival_notice" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "code" varchar(64) DEFAULT NULL,
      "name" varchar(255) DEFAULT NULL,
      "purchase_order_code" varchar(64) DEFAULT NULL,
      "vendor_id" bigint DEFAULT NULL,
      "arrival_date" timestamp DEFAULT NULL,
      "contact_name" varchar(64) DEFAULT NULL,
      "contact_telephone" varchar(64) DEFAULT NULL,
      "status" tinyint DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 外协入库单
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_wm_outsource_receipt" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "code" varchar(64) DEFAULT NULL,
      "name" varchar(255) DEFAULT NULL,
      "work_order_id" bigint DEFAULT NULL,
      "vendor_id" bigint DEFAULT NULL,
      "receipt_date" timestamp DEFAULT NULL,
      "status" tinyint DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 来料检验单(IQC)
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_qc_iqc" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "code" varchar(64) DEFAULT NULL,
      "name" varchar(255) DEFAULT NULL,
      "template_id" bigint DEFAULT NULL,
      "source_doc_type" int DEFAULT NULL,
      "source_doc_id" bigint DEFAULT NULL,
      "source_line_id" bigint DEFAULT NULL,
37313f35   YunaiV   ✨ feat(mes): 添加来源...
220
      "source_doc_code" varchar(64) DEFAULT NULL,
dbccfbab   YunaiV   ✅ test(iqc): 添加 I...
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
      "vendor_id" bigint DEFAULT NULL,
      "vendor_batch" varchar(64) DEFAULT NULL,
      "item_id" bigint DEFAULT NULL,
      "received_quantity" decimal(24,6) DEFAULT NULL,
      "check_quantity" decimal(24,6) DEFAULT NULL,
      "qualified_quantity" decimal(24,6) DEFAULT NULL,
      "unqualified_quantity" decimal(24,6) DEFAULT NULL,
      "critical_rate" decimal(10,2) DEFAULT NULL,
      "major_rate" decimal(10,2) DEFAULT NULL,
      "minor_rate" decimal(10,2) DEFAULT NULL,
      "critical_quantity" int DEFAULT NULL,
      "major_quantity" int DEFAULT NULL,
      "minor_quantity" int DEFAULT NULL,
      "check_result" tinyint DEFAULT NULL,
      "receive_date" timestamp DEFAULT NULL,
      "inspect_date" timestamp DEFAULT NULL,
      "inspector_user_id" bigint DEFAULT NULL,
      "status" tinyint DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
fa473f7d   YunaiV   ✨ feat(mes): 更新来源...
248
249
250
251
252
253
254
255
256
257
258
259
260
  
  -- ----------------------------
  -- MES 过程检验单(IPQC)
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_qc_ipqc" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "code" varchar(64) DEFAULT NULL,
      "name" varchar(500) DEFAULT NULL,
      "type" tinyint DEFAULT NULL,
      "template_id" bigint DEFAULT NULL,
      "source_doc_type" int DEFAULT NULL,
      "source_doc_id" bigint DEFAULT NULL,
      "source_line_id" bigint DEFAULT NULL,
37313f35   YunaiV   ✨ feat(mes): 添加来源...
261
      "source_doc_code" varchar(64) DEFAULT NULL,
fa473f7d   YunaiV   ✨ feat(mes): 更新来源...
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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
      "work_order_id" bigint DEFAULT NULL,
      "task_id" bigint DEFAULT NULL,
      "workstation_id" bigint DEFAULT NULL,
      "process_id" bigint DEFAULT NULL,
      "item_id" bigint DEFAULT NULL,
      "check_quantity" decimal(14,2) DEFAULT NULL,
      "qualified_quantity" decimal(14,2) DEFAULT NULL,
      "unqualified_quantity" decimal(14,2) DEFAULT NULL,
      "labor_scrap_quantity" decimal(14,2) DEFAULT NULL,
      "material_scrap_quantity" decimal(14,2) DEFAULT NULL,
      "other_scrap_quantity" decimal(14,2) DEFAULT NULL,
      "critical_rate" decimal(14,2) DEFAULT NULL,
      "major_rate" decimal(14,2) DEFAULT NULL,
      "minor_rate" decimal(14,2) DEFAULT NULL,
      "critical_quantity" int DEFAULT NULL,
      "major_quantity" int DEFAULT NULL,
      "minor_quantity" int DEFAULT NULL,
      "check_result" tinyint DEFAULT NULL,
      "inspect_date" timestamp DEFAULT NULL,
      "inspector_user_id" bigint DEFAULT NULL,
      "status" tinyint DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 生产报工
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_pro_feedback" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "code" varchar(64) DEFAULT NULL,
      "type" tinyint DEFAULT NULL,
      "channel" varchar(64) DEFAULT NULL,
      "feedback_time" timestamp DEFAULT NULL,
      "workstation_id" bigint DEFAULT NULL,
      "route_id" bigint DEFAULT NULL,
      "process_id" bigint DEFAULT NULL,
      "work_order_id" bigint DEFAULT NULL,
      "task_id" bigint DEFAULT NULL,
      "item_id" bigint DEFAULT NULL,
      "expire_date" timestamp DEFAULT NULL,
      "lot_number" varchar(64) DEFAULT NULL,
      "scheduled_quantity" decimal(14,2) DEFAULT NULL,
      "feedback_quantity" decimal(14,2) DEFAULT NULL,
      "qualified_quantity" decimal(14,2) DEFAULT NULL,
      "unqualified_quantity" decimal(14,2) DEFAULT NULL,
      "uncheck_quantity" decimal(14,2) DEFAULT NULL,
      "labor_scrap_quantity" decimal(14,2) DEFAULT NULL,
      "material_scrap_quantity" decimal(14,2) DEFAULT NULL,
      "other_scrap_quantity" decimal(14,2) DEFAULT NULL,
      "feedback_user_id" bigint DEFAULT NULL,
      "approve_user_id" bigint DEFAULT NULL,
      "status" tinyint DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 生产入库单主表
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_wm_product_produce" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "work_order_id" bigint DEFAULT NULL,
      "feedback_id" bigint DEFAULT NULL,
      "task_id" bigint DEFAULT NULL,
      "workstation_id" bigint DEFAULT NULL,
      "process_id" bigint DEFAULT NULL,
      "produce_date" timestamp DEFAULT NULL,
      "status" int DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 生产入库单行表
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_wm_product_produce_line" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "produce_id" bigint DEFAULT NULL,
      "feedback_id" bigint DEFAULT NULL,
      "item_id" bigint DEFAULT NULL,
      "quantity" decimal(12,2) DEFAULT NULL,
      "batch_id" bigint DEFAULT NULL,
      "batch_code" varchar(255) DEFAULT NULL,
      "expire_date" timestamp DEFAULT NULL,
      "lot_number" varchar(128) DEFAULT NULL,
      "quality_status" int DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 生产入库明细表
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_wm_product_produce_detail" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "produce_id" bigint DEFAULT NULL,
      "line_id" bigint DEFAULT NULL,
      "item_id" bigint DEFAULT NULL,
      "quantity" decimal(12,2) DEFAULT NULL,
      "batch_id" bigint DEFAULT NULL,
      "batch_code" varchar(255) DEFAULT NULL,
      "warehouse_id" bigint DEFAULT NULL,
      "location_id" bigint DEFAULT NULL,
      "area_id" bigint DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
d6d6887b   YunaiV   ✨ feat(mes): 将质量状...
400
  
d6d6887b   YunaiV   ✨ feat(mes): 将质量状...
401
402
403
404
405
406
407
408
  -- ----------------------------
  -- MES 出货检验单(OQC)
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_qc_oqc" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "code" varchar(64) NOT NULL,
      "name" varchar(500) NOT NULL,
      "template_id" bigint NOT NULL,
d6d6887b   YunaiV   ✨ feat(mes): 将质量状...
409
      "source_doc_type" int DEFAULT NULL,
a5e130d1   YunaiV   ✨ feat(vo): 更新多个 ...
410
      "source_doc_id" bigint DEFAULT NULL,
d6d6887b   YunaiV   ✨ feat(mes): 将质量状...
411
      "source_line_id" bigint DEFAULT NULL,
37313f35   YunaiV   ✨ feat(mes): 添加来源...
412
      "source_doc_code" varchar(64) DEFAULT NULL,
d6d6887b   YunaiV   ✨ feat(mes): 将质量状...
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
      "client_id" bigint NOT NULL,
      "batch_code" varchar(64) DEFAULT NULL,
      "item_id" bigint NOT NULL,
      "min_check_quantity" int DEFAULT 1,
      "max_unqualified_quantity" int DEFAULT 0,
      "out_quantity" decimal(14,2) NOT NULL,
      "check_quantity" decimal(14,2) DEFAULT NULL,
      "qualified_quantity" decimal(14,2) DEFAULT 0.00,
      "unqualified_quantity" decimal(14,2) DEFAULT 0.00,
      "critical_rate" decimal(14,2) DEFAULT 0.00,
      "major_rate" decimal(14,2) DEFAULT 0.00,
      "minor_rate" decimal(14,2) DEFAULT 0.00,
      "critical_quantity" int DEFAULT 0,
      "major_quantity" int DEFAULT 0,
      "minor_quantity" int DEFAULT 0,
      "check_result" tinyint DEFAULT NULL,
      "out_date" timestamp DEFAULT NULL,
      "inspect_date" timestamp DEFAULT NULL,
      "inspector_user_id" bigint DEFAULT NULL,
      "status" tinyint NOT NULL DEFAULT 0,
      "remark" varchar(500) DEFAULT '',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 退货检验单(RQC)
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_qc_rqc" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "code" varchar(64) NOT NULL,
      "name" varchar(500) NOT NULL,
      "template_id" bigint NOT NULL,
d6d6887b   YunaiV   ✨ feat(mes): 将质量状...
451
      "source_doc_type" int DEFAULT NULL,
a5e130d1   YunaiV   ✨ feat(vo): 更新多个 ...
452
      "source_doc_id" bigint DEFAULT NULL,
d6d6887b   YunaiV   ✨ feat(mes): 将质量状...
453
      "source_line_id" bigint DEFAULT NULL,
37313f35   YunaiV   ✨ feat(mes): 添加来源...
454
      "source_doc_code" varchar(64) DEFAULT NULL,
d6d6887b   YunaiV   ✨ feat(mes): 将质量状...
455
456
457
458
459
460
      "type" int DEFAULT NULL,
      "item_id" bigint NOT NULL,
      "batch_code" varchar(128) DEFAULT NULL,
      "check_quantity" decimal(14,2) DEFAULT NULL,
      "qualified_quantity" decimal(14,2) DEFAULT 0.00,
      "unqualified_quantity" decimal(14,2) DEFAULT 0.00,
a5e130d1   YunaiV   ✨ feat(vo): 更新多个 ...
461
462
463
464
465
466
      "critical_rate" decimal(14,2) DEFAULT 0.00,
      "major_rate" decimal(14,2) DEFAULT 0.00,
      "minor_rate" decimal(14,2) DEFAULT 0.00,
      "critical_quantity" int DEFAULT 0,
      "major_quantity" int DEFAULT 0,
      "minor_quantity" int DEFAULT 0,
d6d6887b   YunaiV   ✨ feat(mes): 将质量状...
467
468
469
470
471
      "check_result" tinyint DEFAULT NULL,
      "inspect_date" timestamp DEFAULT NULL,
      "inspector_user_id" bigint DEFAULT NULL,
      "status" tinyint NOT NULL DEFAULT 0,
      "remark" varchar(500) DEFAULT '',
d6d6887b   YunaiV   ✨ feat(mes): 将质量状...
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 销售出库单行
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_wm_product_sales_line" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "sales_id" bigint NOT NULL,
0c3c271c   YunaiV   ✨ feat(sales): 新增...
487
      "notice_line_id" bigint DEFAULT NULL,
d6d6887b   YunaiV   ✨ feat(mes): 将质量状...
488
489
490
      "item_id" bigint NOT NULL,
      "quantity" decimal(20,6) NOT NULL,
      "batch_id" bigint DEFAULT NULL,
1e239b66   YunaiV   ✨ feat(test): 增加工...
491
      "batch_code" varchar(255) DEFAULT NULL,
d6d6887b   YunaiV   ✨ feat(mes): 将质量状...
492
      "material_stock_id" bigint DEFAULT NULL,
b31f78c8   YunaiV   ✨ feat(mes): 更新质检...
493
      "oqc_check_flag" tinyint DEFAULT NULL,
d6d6887b   YunaiV   ✨ feat(mes): 将质量状...
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
      "oqc_id" bigint DEFAULT NULL,
      "quality_status" int DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 生产退料单行
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_wm_return_issue_line" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "issue_id" bigint NOT NULL,
      "material_stock_id" bigint DEFAULT NULL,
      "item_id" bigint NOT NULL,
      "quantity" decimal(12,2) NOT NULL DEFAULT 0.00,
      "batch_id" bigint DEFAULT NULL,
627bbba3   YunaiV   ✨ feat(mes): 新增库存...
516
      "batch_code" varchar(255) DEFAULT NULL,
828c878f   YunaiV   ✨ feat(mes): 更新退货...
517
      "rqc_id" bigint DEFAULT NULL,
b31f78c8   YunaiV   ✨ feat(mes): 更新质检...
518
      "rqc_check_flag" bit NOT NULL DEFAULT FALSE,
d6d6887b   YunaiV   ✨ feat(mes): 将质量状...
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
      "quality_status" int DEFAULT NULL,
      "remark" varchar(500) DEFAULT '',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 销售退货单行
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_wm_return_sales_line" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "return_id" bigint NOT NULL,
      "item_id" bigint NOT NULL,
      "quantity" decimal(12,2) NOT NULL DEFAULT 0.00,
      "batch_id" bigint DEFAULT NULL,
39ddc422   YunaiV   ✨ feat(mes): 更新 M...
539
      "batch_code" varchar(255) DEFAULT NULL,
828c878f   YunaiV   ✨ feat(mes): 更新退货...
540
      "rqc_id" bigint DEFAULT NULL,
b31f78c8   YunaiV   ✨ feat(mes): 更新质检...
541
      "rqc_check_flag" bit NOT NULL DEFAULT FALSE,
d6d6887b   YunaiV   ✨ feat(mes): 将质量状...
542
543
544
545
546
547
548
549
550
551
552
      "quality_status" int DEFAULT NULL,
      "remark" varchar(500) DEFAULT '',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
d1d43ca4   YunaiV   ✨ feat(mes): 新增采购...
553
554
555
556
557
558
559
560
561
562
  -- ----------------------------
  -- MES 采购入库单
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_wm_item_receipt" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "code" varchar(64) NOT NULL,
      "name" varchar(255) DEFAULT NULL,
      "iqc_id" bigint DEFAULT NULL,
      "notice_id" bigint DEFAULT NULL,
      "vendor_id" bigint DEFAULT NULL,
0f0b3957   YunaiV   ✨ feat(mes): 新增采购...
563
      "purchase_order_code" varchar(64) DEFAULT NULL,
d1d43ca4   YunaiV   ✨ feat(mes): 新增采购...
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
      "receipt_date" timestamp DEFAULT NULL,
      "status" tinyint NOT NULL DEFAULT 0,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 采购入库单行
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_wm_item_receipt_line" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "receipt_id" bigint NOT NULL,
      "arrival_notice_line_id" bigint DEFAULT NULL,
      "item_id" bigint NOT NULL,
      "received_quantity" decimal(14,2) DEFAULT NULL,
      "batch_id" bigint DEFAULT NULL,
      "batch_code" varchar(255) DEFAULT NULL,
      "production_date" timestamp DEFAULT NULL,
      "expire_date" timestamp DEFAULT NULL,
      "lot_number" varchar(128) DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 采购入库明细
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_wm_item_receipt_detail" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "line_id" bigint NOT NULL,
      "receipt_id" bigint NOT NULL,
      "item_id" bigint NOT NULL,
      "quantity" decimal(14,2) DEFAULT NULL,
      "batch_id" bigint DEFAULT NULL,
      "warehouse_id" bigint DEFAULT NULL,
      "location_id" bigint DEFAULT NULL,
      "area_id" bigint DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
b690a596   YunaiV   ✨ feat(mes): 新增物料...
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
  
  -- ----------------------------
  -- MES 物料消耗记录表
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_wm_item_consume" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "work_order_id" bigint NOT NULL,
      "task_id" bigint NOT NULL,
      "workstation_id" bigint NOT NULL,
      "process_id" bigint NOT NULL,
      "feedback_id" bigint NOT NULL,
      "consume_date" timestamp NOT NULL,
      "status" tinyint NOT NULL DEFAULT 0,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 物料消耗记录行表
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_wm_item_consume_line" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "consume_id" bigint NOT NULL,
      "item_id" bigint NOT NULL,
      "quantity" decimal(14,2) NOT NULL,
      "batch_id" bigint DEFAULT NULL,
      "batch_code" varchar(128) DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
  -- MES 物料消耗记录明细表
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_wm_item_consume_detail" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "consume_id" bigint NOT NULL,
      "line_id" bigint NOT NULL,
      "material_stock_id" bigint DEFAULT NULL,
      "item_id" bigint NOT NULL,
      "quantity" decimal(14,2) NOT NULL,
      "batch_id" bigint DEFAULT NULL,
      "batch_code" varchar(128) DEFAULT NULL,
      "warehouse_id" bigint NOT NULL,
      "location_id" bigint NOT NULL,
      "area_id" bigint NOT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
61545f9e   YunaiV   ✨ feat(mes): 增强批次...
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
  
  -- ----------------------------
  -- MES 批次记录表
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_wm_batch" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "code" varchar(128) DEFAULT NULL,
      "item_id" bigint DEFAULT NULL,
      "produce_date" timestamp DEFAULT NULL,
      "expire_date" timestamp DEFAULT NULL,
      "receipt_date" timestamp DEFAULT NULL,
      "vendor_id" bigint DEFAULT NULL,
      "client_id" bigint DEFAULT NULL,
      "sales_order_code" varchar(64) DEFAULT NULL,
      "purchase_order_code" varchar(64) DEFAULT NULL,
      "work_order_id" bigint DEFAULT NULL,
      "task_id" bigint DEFAULT NULL,
      "workstation_id" bigint DEFAULT NULL,
      "tool_id" bigint DEFAULT NULL,
      "mold_id" bigint DEFAULT NULL,
      "lot_number" varchar(128) DEFAULT NULL,
      "quality_status" int DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
8bcd65d2   YunaiV   ✨ feat(task): 添加质...
720
721
  
  -- ----------------------------
03b421a8   YunaiV   ✨ feat(stock): 添加...
722
723
724
725
  -- MES 库存台账
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_wm_material_stock" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
a1c14c49   YunaiV   ♻️ refactor(mes):...
726
727
728
729
730
731
732
733
734
735
736
      "item_type_id" bigint DEFAULT NULL,
      "item_id" bigint DEFAULT NULL,
      "batch_id" bigint DEFAULT NULL,
      "batch_code" varchar(255) DEFAULT NULL,
      "warehouse_id" bigint DEFAULT NULL,
      "location_id" bigint DEFAULT NULL,
      "area_id" bigint DEFAULT NULL,
      "vendor_id" bigint DEFAULT NULL,
      "quantity" decimal(14,2) DEFAULT NULL,
      "receipt_time" timestamp DEFAULT NULL,
      "frozen" bit DEFAULT FALSE,
03b421a8   YunaiV   ✨ feat(stock): 添加...
737
738
739
740
741
742
743
744
745
746
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
8bcd65d2   YunaiV   ✨ feat(task): 添加质...
747
748
749
750
751
752
753
754
755
756
757
758
  -- MES 生产任务
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_pro_task" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "code" varchar(64) DEFAULT NULL,
      "name" varchar(255) DEFAULT NULL,
      "work_order_id" bigint DEFAULT NULL,
      "workstation_id" bigint DEFAULT NULL,
      "route_id" bigint DEFAULT NULL,
      "process_id" bigint DEFAULT NULL,
      "item_id" bigint DEFAULT NULL,
      "quantity" decimal(14,2) DEFAULT NULL,
7f53d60e   YunaiV   fix: 修复首批关系型数据库通用...
759
760
761
      "produced_quantity" decimal(14,2) NOT NULL DEFAULT 0,
      "qualify_quantity" decimal(14,2) NOT NULL DEFAULT 0,
      "unqualify_quantity" decimal(14,2) NOT NULL DEFAULT 0,
8bcd65d2   YunaiV   ✨ feat(task): 添加质...
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
      "changed_quantity" decimal(14,2) DEFAULT NULL,
      "client_id" bigint DEFAULT NULL,
      "start_time" timestamp DEFAULT NULL,
      "duration" int DEFAULT NULL,
      "end_time" timestamp DEFAULT NULL,
      "color_code" varchar(20) DEFAULT NULL,
      "finish_date" timestamp DEFAULT NULL,
      "cancel_date" timestamp DEFAULT NULL,
      "status" int DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
7f53d60e   YunaiV   fix: 修复首批关系型数据库通用...
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
  -- MES 生产工单
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_pro_work_order" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "code" varchar(64) DEFAULT NULL,
      "name" varchar(255) DEFAULT NULL,
      "type" tinyint DEFAULT NULL,
      "order_source_type" tinyint DEFAULT NULL,
      "order_source_code" varchar(64) DEFAULT NULL,
      "product_id" bigint DEFAULT NULL,
      "quantity" decimal(14,2) NOT NULL DEFAULT 0,
      "quantity_produced" decimal(14,2) NOT NULL DEFAULT 0,
      "quantity_changed" decimal(14,2) NOT NULL DEFAULT 0,
      "quantity_scheduled" decimal(14,2) NOT NULL DEFAULT 0,
      "client_id" bigint DEFAULT NULL,
      "vendor_id" bigint DEFAULT NULL,
      "batch_code" varchar(64) DEFAULT NULL,
      "request_date" timestamp DEFAULT NULL,
      "parent_id" bigint NOT NULL DEFAULT 0,
      "finish_date" timestamp DEFAULT NULL,
      "cancel_date" timestamp DEFAULT NULL,
      "status" tinyint NOT NULL DEFAULT 0,
      "remark" varchar(500) DEFAULT '',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
  
  -- ----------------------------
8bcd65d2   YunaiV   ✨ feat(task): 添加质...
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
  -- MES 工艺路线工序
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_pro_route_process" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "route_id" bigint DEFAULT NULL,
      "process_id" bigint DEFAULT NULL,
      "sort" int DEFAULT NULL,
      "next_process_id" bigint DEFAULT NULL,
      "link_type" int DEFAULT NULL,
      "prepare_time" int DEFAULT NULL,
      "wait_time" int DEFAULT NULL,
      "color_code" varchar(20) DEFAULT NULL,
      "key_flag" bit DEFAULT FALSE,
      "check_flag" bit DEFAULT FALSE,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
a693d31e   YunaiV   ✨ feat(stock): 添加...
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
  
  -- ----------------------------
  -- MES 销售出库明细
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_wm_product_sales_detail" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "line_id" bigint NOT NULL,
      "sales_id" bigint NOT NULL,
      "item_id" bigint NOT NULL,
      "quantity" decimal(14,2) DEFAULT NULL,
      "material_stock_id" bigint DEFAULT NULL,
      "batch_id" bigint DEFAULT NULL,
      "batch_code" varchar(255) DEFAULT NULL,
      "warehouse_id" bigint DEFAULT NULL,
      "location_id" bigint DEFAULT NULL,
      "area_id" bigint DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );
80183a18   YunaiV   ✨ feat(qc): 增加到货通...
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
  
  -- ----------------------------
  -- MES 检验结果记录
  -- ----------------------------
  CREATE TABLE IF NOT EXISTS "mes_qc_indicator_result" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "code" varchar(64) DEFAULT NULL,
      "qc_id" bigint DEFAULT NULL,
      "qc_type" int DEFAULT NULL,
      "item_id" bigint DEFAULT NULL,
      "sn" varchar(128) DEFAULT NULL,
      "remark" varchar(500) DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  );