快检实验方法新增
This commit is contained in:
@@ -1,147 +1,294 @@
|
||||
-- 胶料快检实验方法(主子表):字典 + 建表 + 菜单(质量管理下)+ 按钮 + 租户 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 '租户',
|
||||
-- 胶料快检实验方法(主子表):字典 + 建表 + 菜单(质量管理下)+ 按钮 + 租户 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 '租户',
|
||||
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
|
||||
PRIMARY KEY (`id`),
|
||||
|
||||
KEY `idx_mrqtm_tenant_code` (`tenant_id`, `method_code`),
|
||||
|
||||
KEY `idx_mrqtm_type` (`quick_test_type_id`),
|
||||
|
||||
UNIQUE KEY `uk_mrqtm_tenant_name_del` (`tenant_id`, `method_name`, `del_flag`)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验方法';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_method_line` (
|
||||
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
|
||||
`method_id` varchar(32) NOT NULL COMMENT '主表 mes_xsl_rubber_quick_test_method.id',
|
||||
|
||||
`data_point_id` varchar(32) NOT NULL COMMENT '数据点 mes_xsl_rubber_quick_test_data_point.id',
|
||||
|
||||
`point_name` varchar(128) DEFAULT NULL COMMENT '数据点名称冗余(只读带出)',
|
||||
|
||||
`unit_type` varchar(64) DEFAULT NULL COMMENT '单位类型冗余(只读带出)',
|
||||
|
||||
`torque_unit_type` varchar(32) DEFAULT NULL COMMENT '扭矩单位类型(字典xslmes_rubber_quick_test_torque_unit)',
|
||||
|
||||
`time_unit_type` varchar(32) DEFAULT NULL COMMENT '时间单位类型(字典xslmes_rubber_quick_test_time_unit)',
|
||||
|
||||
`mooney_unit_type` varchar(32) DEFAULT NULL COMMENT '门尼单位类型(字典xslmes_rubber_quick_test_mooney_unit)',
|
||||
|
||||
`sort_no` int DEFAULT NULL COMMENT '排序号',
|
||||
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
|
||||
PRIMARY KEY (`id`),
|
||||
|
||||
KEY `idx_mrqtml_method` (`method_id`),
|
||||
|
||||
UNIQUE KEY `uk_mrqtml_method_point` (`method_id`, `data_point_id`)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验方法明细';
|
||||
|
||||
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_quality_pid = IFNULL(
|
||||
|
||||
(SELECT `id` FROM `sys_permission` WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '质量管理' LIMIT 1),
|
||||
|
||||
'1860000000000000162'
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
|
||||
VALUES ('1860000000000000177', @mes_quality_pid, '胶料快检实验方法', '/xslmes/mesXslRubberQuickTestMethod', 'xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethodList', 'MesXslRubberQuickTestMethodList', 1, NULL, '1', 3, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
|
||||
ON DUPLICATE KEY UPDATE
|
||||
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
|
||||
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:profile-outlined' WHERE `id` = '1860000000000000177' AND `del_flag` = 0;
|
||||
|
||||
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
|
||||
('1860000000000000178', '1860000000000000177', '新增', 2, 'mes:mes_xsl_rubber_quick_test_method:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000179', '1860000000000000177', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_method:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000180', '1860000000000000177', '删除', 2, 'mes:mes_xsl_rubber_quick_test_method:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000181', '1860000000000000177', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_method:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000182', '1860000000000000177', '导出', 2, 'mes:mes_xsl_rubber_quick_test_method:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000183', '1860000000000000177', '导入', 2, 'mes:mes_xsl_rubber_quick_test_method:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
|
||||
ON DUPLICATE KEY UPDATE
|
||||
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
|
||||
`is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
|
||||
FROM `sys_role` r
|
||||
|
||||
CROSS JOIN `sys_permission` p
|
||||
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
|
||||
AND r.`role_code` = 'admin'
|
||||
|
||||
AND p.`id` IN (
|
||||
|
||||
'1860000000000000177',
|
||||
|
||||
'1860000000000000178', '1860000000000000179', '1860000000000000180', '1860000000000000181',
|
||||
|
||||
'1860000000000000182', '1860000000000000183'
|
||||
|
||||
)
|
||||
|
||||
AND NOT EXISTS (
|
||||
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
|
||||
);
|
||||
|
||||
|
||||
@@ -1,104 +1,208 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* MES 胶料快检实验方法主表
|
||||
|
||||
*/
|
||||
|
||||
@Data
|
||||
|
||||
@TableName("mes_xsl_rubber_quick_test_method")
|
||||
|
||||
@Accessors(chain = true)
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
@Schema(description = "MES胶料快检实验方法")
|
||||
|
||||
public class MesXslRubberQuickTestMethod implements Serializable {
|
||||
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
|
||||
private String id;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "方法编号", width = 14)
|
||||
|
||||
@Schema(description = "方法编号(租户内从001递增自动生成,只读)")
|
||||
|
||||
private String methodCode;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "实验方法名称", width = 24)
|
||||
|
||||
@Schema(description = "实验方法名称(同租户未删除唯一)")
|
||||
|
||||
private String methodName;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "实验类型", width = 20, dictTable = "mes_xsl_rubber_quick_test_type", dicText = "type_name", dicCode = "id")
|
||||
|
||||
@Dict(dictTable = "mes_xsl_rubber_quick_test_type", dicText = "type_name", dicCode = "id")
|
||||
|
||||
@Schema(description = "实验类型ID")
|
||||
|
||||
private String quickTestTypeId;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "实验类型名称", width = 20)
|
||||
|
||||
@Schema(description = "实验类型名称冗余")
|
||||
|
||||
private String quickTestTypeName;
|
||||
|
||||
|
||||
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* MES 胶料快检实验方法主表
|
||||
|
||||
*/
|
||||
|
||||
@Data
|
||||
|
||||
@TableName("mes_xsl_rubber_quick_test_method")
|
||||
|
||||
@Accessors(chain = true)
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
@Schema(description = "MES胶料快检实验方法")
|
||||
|
||||
public class MesXslRubberQuickTestMethod implements Serializable {
|
||||
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
|
||||
private String id;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "方法编号", width = 14)
|
||||
|
||||
@Schema(description = "方法编号(租户内从001递增自动生成,只读)")
|
||||
|
||||
private String methodCode;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "实验方法名称", width = 24)
|
||||
|
||||
@Schema(description = "实验方法名称(同租户未删除唯一)")
|
||||
|
||||
private String methodName;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "实验类型", width = 20, dictTable = "mes_xsl_rubber_quick_test_type", dicText = "type_name", dicCode = "id")
|
||||
|
||||
@Dict(dictTable = "mes_xsl_rubber_quick_test_type", dicText = "type_name", dicCode = "id")
|
||||
|
||||
@Schema(description = "实验类型ID")
|
||||
|
||||
private String quickTestTypeId;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "实验类型名称", width = 20)
|
||||
|
||||
@Schema(description = "实验类型名称冗余")
|
||||
|
||||
private String quickTestTypeName;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "实验温度°C", width = 14, type = 10)
|
||||
|
||||
@Schema(description = "实验温度°C")
|
||||
|
||||
private BigDecimal testTempC;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "预热时间min", width = 14, type = 10)
|
||||
|
||||
@Schema(description = "预热时间min")
|
||||
|
||||
private BigDecimal preheatTimeMin;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "实验时间min", width = 14, type = 10)
|
||||
|
||||
@Schema(description = "实验时间min")
|
||||
|
||||
private BigDecimal testTimeMin;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "实验角度Deg", width = 14, type = 10)
|
||||
|
||||
@Schema(description = "实验角度Deg")
|
||||
|
||||
private BigDecimal testAngleDeg;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "实验频率Hz", width = 14, type = 10)
|
||||
|
||||
@Schema(description = "实验频率Hz")
|
||||
|
||||
private BigDecimal testFreqHz;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "转子类型", width = 12, dicCode = "xslmes_rubber_quick_test_rotor_type")
|
||||
|
||||
@Dict(dicCode = "xslmes_rubber_quick_test_rotor_type")
|
||||
|
||||
@Schema(description = "转子类型(字典xslmes_rubber_quick_test_rotor_type)")
|
||||
|
||||
private String rotorType;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "转子速度rpm", width = 14, type = 10)
|
||||
|
||||
@Schema(description = "转子速度rpm")
|
||||
|
||||
private BigDecimal rotorSpeedRpm;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "方法描述", width = 40)
|
||||
|
||||
@Schema(description = "方法描述")
|
||||
|
||||
private String methodDesc;
|
||||
|
||||
|
||||
|
||||
private Integer tenantId;
|
||||
|
||||
private String sysOrgCode;
|
||||
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
|
||||
@TableLogic
|
||||
|
||||
@Schema(description = "删除状态(0正常 1已删除)")
|
||||
|
||||
private Integer delFlag;
|
||||
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
|
||||
@Schema(description = "数据点明细")
|
||||
|
||||
private List<MesXslRubberQuickTestMethodLine> lineList;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,64 +1,128 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* MES 胶料快检实验方法明细
|
||||
|
||||
*/
|
||||
|
||||
@Data
|
||||
|
||||
@TableName("mes_xsl_rubber_quick_test_method_line")
|
||||
|
||||
@Accessors(chain = true)
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
@Schema(description = "MES胶料快检实验方法明细")
|
||||
|
||||
public class MesXslRubberQuickTestMethodLine implements Serializable {
|
||||
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
|
||||
private String id;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "主表主键 mes_xsl_rubber_quick_test_method.id")
|
||||
|
||||
private String methodId;
|
||||
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* MES 胶料快检实验方法明细
|
||||
|
||||
*/
|
||||
|
||||
@Data
|
||||
|
||||
@TableName("mes_xsl_rubber_quick_test_method_line")
|
||||
|
||||
@Accessors(chain = true)
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
@Schema(description = "MES胶料快检实验方法明细")
|
||||
|
||||
public class MesXslRubberQuickTestMethodLine implements Serializable {
|
||||
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
|
||||
private String id;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "主表主键 mes_xsl_rubber_quick_test_method.id")
|
||||
|
||||
private String methodId;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "数据点主键 mes_xsl_rubber_quick_test_data_point.id")
|
||||
|
||||
private String dataPointId;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "数据点名称冗余(只读带出)")
|
||||
|
||||
private String pointName;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "单位类型冗余(只读带出)")
|
||||
|
||||
private String unitType;
|
||||
|
||||
|
||||
|
||||
@Dict(dicCode = "xslmes_rubber_quick_test_torque_unit")
|
||||
|
||||
@Schema(description = "扭矩单位类型")
|
||||
|
||||
private String torqueUnitType;
|
||||
|
||||
|
||||
|
||||
@Dict(dicCode = "xslmes_rubber_quick_test_time_unit")
|
||||
|
||||
@Schema(description = "时间单位类型")
|
||||
|
||||
private String timeUnitType;
|
||||
|
||||
|
||||
|
||||
@Dict(dicCode = "xslmes_rubber_quick_test_mooney_unit")
|
||||
|
||||
@Schema(description = "门尼单位类型")
|
||||
|
||||
private String mooneyUnitType;
|
||||
|
||||
|
||||
|
||||
private Integer sortNo;
|
||||
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine;
|
||||
|
||||
|
||||
|
||||
@Mapper
|
||||
|
||||
public interface MesXslRubberQuickTestMethodLineMapper extends BaseMapper<MesXslRubberQuickTestMethodLine> {}
|
||||
|
||||
|
||||
@@ -1,19 +1,38 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
|
||||
|
||||
|
||||
|
||||
@Mapper
|
||||
|
||||
public interface MesXslRubberQuickTestMethodMapper extends BaseMapper<MesXslRubberQuickTestMethod> {
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
|
||||
|
||||
|
||||
|
||||
@Mapper
|
||||
|
||||
public interface MesXslRubberQuickTestMethodMapper extends BaseMapper<MesXslRubberQuickTestMethod> {
|
||||
|
||||
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260522 for:【MES】胶料快检实验方法租户内最大三位数字编号-----------
|
||||
|
||||
@Select(
|
||||
|
||||
"SELECT IFNULL(MAX(CAST(method_code AS UNSIGNED)), 0) FROM mes_xsl_rubber_quick_test_method "
|
||||
|
||||
+ "WHERE del_flag = 0 AND method_code REGEXP '^[0-9]+$' "
|
||||
|
||||
+ "AND (#{tenantId} IS NULL OR tenant_id = #{tenantId})")
|
||||
|
||||
Integer selectMaxNumericMethodCode(@Param("tenantId") Integer tenantId);
|
||||
|
||||
//update-end---author:jiangxh ---date:20260522 for:【MES】胶料快检实验方法租户内最大三位数字编号-----------
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +1,50 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine;
|
||||
|
||||
|
||||
|
||||
public interface IMesXslRubberQuickTestMethodService extends IService<MesXslRubberQuickTestMethod> {
|
||||
|
||||
|
||||
|
||||
String generateNextMethodCode(MesXslRubberQuickTestMethod context);
|
||||
|
||||
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine;
|
||||
|
||||
|
||||
|
||||
public interface IMesXslRubberQuickTestMethodService extends IService<MesXslRubberQuickTestMethod> {
|
||||
|
||||
|
||||
|
||||
String generateNextMethodCode(MesXslRubberQuickTestMethod context);
|
||||
|
||||
|
||||
|
||||
boolean isMethodNameDuplicated(String methodName, String excludeId, MesXslRubberQuickTestMethod context);
|
||||
|
||||
|
||||
|
||||
void saveMain(MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList);
|
||||
|
||||
|
||||
|
||||
void updateMain(MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList);
|
||||
|
||||
|
||||
|
||||
void delMain(String id);
|
||||
|
||||
|
||||
|
||||
void delBatchMain(Collection<? extends Serializable> idList);
|
||||
|
||||
|
||||
|
||||
List<MesXslRubberQuickTestMethodLine> selectLinesByMethodId(String methodId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,166 +1,332 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine;
|
||||
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestMethodLineMapper;
|
||||
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestMethodMapper;
|
||||
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestMethodService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
|
||||
|
||||
@Service
|
||||
|
||||
public class MesXslRubberQuickTestMethodServiceImpl
|
||||
|
||||
extends ServiceImpl<MesXslRubberQuickTestMethodMapper, MesXslRubberQuickTestMethod>
|
||||
|
||||
implements IMesXslRubberQuickTestMethodService {
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
|
||||
private MesXslRubberQuickTestMethodLineMapper mesXslRubberQuickTestMethodLineMapper;
|
||||
|
||||
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260522 for:【MES】胶料快检实验方法编号001递增、名称同租户唯一、主子保存-----------
|
||||
|
||||
@Override
|
||||
|
||||
public String generateNextMethodCode(MesXslRubberQuickTestMethod context) {
|
||||
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
|
||||
Integer max = baseMapper.selectMaxNumericMethodCode(tenantId);
|
||||
|
||||
int next = (max == null ? 0 : max) + 1;
|
||||
|
||||
if (next > 999) {
|
||||
|
||||
throw new IllegalStateException("实验方法编号已超过999,请联系管理员");
|
||||
|
||||
}
|
||||
|
||||
return String.format("%03d", next);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public boolean isMethodNameDuplicated(String methodName, String excludeId, MesXslRubberQuickTestMethod context) {
|
||||
|
||||
if (oConvertUtils.isEmpty(methodName)) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
|
||||
LambdaQueryWrapper<MesXslRubberQuickTestMethod> w = new LambdaQueryWrapper<>();
|
||||
|
||||
w.eq(MesXslRubberQuickTestMethod::getMethodName, methodName.trim());
|
||||
|
||||
w.and(
|
||||
|
||||
q ->
|
||||
|
||||
q.eq(MesXslRubberQuickTestMethod::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
|
||||
.or()
|
||||
|
||||
.isNull(MesXslRubberQuickTestMethod::getDelFlag));
|
||||
|
||||
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||
|
||||
w.ne(MesXslRubberQuickTestMethod::getId, excludeId);
|
||||
|
||||
}
|
||||
|
||||
if (tenantId != null) {
|
||||
|
||||
w.eq(MesXslRubberQuickTestMethod::getTenantId, tenantId);
|
||||
|
||||
}
|
||||
|
||||
return this.count(w) > 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
public void saveMain(MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList) {
|
||||
|
||||
assertMethodNameUniqueForSave(main, null);
|
||||
|
||||
if (oConvertUtils.isEmpty(main.getMethodCode())) {
|
||||
|
||||
main.setMethodCode(generateNextMethodCode(main));
|
||||
|
||||
}
|
||||
|
||||
this.save(main);
|
||||
|
||||
insertLines(main.getId(), lineList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
public void updateMain(MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList) {
|
||||
|
||||
if (oConvertUtils.isEmpty(main.getId())) {
|
||||
|
||||
throw new JeecgBootException("缺少主键");
|
||||
|
||||
}
|
||||
|
||||
MesXslRubberQuickTestMethod old = this.getById(main.getId());
|
||||
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine;
|
||||
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestMethodLineMapper;
|
||||
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestMethodMapper;
|
||||
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestMethodService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
|
||||
|
||||
@Service
|
||||
|
||||
public class MesXslRubberQuickTestMethodServiceImpl
|
||||
|
||||
extends ServiceImpl<MesXslRubberQuickTestMethodMapper, MesXslRubberQuickTestMethod>
|
||||
|
||||
implements IMesXslRubberQuickTestMethodService {
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
|
||||
private MesXslRubberQuickTestMethodLineMapper mesXslRubberQuickTestMethodLineMapper;
|
||||
|
||||
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260522 for:【MES】胶料快检实验方法编号001递增、名称同租户唯一、主子保存-----------
|
||||
|
||||
@Override
|
||||
|
||||
public String generateNextMethodCode(MesXslRubberQuickTestMethod context) {
|
||||
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
|
||||
Integer max = baseMapper.selectMaxNumericMethodCode(tenantId);
|
||||
|
||||
int next = (max == null ? 0 : max) + 1;
|
||||
|
||||
if (next > 999) {
|
||||
|
||||
throw new IllegalStateException("实验方法编号已超过999,请联系管理员");
|
||||
|
||||
}
|
||||
|
||||
return String.format("%03d", next);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public boolean isMethodNameDuplicated(String methodName, String excludeId, MesXslRubberQuickTestMethod context) {
|
||||
|
||||
if (oConvertUtils.isEmpty(methodName)) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
|
||||
LambdaQueryWrapper<MesXslRubberQuickTestMethod> w = new LambdaQueryWrapper<>();
|
||||
|
||||
w.eq(MesXslRubberQuickTestMethod::getMethodName, methodName.trim());
|
||||
|
||||
w.and(
|
||||
|
||||
q ->
|
||||
|
||||
q.eq(MesXslRubberQuickTestMethod::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
|
||||
.or()
|
||||
|
||||
.isNull(MesXslRubberQuickTestMethod::getDelFlag));
|
||||
|
||||
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||
|
||||
w.ne(MesXslRubberQuickTestMethod::getId, excludeId);
|
||||
|
||||
}
|
||||
|
||||
if (tenantId != null) {
|
||||
|
||||
w.eq(MesXslRubberQuickTestMethod::getTenantId, tenantId);
|
||||
|
||||
}
|
||||
|
||||
return this.count(w) > 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
public void saveMain(MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList) {
|
||||
|
||||
assertMethodNameUniqueForSave(main, null);
|
||||
|
||||
if (oConvertUtils.isEmpty(main.getMethodCode())) {
|
||||
|
||||
main.setMethodCode(generateNextMethodCode(main));
|
||||
|
||||
}
|
||||
|
||||
this.save(main);
|
||||
|
||||
insertLines(main.getId(), lineList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
public void updateMain(MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList) {
|
||||
|
||||
if (oConvertUtils.isEmpty(main.getId())) {
|
||||
|
||||
throw new JeecgBootException("缺少主键");
|
||||
|
||||
}
|
||||
|
||||
MesXslRubberQuickTestMethod old = this.getById(main.getId());
|
||||
|
||||
if (old == null) {
|
||||
|
||||
throw new JeecgBootException("实验方法不存在");
|
||||
|
||||
}
|
||||
|
||||
main.setMethodCode(old.getMethodCode());
|
||||
|
||||
assertMethodNameUniqueForSave(main, main.getId());
|
||||
|
||||
this.updateById(main);
|
||||
|
||||
mesXslRubberQuickTestMethodLineMapper.delete(
|
||||
|
||||
new LambdaQueryWrapper<MesXslRubberQuickTestMethodLine>()
|
||||
|
||||
.eq(MesXslRubberQuickTestMethodLine::getMethodId, main.getId()));
|
||||
|
||||
insertLines(main.getId(), lineList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void insertLines(String methodId, List<MesXslRubberQuickTestMethodLine> lineList) {
|
||||
|
||||
if (CollectionUtils.isEmpty(lineList)) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
int sort = 0;
|
||||
|
||||
for (MesXslRubberQuickTestMethodLine line : lineList) {
|
||||
|
||||
line.setId(null);
|
||||
|
||||
line.setMethodId(methodId);
|
||||
|
||||
line.setSortNo(sort++);
|
||||
|
||||
mesXslRubberQuickTestMethodLineMapper.insert(line);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
public void delMain(String id) {
|
||||
|
||||
mesXslRubberQuickTestMethodLineMapper.delete(
|
||||
|
||||
new LambdaQueryWrapper<MesXslRubberQuickTestMethodLine>()
|
||||
|
||||
.eq(MesXslRubberQuickTestMethodLine::getMethodId, id));
|
||||
|
||||
this.removeById(id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
public void delBatchMain(Collection<? extends Serializable> idList) {
|
||||
|
||||
for (Serializable id : idList) {
|
||||
|
||||
delMain(id.toString());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public List<MesXslRubberQuickTestMethodLine> selectLinesByMethodId(String methodId) {
|
||||
|
||||
return mesXslRubberQuickTestMethodLineMapper.selectList(
|
||||
|
||||
new LambdaQueryWrapper<MesXslRubberQuickTestMethodLine>()
|
||||
|
||||
.eq(MesXslRubberQuickTestMethodLine::getMethodId, methodId)
|
||||
|
||||
.orderByAsc(MesXslRubberQuickTestMethodLine::getSortNo));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void assertMethodNameUniqueForSave(MesXslRubberQuickTestMethod entity, String excludeId) {
|
||||
|
||||
if (entity == null || oConvertUtils.isEmpty(entity.getMethodName())) {
|
||||
|
||||
throw new JeecgBootException("实验方法名称不能为空");
|
||||
|
||||
}
|
||||
|
||||
String name = entity.getMethodName().trim();
|
||||
|
||||
entity.setMethodName(name);
|
||||
|
||||
if (isMethodNameDuplicated(name, excludeId, entity)) {
|
||||
|
||||
throw new JeecgBootException("实验方法名称已存在");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static Integer resolveTenantId(MesXslRubberQuickTestMethod context) {
|
||||
|
||||
if (context != null && context.getTenantId() != null) {
|
||||
|
||||
return context.getTenantId();
|
||||
|
||||
}
|
||||
|
||||
String ts = TenantContext.getTenant();
|
||||
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
|
||||
try {
|
||||
|
||||
ts = TokenUtils.getTenantIdByRequest(SpringContextUtils.getHttpServletRequest());
|
||||
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
return Integer.parseInt(ts.trim());
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//update-end---author:jiangxh ---date:20260522 for:【MES】胶料快检实验方法编号001递增、名称同租户唯一、主子保存-----------
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
package org.jeecg.modules.xslmes.vo;
|
||||
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
|
||||
|
||||
|
||||
|
||||
package org.jeecg.modules.xslmes.vo;
|
||||
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 胶料快检实验方法主子保存页 VO
|
||||
|
||||
*/
|
||||
|
||||
@Data
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
||||
public class MesXslRubberQuickTestMethodPage extends MesXslRubberQuickTestMethod {}
|
||||
|
||||
|
||||
@@ -1,146 +1,292 @@
|
||||
-- MES 胶料快检实验方法(主子表):字典 + 建表 + 菜单(质量管理下)+ 按钮 + 租户 admin 授权
|
||||
|
||||
-- 权限前缀:mes:mes_xsl_rubber_quick_test_method:*
|
||||
|
||||
-- 菜单 ID 段 1860000000000000177(避免与数据点 170 段冲突)
|
||||
|
||||
-- 依赖:mes_xsl_rubber_quick_test_type、mes_xsl_rubber_quick_test_data_point、质量管理目录
|
||||
|
||||
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 '租户',
|
||||
|
||||
-- MES 胶料快检实验方法(主子表):字典 + 建表 + 菜单(质量管理下)+ 按钮 + 租户 admin 授权
|
||||
|
||||
-- 权限前缀:mes:mes_xsl_rubber_quick_test_method:*
|
||||
|
||||
-- 菜单 ID 段 1860000000000000177(避免与数据点 170 段冲突)
|
||||
|
||||
-- 依赖:mes_xsl_rubber_quick_test_type、mes_xsl_rubber_quick_test_data_point、质量管理目录
|
||||
|
||||
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 '租户',
|
||||
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
|
||||
PRIMARY KEY (`id`),
|
||||
|
||||
KEY `idx_mrqtm_tenant_code` (`tenant_id`, `method_code`),
|
||||
|
||||
KEY `idx_mrqtm_type` (`quick_test_type_id`),
|
||||
|
||||
UNIQUE KEY `uk_mrqtm_tenant_name_del` (`tenant_id`, `method_name`, `del_flag`)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验方法';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_method_line` (
|
||||
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
|
||||
`method_id` varchar(32) NOT NULL COMMENT '主表 mes_xsl_rubber_quick_test_method.id',
|
||||
|
||||
`data_point_id` varchar(32) NOT NULL COMMENT '数据点 mes_xsl_rubber_quick_test_data_point.id',
|
||||
|
||||
`point_name` varchar(128) DEFAULT NULL COMMENT '数据点名称冗余(只读带出)',
|
||||
|
||||
`unit_type` varchar(64) DEFAULT NULL COMMENT '单位类型冗余(只读带出)',
|
||||
|
||||
`torque_unit_type` varchar(32) DEFAULT NULL COMMENT '扭矩单位类型(字典xslmes_rubber_quick_test_torque_unit)',
|
||||
|
||||
`time_unit_type` varchar(32) DEFAULT NULL COMMENT '时间单位类型(字典xslmes_rubber_quick_test_time_unit)',
|
||||
|
||||
`mooney_unit_type` varchar(32) DEFAULT NULL COMMENT '门尼单位类型(字典xslmes_rubber_quick_test_mooney_unit)',
|
||||
|
||||
`sort_no` int DEFAULT NULL COMMENT '排序号',
|
||||
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
|
||||
PRIMARY KEY (`id`),
|
||||
|
||||
KEY `idx_mrqtml_method` (`method_id`),
|
||||
|
||||
UNIQUE KEY `uk_mrqtml_method_point` (`method_id`, `data_point_id`)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验方法明细';
|
||||
|
||||
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_quality_pid = IFNULL(
|
||||
|
||||
(SELECT `id` FROM `sys_permission` WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '质量管理' LIMIT 1),
|
||||
|
||||
'1860000000000000162'
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
|
||||
VALUES ('1860000000000000177', @mes_quality_pid, '胶料快检实验方法', '/xslmes/mesXslRubberQuickTestMethod', 'xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethodList', 'MesXslRubberQuickTestMethodList', 1, NULL, '1', 3, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
|
||||
ON DUPLICATE KEY UPDATE
|
||||
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
|
||||
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:profile-outlined' WHERE `id` = '1860000000000000177' AND `del_flag` = 0;
|
||||
|
||||
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
|
||||
('1860000000000000178', '1860000000000000177', '新增', 2, 'mes:mes_xsl_rubber_quick_test_method:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000179', '1860000000000000177', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_method:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000180', '1860000000000000177', '删除', 2, 'mes:mes_xsl_rubber_quick_test_method:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000181', '1860000000000000177', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_method:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000182', '1860000000000000177', '导出', 2, 'mes:mes_xsl_rubber_quick_test_method:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000183', '1860000000000000177', '导入', 2, 'mes:mes_xsl_rubber_quick_test_method:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
|
||||
ON DUPLICATE KEY UPDATE
|
||||
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
|
||||
`is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
|
||||
FROM `sys_role` r
|
||||
|
||||
CROSS JOIN `sys_permission` p
|
||||
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
|
||||
AND r.`role_code` = 'admin'
|
||||
|
||||
AND p.`id` IN (
|
||||
|
||||
'1860000000000000177',
|
||||
|
||||
'1860000000000000178', '1860000000000000179', '1860000000000000180', '1860000000000000181',
|
||||
|
||||
'1860000000000000182', '1860000000000000183'
|
||||
|
||||
)
|
||||
|
||||
AND NOT EXISTS (
|
||||
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user