18 小时以前 7a681887e5a8e1aab49acc886974d354c69a280e
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
-- ========================================================================
-- MES 质检指标种子数据:正丁醇检验记录(GB/T 6027)样例树
-- 用途:演示分组检验项 + 公式文本 + 平行测量,供前端录入/打印直接试用
-- 取值约定:item_type 1=录入项 2=分组项;result_type 1=浮点 2=整数 3=文本 4=字典 5=文件
-- 不含 tenant_id(项目不使用多租户)
-- 注意:执行前确认 mes_qc_indicator 已含 parent_id/item_type/formula_text/unit_text/sort_order 列
-- ========================================================================
 
-- 幂等:重复执行前清理旧种子(按 code 前缀,含分组与子项)
DELETE FROM mes_qc_indicator WHERE code LIKE 'SEED-BT-%';
 
-- 顶级:外观(定性文本结论)
INSERT INTO mes_qc_indicator (code, name, parent_id, item_type, formula_text, unit_text, sort_order, type, result_type, result_specification, remark, creator, updater)
VALUES ('SEED-BT-APPEAR', '外观', 0, 1, NULL, NULL, 10, 4, 3, NULL, '澄清透明液体,无机械杂质', '1', '1');
 
-- 顶级:色度
INSERT INTO mes_qc_indicator (code, name, parent_id, item_type, formula_text, unit_text, sort_order, type, result_type, result_specification, remark, creator, updater)
VALUES ('SEED-BT-COLOR', '色度', 0, 1, NULL, 'Hazen', 20, 4, 1, NULL, NULL, '1', '1');
 
-- 分组:水分测定(含公式文本,下挂参数行 + 结果行)
INSERT INTO mes_qc_indicator (code, name, parent_id, item_type, formula_text, unit_text, sort_order, type, result_type, result_specification, remark, creator, updater)
VALUES ('SEED-BT-WATER', '水分', 0, 2, 'w = (m1 - m0) / m × 100%', NULL, 30, 4, NULL, NULL, '卡尔费休/干燥失重', '1', '1');
SET @g_water = LAST_INSERT_ID();
INSERT INTO mes_qc_indicator (code, name, parent_id, item_type, formula_text, unit_text, sort_order, type, result_type, result_specification, remark, creator, updater) VALUES
('SEED-BT-WATER-M',  '试样质量 m',   @g_water, 1, NULL, 'g',  1, 4, 1, NULL, NULL, '1', '1'),
('SEED-BT-WATER-M1', '试样+称量瓶 m1', @g_water, 1, NULL, 'g', 2, 4, 1, NULL, NULL, '1', '1'),
('SEED-BT-WATER-M0', '称量瓶 m0',    @g_water, 1, NULL, 'g',  3, 4, 1, NULL, NULL, '1', '1'),
('SEED-BT-WATER-W',  '水分结果 w',   @g_water, 1, NULL, '%',  4, 4, 1, NULL, NULL, '1', '1');
 
-- 分组:酸含量(左侧公式 + 多参数行 + 结果行)
INSERT INTO mes_qc_indicator (code, name, parent_id, item_type, formula_text, unit_text, sort_order, type, result_type, result_specification, remark, creator, updater)
VALUES ('SEED-BT-ACID', '酸含量', 0, 2, 'w3 = c × V × 0.06005 / m × 100%', NULL, 40, 4, NULL, NULL, '酸碱滴定', '1', '1');
SET @g_acid = LAST_INSERT_ID();
INSERT INTO mes_qc_indicator (code, name, parent_id, item_type, formula_text, unit_text, sort_order, type, result_type, result_specification, remark, creator, updater) VALUES
('SEED-BT-ACID-C',   '标液浓度 c', @g_acid, 1, NULL, 'mol/L', 1, 4, 1, NULL, NULL, '1', '1'),
('SEED-BT-ACID-V',   '消耗滴定液体积 V', @g_acid, 1, NULL, 'mL', 2, 4, 1, NULL, NULL, '1', '1'),
('SEED-BT-ACID-M',   '试样质量 m', @g_acid, 1, NULL, 'g',    3, 4, 1, NULL, NULL, '1', '1'),
('SEED-BT-ACID-W3',  '酸含量结果 w3', @g_acid, 1, NULL, '%', 4, 4, 1, NULL, NULL, '1', '1');
 
-- 分组:正丁醇含量(纯度差减法)
INSERT INTO mes_qc_indicator (code, name, parent_id, item_type, formula_text, unit_text, sort_order, type, result_type, result_specification, remark, creator, updater)
VALUES ('SEED-BT-PURITY', '正丁醇含量', 0, 2, '纯度 = 100% - 水分 - 酸含量 - 其它杂质', NULL, 50, 4, NULL, NULL, '气相色谱/差减', '1', '1');
SET @g_purity = LAST_INSERT_ID();
INSERT INTO mes_qc_indicator (code, name, parent_id, item_type, formula_text, unit_text, sort_order, type, result_type, result_specification, remark, creator, updater) VALUES
('SEED-BT-PURITY-V', '正丁醇含量 /%', @g_purity, 1, NULL, '%', 1, 4, 1, NULL, NULL, '1', '1');
 
-- 顶级:密度、折光率
INSERT INTO mes_qc_indicator (code, name, parent_id, item_type, formula_text, unit_text, sort_order, type, result_type, result_specification, remark, creator, updater) VALUES
('SEED-BT-DENSITY', '密度',   0, 1, NULL, 'kg/m³', 60, 4, 1, NULL, NULL, '1', '1'),
('SEED-BT-REFRACT', '折光率', 0, 1, NULL, 'n²⁰D', 70, 4, 1, NULL, NULL, '1', '1');