胶料快检实验类型、胶料快检数据点、胶料快检实验方法新增
This commit is contained in:
@@ -0,0 +1,147 @@
|
||||
-- 胶料快检实验方法(主子表):字典 + 建表 + 菜单(质量管理下)+ 按钮 + 租户 admin 授权
|
||||
|
||||
-- 权限前缀:mes:mes_xsl_rubber_quick_test_method:*
|
||||
|
||||
-- 菜单 ID 段 1860000000000000177(与数据点 170 段区分)
|
||||
|
||||
-- 可与 Flyway V3.9.2_102 重复执行(ON DUPLICATE / IF NOT EXISTS)
|
||||
|
||||
-- SET @mes_tenant_id:多租户 admin 授权目标租户
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES胶料快检转子类型', 'xslmes_rubber_quick_test_rotor_type', '1大转子2小转子', 0, 'admin', NOW(), 0, 0
|
||||
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND `del_flag` = 0);
|
||||
|
||||
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '大转子', '1', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '小转子', '2', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '2');
|
||||
|
||||
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES胶料快检扭矩单位', 'xslmes_rubber_quick_test_torque_unit', 'Ib.in、dNm、kg.cm、Nm、mdm', 0, 'admin', NOW(), 0, 0
|
||||
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_torque_unit' AND `del_flag` = 0);
|
||||
|
||||
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, v.txt, v.val, v.ord, 1, 'admin', NOW()
|
||||
|
||||
FROM `sys_dict` d
|
||||
|
||||
CROSS JOIN (
|
||||
|
||||
SELECT 'Ib.in' AS txt, 'Ib.in' AS val, 1 AS ord UNION ALL
|
||||
|
||||
SELECT 'dNm', 'dNm', 2 UNION ALL
|
||||
|
||||
SELECT 'kg.cm', 'kg.cm', 3 UNION ALL
|
||||
|
||||
SELECT 'Nm', 'Nm', 4 UNION ALL
|
||||
|
||||
SELECT 'mdm', 'mdm', 5
|
||||
|
||||
) v
|
||||
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_torque_unit'
|
||||
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = v.val);
|
||||
|
||||
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES胶料快检时间单位', 'xslmes_rubber_quick_test_time_unit', 'sec、min、m:s', 0, 'admin', NOW(), 0, 0
|
||||
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_time_unit' AND `del_flag` = 0);
|
||||
|
||||
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, v.txt, v.val, v.ord, 1, 'admin', NOW()
|
||||
|
||||
FROM `sys_dict` d
|
||||
|
||||
CROSS JOIN (
|
||||
|
||||
SELECT 'sec' AS txt, 'sec' AS val, 1 AS ord UNION ALL
|
||||
|
||||
SELECT 'min', 'min', 2 UNION ALL
|
||||
|
||||
SELECT 'm:s', 'm:s', 3
|
||||
|
||||
) v
|
||||
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_time_unit'
|
||||
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = v.val);
|
||||
|
||||
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES胶料快检门尼单位', 'xslmes_rubber_quick_test_mooney_unit', 'MU', 0, 'admin', NOW(), 0, 0
|
||||
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_mooney_unit' AND `del_flag` = 0);
|
||||
|
||||
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, 'MU', 'MU', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_mooney_unit'
|
||||
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'MU');
|
||||
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_method` (
|
||||
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
|
||||
`method_code` varchar(16) NOT NULL COMMENT '方法编号(租户内从001递增自动生成)',
|
||||
|
||||
`method_name` varchar(128) NOT NULL COMMENT '实验方法名称(同租户未删除唯一)',
|
||||
|
||||
`quick_test_type_id` varchar(32) NOT NULL COMMENT '实验类型 mes_xsl_rubber_quick_test_type.id',
|
||||
|
||||
`quick_test_type_name` varchar(128) DEFAULT NULL COMMENT '实验类型名称冗余',
|
||||
|
||||
`test_temp_c` decimal(12,2) DEFAULT NULL COMMENT '实验温度°C',
|
||||
|
||||
`preheat_time_min` decimal(12,2) DEFAULT NULL COMMENT '预热时间min',
|
||||
|
||||
`test_time_min` decimal(12,2) DEFAULT NULL COMMENT '实验时间min',
|
||||
|
||||
`test_angle_deg` decimal(12,2) DEFAULT NULL COMMENT '实验角度Deg',
|
||||
|
||||
`test_freq_hz` decimal(12,2) DEFAULT NULL COMMENT '实验频率Hz',
|
||||
|
||||
`rotor_type` varchar(2) DEFAULT NULL COMMENT '转子类型(字典xslmes_rubber_quick_test_rotor_type:1大转子2小转子)',
|
||||
|
||||
`rotor_speed_rpm` decimal(12,2) DEFAULT NULL COMMENT '转子速度rpm',
|
||||
|
||||
`method_desc` varchar(500) DEFAULT NULL COMMENT '方法描述',
|
||||
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
Reference in New Issue
Block a user