Merge branch 'main' of http://27.223.88.102:33000/chenx/qhmes
This commit is contained in:
@@ -32,19 +32,19 @@ VALUES ('1860000000000000060', @mes_base_pid, '工序管理', '/xslmes/mesXslPro
|
|||||||
ON DUPLICATE KEY UPDATE
|
ON DUPLICATE KEY UPDATE
|
||||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
`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`),
|
`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` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
`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`);
|
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||||
|
|
||||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||||
('1860000000000000061', '1860000000000000060', '新增', 2, 'mes:mes_process_operation:add', '1', '1', 0, 'admin', NOW()),
|
('1860000000000000061', '1860000000000000060', '新增', 2, 'mes:mes_process_operation:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
('1860000000000000062', '1860000000000000060', '编辑', 2, 'mes:mes_process_operation:edit', '1', '1', 0, 'admin', NOW()),
|
('1860000000000000062', '1860000000000000060', '编辑', 2, 'mes:mes_process_operation:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
('1860000000000000063', '1860000000000000060', '删除', 2, 'mes:mes_process_operation:delete', '1', '1', 0, 'admin', NOW()),
|
('1860000000000000063', '1860000000000000060', '删除', 2, 'mes:mes_process_operation:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
('1860000000000000064', '1860000000000000060', '批量删除', 2, 'mes:mes_process_operation:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
('1860000000000000064', '1860000000000000060', '批量删除', 2, 'mes:mes_process_operation:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
('1860000000000000065', '1860000000000000060', '导出', 2, 'mes:mes_process_operation:exportXls', '1', '1', 0, 'admin', NOW()),
|
('1860000000000000065', '1860000000000000060', '导出', 2, 'mes:mes_process_operation:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
('1860000000000000066', '1860000000000000060', '导入', 2, 'mes:mes_process_operation:importExcel', '1', '1', 0, 'admin', NOW())
|
('1860000000000000066', '1860000000000000060', '导入', 2, 'mes:mes_process_operation:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||||
ON DUPLICATE KEY UPDATE
|
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`),
|
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||||
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
`is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||||
|
|
||||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
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'
|
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||||
|
|||||||
79
jeecg-boot/db/mes-xsl-downtime-main-type-menu-permission.sql
Normal file
79
jeecg-boot/db/mes-xsl-downtime-main-type-menu-permission.sql
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
-- MES 停机主类型:字典 + 建表 + 菜单 + 按钮 + 租户 admin 授权(可整文件一次执行)
|
||||||
|
-- 权限前缀与 Controller、前端 v-auth 一致:mes:mes_xsl_downtime_main_type:*
|
||||||
|
-- 父菜单:MES基础资料 / MES资料;修改租户改 SET @mes_tenant_id
|
||||||
|
-- 新环境也可依赖 Flyway:V3.9.2_64__mes_xsl_downtime_main_type.sql
|
||||||
|
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_downtime_main_type_status', '0启用1停用', 0, 'admin', NOW(), 0, 0
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_downtime_main_type_status' 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, '启用', '0', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_downtime_main_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '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', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_downtime_main_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_main_type` (
|
||||||
|
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||||
|
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序 mes_xsl_process_operation.id',
|
||||||
|
`process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
|
||||||
|
`downtime_type` varchar(500) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||||
|
`display_order` int NOT NULL DEFAULT '0' COMMENT '显示顺序(升序)',
|
||||||
|
`distinguish_color` varchar(500) DEFAULT NULL COMMENT '区分颜色(十六进制色值,如#1890ff)',
|
||||||
|
`status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_downtime_main_type_status:0启用1停用)',
|
||||||
|
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||||
|
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||||
|
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||||
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||||
|
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||||
|
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_mdmt_tenant_type` (`tenant_id`, `downtime_type`),
|
||||||
|
KEY `idx_mdmt_process` (`process_operation_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机主类型';
|
||||||
|
|
||||||
|
SET @mes_tenant_id = 1002;
|
||||||
|
|
||||||
|
SET @mes_base_pid = (
|
||||||
|
SELECT MIN(`id`) FROM `sys_permission`
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||||
|
);
|
||||||
|
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||||
|
|
||||||
|
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 ('1860000000000000119', @mes_base_pid, '停机主类型', '/xslmes/mesXslDowntimeMainType', 'xslmes/mesXslDowntimeMainType/MesXslDowntimeMainTypeList', NULL, 1, NULL, '1', 18, 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` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||||
|
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||||
|
|
||||||
|
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||||
|
('1860000000000000120', '1860000000000000119', '新增', 2, 'mes:mes_xsl_downtime_main_type:add', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000121', '1860000000000000119', '编辑', 2, 'mes:mes_xsl_downtime_main_type:edit', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000122', '1860000000000000119', '删除', 2, 'mes:mes_xsl_downtime_main_type:delete', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000123', '1860000000000000119', '批量删除', 2, 'mes:mes_xsl_downtime_main_type:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000124', '1860000000000000119', '导出', 2, 'mes:mes_xsl_downtime_main_type:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000125', '1860000000000000119', '导入', 2, 'mes:mes_xsl_downtime_main_type:importExcel', '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`),
|
||||||
|
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||||
|
|
||||||
|
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 (
|
||||||
|
'1860000000000000119',
|
||||||
|
'1860000000000000120', '1860000000000000121', '1860000000000000122', '1860000000000000123',
|
||||||
|
'1860000000000000124', '1860000000000000125'
|
||||||
|
)
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM `sys_role_permission` rp
|
||||||
|
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||||
|
);
|
||||||
22
jeecg-boot/db/mes-xsl-downtime-main-type.sql
Normal file
22
jeecg-boot/db/mes-xsl-downtime-main-type.sql
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
-- 仅建表 mes_xsl_downtime_main_type。完整初始化请执行 mes-xsl-downtime-main-type-menu-permission.sql
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_main_type` (
|
||||||
|
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||||
|
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序 mes_xsl_process_operation.id',
|
||||||
|
`process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
|
||||||
|
`downtime_type` varchar(500) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||||
|
`display_order` int NOT NULL DEFAULT '0' COMMENT '显示顺序(升序)',
|
||||||
|
`distinguish_color` varchar(500) DEFAULT NULL COMMENT '区分颜色(十六进制色值,如#1890ff)',
|
||||||
|
`status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_downtime_main_type_status:0启用1停用)',
|
||||||
|
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||||
|
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||||
|
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||||
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||||
|
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||||
|
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_mdmt_tenant_type` (`tenant_id`, `downtime_type`),
|
||||||
|
KEY `idx_mdmt_process` (`process_operation_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机主类型';
|
||||||
87
jeecg-boot/db/mes-xsl-downtime-type-menu-permission.sql
Normal file
87
jeecg-boot/db/mes-xsl-downtime-type-menu-permission.sql
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
-- MES 停机类型:字典 + 建表 + 菜单 + 按钮 + 租户 admin 授权(可整文件一次执行)
|
||||||
|
-- 权限前缀:mes:mes_xsl_downtime_type:*
|
||||||
|
-- 依赖:mes_xsl_process_operation、mes_xsl_downtime_main_type;父菜单 MES基础资料
|
||||||
|
-- Flyway:V3.9.2_65__mes_xsl_downtime_type.sql
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
-- 责任区分、故障等级为手填,不初始化字典;已上线库请执行 mes-xsl-downtime-type-remove-unused-dict.sql
|
||||||
|
|
||||||
|
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), 'MES停机类型是否启用', 'xslmes_downtime_type_status', '0启用1停用', 0, 'admin', NOW(), 0, 0
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_downtime_type_status' 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, '启用', '0', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_downtime_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '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', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_downtime_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_type` (
|
||||||
|
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||||
|
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序 mes_xsl_process_operation.id',
|
||||||
|
`process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
|
||||||
|
`downtime_main_type_id` varchar(32) NOT NULL COMMENT '所属主类型 mes_xsl_downtime_main_type.id',
|
||||||
|
`downtime_main_type_name` varchar(500) DEFAULT NULL COMMENT '主类型名称冗余(停机主类型.downtime_type)',
|
||||||
|
`downtime_type` varchar(500) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||||
|
`display_order` int NOT NULL DEFAULT '0' COMMENT '显示顺序(升序,必填)',
|
||||||
|
`distinguish_color` varchar(500) DEFAULT NULL COMMENT '区分颜色(十六进制色值)',
|
||||||
|
`responsibility_distinct` varchar(500) DEFAULT NULL COMMENT '责任区分(手填)',
|
||||||
|
`fault_level` varchar(500) DEFAULT NULL COMMENT '故障等级(手填)',
|
||||||
|
`downtime_maintenance` varchar(1) DEFAULT '0' COMMENT '是否停机维修(字典yn:1是0否)',
|
||||||
|
`status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_downtime_type_status:0启用1停用)',
|
||||||
|
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||||
|
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||||
|
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||||
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||||
|
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||||
|
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_mdt_tenant_type` (`tenant_id`, `downtime_type`),
|
||||||
|
KEY `idx_mdt_process` (`process_operation_id`),
|
||||||
|
KEY `idx_mdt_main_type` (`downtime_main_type_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机类型';
|
||||||
|
|
||||||
|
SET @mes_tenant_id = 1002;
|
||||||
|
|
||||||
|
SET @mes_base_pid = (
|
||||||
|
SELECT MIN(`id`) FROM `sys_permission`
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||||
|
);
|
||||||
|
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||||
|
|
||||||
|
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 ('1860000000000000126', @mes_base_pid, '停机类型', '/xslmes/mesXslDowntimeType', 'xslmes/mesXslDowntimeType/MesXslDowntimeTypeList', NULL, 1, NULL, '1', 19, 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` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||||
|
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||||
|
|
||||||
|
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||||
|
('1860000000000000127', '1860000000000000126', '新增', 2, 'mes:mes_xsl_downtime_type:add', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000128', '1860000000000000126', '编辑', 2, 'mes:mes_xsl_downtime_type:edit', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000129', '1860000000000000126', '删除', 2, 'mes:mes_xsl_downtime_type:delete', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000130', '1860000000000000126', '批量删除', 2, 'mes:mes_xsl_downtime_type:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000131', '1860000000000000126', '导出', 2, 'mes:mes_xsl_downtime_type:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000132', '1860000000000000126', '导入', 2, 'mes:mes_xsl_downtime_type:importExcel', '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`),
|
||||||
|
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||||
|
|
||||||
|
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 (
|
||||||
|
'1860000000000000126',
|
||||||
|
'1860000000000000127', '1860000000000000128', '1860000000000000129', '1860000000000000130',
|
||||||
|
'1860000000000000131', '1860000000000000132'
|
||||||
|
)
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM `sys_role_permission` rp
|
||||||
|
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||||
|
);
|
||||||
11
jeecg-boot/db/mes-xsl-downtime-type-remove-unused-dict.sql
Normal file
11
jeecg-boot/db/mes-xsl-downtime-type-remove-unused-dict.sql
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
-- 删除停机类型模块中已废弃的字典(责任区分、故障等级已改为手填,不再使用下拉字典)
|
||||||
|
-- 保留:xslmes_downtime_type_status(是否启用)、xslmes_downtime_main_type_status(停机主类型是否启用)
|
||||||
|
-- 执行后请在系统管理刷新字典缓存,或重新登录
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
DELETE i FROM `sys_dict_item` i
|
||||||
|
INNER JOIN `sys_dict` d ON i.`dict_id` = d.`id`
|
||||||
|
WHERE d.`dict_code` IN ('xslmes_downtime_responsibility', 'xslmes_downtime_fault_level');
|
||||||
|
|
||||||
|
DELETE FROM `sys_dict`
|
||||||
|
WHERE `dict_code` IN ('xslmes_downtime_responsibility', 'xslmes_downtime_fault_level');
|
||||||
28
jeecg-boot/db/mes-xsl-downtime-type.sql
Normal file
28
jeecg-boot/db/mes-xsl-downtime-type.sql
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
-- 仅建表 mes_xsl_downtime_type。完整初始化请执行 mes-xsl-downtime-type-menu-permission.sql
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_type` (
|
||||||
|
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||||
|
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序 mes_xsl_process_operation.id',
|
||||||
|
`process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
|
||||||
|
`downtime_main_type_id` varchar(32) NOT NULL COMMENT '所属主类型 mes_xsl_downtime_main_type.id',
|
||||||
|
`downtime_main_type_name` varchar(500) DEFAULT NULL COMMENT '主类型名称冗余(停机主类型.downtime_type)',
|
||||||
|
`downtime_type` varchar(500) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||||
|
`display_order` int NOT NULL DEFAULT '0' COMMENT '显示顺序(升序,必填)',
|
||||||
|
`distinguish_color` varchar(500) DEFAULT NULL COMMENT '区分颜色(十六进制色值)',
|
||||||
|
`responsibility_distinct` varchar(500) DEFAULT NULL COMMENT '责任区分(手填)',
|
||||||
|
`fault_level` varchar(500) DEFAULT NULL COMMENT '故障等级(手填)',
|
||||||
|
`downtime_maintenance` varchar(1) DEFAULT '0' COMMENT '是否停机维修(字典yn:1是0否)',
|
||||||
|
`status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_downtime_type_status:0启用1停用)',
|
||||||
|
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||||
|
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||||
|
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||||
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||||
|
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||||
|
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_mdt_tenant_type` (`tenant_id`, `downtime_type`),
|
||||||
|
KEY `idx_mdt_process` (`process_operation_id`),
|
||||||
|
KEY `idx_mdt_main_type` (`downtime_main_type_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机类型';
|
||||||
@@ -67,19 +67,19 @@ VALUES ('1860000000000000070', @mes_base_pid, '设备类别', '/xslmes/mesXslEqu
|
|||||||
ON DUPLICATE KEY UPDATE
|
ON DUPLICATE KEY UPDATE
|
||||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
`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`),
|
`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` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
`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`);
|
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||||
|
|
||||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||||
('1860000000000000071', '1860000000000000070', '新增', 2, 'mes:mes_xsl_equipment_category:add', '1', '1', 0, 'admin', NOW()),
|
('1860000000000000071', '1860000000000000070', '新增', 2, 'mes:mes_xsl_equipment_category:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
('1860000000000000072', '1860000000000000070', '编辑', 2, 'mes:mes_xsl_equipment_category:edit', '1', '1', 0, 'admin', NOW()),
|
('1860000000000000072', '1860000000000000070', '编辑', 2, 'mes:mes_xsl_equipment_category:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
('1860000000000000073', '1860000000000000070', '删除', 2, 'mes:mes_xsl_equipment_category:delete', '1', '1', 0, 'admin', NOW()),
|
('1860000000000000073', '1860000000000000070', '删除', 2, 'mes:mes_xsl_equipment_category:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
('1860000000000000074', '1860000000000000070', '批量删除', 2, 'mes:mes_xsl_equipment_category:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
('1860000000000000074', '1860000000000000070', '批量删除', 2, 'mes:mes_xsl_equipment_category:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
('1860000000000000075', '1860000000000000070', '导出', 2, 'mes:mes_xsl_equipment_category:exportXls', '1', '1', 0, 'admin', NOW()),
|
('1860000000000000075', '1860000000000000070', '导出', 2, 'mes:mes_xsl_equipment_category:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
('1860000000000000076', '1860000000000000070', '导入', 2, 'mes:mes_xsl_equipment_category:importExcel', '1', '1', 0, 'admin', NOW())
|
('1860000000000000076', '1860000000000000070', '导入', 2, 'mes:mes_xsl_equipment_category:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||||
ON DUPLICATE KEY UPDATE
|
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`),
|
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||||
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
`is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||||
|
|
||||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
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'
|
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||||
|
|||||||
69
jeecg-boot/db/mes-xsl-equipment-type-menu-fix.sql
Normal file
69
jeecg-boot/db/mes-xsl-equipment-type-menu-fix.sql
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
-- 设备类型菜单/按钮补全并挂到 MES基础资料(解决仅 UPDATE 时 id 077 不存在、菜单与权限均不显示)
|
||||||
|
-- 可重复执行;修改租户改 SET @mes_tenant_id
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
SET @mes_tenant_id = 1002;
|
||||||
|
|
||||||
|
SET @mes_base_pid = (
|
||||||
|
SELECT `id` FROM `sys_permission`
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
|
||||||
|
LIMIT 1
|
||||||
|
);
|
||||||
|
SET @mes_base_pid = IFNULL(@mes_base_pid, (
|
||||||
|
SELECT MIN(`id`) FROM `sys_permission`
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
|
||||||
|
));
|
||||||
|
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||||
|
|
||||||
|
UPDATE `sys_permission`
|
||||||
|
SET `is_leaf` = 0
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料');
|
||||||
|
|
||||||
|
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 ('1860000000000000077', @mes_base_pid, '设备类型', '/xslmes/mesXslEquipmentType', 'xslmes/mesXslEquipmentType/MesXslEquipmentTypeList', NULL, 1, NULL, '1', 11, 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`),
|
||||||
|
`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`);
|
||||||
|
|
||||||
|
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||||
|
('1860000000000000078', '1860000000000000077', '新增', 2, 'mes:mes_xsl_equipment_type:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000079', '1860000000000000077', '编辑', 2, 'mes:mes_xsl_equipment_type:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000080', '1860000000000000077', '删除', 2, 'mes:mes_xsl_equipment_type:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000081', '1860000000000000077', '批量删除', 2, 'mes:mes_xsl_equipment_type:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000082', '1860000000000000077', '导出', 2, 'mes:mes_xsl_equipment_type:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000083', '1860000000000000077', '导入', 2, 'mes:mes_xsl_equipment_type: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;
|
||||||
|
|
||||||
|
UPDATE `sys_permission` p
|
||||||
|
INNER JOIN (SELECT @mes_base_pid AS `pid`) x ON 1 = 1
|
||||||
|
SET p.`parent_id` = x.`pid`,
|
||||||
|
p.`is_leaf` = 0,
|
||||||
|
p.`url` = '/xslmes/mesXslEquipmentType',
|
||||||
|
p.`component` = 'xslmes/mesXslEquipmentType/MesXslEquipmentTypeList',
|
||||||
|
p.`hidden` = 0,
|
||||||
|
p.`del_flag` = 0,
|
||||||
|
p.`status` = '1',
|
||||||
|
p.`update_time` = NOW()
|
||||||
|
WHERE p.`menu_type` = 1
|
||||||
|
AND p.`url` = '/xslmes/mesXslEquipmentType'
|
||||||
|
AND p.`id` <> '1860000000000000077';
|
||||||
|
|
||||||
|
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 (
|
||||||
|
'1860000000000000077',
|
||||||
|
'1860000000000000078', '1860000000000000079', '1860000000000000080',
|
||||||
|
'1860000000000000081', '1860000000000000082', '1860000000000000083'
|
||||||
|
)
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM `sys_role_permission` rp
|
||||||
|
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||||
|
);
|
||||||
@@ -31,14 +31,14 @@ WHERE d.`dict_code` = 'xslmes_manufacturer_valid' AND NOT EXISTS (SELECT 1 FROM
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `mes_xsl_manufacturer` (
|
CREATE TABLE IF NOT EXISTS `mes_xsl_manufacturer` (
|
||||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||||
`manufacturer_category` varchar(32) NOT NULL COMMENT '厂家类别(字典xslmes_manufacturer_category:mold模具 capsule胶囊 equipment设备)',
|
`manufacturer_category` varchar(500) NOT NULL COMMENT '厂家类别(字典xslmes_manufacturer_category:mold模具 capsule胶囊 equipment设备)',
|
||||||
`manufacturer_name` varchar(128) NOT NULL COMMENT '厂家名称(同租户未删除数据中唯一)',
|
`manufacturer_name` varchar(500) NOT NULL COMMENT '厂家名称(同租户未删除数据中唯一)',
|
||||||
`valid_status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否有效(字典xslmes_manufacturer_valid:0有效1无效)',
|
`valid_status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否有效(字典xslmes_manufacturer_valid:0有效1无效)',
|
||||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ SET NAMES utf8mb4;
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `mes_xsl_manufacturer` (
|
CREATE TABLE IF NOT EXISTS `mes_xsl_manufacturer` (
|
||||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||||
`manufacturer_category` varchar(32) NOT NULL COMMENT '厂家类别(字典xslmes_manufacturer_category:mold模具 capsule胶囊 equipment设备)',
|
`manufacturer_category` varchar(500) NOT NULL COMMENT '厂家类别(字典xslmes_manufacturer_category:mold模具 capsule胶囊 equipment设备)',
|
||||||
`manufacturer_name` varchar(128) NOT NULL COMMENT '厂家名称(同租户未删除数据中唯一)',
|
`manufacturer_name` varchar(500) NOT NULL COMMENT '厂家名称(同租户未删除数据中唯一)',
|
||||||
`valid_status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否有效(字典xslmes_manufacturer_valid:0有效1无效)',
|
`valid_status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否有效(字典xslmes_manufacturer_valid:0有效1无效)',
|
||||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
-- 工序管理、设备类别、设备类型:挂到「MES基础资料」下,并修复权限树(is_leaf)与租户 admin 授权
|
||||||
|
-- 适用:菜单曾在 MES XSL 根下或 is_leaf=1 导致角色授权页不显示按钮权限
|
||||||
|
-- 修改租户:改 SET @mes_tenant_id
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
SET @mes_tenant_id = 1002;
|
||||||
|
|
||||||
|
SET @mes_base_pid = (
|
||||||
|
SELECT `id` FROM `sys_permission`
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
|
||||||
|
LIMIT 1
|
||||||
|
);
|
||||||
|
SET @mes_base_pid = IFNULL(@mes_base_pid, (
|
||||||
|
SELECT MIN(`id`) FROM `sys_permission`
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
|
||||||
|
));
|
||||||
|
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||||
|
|
||||||
|
UPDATE `sys_permission`
|
||||||
|
SET `is_leaf` = 0
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料');
|
||||||
|
|
||||||
|
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 ('1860000000000000060', @mes_base_pid, '工序管理', '/xslmes/mesXslProcessOperation', 'xslmes/mesXslProcessOperation/MesXslProcessOperationList', NULL, 1, NULL, '1', 9, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
`parent_id` = VALUES(`parent_id`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||||
|
`is_leaf` = 0, `hidden` = 0, `status` = '1', `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
|
||||||
|
('1860000000000000061', '1860000000000000060', '新增', 2, 'mes:mes_process_operation:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000062', '1860000000000000060', '编辑', 2, 'mes:mes_process_operation:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000063', '1860000000000000060', '删除', 2, 'mes:mes_process_operation:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000064', '1860000000000000060', '批量删除', 2, 'mes:mes_process_operation:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000065', '1860000000000000060', '导出', 2, 'mes:mes_process_operation:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000066', '1860000000000000060', '导入', 2, 'mes:mes_process_operation:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
`parent_id` = VALUES(`parent_id`), `perms` = VALUES(`perms`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||||
|
|
||||||
|
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 ('1860000000000000070', @mes_base_pid, '设备类别', '/xslmes/mesXslEquipmentCategory', 'xslmes/mesXslEquipmentCategory/MesXslEquipmentCategoryList', NULL, 1, NULL, '1', 10, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
`parent_id` = VALUES(`parent_id`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||||
|
`is_leaf` = 0, `hidden` = 0, `status` = '1', `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
|
||||||
|
('1860000000000000071', '1860000000000000070', '新增', 2, 'mes:mes_xsl_equipment_category:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000072', '1860000000000000070', '编辑', 2, 'mes:mes_xsl_equipment_category:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000073', '1860000000000000070', '删除', 2, 'mes:mes_xsl_equipment_category:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000074', '1860000000000000070', '批量删除', 2, 'mes:mes_xsl_equipment_category:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000075', '1860000000000000070', '导出', 2, 'mes:mes_xsl_equipment_category:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000076', '1860000000000000070', '导入', 2, 'mes:mes_xsl_equipment_category:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
`parent_id` = VALUES(`parent_id`), `perms` = VALUES(`perms`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||||
|
|
||||||
|
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 ('1860000000000000077', @mes_base_pid, '设备类型', '/xslmes/mesXslEquipmentType', 'xslmes/mesXslEquipmentType/MesXslEquipmentTypeList', NULL, 1, NULL, '1', 11, 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`),
|
||||||
|
`is_leaf` = 0, `hidden` = 0, `status` = '1', `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
|
||||||
|
('1860000000000000078', '1860000000000000077', '新增', 2, 'mes:mes_xsl_equipment_type:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000079', '1860000000000000077', '编辑', 2, 'mes:mes_xsl_equipment_type:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000080', '1860000000000000077', '删除', 2, 'mes:mes_xsl_equipment_type:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000081', '1860000000000000077', '批量删除', 2, 'mes:mes_xsl_equipment_type:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000082', '1860000000000000077', '导出', 2, 'mes:mes_xsl_equipment_type:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000083', '1860000000000000077', '导入', 2, 'mes:mes_xsl_equipment_type:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
`parent_id` = VALUES(`parent_id`), `perms` = VALUES(`perms`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||||
|
|
||||||
|
UPDATE `sys_permission` SET `name` = '新增' WHERE `id` = '1860000000000000061' AND `name` = '添加';
|
||||||
|
|
||||||
|
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 (
|
||||||
|
'1860000000000000060',
|
||||||
|
'1860000000000000061', '1860000000000000062', '1860000000000000063',
|
||||||
|
'1860000000000000064', '1860000000000000065', '1860000000000000066',
|
||||||
|
'1860000000000000070',
|
||||||
|
'1860000000000000071', '1860000000000000072', '1860000000000000073',
|
||||||
|
'1860000000000000074', '1860000000000000075', '1860000000000000076',
|
||||||
|
'1860000000000000077',
|
||||||
|
'1860000000000000078', '1860000000000000079', '1860000000000000080',
|
||||||
|
'1860000000000000081', '1860000000000000082', '1860000000000000083'
|
||||||
|
)
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM `sys_role_permission` rp
|
||||||
|
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||||
|
);
|
||||||
79
jeecg-boot/db/mes-xsl-process-and-category-menu-fix.sql
Normal file
79
jeecg-boot/db/mes-xsl-process-and-category-menu-fix.sql
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
-- 工序管理(060)、设备类别(070):补全菜单/按钮、挂 MES基础资料、修复 is_leaf、租户 admin 授权
|
||||||
|
-- 可重复执行;修改租户改 SET @mes_tenant_id
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
SET @mes_tenant_id = 1002;
|
||||||
|
|
||||||
|
SET @mes_base_pid = (
|
||||||
|
SELECT `id` FROM `sys_permission`
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
|
||||||
|
LIMIT 1
|
||||||
|
);
|
||||||
|
SET @mes_base_pid = IFNULL(@mes_base_pid, (
|
||||||
|
SELECT MIN(`id`) FROM `sys_permission`
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
|
||||||
|
));
|
||||||
|
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||||
|
|
||||||
|
UPDATE `sys_permission`
|
||||||
|
SET `is_leaf` = 0
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料');
|
||||||
|
|
||||||
|
-- 工序管理
|
||||||
|
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 ('1860000000000000060', @mes_base_pid, '工序管理', '/xslmes/mesXslProcessOperation', 'xslmes/mesXslProcessOperation/MesXslProcessOperationList', NULL, 1, NULL, '1', 9, 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`),
|
||||||
|
`menu_type` = VALUES(`menu_type`), `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;
|
||||||
|
|
||||||
|
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||||
|
('1860000000000000061', '1860000000000000060', '新增', 2, 'mes:mes_process_operation:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000062', '1860000000000000060', '编辑', 2, 'mes:mes_process_operation:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000063', '1860000000000000060', '删除', 2, 'mes:mes_process_operation:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000064', '1860000000000000060', '批量删除', 2, 'mes:mes_process_operation:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000065', '1860000000000000060', '导出', 2, 'mes:mes_process_operation:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000066', '1860000000000000060', '导入', 2, 'mes:mes_process_operation: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;
|
||||||
|
|
||||||
|
UPDATE `sys_permission` SET `name` = '新增' WHERE `id` = '1860000000000000061' AND `name` = '添加';
|
||||||
|
|
||||||
|
-- 设备类别
|
||||||
|
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 ('1860000000000000070', @mes_base_pid, '设备类别', '/xslmes/mesXslEquipmentCategory', 'xslmes/mesXslEquipmentCategory/MesXslEquipmentCategoryList', NULL, 1, NULL, '1', 10, 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`),
|
||||||
|
`menu_type` = VALUES(`menu_type`), `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;
|
||||||
|
|
||||||
|
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||||
|
('1860000000000000071', '1860000000000000070', '新增', 2, 'mes:mes_xsl_equipment_category:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000072', '1860000000000000070', '编辑', 2, 'mes:mes_xsl_equipment_category:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000073', '1860000000000000070', '删除', 2, 'mes:mes_xsl_equipment_category:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000074', '1860000000000000070', '批量删除', 2, 'mes:mes_xsl_equipment_category:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000075', '1860000000000000070', '导出', 2, 'mes:mes_xsl_equipment_category:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000076', '1860000000000000070', '导入', 2, 'mes:mes_xsl_equipment_category: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 (
|
||||||
|
'1860000000000000060',
|
||||||
|
'1860000000000000061', '1860000000000000062', '1860000000000000063',
|
||||||
|
'1860000000000000064', '1860000000000000065', '1860000000000000066',
|
||||||
|
'1860000000000000070',
|
||||||
|
'1860000000000000071', '1860000000000000072', '1860000000000000073',
|
||||||
|
'1860000000000000074', '1860000000000000075', '1860000000000000076'
|
||||||
|
)
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM `sys_role_permission` rp
|
||||||
|
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||||
|
);
|
||||||
@@ -0,0 +1,324 @@
|
|||||||
|
package org.jeecg.modules.xslmes.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslProcessOperation;
|
||||||
|
import org.jeecg.modules.xslmes.service.IMesXslDowntimeMainTypeService;
|
||||||
|
import org.jeecg.modules.xslmes.service.IMesXslProcessOperationService;
|
||||||
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||||
|
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MES 停机主类型
|
||||||
|
*/
|
||||||
|
@Tag(name = "MES停机主类型")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/xslmes/mesXslDowntimeMainType")
|
||||||
|
@Slf4j
|
||||||
|
public class MesXslDowntimeMainTypeController extends JeecgController<MesXslDowntimeMainType, IMesXslDowntimeMainTypeService> {
|
||||||
|
|
||||||
|
private static final Set<String> STATUS_VALUES = Set.of("0", "1");
|
||||||
|
private static final Pattern COLOR_HEX = Pattern.compile("^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$");
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMesXslDowntimeMainTypeService mesXslDowntimeMainTypeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMesXslProcessOperationService mesXslProcessOperationService;
|
||||||
|
|
||||||
|
@Operation(summary = "MES停机主类型-分页列表查询")
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
public Result<IPage<MesXslDowntimeMainType>> queryPageList(
|
||||||
|
MesXslDowntimeMainType model,
|
||||||
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
QueryWrapper<MesXslDowntimeMainType> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||||
|
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机主类型列表默认按显示顺序升序-----------
|
||||||
|
queryWrapper.orderByAsc("display_order").orderByDesc("create_time");
|
||||||
|
//update-end---author:jiangxh ---date:20260518 for:【MES】停机主类型列表默认按显示顺序升序-----------
|
||||||
|
Page<MesXslDowntimeMainType> page = new Page<>(pageNo, pageSize);
|
||||||
|
IPage<MesXslDowntimeMainType> pageList = mesXslDowntimeMainTypeService.page(page, queryWrapper);
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "MES停机主类型-添加")
|
||||||
|
@Operation(summary = "MES停机主类型-添加")
|
||||||
|
@RequiresPermissions("mes:mes_xsl_downtime_main_type:add")
|
||||||
|
@PostMapping(value = "/add")
|
||||||
|
public Result<String> add(@RequestBody MesXslDowntimeMainType model) {
|
||||||
|
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机主类型保存前校验-----------
|
||||||
|
String err = validateForSave(model, null);
|
||||||
|
if (err != null) {
|
||||||
|
return Result.error(err);
|
||||||
|
}
|
||||||
|
//update-end---author:jiangxh ---date:20260518 for:【MES】停机主类型保存前校验-----------
|
||||||
|
mesXslDowntimeMainTypeService.save(model);
|
||||||
|
return Result.OK("添加成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "MES停机主类型-编辑")
|
||||||
|
@Operation(summary = "MES停机主类型-编辑")
|
||||||
|
@RequiresPermissions("mes:mes_xsl_downtime_main_type:edit")
|
||||||
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
|
public Result<String> edit(@RequestBody MesXslDowntimeMainType model) {
|
||||||
|
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机主类型保存前校验-----------
|
||||||
|
String err = validateForSave(model, model.getId());
|
||||||
|
if (err != null) {
|
||||||
|
return Result.error(err);
|
||||||
|
}
|
||||||
|
//update-end---author:jiangxh ---date:20260518 for:【MES】停机主类型保存前校验-----------
|
||||||
|
mesXslDowntimeMainTypeService.updateById(model);
|
||||||
|
return Result.OK("编辑成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "MES停机主类型-删除")
|
||||||
|
@Operation(summary = "MES停机主类型-通过id删除")
|
||||||
|
@RequiresPermissions("mes:mes_xsl_downtime_main_type:delete")
|
||||||
|
@DeleteMapping(value = "/delete")
|
||||||
|
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
mesXslDowntimeMainTypeService.removeById(id);
|
||||||
|
return Result.OK("删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "MES停机主类型-批量删除")
|
||||||
|
@Operation(summary = "MES停机主类型-批量删除")
|
||||||
|
@RequiresPermissions("mes:mes_xsl_downtime_main_type:deleteBatch")
|
||||||
|
@DeleteMapping(value = "/deleteBatch")
|
||||||
|
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||||
|
mesXslDowntimeMainTypeService.removeByIds(Arrays.asList(ids.split(",")));
|
||||||
|
return Result.OK("批量删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "MES停机主类型-通过id查询")
|
||||||
|
@GetMapping(value = "/queryById")
|
||||||
|
public Result<MesXslDowntimeMainType> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
MesXslDowntimeMainType entity = mesXslDowntimeMainTypeService.getById(id);
|
||||||
|
if (entity == null) {
|
||||||
|
return Result.error("未找到对应数据");
|
||||||
|
}
|
||||||
|
return Result.OK(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "校验停机类型是否重复(同租户未删除数据;dataId 为编辑时当前主键)")
|
||||||
|
@GetMapping(value = "/checkDowntimeType")
|
||||||
|
public Result<String> checkDowntimeType(
|
||||||
|
@RequestParam(name = "downtimeType", required = true) String downtimeType,
|
||||||
|
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||||
|
if (oConvertUtils.isEmpty(downtimeType) || downtimeType.trim().isEmpty()) {
|
||||||
|
return Result.OK("该值可用!");
|
||||||
|
}
|
||||||
|
MesXslDowntimeMainType ctx = new MesXslDowntimeMainType();
|
||||||
|
if (mesXslDowntimeMainTypeService.isDowntimeTypeDuplicated(downtimeType.trim(), dataId, ctx)) {
|
||||||
|
return Result.error("停机类型不能重复");
|
||||||
|
}
|
||||||
|
return Result.OK("该值可用!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("mes:mes_xsl_downtime_main_type:exportXls")
|
||||||
|
@RequestMapping(value = "/exportXls")
|
||||||
|
public ModelAndView exportXls(HttpServletRequest request, MesXslDowntimeMainType model) {
|
||||||
|
return super.exportXls(request, model, MesXslDowntimeMainType.class, "MES停机主类型");
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("mes:mes_xsl_downtime_main_type:importExcel")
|
||||||
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||||
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机主类型导入:类型唯一、工序编码解析、颜色与启用状态校验-----------
|
||||||
|
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||||
|
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||||
|
for (Map.Entry<String, MultipartFile> ent : fileMap.entrySet()) {
|
||||||
|
MultipartFile file = ent.getValue();
|
||||||
|
ImportParams params = new ImportParams();
|
||||||
|
params.setTitleRows(2);
|
||||||
|
params.setHeadRows(1);
|
||||||
|
params.setNeedSave(true);
|
||||||
|
try {
|
||||||
|
List<MesXslDowntimeMainType> list =
|
||||||
|
ExcelImportUtil.importExcel(file.getInputStream(), MesXslDowntimeMainType.class, params);
|
||||||
|
if (list == null) {
|
||||||
|
list = List.of();
|
||||||
|
}
|
||||||
|
Set<String> typesInFile = new HashSet<>();
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
MesXslDowntimeMainType row = list.get(i);
|
||||||
|
int rowNo = i + 1;
|
||||||
|
if (row == null) {
|
||||||
|
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
|
||||||
|
}
|
||||||
|
String dt = row.getDowntimeType();
|
||||||
|
if (dt != null) {
|
||||||
|
dt = dt.trim();
|
||||||
|
}
|
||||||
|
if (oConvertUtils.isEmpty(dt)) {
|
||||||
|
return Result.error("文件导入失败:第 " + rowNo + " 条停机类型不能为空");
|
||||||
|
}
|
||||||
|
row.setDowntimeType(dt);
|
||||||
|
if (!typesInFile.add(dt)) {
|
||||||
|
return Result.error("文件导入失败:停机类型【" + dt + "】在导入文件中重复");
|
||||||
|
}
|
||||||
|
if (mesXslDowntimeMainTypeService.isDowntimeTypeDuplicated(dt, null, row)) {
|
||||||
|
return Result.error("文件导入失败:第 " + rowNo + " 条停机类型【" + dt + "】不能重复(同租户未删除数据中已存在)");
|
||||||
|
}
|
||||||
|
String opCode = row.getImportOperationCode();
|
||||||
|
if (opCode != null) {
|
||||||
|
opCode = opCode.trim();
|
||||||
|
}
|
||||||
|
if (oConvertUtils.isEmpty(opCode)) {
|
||||||
|
return Result.error("文件导入失败:第 " + rowNo + " 条工序编码不能为空");
|
||||||
|
}
|
||||||
|
MesXslProcessOperation op = findProcessByOperationCode(opCode, row);
|
||||||
|
if (op == null) {
|
||||||
|
return Result.error("文件导入失败:第 " + rowNo + " 条工序编码【" + opCode + "】不存在");
|
||||||
|
}
|
||||||
|
row.setProcessOperationId(op.getId());
|
||||||
|
row.setProcessOperationName(op.getOperationName());
|
||||||
|
|
||||||
|
if (row.getDisplayOrder() == null) {
|
||||||
|
row.setDisplayOrder(0);
|
||||||
|
}
|
||||||
|
String colorErr = normalizeColor(row);
|
||||||
|
if (colorErr != null) {
|
||||||
|
return Result.error("文件导入失败:第 " + rowNo + " 条" + colorErr);
|
||||||
|
}
|
||||||
|
String st = row.getStatus();
|
||||||
|
if (oConvertUtils.isEmpty(st)) {
|
||||||
|
row.setStatus("0");
|
||||||
|
} else {
|
||||||
|
st = st.trim();
|
||||||
|
if (!STATUS_VALUES.contains(st)) {
|
||||||
|
return Result.error("文件导入失败:第 " + rowNo + " 条是否启用无效(须为 0 启用或 1 停用)");
|
||||||
|
}
|
||||||
|
row.setStatus(st);
|
||||||
|
}
|
||||||
|
row.setImportOperationCode(null);
|
||||||
|
}
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
mesXslDowntimeMainTypeService.saveBatch(list);
|
||||||
|
log.info("停机主类型Excel导入完成,耗时{}ms,行数={}", System.currentTimeMillis() - start, list.size());
|
||||||
|
return Result.ok("文件导入成功!数据行数:" + list.size());
|
||||||
|
} catch (Exception e) {
|
||||||
|
String msg = e.getMessage();
|
||||||
|
log.error(msg, e);
|
||||||
|
if (msg != null && msg.indexOf("Duplicate entry") >= 0) {
|
||||||
|
return Result.error("文件导入失败: 存在重复数据(停机类型不能重复)");
|
||||||
|
}
|
||||||
|
return Result.error("文件导入失败:" + e.getMessage());
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
file.getInputStream().close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//update-end---author:jiangxh ---date:20260518 for:【MES】停机主类型导入:类型唯一、工序编码解析、颜色与启用状态校验-----------
|
||||||
|
return Result.error("文件导入失败!");
|
||||||
|
}
|
||||||
|
|
||||||
|
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机主类型保存前校验与工序名称回填-----------
|
||||||
|
private String validateForSave(MesXslDowntimeMainType model, String excludeId) {
|
||||||
|
if (oConvertUtils.isEmpty(model.getDowntimeType()) || model.getDowntimeType().trim().isEmpty()) {
|
||||||
|
return "停机类型不能为空";
|
||||||
|
}
|
||||||
|
String dt = model.getDowntimeType().trim();
|
||||||
|
model.setDowntimeType(dt);
|
||||||
|
if (mesXslDowntimeMainTypeService.isDowntimeTypeDuplicated(dt, excludeId, model)) {
|
||||||
|
return "停机类型不能重复";
|
||||||
|
}
|
||||||
|
if (oConvertUtils.isEmpty(model.getProcessOperationId())) {
|
||||||
|
return "请选择所属工序";
|
||||||
|
}
|
||||||
|
MesXslProcessOperation op = mesXslProcessOperationService.getById(model.getProcessOperationId());
|
||||||
|
if (op == null) {
|
||||||
|
return "所属工序不存在";
|
||||||
|
}
|
||||||
|
model.setProcessOperationName(op.getOperationName());
|
||||||
|
|
||||||
|
if (model.getDisplayOrder() == null) {
|
||||||
|
model.setDisplayOrder(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
String colorErr = normalizeColor(model);
|
||||||
|
if (colorErr != null) {
|
||||||
|
return colorErr;
|
||||||
|
}
|
||||||
|
|
||||||
|
String st = model.getStatus();
|
||||||
|
if (oConvertUtils.isEmpty(st)) {
|
||||||
|
model.setStatus("0");
|
||||||
|
} else {
|
||||||
|
st = st.trim();
|
||||||
|
if (!STATUS_VALUES.contains(st)) {
|
||||||
|
return "是否启用取值无效";
|
||||||
|
}
|
||||||
|
model.setStatus(st);
|
||||||
|
}
|
||||||
|
model.setImportOperationCode(null);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String normalizeColor(MesXslDowntimeMainType model) {
|
||||||
|
String color = model.getDistinguishColor();
|
||||||
|
if (oConvertUtils.isEmpty(color)) {
|
||||||
|
model.setDistinguishColor(null);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
color = color.trim();
|
||||||
|
if (!color.startsWith("#")) {
|
||||||
|
color = "#" + color;
|
||||||
|
}
|
||||||
|
if (!COLOR_HEX.matcher(color).matches()) {
|
||||||
|
return "区分颜色格式无效(须为十六进制色值,如 #1890ff)";
|
||||||
|
}
|
||||||
|
model.setDistinguishColor(color.toLowerCase());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private MesXslProcessOperation findProcessByOperationCode(String operationCode, MesXslDowntimeMainType context) {
|
||||||
|
LambdaQueryWrapper<MesXslProcessOperation> w = new LambdaQueryWrapper<>();
|
||||||
|
w.eq(MesXslProcessOperation::getOperationCode, operationCode.trim());
|
||||||
|
w.and(
|
||||||
|
q ->
|
||||||
|
q.eq(MesXslProcessOperation::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||||
|
.or()
|
||||||
|
.isNull(MesXslProcessOperation::getDelFlag));
|
||||||
|
Integer tenantId = context != null ? context.getTenantId() : null;
|
||||||
|
if (tenantId != null) {
|
||||||
|
w.eq(MesXslProcessOperation::getTenantId, tenantId);
|
||||||
|
}
|
||||||
|
List<MesXslProcessOperation> found = mesXslProcessOperationService.list(w);
|
||||||
|
if (found == null || found.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return found.get(0);
|
||||||
|
}
|
||||||
|
//update-end---author:jiangxh ---date:20260518 for:【MES】停机主类型保存前校验与工序名称回填-----------
|
||||||
|
}
|
||||||
@@ -0,0 +1,433 @@
|
|||||||
|
package org.jeecg.modules.xslmes.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslDowntimeType;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslProcessOperation;
|
||||||
|
import org.jeecg.modules.xslmes.service.IMesXslDowntimeMainTypeService;
|
||||||
|
import org.jeecg.modules.xslmes.service.IMesXslDowntimeTypeService;
|
||||||
|
import org.jeecg.modules.xslmes.service.IMesXslProcessOperationService;
|
||||||
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||||
|
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MES 停机类型
|
||||||
|
*/
|
||||||
|
@Tag(name = "MES停机类型")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/xslmes/mesXslDowntimeType")
|
||||||
|
@Slf4j
|
||||||
|
public class MesXslDowntimeTypeController extends JeecgController<MesXslDowntimeType, IMesXslDowntimeTypeService> {
|
||||||
|
|
||||||
|
private static final Set<String> STATUS_VALUES = Set.of("0", "1");
|
||||||
|
private static final Set<String> YN_VALUES = Set.of("0", "1");
|
||||||
|
private static final Pattern COLOR_HEX = Pattern.compile("^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$");
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMesXslDowntimeTypeService mesXslDowntimeTypeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMesXslProcessOperationService mesXslProcessOperationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMesXslDowntimeMainTypeService mesXslDowntimeMainTypeService;
|
||||||
|
|
||||||
|
@Operation(summary = "MES停机类型-分页列表查询")
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
public Result<IPage<MesXslDowntimeType>> queryPageList(
|
||||||
|
MesXslDowntimeType model,
|
||||||
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
QueryWrapper<MesXslDowntimeType> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||||
|
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型列表默认按显示顺序升序-----------
|
||||||
|
queryWrapper.orderByAsc("display_order").orderByDesc("create_time");
|
||||||
|
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型列表默认按显示顺序升序-----------
|
||||||
|
Page<MesXslDowntimeType> page = new Page<>(pageNo, pageSize);
|
||||||
|
IPage<MesXslDowntimeType> pageList = mesXslDowntimeTypeService.page(page, queryWrapper);
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "MES停机类型-添加")
|
||||||
|
@Operation(summary = "MES停机类型-添加")
|
||||||
|
@RequiresPermissions("mes:mes_xsl_downtime_type:add")
|
||||||
|
@PostMapping(value = "/add")
|
||||||
|
public Result<String> add(@RequestBody MesXslDowntimeType model) {
|
||||||
|
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型保存前校验-----------
|
||||||
|
String err = validateForSave(model, null);
|
||||||
|
if (err != null) {
|
||||||
|
return Result.error(err);
|
||||||
|
}
|
||||||
|
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型保存前校验-----------
|
||||||
|
mesXslDowntimeTypeService.save(model);
|
||||||
|
return Result.OK("添加成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "MES停机类型-编辑")
|
||||||
|
@Operation(summary = "MES停机类型-编辑")
|
||||||
|
@RequiresPermissions("mes:mes_xsl_downtime_type:edit")
|
||||||
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
|
public Result<String> edit(@RequestBody MesXslDowntimeType model) {
|
||||||
|
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型保存前校验-----------
|
||||||
|
String err = validateForSave(model, model.getId());
|
||||||
|
if (err != null) {
|
||||||
|
return Result.error(err);
|
||||||
|
}
|
||||||
|
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型保存前校验-----------
|
||||||
|
mesXslDowntimeTypeService.updateById(model);
|
||||||
|
return Result.OK("编辑成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "MES停机类型-删除")
|
||||||
|
@Operation(summary = "MES停机类型-通过id删除")
|
||||||
|
@RequiresPermissions("mes:mes_xsl_downtime_type:delete")
|
||||||
|
@DeleteMapping(value = "/delete")
|
||||||
|
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
mesXslDowntimeTypeService.removeById(id);
|
||||||
|
return Result.OK("删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "MES停机类型-批量删除")
|
||||||
|
@Operation(summary = "MES停机类型-批量删除")
|
||||||
|
@RequiresPermissions("mes:mes_xsl_downtime_type:deleteBatch")
|
||||||
|
@DeleteMapping(value = "/deleteBatch")
|
||||||
|
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||||
|
mesXslDowntimeTypeService.removeByIds(Arrays.asList(ids.split(",")));
|
||||||
|
return Result.OK("批量删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "MES停机类型-通过id查询")
|
||||||
|
@GetMapping(value = "/queryById")
|
||||||
|
public Result<MesXslDowntimeType> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
MesXslDowntimeType entity = mesXslDowntimeTypeService.getById(id);
|
||||||
|
if (entity == null) {
|
||||||
|
return Result.error("未找到对应数据");
|
||||||
|
}
|
||||||
|
return Result.OK(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "校验停机类型是否重复(同租户未删除数据;dataId 为编辑时当前主键)")
|
||||||
|
@GetMapping(value = "/checkDowntimeType")
|
||||||
|
public Result<String> checkDowntimeType(
|
||||||
|
@RequestParam(name = "downtimeType", required = true) String downtimeType,
|
||||||
|
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||||
|
if (oConvertUtils.isEmpty(downtimeType) || downtimeType.trim().isEmpty()) {
|
||||||
|
return Result.OK("该值可用!");
|
||||||
|
}
|
||||||
|
MesXslDowntimeType ctx = new MesXslDowntimeType();
|
||||||
|
if (mesXslDowntimeTypeService.isDowntimeTypeDuplicated(downtimeType.trim(), dataId, ctx)) {
|
||||||
|
return Result.error("停机类型不能重复");
|
||||||
|
}
|
||||||
|
return Result.OK("该值可用!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("mes:mes_xsl_downtime_type:exportXls")
|
||||||
|
@RequestMapping(value = "/exportXls")
|
||||||
|
public ModelAndView exportXls(HttpServletRequest request, MesXslDowntimeType model) {
|
||||||
|
return super.exportXls(request, model, MesXslDowntimeType.class, "MES停机类型");
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("mes:mes_xsl_downtime_type:importExcel")
|
||||||
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||||
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型导入:必填校验、类型唯一、工序与主类型解析-----------
|
||||||
|
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||||
|
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||||
|
for (Map.Entry<String, MultipartFile> ent : fileMap.entrySet()) {
|
||||||
|
MultipartFile file = ent.getValue();
|
||||||
|
ImportParams params = new ImportParams();
|
||||||
|
params.setTitleRows(2);
|
||||||
|
params.setHeadRows(1);
|
||||||
|
params.setNeedSave(true);
|
||||||
|
try {
|
||||||
|
List<MesXslDowntimeType> list =
|
||||||
|
ExcelImportUtil.importExcel(file.getInputStream(), MesXslDowntimeType.class, params);
|
||||||
|
if (list == null) {
|
||||||
|
list = List.of();
|
||||||
|
}
|
||||||
|
Set<String> typesInFile = new HashSet<>();
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
MesXslDowntimeType row = list.get(i);
|
||||||
|
int rowNo = i + 1;
|
||||||
|
if (row == null) {
|
||||||
|
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
|
||||||
|
}
|
||||||
|
String err = validateImportRow(row, rowNo, typesInFile);
|
||||||
|
if (err != null) {
|
||||||
|
return Result.error(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
mesXslDowntimeTypeService.saveBatch(list);
|
||||||
|
log.info("停机类型Excel导入完成,耗时{}ms,行数={}", System.currentTimeMillis() - start, list.size());
|
||||||
|
return Result.ok("文件导入成功!数据行数:" + list.size());
|
||||||
|
} catch (Exception e) {
|
||||||
|
String msg = e.getMessage();
|
||||||
|
log.error(msg, e);
|
||||||
|
if (msg != null && msg.indexOf("Duplicate entry") >= 0) {
|
||||||
|
return Result.error("文件导入失败: 存在重复数据(停机类型不能重复)");
|
||||||
|
}
|
||||||
|
return Result.error("文件导入失败:" + e.getMessage());
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
file.getInputStream().close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型导入:必填校验、类型唯一、工序与主类型解析-----------
|
||||||
|
return Result.error("文件导入失败!");
|
||||||
|
}
|
||||||
|
|
||||||
|
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型保存前校验、关联工序与主类型回填-----------
|
||||||
|
private String validateForSave(MesXslDowntimeType model, String excludeId) {
|
||||||
|
if (oConvertUtils.isEmpty(model.getProcessOperationId())) {
|
||||||
|
return "请选择所属工序";
|
||||||
|
}
|
||||||
|
MesXslProcessOperation op = mesXslProcessOperationService.getById(model.getProcessOperationId());
|
||||||
|
if (op == null) {
|
||||||
|
return "所属工序不存在";
|
||||||
|
}
|
||||||
|
model.setProcessOperationName(op.getOperationName());
|
||||||
|
|
||||||
|
if (oConvertUtils.isEmpty(model.getDowntimeMainTypeId())) {
|
||||||
|
return "请选择所属主类型";
|
||||||
|
}
|
||||||
|
String mainErr = fillAndValidateMainType(model);
|
||||||
|
if (mainErr != null) {
|
||||||
|
return mainErr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oConvertUtils.isEmpty(model.getDowntimeType()) || model.getDowntimeType().trim().isEmpty()) {
|
||||||
|
return "停机类型不能为空";
|
||||||
|
}
|
||||||
|
String dt = model.getDowntimeType().trim();
|
||||||
|
model.setDowntimeType(dt);
|
||||||
|
if (mesXslDowntimeTypeService.isDowntimeTypeDuplicated(dt, excludeId, model)) {
|
||||||
|
return "停机类型不能重复";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.getDisplayOrder() == null) {
|
||||||
|
return "显示顺序不能为空";
|
||||||
|
}
|
||||||
|
|
||||||
|
String colorErr = normalizeColor(model);
|
||||||
|
if (colorErr != null) {
|
||||||
|
return colorErr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//update-begin---author:jiangxh ---date:20260518 for:【MES】责任区分、故障等级改为手填文本,仅 trim-----------
|
||||||
|
model.setResponsibilityDistinct(trimToNull(model.getResponsibilityDistinct()));
|
||||||
|
model.setFaultLevel(trimToNull(model.getFaultLevel()));
|
||||||
|
//update-end---author:jiangxh ---date:20260518 for:【MES】责任区分、故障等级改为手填文本,仅 trim-----------
|
||||||
|
|
||||||
|
String dm = model.getDowntimeMaintenance();
|
||||||
|
if (oConvertUtils.isEmpty(dm)) {
|
||||||
|
model.setDowntimeMaintenance("0");
|
||||||
|
} else {
|
||||||
|
dm = dm.trim();
|
||||||
|
if (!YN_VALUES.contains(dm)) {
|
||||||
|
return "是否停机维修取值无效";
|
||||||
|
}
|
||||||
|
model.setDowntimeMaintenance(dm);
|
||||||
|
}
|
||||||
|
|
||||||
|
String st = model.getStatus();
|
||||||
|
if (oConvertUtils.isEmpty(st)) {
|
||||||
|
model.setStatus("0");
|
||||||
|
} else {
|
||||||
|
st = st.trim();
|
||||||
|
if (!STATUS_VALUES.contains(st)) {
|
||||||
|
return "是否启用取值无效";
|
||||||
|
}
|
||||||
|
model.setStatus(st);
|
||||||
|
}
|
||||||
|
model.setImportOperationCode(null);
|
||||||
|
model.setImportMainTypeName(null);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String fillAndValidateMainType(MesXslDowntimeType model) {
|
||||||
|
MesXslDowntimeMainType main = mesXslDowntimeMainTypeService.getById(model.getDowntimeMainTypeId());
|
||||||
|
if (main == null) {
|
||||||
|
return "所属主类型不存在";
|
||||||
|
}
|
||||||
|
if (!model.getProcessOperationId().equals(main.getProcessOperationId())) {
|
||||||
|
return "所属主类型与所选工序不匹配";
|
||||||
|
}
|
||||||
|
model.setDowntimeMainTypeName(main.getDowntimeType());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String validateImportRow(MesXslDowntimeType row, int rowNo, Set<String> typesInFile) {
|
||||||
|
String opCode = row.getImportOperationCode();
|
||||||
|
if (opCode != null) {
|
||||||
|
opCode = opCode.trim();
|
||||||
|
}
|
||||||
|
if (oConvertUtils.isEmpty(opCode)) {
|
||||||
|
return "文件导入失败:第 " + rowNo + " 条工序编码不能为空";
|
||||||
|
}
|
||||||
|
MesXslProcessOperation op = findProcessByOperationCode(opCode, row);
|
||||||
|
if (op == null) {
|
||||||
|
return "文件导入失败:第 " + rowNo + " 条工序编码【" + opCode + "】不存在";
|
||||||
|
}
|
||||||
|
row.setProcessOperationId(op.getId());
|
||||||
|
row.setProcessOperationName(op.getOperationName());
|
||||||
|
|
||||||
|
String mainName = row.getImportMainTypeName();
|
||||||
|
if (mainName != null) {
|
||||||
|
mainName = mainName.trim();
|
||||||
|
}
|
||||||
|
if (oConvertUtils.isEmpty(mainName)) {
|
||||||
|
return "文件导入失败:第 " + rowNo + " 条主类型名称不能为空";
|
||||||
|
}
|
||||||
|
MesXslDowntimeMainType main = findMainTypeByNameAndProcess(mainName, op.getId(), row);
|
||||||
|
if (main == null) {
|
||||||
|
return "文件导入失败:第 " + rowNo + " 条主类型【" + mainName + "】在所选工序下不存在";
|
||||||
|
}
|
||||||
|
row.setDowntimeMainTypeId(main.getId());
|
||||||
|
row.setDowntimeMainTypeName(main.getDowntimeType());
|
||||||
|
|
||||||
|
String dt = row.getDowntimeType();
|
||||||
|
if (dt != null) {
|
||||||
|
dt = dt.trim();
|
||||||
|
}
|
||||||
|
if (oConvertUtils.isEmpty(dt)) {
|
||||||
|
return "文件导入失败:第 " + rowNo + " 条停机类型不能为空";
|
||||||
|
}
|
||||||
|
row.setDowntimeType(dt);
|
||||||
|
if (!typesInFile.add(dt)) {
|
||||||
|
return "文件导入失败:停机类型【" + dt + "】在导入文件中重复";
|
||||||
|
}
|
||||||
|
if (mesXslDowntimeTypeService.isDowntimeTypeDuplicated(dt, null, row)) {
|
||||||
|
return "文件导入失败:第 " + rowNo + " 条停机类型【" + dt + "】不能重复(同租户未删除数据中已存在)";
|
||||||
|
}
|
||||||
|
if (row.getDisplayOrder() == null) {
|
||||||
|
return "文件导入失败:第 " + rowNo + " 条显示顺序不能为空";
|
||||||
|
}
|
||||||
|
|
||||||
|
String colorErr = normalizeColor(row);
|
||||||
|
if (colorErr != null) {
|
||||||
|
return "文件导入失败:第 " + rowNo + " 条" + colorErr;
|
||||||
|
}
|
||||||
|
|
||||||
|
row.setResponsibilityDistinct(trimToNull(row.getResponsibilityDistinct()));
|
||||||
|
row.setFaultLevel(trimToNull(row.getFaultLevel()));
|
||||||
|
|
||||||
|
String dm = row.getDowntimeMaintenance();
|
||||||
|
if (oConvertUtils.isEmpty(dm)) {
|
||||||
|
row.setDowntimeMaintenance("0");
|
||||||
|
} else {
|
||||||
|
dm = dm.trim();
|
||||||
|
if (!YN_VALUES.contains(dm)) {
|
||||||
|
return "文件导入失败:第 " + rowNo + " 条是否停机维修无效";
|
||||||
|
}
|
||||||
|
row.setDowntimeMaintenance(dm);
|
||||||
|
}
|
||||||
|
|
||||||
|
String st = row.getStatus();
|
||||||
|
if (oConvertUtils.isEmpty(st)) {
|
||||||
|
row.setStatus("0");
|
||||||
|
} else {
|
||||||
|
st = st.trim();
|
||||||
|
if (!STATUS_VALUES.contains(st)) {
|
||||||
|
return "文件导入失败:第 " + rowNo + " 条是否启用无效";
|
||||||
|
}
|
||||||
|
row.setStatus(st);
|
||||||
|
}
|
||||||
|
row.setImportOperationCode(null);
|
||||||
|
row.setImportMainTypeName(null);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private MesXslDowntimeMainType findMainTypeByNameAndProcess(
|
||||||
|
String mainTypeName, String processOperationId, MesXslDowntimeType context) {
|
||||||
|
LambdaQueryWrapper<MesXslDowntimeMainType> w = new LambdaQueryWrapper<>();
|
||||||
|
w.eq(MesXslDowntimeMainType::getDowntimeType, mainTypeName.trim());
|
||||||
|
w.eq(MesXslDowntimeMainType::getProcessOperationId, processOperationId);
|
||||||
|
w.and(
|
||||||
|
q ->
|
||||||
|
q.eq(MesXslDowntimeMainType::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||||
|
.or()
|
||||||
|
.isNull(MesXslDowntimeMainType::getDelFlag));
|
||||||
|
Integer tenantId = context != null ? context.getTenantId() : null;
|
||||||
|
if (tenantId != null) {
|
||||||
|
w.eq(MesXslDowntimeMainType::getTenantId, tenantId);
|
||||||
|
}
|
||||||
|
w.last("LIMIT 1");
|
||||||
|
return mesXslDowntimeMainTypeService.getOne(w, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private MesXslProcessOperation findProcessByOperationCode(String operationCode, MesXslDowntimeType context) {
|
||||||
|
LambdaQueryWrapper<MesXslProcessOperation> w = new LambdaQueryWrapper<>();
|
||||||
|
w.eq(MesXslProcessOperation::getOperationCode, operationCode.trim());
|
||||||
|
w.and(
|
||||||
|
q ->
|
||||||
|
q.eq(MesXslProcessOperation::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||||
|
.or()
|
||||||
|
.isNull(MesXslProcessOperation::getDelFlag));
|
||||||
|
Integer tenantId = context != null ? context.getTenantId() : null;
|
||||||
|
if (tenantId != null) {
|
||||||
|
w.eq(MesXslProcessOperation::getTenantId, tenantId);
|
||||||
|
}
|
||||||
|
List<MesXslProcessOperation> found = mesXslProcessOperationService.list(w);
|
||||||
|
if (found == null || found.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return found.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String trimToNull(String value) {
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String v = value.trim();
|
||||||
|
return v.isEmpty() ? null : v;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String normalizeColor(MesXslDowntimeType model) {
|
||||||
|
String color = model.getDistinguishColor();
|
||||||
|
if (oConvertUtils.isEmpty(color)) {
|
||||||
|
model.setDistinguishColor(null);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
color = color.trim();
|
||||||
|
if (!color.startsWith("#")) {
|
||||||
|
color = "#" + color;
|
||||||
|
}
|
||||||
|
if (!COLOR_HEX.matcher(color).matches()) {
|
||||||
|
return "区分颜色格式无效(须为十六进制色值,如 #1890ff)";
|
||||||
|
}
|
||||||
|
model.setDistinguishColor(color.toLowerCase());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型保存前校验、关联工序与主类型回填-----------
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
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.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.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MES 停机主类型(表 mes_xsl_downtime_main_type)
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("mes_xsl_downtime_main_type")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Schema(description = "MES停机主类型")
|
||||||
|
public class MesXslDowntimeMainType implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "所属工序主键")
|
||||||
|
private String processOperationId;
|
||||||
|
|
||||||
|
@Excel(name = "工序名称", width = 24)
|
||||||
|
@Schema(description = "工序名称冗余")
|
||||||
|
private String processOperationName;
|
||||||
|
|
||||||
|
@Excel(name = "停机类型", width = 24)
|
||||||
|
@Schema(description = "停机类型(同租户未删除数据中唯一)")
|
||||||
|
private String downtimeType;
|
||||||
|
|
||||||
|
@Excel(name = "显示顺序", width = 12)
|
||||||
|
@Schema(description = "显示顺序(升序)")
|
||||||
|
private Integer displayOrder;
|
||||||
|
|
||||||
|
@Excel(name = "区分颜色", width = 16)
|
||||||
|
@Schema(description = "区分颜色(十六进制色值)")
|
||||||
|
private String distinguishColor;
|
||||||
|
|
||||||
|
@Excel(name = "是否启用", width = 12, dicCode = "xslmes_downtime_main_type_status")
|
||||||
|
@Dict(dicCode = "xslmes_downtime_main_type_status")
|
||||||
|
@Schema(description = "是否启用(字典 xslmes_downtime_main_type_status:0启用1停用)")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/** Excel 导入用:工序编码,不落库 */
|
||||||
|
@TableField(exist = false)
|
||||||
|
@Excel(name = "工序编码", width = 18)
|
||||||
|
@Schema(description = "导入用工序编码")
|
||||||
|
private String importOperationCode;
|
||||||
|
|
||||||
|
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;
|
||||||
|
private Integer delFlag;
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
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.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.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MES 停机类型(表 mes_xsl_downtime_type)
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("mes_xsl_downtime_type")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Schema(description = "MES停机类型")
|
||||||
|
public class MesXslDowntimeType implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "所属工序主键")
|
||||||
|
private String processOperationId;
|
||||||
|
|
||||||
|
@Excel(name = "工序名称", width = 24)
|
||||||
|
@Schema(description = "工序名称冗余")
|
||||||
|
private String processOperationName;
|
||||||
|
|
||||||
|
@Schema(description = "所属停机主类型主键")
|
||||||
|
private String downtimeMainTypeId;
|
||||||
|
|
||||||
|
@Excel(name = "所属主类型", width = 24)
|
||||||
|
@Schema(description = "主类型名称冗余")
|
||||||
|
private String downtimeMainTypeName;
|
||||||
|
|
||||||
|
@Excel(name = "停机类型", width = 24)
|
||||||
|
@Schema(description = "停机类型(同租户未删除数据中唯一)")
|
||||||
|
private String downtimeType;
|
||||||
|
|
||||||
|
@Excel(name = "显示顺序", width = 12)
|
||||||
|
@Schema(description = "显示顺序(升序,必填)")
|
||||||
|
private Integer displayOrder;
|
||||||
|
|
||||||
|
@Excel(name = "区分颜色", width = 16)
|
||||||
|
@Schema(description = "区分颜色(十六进制色值)")
|
||||||
|
private String distinguishColor;
|
||||||
|
|
||||||
|
@Excel(name = "责任区分", width = 20)
|
||||||
|
@Schema(description = "责任区分(手填)")
|
||||||
|
private String responsibilityDistinct;
|
||||||
|
|
||||||
|
@Excel(name = "故障等级", width = 16)
|
||||||
|
@Schema(description = "故障等级(手填)")
|
||||||
|
private String faultLevel;
|
||||||
|
|
||||||
|
@Excel(name = "是否停机维修", width = 14, dicCode = "yn")
|
||||||
|
@Dict(dicCode = "yn")
|
||||||
|
@Schema(description = "是否停机维修(字典 yn:1是0否)")
|
||||||
|
private String downtimeMaintenance;
|
||||||
|
|
||||||
|
@Excel(name = "是否启用", width = 12, dicCode = "xslmes_downtime_type_status")
|
||||||
|
@Dict(dicCode = "xslmes_downtime_type_status")
|
||||||
|
@Schema(description = "是否启用(字典 xslmes_downtime_type_status:0启用1停用)")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
@Excel(name = "工序编码", width = 18)
|
||||||
|
@Schema(description = "导入用工序编码")
|
||||||
|
private String importOperationCode;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
@Excel(name = "主类型名称", width = 24)
|
||||||
|
@Schema(description = "导入用停机主类型名称")
|
||||||
|
private String importMainTypeName;
|
||||||
|
|
||||||
|
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;
|
||||||
|
private Integer delFlag;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package org.jeecg.modules.xslmes.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MES 停机主类型
|
||||||
|
*/
|
||||||
|
public interface MesXslDowntimeMainTypeMapper extends BaseMapper<MesXslDowntimeMainType> {}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package org.jeecg.modules.xslmes.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslDowntimeType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MES 停机类型
|
||||||
|
*/
|
||||||
|
public interface MesXslDowntimeTypeMapper extends BaseMapper<MesXslDowntimeType> {}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* MES XSL 业务模块(Maven 工程名:jeecg-module-xslmes)。
|
* MES XSL 业务模块(Maven 工程名:jeecg-module-xslmes)。
|
||||||
* 包含:客户管理({@link org.jeecg.modules.xslmes.entity.MesXslCustomer})、工序管理({@link org.jeecg.modules.xslmes.entity.MesXslProcessOperation})、设备类别({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentCategory})、设备类型({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentType})、设备部位({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentPart})、设备小部位({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentSubPart})、备品件类别({@link org.jeecg.modules.xslmes.entity.MesXslSparePartsCategory})、备品件信息({@link org.jeecg.modules.xslmes.entity.MesXslSparePart})、厂家信息({@link org.jeecg.modules.xslmes.entity.MesXslManufacturer})等。
|
* 包含:客户管理({@link org.jeecg.modules.xslmes.entity.MesXslCustomer})、工序管理({@link org.jeecg.modules.xslmes.entity.MesXslProcessOperation})、设备类别({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentCategory})、设备类型({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentType})、设备部位({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentPart})、设备小部位({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentSubPart})、备品件类别({@link org.jeecg.modules.xslmes.entity.MesXslSparePartsCategory})、备品件信息({@link org.jeecg.modules.xslmes.entity.MesXslSparePart})、厂家信息({@link org.jeecg.modules.xslmes.entity.MesXslManufacturer})、停机主类型({@link org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType})、停机类型({@link org.jeecg.modules.xslmes.entity.MesXslDowntimeType})等。
|
||||||
*/
|
*/
|
||||||
package org.jeecg.modules.xslmes;
|
package org.jeecg.modules.xslmes;
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.jeecg.modules.xslmes.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType;
|
||||||
|
|
||||||
|
public interface IMesXslDowntimeMainTypeService extends IService<MesXslDowntimeMainType> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 停机类型是否已被占用(仅统计未删除:del_flag 为 0 或 null)。租户与拦截器注入逻辑一致。
|
||||||
|
*
|
||||||
|
* @param downtimeType 停机类型(已 trim 后传入)
|
||||||
|
* @param excludeId 编辑时排除自身主键,新增传 null
|
||||||
|
* @param context 当前提交的实体(可取 tenantId;可为 null)
|
||||||
|
*/
|
||||||
|
boolean isDowntimeTypeDuplicated(String downtimeType, String excludeId, MesXslDowntimeMainType context);
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package org.jeecg.modules.xslmes.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslDowntimeType;
|
||||||
|
|
||||||
|
public interface IMesXslDowntimeTypeService extends IService<MesXslDowntimeType> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 停机类型名称是否已被占用(仅统计未删除:del_flag 为 0 或 null)。租户与拦截器注入逻辑一致。
|
||||||
|
*/
|
||||||
|
boolean isDowntimeTypeDuplicated(String downtimeType, String excludeId, MesXslDowntimeType context);
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package org.jeecg.modules.xslmes.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.jeecg.common.config.TenantContext;
|
||||||
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
|
import org.jeecg.common.util.TokenUtils;
|
||||||
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType;
|
||||||
|
import org.jeecg.modules.xslmes.mapper.MesXslDowntimeMainTypeMapper;
|
||||||
|
import org.jeecg.modules.xslmes.service.IMesXslDowntimeMainTypeService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class MesXslDowntimeMainTypeServiceImpl extends ServiceImpl<MesXslDowntimeMainTypeMapper, MesXslDowntimeMainType>
|
||||||
|
implements IMesXslDowntimeMainTypeService {
|
||||||
|
|
||||||
|
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||||
|
@Override
|
||||||
|
public boolean isDowntimeTypeDuplicated(String downtimeType, String excludeId, MesXslDowntimeMainType context) {
|
||||||
|
if (oConvertUtils.isEmpty(downtimeType)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Integer tenantId = resolveTenantId(context);
|
||||||
|
LambdaQueryWrapper<MesXslDowntimeMainType> w = new LambdaQueryWrapper<>();
|
||||||
|
w.eq(MesXslDowntimeMainType::getDowntimeType, downtimeType.trim());
|
||||||
|
w.and(
|
||||||
|
q ->
|
||||||
|
q.eq(MesXslDowntimeMainType::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||||
|
.or()
|
||||||
|
.isNull(MesXslDowntimeMainType::getDelFlag));
|
||||||
|
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||||
|
w.ne(MesXslDowntimeMainType::getId, excludeId);
|
||||||
|
}
|
||||||
|
if (tenantId != null) {
|
||||||
|
w.eq(MesXslDowntimeMainType::getTenantId, tenantId);
|
||||||
|
}
|
||||||
|
return this.count(w) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Integer resolveTenantId(MesXslDowntimeMainType 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:20260518 for:【MES】停机类型同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package org.jeecg.modules.xslmes.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.jeecg.common.config.TenantContext;
|
||||||
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
|
import org.jeecg.common.util.TokenUtils;
|
||||||
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
|
import org.jeecg.modules.xslmes.entity.MesXslDowntimeType;
|
||||||
|
import org.jeecg.modules.xslmes.mapper.MesXslDowntimeTypeMapper;
|
||||||
|
import org.jeecg.modules.xslmes.service.IMesXslDowntimeTypeService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class MesXslDowntimeTypeServiceImpl extends ServiceImpl<MesXslDowntimeTypeMapper, MesXslDowntimeType>
|
||||||
|
implements IMesXslDowntimeTypeService {
|
||||||
|
|
||||||
|
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型名称同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||||
|
@Override
|
||||||
|
public boolean isDowntimeTypeDuplicated(String downtimeType, String excludeId, MesXslDowntimeType context) {
|
||||||
|
if (oConvertUtils.isEmpty(downtimeType)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Integer tenantId = resolveTenantId(context);
|
||||||
|
LambdaQueryWrapper<MesXslDowntimeType> w = new LambdaQueryWrapper<>();
|
||||||
|
w.eq(MesXslDowntimeType::getDowntimeType, downtimeType.trim());
|
||||||
|
w.and(
|
||||||
|
q ->
|
||||||
|
q.eq(MesXslDowntimeType::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||||
|
.or()
|
||||||
|
.isNull(MesXslDowntimeType::getDelFlag));
|
||||||
|
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||||
|
w.ne(MesXslDowntimeType::getId, excludeId);
|
||||||
|
}
|
||||||
|
if (tenantId != null) {
|
||||||
|
w.eq(MesXslDowntimeType::getTenantId, tenantId);
|
||||||
|
}
|
||||||
|
return this.count(w) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Integer resolveTenantId(MesXslDowntimeType 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:20260518 for:【MES】停机类型名称同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||||
|
}
|
||||||
@@ -195,3 +195,61 @@ jeecgboot-vue3/src/views/xslmes/mesXslManufacturer/MesXslManufacturerList.vue
|
|||||||
jeecgboot-vue3/src/views/xslmes/mesXslManufacturer/MesXslManufacturer.data.ts
|
jeecgboot-vue3/src/views/xslmes/mesXslManufacturer/MesXslManufacturer.data.ts
|
||||||
jeecgboot-vue3/src/views/xslmes/mesXslManufacturer/MesXslManufacturer.api.ts
|
jeecgboot-vue3/src/views/xslmes/mesXslManufacturer/MesXslManufacturer.api.ts
|
||||||
jeecgboot-vue3/src/views/xslmes/mesXslManufacturer/components/MesXslManufacturerModal.vue
|
jeecgboot-vue3/src/views/xslmes/mesXslManufacturer/components/MesXslManufacturerModal.vue
|
||||||
|
-- author:jiangxh---date:20260518--for: 【MES】停机主类型(所属工序、停机类型唯一、显示顺序、区分颜色、是否启用) ---
|
||||||
|
jeecg-boot/db/mes-xsl-downtime-main-type-menu-permission.sql
|
||||||
|
jeecg-boot/db/mes-xsl-downtime-main-type.sql
|
||||||
|
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_64__mes_xsl_downtime_main_type.sql
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslDowntimeMainType.java
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslDowntimeMainTypeMapper.java
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslDowntimeMainTypeService.java
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslDowntimeMainTypeServiceImpl.java
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeMainTypeController.java
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/package-info.java
|
||||||
|
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainTypeList.vue
|
||||||
|
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainType.data.ts
|
||||||
|
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainType.api.ts
|
||||||
|
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/components/MesXslDowntimeMainTypeModal.vue
|
||||||
|
-- author:jiangxh---date:20260518--for: 【MES】停机类型(工序+主类型+停机类型、责任区分、故障等级、停机维修、色卡) ---
|
||||||
|
jeecg-boot/db/mes-xsl-downtime-type-menu-permission.sql
|
||||||
|
jeecg-boot/db/mes-xsl-downtime-type.sql
|
||||||
|
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_65__mes_xsl_downtime_type.sql
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslDowntimeType.java
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslDowntimeTypeMapper.java
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslDowntimeTypeService.java
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslDowntimeTypeServiceImpl.java
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeTypeController.java
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/package-info.java
|
||||||
|
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeTypeList.vue
|
||||||
|
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeType.data.ts
|
||||||
|
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeType.api.ts
|
||||||
|
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/components/MesXslDowntimeTypeModal.vue
|
||||||
|
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/components/MesXslDowntimeMainTypeSelectModal.vue
|
||||||
|
-- author:jiangxh---date:20260518--for: 【MES】停机类型责任区分、故障等级改为手填(非字典) ---
|
||||||
|
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_66__mes_xsl_downtime_type_text_fields.sql
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslDowntimeType.java
|
||||||
|
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeTypeController.java
|
||||||
|
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeType.data.ts
|
||||||
|
jeecg-boot/db/mes-xsl-downtime-type.sql
|
||||||
|
jeecg-boot/db/mes-xsl-downtime-type-menu-permission.sql
|
||||||
|
-- author:jiangxh---date:20260518--for: 【MES】停机主类型/停机类型/厂家信息业务字符字段统一 varchar(500) ---
|
||||||
|
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_67__mes_xsl_varchar500_biz_fields.sql
|
||||||
|
jeecg-boot/db/mes-xsl-downtime-main-type.sql
|
||||||
|
jeecg-boot/db/mes-xsl-downtime-main-type-menu-permission.sql
|
||||||
|
jeecg-boot/db/mes-xsl-manufacturer.sql
|
||||||
|
jeecg-boot/db/mes-xsl-manufacturer-menu-permission.sql
|
||||||
|
-- author:jiangxh---date:20260518--for: 【MES】删除停机类型废弃字典(责任区分、故障等级改手填后) ---
|
||||||
|
jeecg-boot/db/mes-xsl-downtime-type-remove-unused-dict.sql
|
||||||
|
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_68__mes_xsl_downtime_remove_unused_dict.sql
|
||||||
|
jeecg-boot/db/mes-xsl-downtime-type-menu-permission.sql
|
||||||
|
-- author:jiangxh---date:20260518--for: 【MES】工序管理/设备类别/设备类型菜单挂 MES基础资料并修复权限树与租户授权 ---
|
||||||
|
jeecg-boot/db/mes-xsl-move-process-equipment-menus-to-mes-base.sql
|
||||||
|
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_69__mes_xsl_move_process_equipment_menus_to_mes_base.sql
|
||||||
|
-- author:jiangxh---date:20260518--for: 【MES】设备类型菜单补全 INSERT(077 未建时仅 UPDATE 无效)---
|
||||||
|
jeecg-boot/db/mes-xsl-equipment-type-menu-fix.sql
|
||||||
|
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_70__mes_xsl_equipment_type_menu_ensure.sql
|
||||||
|
-- author:jiangxh---date:20260518--for: 【MES】工序管理/设备类别菜单与按钮权限补全及租户授权 ---
|
||||||
|
jeecg-boot/db/mes-xsl-process-and-category-menu-fix.sql
|
||||||
|
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_71__mes_xsl_process_and_category_menu_ensure.sql
|
||||||
|
jeecg-boot/db/mes-process-operation-menu-permission.sql
|
||||||
|
jeecg-boot/db/mes-xsl-equipment-category-menu-permission.sql
|
||||||
|
jeecg-boot/db/mes-xsl-move-process-equipment-menus-to-mes-base.sql
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
-- MES 停机主类型:字典 + 建表 + 菜单 + 按钮 + 租户 admin 授权(与 jeecg-boot/db/mes-xsl-downtime-main-type-menu-permission.sql 一致)
|
||||||
|
-- 权限前缀:mes:mes_xsl_downtime_main_type:*;父菜单 MES基础资料 / MES资料
|
||||||
|
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_downtime_main_type_status', '0启用1停用', 0, 'admin', NOW(), 0, 0
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_downtime_main_type_status' 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, '启用', '0', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_downtime_main_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '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', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_downtime_main_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_main_type` (
|
||||||
|
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||||
|
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序 mes_xsl_process_operation.id',
|
||||||
|
`process_operation_name` varchar(128) DEFAULT NULL COMMENT '工序名称冗余',
|
||||||
|
`downtime_type` varchar(128) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||||
|
`display_order` int NOT NULL DEFAULT '0' COMMENT '显示顺序(升序)',
|
||||||
|
`distinguish_color` varchar(32) DEFAULT NULL COMMENT '区分颜色(十六进制色值,如#1890ff)',
|
||||||
|
`status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_downtime_main_type_status:0启用1停用)',
|
||||||
|
`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_mdmt_tenant_type` (`tenant_id`, `downtime_type`),
|
||||||
|
KEY `idx_mdmt_process` (`process_operation_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机主类型';
|
||||||
|
|
||||||
|
SET @mes_tenant_id = 1002;
|
||||||
|
|
||||||
|
SET @mes_base_pid = (
|
||||||
|
SELECT MIN(`id`) FROM `sys_permission`
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||||
|
);
|
||||||
|
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||||
|
|
||||||
|
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 ('1860000000000000119', @mes_base_pid, '停机主类型', '/xslmes/mesXslDowntimeMainType', 'xslmes/mesXslDowntimeMainType/MesXslDowntimeMainTypeList', NULL, 1, NULL, '1', 18, 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` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||||
|
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||||
|
|
||||||
|
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||||
|
('1860000000000000120', '1860000000000000119', '新增', 2, 'mes:mes_xsl_downtime_main_type:add', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000121', '1860000000000000119', '编辑', 2, 'mes:mes_xsl_downtime_main_type:edit', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000122', '1860000000000000119', '删除', 2, 'mes:mes_xsl_downtime_main_type:delete', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000123', '1860000000000000119', '批量删除', 2, 'mes:mes_xsl_downtime_main_type:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000124', '1860000000000000119', '导出', 2, 'mes:mes_xsl_downtime_main_type:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000125', '1860000000000000119', '导入', 2, 'mes:mes_xsl_downtime_main_type:importExcel', '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`),
|
||||||
|
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||||
|
|
||||||
|
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 (
|
||||||
|
'1860000000000000119',
|
||||||
|
'1860000000000000120', '1860000000000000121', '1860000000000000122', '1860000000000000123',
|
||||||
|
'1860000000000000124', '1860000000000000125'
|
||||||
|
)
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM `sys_role_permission` rp
|
||||||
|
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||||
|
);
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
-- MES 停机类型:字典 + 建表 + 菜单 + 按钮 + 租户 admin 授权
|
||||||
|
-- 权限前缀:mes:mes_xsl_downtime_type:*;父菜单 MES基础资料 / MES资料
|
||||||
|
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_downtime_responsibility', '生产、设备、质量、其他', 0, 'admin', NOW(), 0, 0
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_downtime_responsibility' 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, '生产', 'production', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_downtime_responsibility' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'production');
|
||||||
|
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), d.id, '设备', 'equipment', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_downtime_responsibility' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'equipment');
|
||||||
|
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), d.id, '质量', 'quality', 3, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_downtime_responsibility' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'quality');
|
||||||
|
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), d.id, '其他', 'other', 4, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_downtime_responsibility' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'other');
|
||||||
|
|
||||||
|
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), 'MES停机故障等级', 'xslmes_downtime_fault_level', '一级、二级、三级', 0, 'admin', NOW(), 0, 0
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_downtime_fault_level' 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_downtime_fault_level' 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_downtime_fault_level' 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_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), d.id, '三级', '3', 3, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_downtime_fault_level' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '3');
|
||||||
|
|
||||||
|
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||||
|
SELECT REPLACE(UUID(), '-', ''), 'MES停机类型是否启用', 'xslmes_downtime_type_status', '0启用1停用', 0, 'admin', NOW(), 0, 0
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_downtime_type_status' 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, '启用', '0', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_downtime_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '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', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||||
|
WHERE d.`dict_code` = 'xslmes_downtime_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_type` (
|
||||||
|
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||||
|
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序 mes_xsl_process_operation.id',
|
||||||
|
`process_operation_name` varchar(128) DEFAULT NULL COMMENT '工序名称冗余',
|
||||||
|
`downtime_main_type_id` varchar(32) NOT NULL COMMENT '所属主类型 mes_xsl_downtime_main_type.id',
|
||||||
|
`downtime_main_type_name` varchar(128) DEFAULT NULL COMMENT '主类型名称冗余(停机主类型.downtime_type)',
|
||||||
|
`downtime_type` varchar(128) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||||
|
`display_order` int NOT NULL DEFAULT '0' COMMENT '显示顺序(升序,必填)',
|
||||||
|
`distinguish_color` varchar(32) DEFAULT NULL COMMENT '区分颜色(十六进制色值)',
|
||||||
|
`responsibility_distinct` varchar(32) DEFAULT NULL COMMENT '责任区分(字典xslmes_downtime_responsibility)',
|
||||||
|
`fault_level` varchar(10) DEFAULT NULL COMMENT '故障等级(字典xslmes_downtime_fault_level:1一级2二级3三级)',
|
||||||
|
`downtime_maintenance` varchar(1) DEFAULT '0' COMMENT '是否停机维修(字典yn:1是0否)',
|
||||||
|
`status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_downtime_type_status:0启用1停用)',
|
||||||
|
`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_mdt_tenant_type` (`tenant_id`, `downtime_type`),
|
||||||
|
KEY `idx_mdt_process` (`process_operation_id`),
|
||||||
|
KEY `idx_mdt_main_type` (`downtime_main_type_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机类型';
|
||||||
|
|
||||||
|
SET @mes_tenant_id = 1002;
|
||||||
|
|
||||||
|
SET @mes_base_pid = (
|
||||||
|
SELECT MIN(`id`) FROM `sys_permission`
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||||
|
);
|
||||||
|
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||||
|
|
||||||
|
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 ('1860000000000000126', @mes_base_pid, '停机类型', '/xslmes/mesXslDowntimeType', 'xslmes/mesXslDowntimeType/MesXslDowntimeTypeList', NULL, 1, NULL, '1', 19, 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` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||||
|
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||||
|
|
||||||
|
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||||
|
('1860000000000000127', '1860000000000000126', '新增', 2, 'mes:mes_xsl_downtime_type:add', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000128', '1860000000000000126', '编辑', 2, 'mes:mes_xsl_downtime_type:edit', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000129', '1860000000000000126', '删除', 2, 'mes:mes_xsl_downtime_type:delete', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000130', '1860000000000000126', '批量删除', 2, 'mes:mes_xsl_downtime_type:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000131', '1860000000000000126', '导出', 2, 'mes:mes_xsl_downtime_type:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000132', '1860000000000000126', '导入', 2, 'mes:mes_xsl_downtime_type:importExcel', '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`),
|
||||||
|
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||||
|
|
||||||
|
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 (
|
||||||
|
'1860000000000000126',
|
||||||
|
'1860000000000000127', '1860000000000000128', '1860000000000000129', '1860000000000000130',
|
||||||
|
'1860000000000000131', '1860000000000000132'
|
||||||
|
)
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM `sys_role_permission` rp
|
||||||
|
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||||
|
);
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- 停机类型:责任区分、故障等级改为手填,放宽字段长度
|
||||||
|
ALTER TABLE `mes_xsl_downtime_type`
|
||||||
|
MODIFY COLUMN `responsibility_distinct` varchar(128) DEFAULT NULL COMMENT '责任区分(手填)',
|
||||||
|
MODIFY COLUMN `fault_level` varchar(64) DEFAULT NULL COMMENT '故障等级(手填)';
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
-- MES:业务字符字段统一 varchar(500)(MySQL;状态/字典码仍 varchar(1),主键及外键仍 varchar(32))
|
||||||
|
ALTER TABLE `mes_xsl_downtime_main_type`
|
||||||
|
MODIFY COLUMN `process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
|
||||||
|
MODIFY COLUMN `downtime_type` varchar(500) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||||
|
MODIFY COLUMN `distinguish_color` varchar(500) DEFAULT NULL COMMENT '区分颜色(十六进制色值)',
|
||||||
|
MODIFY COLUMN `sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||||
|
MODIFY COLUMN `create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||||
|
MODIFY COLUMN `update_by` varchar(500) DEFAULT NULL COMMENT '更新人';
|
||||||
|
|
||||||
|
ALTER TABLE `mes_xsl_downtime_type`
|
||||||
|
MODIFY COLUMN `process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
|
||||||
|
MODIFY COLUMN `downtime_main_type_name` varchar(500) DEFAULT NULL COMMENT '主类型名称冗余',
|
||||||
|
MODIFY COLUMN `downtime_type` varchar(500) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||||
|
MODIFY COLUMN `distinguish_color` varchar(500) DEFAULT NULL COMMENT '区分颜色(十六进制色值)',
|
||||||
|
MODIFY COLUMN `responsibility_distinct` varchar(500) DEFAULT NULL COMMENT '责任区分(手填)',
|
||||||
|
MODIFY COLUMN `fault_level` varchar(500) DEFAULT NULL COMMENT '故障等级(手填)',
|
||||||
|
MODIFY COLUMN `sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||||
|
MODIFY COLUMN `create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||||
|
MODIFY COLUMN `update_by` varchar(500) DEFAULT NULL COMMENT '更新人';
|
||||||
|
|
||||||
|
ALTER TABLE `mes_xsl_manufacturer`
|
||||||
|
MODIFY COLUMN `manufacturer_category` varchar(500) NOT NULL COMMENT '厂家类别(字典xslmes_manufacturer_category)',
|
||||||
|
MODIFY COLUMN `manufacturer_name` varchar(500) NOT NULL COMMENT '厂家名称(同租户未删除数据中唯一)',
|
||||||
|
MODIFY COLUMN `sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||||
|
MODIFY COLUMN `create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||||
|
MODIFY COLUMN `update_by` varchar(500) DEFAULT NULL COMMENT '更新人';
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
-- 停机类型:删除未使用的字典(责任区分、故障等级已改为手填)
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
DELETE i FROM `sys_dict_item` i
|
||||||
|
INNER JOIN `sys_dict` d ON i.`dict_id` = d.`id`
|
||||||
|
WHERE d.`dict_code` IN ('xslmes_downtime_responsibility', 'xslmes_downtime_fault_level');
|
||||||
|
|
||||||
|
DELETE FROM `sys_dict`
|
||||||
|
WHERE `dict_code` IN ('xslmes_downtime_responsibility', 'xslmes_downtime_fault_level');
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
-- 工序管理、设备类别、设备类型:挂 MES基础资料 + 权限树 is_leaf + 租户 admin 授权(与 db/mes-xsl-move-process-equipment-menus-to-mes-base.sql 一致)
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
SET @mes_tenant_id = 1002;
|
||||||
|
|
||||||
|
SET @mes_base_pid = (
|
||||||
|
SELECT MIN(`id`) FROM `sys_permission`
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||||
|
);
|
||||||
|
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||||
|
|
||||||
|
UPDATE `sys_permission`
|
||||||
|
SET `is_leaf` = 0
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料');
|
||||||
|
|
||||||
|
UPDATE `sys_permission` p
|
||||||
|
INNER JOIN (SELECT @mes_base_pid AS `pid`) x ON 1 = 1
|
||||||
|
SET p.`parent_id` = x.`pid`,
|
||||||
|
p.`is_leaf` = 0,
|
||||||
|
p.`url` = '/xslmes/mesXslProcessOperation',
|
||||||
|
p.`component` = 'xslmes/mesXslProcessOperation/MesXslProcessOperationList',
|
||||||
|
p.`component_name` = NULL,
|
||||||
|
p.`perms_type` = '1',
|
||||||
|
p.`update_by` = 'admin',
|
||||||
|
p.`update_time` = NOW()
|
||||||
|
WHERE p.`id` = '1860000000000000060';
|
||||||
|
|
||||||
|
UPDATE `sys_permission` p
|
||||||
|
INNER JOIN (SELECT @mes_base_pid AS `pid`) x ON 1 = 1
|
||||||
|
SET p.`parent_id` = x.`pid`,
|
||||||
|
p.`is_leaf` = 0,
|
||||||
|
p.`url` = '/xslmes/mesXslEquipmentCategory',
|
||||||
|
p.`component` = 'xslmes/mesXslEquipmentCategory/MesXslEquipmentCategoryList',
|
||||||
|
p.`component_name` = NULL,
|
||||||
|
p.`perms_type` = '1',
|
||||||
|
p.`update_by` = 'admin',
|
||||||
|
p.`update_time` = NOW()
|
||||||
|
WHERE p.`id` = '1860000000000000070';
|
||||||
|
|
||||||
|
UPDATE `sys_permission` p
|
||||||
|
INNER JOIN (SELECT @mes_base_pid AS `pid`) x ON 1 = 1
|
||||||
|
SET p.`parent_id` = x.`pid`,
|
||||||
|
p.`is_leaf` = 0,
|
||||||
|
p.`url` = '/xslmes/mesXslEquipmentType',
|
||||||
|
p.`component` = 'xslmes/mesXslEquipmentType/MesXslEquipmentTypeList',
|
||||||
|
p.`component_name` = NULL,
|
||||||
|
p.`perms_type` = '1',
|
||||||
|
p.`update_by` = 'admin',
|
||||||
|
p.`update_time` = NOW()
|
||||||
|
WHERE p.`id` = '1860000000000000077';
|
||||||
|
|
||||||
|
UPDATE `sys_permission` SET `name` = '新增' WHERE `id` = '1860000000000000061' AND `name` = '添加';
|
||||||
|
|
||||||
|
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 (
|
||||||
|
'1860000000000000060',
|
||||||
|
'1860000000000000061', '1860000000000000062', '1860000000000000063',
|
||||||
|
'1860000000000000064', '1860000000000000065', '1860000000000000066',
|
||||||
|
'1860000000000000070',
|
||||||
|
'1860000000000000071', '1860000000000000072', '1860000000000000073',
|
||||||
|
'1860000000000000074', '1860000000000000075', '1860000000000000076',
|
||||||
|
'1860000000000000077',
|
||||||
|
'1860000000000000078', '1860000000000000079', '1860000000000000080',
|
||||||
|
'1860000000000000081', '1860000000000000082', '1860000000000000083'
|
||||||
|
)
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM `sys_role_permission` rp
|
||||||
|
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||||
|
);
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
-- 设备类型:补全菜单与按钮(id 077 可能从未插入),挂 MES基础资料,修复权限树 is_leaf
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
SET @mes_tenant_id = 1002;
|
||||||
|
|
||||||
|
SET @mes_base_pid = (
|
||||||
|
SELECT `id` FROM `sys_permission`
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
|
||||||
|
LIMIT 1
|
||||||
|
);
|
||||||
|
SET @mes_base_pid = IFNULL(@mes_base_pid, (
|
||||||
|
SELECT MIN(`id`) FROM `sys_permission`
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
|
||||||
|
));
|
||||||
|
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||||
|
|
||||||
|
UPDATE `sys_permission`
|
||||||
|
SET `is_leaf` = 0
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料');
|
||||||
|
|
||||||
|
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 ('1860000000000000077', @mes_base_pid, '设备类型', '/xslmes/mesXslEquipmentType', 'xslmes/mesXslEquipmentType/MesXslEquipmentTypeList', NULL, 1, NULL, '1', 11, 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`),
|
||||||
|
`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`);
|
||||||
|
|
||||||
|
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||||
|
('1860000000000000078', '1860000000000000077', '新增', 2, 'mes:mes_xsl_equipment_type:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000079', '1860000000000000077', '编辑', 2, 'mes:mes_xsl_equipment_type:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000080', '1860000000000000077', '删除', 2, 'mes:mes_xsl_equipment_type:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000081', '1860000000000000077', '批量删除', 2, 'mes:mes_xsl_equipment_type:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000082', '1860000000000000077', '导出', 2, 'mes:mes_xsl_equipment_type:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000083', '1860000000000000077', '导入', 2, 'mes:mes_xsl_equipment_type: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 (
|
||||||
|
'1860000000000000077',
|
||||||
|
'1860000000000000078', '1860000000000000079', '1860000000000000080',
|
||||||
|
'1860000000000000081', '1860000000000000082', '1860000000000000083'
|
||||||
|
)
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM `sys_role_permission` rp
|
||||||
|
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||||
|
);
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
-- 工序管理、设备类别:补全菜单/按钮与租户 admin 授权(与 db/mes-xsl-process-and-category-menu-fix.sql 一致)
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
|
||||||
|
SET @mes_tenant_id = 1002;
|
||||||
|
|
||||||
|
SET @mes_base_pid = (
|
||||||
|
SELECT `id` FROM `sys_permission`
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
|
||||||
|
LIMIT 1
|
||||||
|
);
|
||||||
|
SET @mes_base_pid = IFNULL(@mes_base_pid, (
|
||||||
|
SELECT MIN(`id`) FROM `sys_permission`
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
|
||||||
|
));
|
||||||
|
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||||
|
|
||||||
|
UPDATE `sys_permission`
|
||||||
|
SET `is_leaf` = 0
|
||||||
|
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料');
|
||||||
|
|
||||||
|
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 ('1860000000000000060', @mes_base_pid, '工序管理', '/xslmes/mesXslProcessOperation', 'xslmes/mesXslProcessOperation/MesXslProcessOperationList', NULL, 1, NULL, '1', 9, 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`),
|
||||||
|
`is_leaf` = 0, `hidden` = 0, `status` = '1', `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
|
||||||
|
('1860000000000000061', '1860000000000000060', '新增', 2, 'mes:mes_process_operation:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000062', '1860000000000000060', '编辑', 2, 'mes:mes_process_operation:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000063', '1860000000000000060', '删除', 2, 'mes:mes_process_operation:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000064', '1860000000000000060', '批量删除', 2, 'mes:mes_process_operation:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000065', '1860000000000000060', '导出', 2, 'mes:mes_process_operation:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000066', '1860000000000000060', '导入', 2, 'mes:mes_process_operation:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
`parent_id` = VALUES(`parent_id`), `perms` = VALUES(`perms`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||||
|
|
||||||
|
UPDATE `sys_permission` SET `name` = '新增' WHERE `id` = '1860000000000000061' AND `name` = '添加';
|
||||||
|
|
||||||
|
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 ('1860000000000000070', @mes_base_pid, '设备类别', '/xslmes/mesXslEquipmentCategory', 'xslmes/mesXslEquipmentCategory/MesXslEquipmentCategoryList', NULL, 1, NULL, '1', 10, 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`),
|
||||||
|
`is_leaf` = 0, `hidden` = 0, `status` = '1', `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
|
||||||
|
('1860000000000000071', '1860000000000000070', '新增', 2, 'mes:mes_xsl_equipment_category:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000072', '1860000000000000070', '编辑', 2, 'mes:mes_xsl_equipment_category:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000073', '1860000000000000070', '删除', 2, 'mes:mes_xsl_equipment_category:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000074', '1860000000000000070', '批量删除', 2, 'mes:mes_xsl_equipment_category:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000075', '1860000000000000070', '导出', 2, 'mes:mes_xsl_equipment_category:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||||
|
('1860000000000000076', '1860000000000000070', '导入', 2, 'mes:mes_xsl_equipment_category:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
`parent_id` = VALUES(`parent_id`), `perms` = VALUES(`perms`), `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 (
|
||||||
|
'1860000000000000060',
|
||||||
|
'1860000000000000061', '1860000000000000062', '1860000000000000063',
|
||||||
|
'1860000000000000064', '1860000000000000065', '1860000000000000066',
|
||||||
|
'1860000000000000070',
|
||||||
|
'1860000000000000071', '1860000000000000072', '1860000000000000073',
|
||||||
|
'1860000000000000074', '1860000000000000075', '1860000000000000076'
|
||||||
|
)
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM `sys_role_permission` rp
|
||||||
|
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||||
|
);
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
|
||||||
|
const { createConfirm } = useMessage();
|
||||||
|
|
||||||
|
enum Api {
|
||||||
|
list = '/xslmes/mesXslDowntimeMainType/list',
|
||||||
|
checkDowntimeType = '/xslmes/mesXslDowntimeMainType/checkDowntimeType',
|
||||||
|
save = '/xslmes/mesXslDowntimeMainType/add',
|
||||||
|
edit = '/xslmes/mesXslDowntimeMainType/edit',
|
||||||
|
deleteOne = '/xslmes/mesXslDowntimeMainType/delete',
|
||||||
|
deleteBatch = '/xslmes/mesXslDowntimeMainType/deleteBatch',
|
||||||
|
importExcel = '/xslmes/mesXslDowntimeMainType/importExcel',
|
||||||
|
exportXls = '/xslmes/mesXslDowntimeMainType/exportXls',
|
||||||
|
queryById = '/xslmes/mesXslDowntimeMainType/queryById',
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getExportUrl = Api.exportXls;
|
||||||
|
export const getImportUrl = Api.importExcel;
|
||||||
|
|
||||||
|
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||||
|
|
||||||
|
export const queryById = (params: { id: string }) => defHttp.get({ url: Api.queryById, params });
|
||||||
|
|
||||||
|
export const checkDowntimeType = (params: { downtimeType: string; dataId?: string }) =>
|
||||||
|
defHttp.get(
|
||||||
|
{ url: Api.checkDowntimeType, params },
|
||||||
|
{
|
||||||
|
successMessageMode: 'none',
|
||||||
|
errorMessageMode: 'none',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
export const deleteOne = (params, handleSuccess) => {
|
||||||
|
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
|
||||||
|
handleSuccess();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const batchDelete = (params, handleSuccess) => {
|
||||||
|
createConfirm({
|
||||||
|
iconType: 'warning',
|
||||||
|
title: '确认删除',
|
||||||
|
content: '是否删除选中数据',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: () => {
|
||||||
|
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
|
||||||
|
handleSuccess();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const saveOrUpdate = (params, isUpdate) => {
|
||||||
|
const url = isUpdate ? Api.edit : Api.save;
|
||||||
|
return defHttp.post({ url, params });
|
||||||
|
};
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||||
|
import { h } from 'vue';
|
||||||
|
import { checkDowntimeType } from './MesXslDowntimeMainType.api';
|
||||||
|
|
||||||
|
export const columns: BasicColumn[] = [
|
||||||
|
{ title: '工序名称', align: 'center', dataIndex: 'processOperationName', width: 160 },
|
||||||
|
{ title: '停机类型', align: 'center', dataIndex: 'downtimeType', width: 160 },
|
||||||
|
{ title: '显示顺序', align: 'center', dataIndex: 'displayOrder', width: 90 },
|
||||||
|
{
|
||||||
|
title: '区分颜色',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'distinguishColor',
|
||||||
|
width: 120,
|
||||||
|
customRender: ({ text }) => {
|
||||||
|
const c = text ? String(text) : '';
|
||||||
|
if (!c) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return h('span', { style: { display: 'inline-flex', alignItems: 'center', gap: '6px' } }, [
|
||||||
|
h('span', {
|
||||||
|
style: {
|
||||||
|
display: 'inline-block',
|
||||||
|
width: '20px',
|
||||||
|
height: '20px',
|
||||||
|
borderRadius: '2px',
|
||||||
|
backgroundColor: c,
|
||||||
|
border: '1px solid #d9d9d9',
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
h('span', c),
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ title: '是否启用', align: 'center', dataIndex: 'status_dictText', width: 100 },
|
||||||
|
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100 },
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
width: 165,
|
||||||
|
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
|
||||||
|
},
|
||||||
|
{ title: '租户ID', align: 'center', dataIndex: 'tenantId', width: 90, defaultHidden: true },
|
||||||
|
];
|
||||||
|
|
||||||
|
export const searchFormSchema: FormSchema[] = [
|
||||||
|
{ label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 6 } },
|
||||||
|
{ label: '停机类型', field: 'downtimeType', component: 'Input', colProps: { span: 6 } },
|
||||||
|
{
|
||||||
|
label: '是否启用',
|
||||||
|
field: 'status',
|
||||||
|
component: 'JDictSelectTag',
|
||||||
|
componentProps: { dictCode: 'xslmes_downtime_main_type_status' },
|
||||||
|
colProps: { span: 6 },
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const formSchema: FormSchema[] = [
|
||||||
|
{ label: '', field: 'id', component: 'Input', show: false },
|
||||||
|
{ label: '', field: 'processOperationId', component: 'Input', show: false, dynamicRules: () => [{ required: true, message: '请选择所属工序' }] },
|
||||||
|
{
|
||||||
|
label: '所属工序',
|
||||||
|
field: 'processOperationName',
|
||||||
|
component: 'Input',
|
||||||
|
slot: 'processOperationPicker',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '停机类型',
|
||||||
|
field: 'downtimeType',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: { placeholder: '同租户内未删除数据中不可重复' },
|
||||||
|
dynamicRules: ({ model }) => [
|
||||||
|
{ required: true, message: '请输入停机类型' },
|
||||||
|
{
|
||||||
|
validator: async (_rule, value) => {
|
||||||
|
const v = value == null ? '' : String(value).trim();
|
||||||
|
if (!v) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await checkDowntimeType({ downtimeType: v, dataId: model?.id });
|
||||||
|
return Promise.resolve();
|
||||||
|
} catch (e: any) {
|
||||||
|
const msg = e?.response?.data?.message || e?.message || '停机类型不能重复';
|
||||||
|
return Promise.reject(msg);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '显示顺序',
|
||||||
|
field: 'displayOrder',
|
||||||
|
component: 'InputNumber',
|
||||||
|
defaultValue: 0,
|
||||||
|
componentProps: { min: 0, precision: 0, style: { width: '100%' } },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '区分颜色',
|
||||||
|
field: 'distinguishColor',
|
||||||
|
component: 'Input',
|
||||||
|
slot: 'distinguishColorPicker',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '是否启用',
|
||||||
|
field: 'status',
|
||||||
|
required: true,
|
||||||
|
defaultValue: '0',
|
||||||
|
component: 'JDictSelectTag',
|
||||||
|
componentProps: { dictCode: 'xslmes_downtime_main_type_status', placeholder: '请选择' },
|
||||||
|
},
|
||||||
|
];
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||||
|
<template #tableTitle>
|
||||||
|
<a-button type="primary" v-auth="'mes:mes_xsl_downtime_main_type:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||||
|
新增
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
v-auth="'mes:mes_xsl_downtime_main_type:exportXls'"
|
||||||
|
preIcon="ant-design:export-outlined"
|
||||||
|
@click="onExportXls"
|
||||||
|
>
|
||||||
|
导出
|
||||||
|
</a-button>
|
||||||
|
<j-upload-button
|
||||||
|
type="primary"
|
||||||
|
v-auth="'mes:mes_xsl_downtime_main_type:importExcel'"
|
||||||
|
preIcon="ant-design:import-outlined"
|
||||||
|
@click="onImportXls"
|
||||||
|
>
|
||||||
|
导入
|
||||||
|
</j-upload-button>
|
||||||
|
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||||
|
<template #overlay>
|
||||||
|
<a-menu>
|
||||||
|
<a-menu-item key="1" @click="batchHandleDelete">
|
||||||
|
<Icon icon="ant-design:delete-outlined" />
|
||||||
|
删除
|
||||||
|
</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
</template>
|
||||||
|
<a-button v-auth="'mes:mes_xsl_downtime_main_type:deleteBatch'">
|
||||||
|
批量操作
|
||||||
|
<Icon icon="mdi:chevron-down" />
|
||||||
|
</a-button>
|
||||||
|
</a-dropdown>
|
||||||
|
</template>
|
||||||
|
<template #action="{ record }">
|
||||||
|
<TableAction
|
||||||
|
:actions="[
|
||||||
|
{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'mes:mes_xsl_downtime_main_type:edit' },
|
||||||
|
]"
|
||||||
|
:dropDownActions="getDropDownAction(record)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<MesXslDowntimeMainTypeModal @register="registerModal" @success="handleSuccess" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" name="xslmes-mesXslDowntimeMainType" setup>
|
||||||
|
import { BasicTable, TableAction } from '/@/components/Table';
|
||||||
|
import { useModal } from '/@/components/Modal';
|
||||||
|
import { useListPage } from '/@/hooks/system/useListPage';
|
||||||
|
import Icon from '/@/components/Icon';
|
||||||
|
import MesXslDowntimeMainTypeModal from './components/MesXslDowntimeMainTypeModal.vue';
|
||||||
|
import { columns, searchFormSchema } from './MesXslDowntimeMainType.data';
|
||||||
|
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslDowntimeMainType.api';
|
||||||
|
|
||||||
|
const [registerModal, { openModal }] = useModal();
|
||||||
|
|
||||||
|
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
|
tableProps: {
|
||||||
|
title: '停机主类型',
|
||||||
|
api: list,
|
||||||
|
columns,
|
||||||
|
canResize: true,
|
||||||
|
formConfig: {
|
||||||
|
schemas: searchFormSchema,
|
||||||
|
labelWidth: 100,
|
||||||
|
autoSubmitOnEnter: true,
|
||||||
|
showAdvancedButton: true,
|
||||||
|
},
|
||||||
|
actionColumn: {
|
||||||
|
width: 200,
|
||||||
|
fixed: 'right',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
exportConfig: {
|
||||||
|
name: '停机主类型',
|
||||||
|
url: getExportUrl,
|
||||||
|
},
|
||||||
|
importConfig: {
|
||||||
|
url: getImportUrl,
|
||||||
|
success: handleSuccess,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||||
|
|
||||||
|
function handleAdd() {
|
||||||
|
openModal(true, { isUpdate: false, showFooter: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleEdit(record: Recordable) {
|
||||||
|
openModal(true, { record, isUpdate: true, showFooter: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDetail(record: Recordable) {
|
||||||
|
openModal(true, { record, isUpdate: true, showFooter: false });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDelete(record) {
|
||||||
|
await deleteOne({ id: record.id }, handleSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function batchHandleDelete() {
|
||||||
|
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSuccess() {
|
||||||
|
selectedRowKeys.value = [];
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDropDownAction(record) {
|
||||||
|
return [
|
||||||
|
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||||
|
{
|
||||||
|
label: '删除',
|
||||||
|
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||||
|
auth: 'mes:mes_xsl_downtime_main_type:delete',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
<template>
|
||||||
|
<BasicModal @register="registerModal" :title="title" width="680" v-bind="$attrs" destroyOnClose @ok="handleSubmit">
|
||||||
|
<BasicForm @register="registerForm">
|
||||||
|
<template #processOperationPicker="{ model, field }">
|
||||||
|
<a-input-group compact style="display: flex; width: 100%">
|
||||||
|
<a-input v-model:value="model[field]" read-only placeholder="请选择工序" style="flex: 1" />
|
||||||
|
<a-button type="primary" :disabled="isDetail" @click="openProcessSelect">选择工序</a-button>
|
||||||
|
<a-button v-if="model.processOperationId && !isDetail" @click="clearProcess">清除</a-button>
|
||||||
|
</a-input-group>
|
||||||
|
</template>
|
||||||
|
<template #distinguishColorPicker="{ model, field }">
|
||||||
|
<div style="display: flex; align-items: center; gap: 12px; width: 100%">
|
||||||
|
<input
|
||||||
|
type="color"
|
||||||
|
:value="normalizeColorValue(model[field])"
|
||||||
|
:disabled="isDetail"
|
||||||
|
style="width: 48px; height: 32px; padding: 0; border: 1px solid #d9d9d9; cursor: pointer"
|
||||||
|
@input="(e) => onColorInput(model, field, e)"
|
||||||
|
/>
|
||||||
|
<a-input v-model:value="model[field]" :disabled="isDetail" placeholder="如 #1890ff" allow-clear style="flex: 1" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</BasicForm>
|
||||||
|
<MesXslProcessOperationSelectModal @register="registerProcessModal" @select="onProcessSelect" />
|
||||||
|
</BasicModal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed, ref, unref } from 'vue';
|
||||||
|
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
|
||||||
|
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||||
|
import { formSchema } from '../MesXslDowntimeMainType.data';
|
||||||
|
import { saveOrUpdate } from '../MesXslDowntimeMainType.api';
|
||||||
|
import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue';
|
||||||
|
|
||||||
|
const emit = defineEmits(['register', 'success']);
|
||||||
|
const isUpdate = ref(true);
|
||||||
|
const isDetail = ref(false);
|
||||||
|
|
||||||
|
const [registerProcessModal, { openModal: openProcessModal }] = useModal();
|
||||||
|
|
||||||
|
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = useForm({
|
||||||
|
labelWidth: 100,
|
||||||
|
schemas: formSchema,
|
||||||
|
showActionButtonGroup: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||||
|
await resetFields();
|
||||||
|
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
|
||||||
|
isUpdate.value = !!data?.isUpdate;
|
||||||
|
isDetail.value = !data?.showFooter;
|
||||||
|
if (unref(isUpdate)) await setFieldsValue({ ...data.record });
|
||||||
|
else await setFieldsValue({ status: '0', displayOrder: 0 });
|
||||||
|
setProps({ disabled: !data?.showFooter });
|
||||||
|
});
|
||||||
|
|
||||||
|
const title = computed(() =>
|
||||||
|
!unref(isUpdate) ? '新增停机主类型' : unref(isDetail) ? '停机主类型详情' : '编辑停机主类型',
|
||||||
|
);
|
||||||
|
|
||||||
|
function normalizeColorValue(val: unknown) {
|
||||||
|
const s = val == null ? '' : String(val).trim();
|
||||||
|
if (!s) {
|
||||||
|
return '#1890ff';
|
||||||
|
}
|
||||||
|
return s.startsWith('#') ? s : `#${s}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onColorInput(model: Recordable, field: string, e: Event) {
|
||||||
|
const v = (e.target as HTMLInputElement).value;
|
||||||
|
model[field] = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
function openProcessSelect() {
|
||||||
|
const vals = getFieldsValue();
|
||||||
|
openProcessModal(true, { processOperationId: vals.processOperationId });
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearProcess() {
|
||||||
|
setFieldsValue({ processOperationId: '', processOperationName: '' });
|
||||||
|
}
|
||||||
|
|
||||||
|
function onProcessSelect(payload: { processOperationId?: string; processOperationName?: string }) {
|
||||||
|
setFieldsValue({
|
||||||
|
processOperationId: payload.processOperationId || '',
|
||||||
|
processOperationName: payload.processOperationName || '',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleSubmit() {
|
||||||
|
try {
|
||||||
|
const values = await validate();
|
||||||
|
setModalProps({ confirmLoading: true });
|
||||||
|
await saveOrUpdate(values, isUpdate.value);
|
||||||
|
closeModal();
|
||||||
|
emit('success');
|
||||||
|
} finally {
|
||||||
|
setModalProps({ confirmLoading: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
|
||||||
|
const { createConfirm } = useMessage();
|
||||||
|
|
||||||
|
enum Api {
|
||||||
|
list = '/xslmes/mesXslDowntimeType/list',
|
||||||
|
checkDowntimeType = '/xslmes/mesXslDowntimeType/checkDowntimeType',
|
||||||
|
save = '/xslmes/mesXslDowntimeType/add',
|
||||||
|
edit = '/xslmes/mesXslDowntimeType/edit',
|
||||||
|
deleteOne = '/xslmes/mesXslDowntimeType/delete',
|
||||||
|
deleteBatch = '/xslmes/mesXslDowntimeType/deleteBatch',
|
||||||
|
importExcel = '/xslmes/mesXslDowntimeType/importExcel',
|
||||||
|
exportXls = '/xslmes/mesXslDowntimeType/exportXls',
|
||||||
|
queryById = '/xslmes/mesXslDowntimeType/queryById',
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getExportUrl = Api.exportXls;
|
||||||
|
export const getImportUrl = Api.importExcel;
|
||||||
|
|
||||||
|
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||||
|
|
||||||
|
export const queryById = (params: { id: string }) => defHttp.get({ url: Api.queryById, params });
|
||||||
|
|
||||||
|
export const checkDowntimeType = (params: { downtimeType: string; dataId?: string }) =>
|
||||||
|
defHttp.get(
|
||||||
|
{ url: Api.checkDowntimeType, params },
|
||||||
|
{
|
||||||
|
successMessageMode: 'none',
|
||||||
|
errorMessageMode: 'none',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
export const deleteOne = (params, handleSuccess) => {
|
||||||
|
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
|
||||||
|
handleSuccess();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const batchDelete = (params, handleSuccess) => {
|
||||||
|
createConfirm({
|
||||||
|
iconType: 'warning',
|
||||||
|
title: '确认删除',
|
||||||
|
content: '是否删除选中数据',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: () => {
|
||||||
|
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
|
||||||
|
handleSuccess();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const saveOrUpdate = (params, isUpdate) => {
|
||||||
|
const url = isUpdate ? Api.edit : Api.save;
|
||||||
|
return defHttp.post({ url, params });
|
||||||
|
};
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||||
|
import { h } from 'vue';
|
||||||
|
import { checkDowntimeType } from './MesXslDowntimeType.api';
|
||||||
|
|
||||||
|
export const columns: BasicColumn[] = [
|
||||||
|
{ title: '工序名称', align: 'center', dataIndex: 'processOperationName', width: 140 },
|
||||||
|
{ title: '所属主类型', align: 'center', dataIndex: 'downtimeMainTypeName', width: 140 },
|
||||||
|
{ title: '停机类型', align: 'center', dataIndex: 'downtimeType', width: 140 },
|
||||||
|
{ title: '显示顺序', align: 'center', dataIndex: 'displayOrder', width: 90 },
|
||||||
|
{
|
||||||
|
title: '区分颜色',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'distinguishColor',
|
||||||
|
width: 120,
|
||||||
|
customRender: ({ text }) => {
|
||||||
|
const c = text ? String(text) : '';
|
||||||
|
if (!c) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return h('span', { style: { display: 'inline-flex', alignItems: 'center', gap: '6px' } }, [
|
||||||
|
h('span', {
|
||||||
|
style: {
|
||||||
|
display: 'inline-block',
|
||||||
|
width: '20px',
|
||||||
|
height: '20px',
|
||||||
|
borderRadius: '2px',
|
||||||
|
backgroundColor: c,
|
||||||
|
border: '1px solid #d9d9d9',
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
h('span', c),
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ title: '责任区分', align: 'center', dataIndex: 'responsibilityDistinct', width: 120 },
|
||||||
|
{ title: '故障等级', align: 'center', dataIndex: 'faultLevel', width: 100 },
|
||||||
|
{ title: '是否停机维修', align: 'center', dataIndex: 'downtimeMaintenance_dictText', width: 110 },
|
||||||
|
{ title: '是否启用', align: 'center', dataIndex: 'status_dictText', width: 90 },
|
||||||
|
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100 },
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
width: 165,
|
||||||
|
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const searchFormSchema: FormSchema[] = [
|
||||||
|
{ label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 6 } },
|
||||||
|
{ label: '主类型', field: 'downtimeMainTypeName', component: 'Input', colProps: { span: 6 } },
|
||||||
|
{ label: '停机类型', field: 'downtimeType', component: 'Input', colProps: { span: 6 } },
|
||||||
|
{
|
||||||
|
label: '是否启用',
|
||||||
|
field: 'status',
|
||||||
|
component: 'JDictSelectTag',
|
||||||
|
componentProps: { dictCode: 'xslmes_downtime_type_status' },
|
||||||
|
colProps: { span: 6 },
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const formSchema: FormSchema[] = [
|
||||||
|
{ label: '', field: 'id', component: 'Input', show: false },
|
||||||
|
{ label: '', field: 'processOperationId', component: 'Input', show: false, dynamicRules: () => [{ required: true, message: '请选择所属工序' }] },
|
||||||
|
{
|
||||||
|
label: '所属工序',
|
||||||
|
field: 'processOperationName',
|
||||||
|
component: 'Input',
|
||||||
|
slot: 'processOperationPicker',
|
||||||
|
},
|
||||||
|
{ label: '', field: 'downtimeMainTypeId', component: 'Input', show: false, dynamicRules: () => [{ required: true, message: '请选择所属主类型' }] },
|
||||||
|
{
|
||||||
|
label: '所属主类型',
|
||||||
|
field: 'downtimeMainTypeName',
|
||||||
|
component: 'Input',
|
||||||
|
slot: 'downtimeMainTypePicker',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '停机类型',
|
||||||
|
field: 'downtimeType',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: { placeholder: '同租户内未删除数据中不可重复' },
|
||||||
|
dynamicRules: ({ model }) => [
|
||||||
|
{ required: true, message: '请输入停机类型' },
|
||||||
|
{
|
||||||
|
validator: async (_rule, value) => {
|
||||||
|
const v = value == null ? '' : String(value).trim();
|
||||||
|
if (!v) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await checkDowntimeType({ downtimeType: v, dataId: model?.id });
|
||||||
|
return Promise.resolve();
|
||||||
|
} catch (e: any) {
|
||||||
|
const msg = e?.response?.data?.message || e?.message || '停机类型不能重复';
|
||||||
|
return Promise.reject(msg);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '显示顺序',
|
||||||
|
field: 'displayOrder',
|
||||||
|
required: true,
|
||||||
|
component: 'InputNumber',
|
||||||
|
defaultValue: 0,
|
||||||
|
componentProps: { min: 0, precision: 0, style: { width: '100%' } },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '区分颜色',
|
||||||
|
field: 'distinguishColor',
|
||||||
|
component: 'Input',
|
||||||
|
slot: 'distinguishColorPicker',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '责任区分',
|
||||||
|
field: 'responsibilityDistinct',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: { placeholder: '手填' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '故障等级',
|
||||||
|
field: 'faultLevel',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: { placeholder: '手填' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '是否停机维修',
|
||||||
|
field: 'downtimeMaintenance',
|
||||||
|
defaultValue: '0',
|
||||||
|
component: 'JDictSelectTag',
|
||||||
|
componentProps: { dictCode: 'yn', placeholder: '请选择' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '是否启用',
|
||||||
|
field: 'status',
|
||||||
|
required: true,
|
||||||
|
defaultValue: '0',
|
||||||
|
component: 'JDictSelectTag',
|
||||||
|
componentProps: { dictCode: 'xslmes_downtime_type_status', placeholder: '请选择' },
|
||||||
|
},
|
||||||
|
];
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||||
|
<template #tableTitle>
|
||||||
|
<a-button type="primary" v-auth="'mes:mes_xsl_downtime_type:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||||
|
新增
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
v-auth="'mes:mes_xsl_downtime_type:exportXls'"
|
||||||
|
preIcon="ant-design:export-outlined"
|
||||||
|
@click="onExportXls"
|
||||||
|
>
|
||||||
|
导出
|
||||||
|
</a-button>
|
||||||
|
<j-upload-button
|
||||||
|
type="primary"
|
||||||
|
v-auth="'mes:mes_xsl_downtime_type:importExcel'"
|
||||||
|
preIcon="ant-design:import-outlined"
|
||||||
|
@click="onImportXls"
|
||||||
|
>
|
||||||
|
导入
|
||||||
|
</j-upload-button>
|
||||||
|
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||||
|
<template #overlay>
|
||||||
|
<a-menu>
|
||||||
|
<a-menu-item key="1" @click="batchHandleDelete">
|
||||||
|
<Icon icon="ant-design:delete-outlined" />
|
||||||
|
删除
|
||||||
|
</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
</template>
|
||||||
|
<a-button v-auth="'mes:mes_xsl_downtime_type:deleteBatch'">
|
||||||
|
批量操作
|
||||||
|
<Icon icon="mdi:chevron-down" />
|
||||||
|
</a-button>
|
||||||
|
</a-dropdown>
|
||||||
|
</template>
|
||||||
|
<template #action="{ record }">
|
||||||
|
<TableAction
|
||||||
|
:actions="[
|
||||||
|
{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'mes:mes_xsl_downtime_type:edit' },
|
||||||
|
]"
|
||||||
|
:dropDownActions="getDropDownAction(record)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<MesXslDowntimeTypeModal @register="registerModal" @success="handleSuccess" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" name="xslmes-mesXslDowntimeType" setup>
|
||||||
|
import { BasicTable, TableAction } from '/@/components/Table';
|
||||||
|
import { useModal } from '/@/components/Modal';
|
||||||
|
import { useListPage } from '/@/hooks/system/useListPage';
|
||||||
|
import Icon from '/@/components/Icon';
|
||||||
|
import MesXslDowntimeTypeModal from './components/MesXslDowntimeTypeModal.vue';
|
||||||
|
import { columns, searchFormSchema } from './MesXslDowntimeType.data';
|
||||||
|
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslDowntimeType.api';
|
||||||
|
|
||||||
|
const [registerModal, { openModal }] = useModal();
|
||||||
|
|
||||||
|
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
|
tableProps: {
|
||||||
|
title: '停机类型',
|
||||||
|
api: list,
|
||||||
|
columns,
|
||||||
|
canResize: true,
|
||||||
|
formConfig: {
|
||||||
|
schemas: searchFormSchema,
|
||||||
|
labelWidth: 100,
|
||||||
|
autoSubmitOnEnter: true,
|
||||||
|
showAdvancedButton: true,
|
||||||
|
},
|
||||||
|
actionColumn: {
|
||||||
|
width: 200,
|
||||||
|
fixed: 'right',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
exportConfig: {
|
||||||
|
name: '停机类型',
|
||||||
|
url: getExportUrl,
|
||||||
|
},
|
||||||
|
importConfig: {
|
||||||
|
url: getImportUrl,
|
||||||
|
success: handleSuccess,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||||
|
|
||||||
|
function handleAdd() {
|
||||||
|
openModal(true, { isUpdate: false, showFooter: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleEdit(record: Recordable) {
|
||||||
|
openModal(true, { record, isUpdate: true, showFooter: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDetail(record: Recordable) {
|
||||||
|
openModal(true, { record, isUpdate: true, showFooter: false });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDelete(record) {
|
||||||
|
await deleteOne({ id: record.id }, handleSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function batchHandleDelete() {
|
||||||
|
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSuccess() {
|
||||||
|
selectedRowKeys.value = [];
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDropDownAction(record) {
|
||||||
|
return [
|
||||||
|
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||||
|
{
|
||||||
|
label: '删除',
|
||||||
|
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||||
|
auth: 'mes:mes_xsl_downtime_type:delete',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
<template>
|
||||||
|
<BasicModal v-bind="$attrs" title="选择停机主类型" :width="960" @register="registerModal" @ok="handleOk">
|
||||||
|
<BasicTable @register="registerTable" />
|
||||||
|
</BasicModal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||||
|
import { BasicTable, useTable } from '/@/components/Table';
|
||||||
|
import { list, queryById } from '/@/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainType.api';
|
||||||
|
|
||||||
|
const emit = defineEmits(['register', 'select']);
|
||||||
|
|
||||||
|
const selectedRow = ref<Recordable | null>(null);
|
||||||
|
const processOperationIdRef = ref<string>('');
|
||||||
|
|
||||||
|
function handleSelectionChange(_keys: string[], rows: Recordable[]) {
|
||||||
|
selectedRow.value = rows?.[0] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const [registerTable, { reload, setProps, getSelectRowKeys, getSelectRows, setSelectedRowKeys, clearSelectedRowKeys }] =
|
||||||
|
useTable({
|
||||||
|
api: (params) => {
|
||||||
|
const p = { ...params };
|
||||||
|
if (processOperationIdRef.value) {
|
||||||
|
p.processOperationId = processOperationIdRef.value;
|
||||||
|
}
|
||||||
|
return list(p);
|
||||||
|
},
|
||||||
|
columns: [
|
||||||
|
{ title: '工序名称', dataIndex: 'processOperationName', width: 160 },
|
||||||
|
{ title: '停机类型', dataIndex: 'downtimeType', width: 200 },
|
||||||
|
{ title: '显示顺序', dataIndex: 'displayOrder', width: 90 },
|
||||||
|
],
|
||||||
|
rowKey: 'id',
|
||||||
|
useSearchForm: true,
|
||||||
|
formConfig: {
|
||||||
|
labelWidth: 90,
|
||||||
|
schemas: [{ label: '停机类型', field: 'downtimeType', component: 'Input', colProps: { span: 10 } }],
|
||||||
|
},
|
||||||
|
pagination: { pageSize: 10 },
|
||||||
|
canResize: false,
|
||||||
|
showIndexColumn: false,
|
||||||
|
immediate: false,
|
||||||
|
rowSelection: {
|
||||||
|
type: 'radio',
|
||||||
|
columnWidth: 48,
|
||||||
|
onChange: handleSelectionChange,
|
||||||
|
},
|
||||||
|
clickToRowSelect: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||||
|
selectedRow.value = null;
|
||||||
|
processOperationIdRef.value = (data?.processOperationId as string) || '';
|
||||||
|
clearSelectedRowKeys?.();
|
||||||
|
setProps({
|
||||||
|
rowSelection: {
|
||||||
|
type: 'radio',
|
||||||
|
columnWidth: 48,
|
||||||
|
onChange: handleSelectionChange,
|
||||||
|
},
|
||||||
|
clickToRowSelect: true,
|
||||||
|
});
|
||||||
|
setModalProps({ confirmLoading: false });
|
||||||
|
const mid = data?.downtimeMainTypeId as string | undefined;
|
||||||
|
if (mid) {
|
||||||
|
setSelectedRowKeys?.([mid]);
|
||||||
|
try {
|
||||||
|
const raw = await queryById({ id: mid });
|
||||||
|
const row = (raw as any)?.id != null ? raw : (raw as any)?.result;
|
||||||
|
if (row) {
|
||||||
|
selectedRow.value = row;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// 忽略
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reload();
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleOk() {
|
||||||
|
const keys = (getSelectRowKeys?.() || []) as string[];
|
||||||
|
let row = selectedRow.value || ((getSelectRows?.() || []) as Recordable[])[0];
|
||||||
|
if (!row && keys.length) {
|
||||||
|
try {
|
||||||
|
const raw = await queryById({ id: keys[0] });
|
||||||
|
row = (raw as any)?.id != null ? raw : (raw as any)?.result;
|
||||||
|
} catch {
|
||||||
|
// 忽略
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!row?.id) {
|
||||||
|
emit('select', { downtimeMainTypeId: '', downtimeMainTypeName: '' });
|
||||||
|
closeModal();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
emit('select', {
|
||||||
|
downtimeMainTypeId: row.id,
|
||||||
|
downtimeMainTypeName: row.downtimeType || '',
|
||||||
|
});
|
||||||
|
closeModal();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
<template>
|
||||||
|
<BasicModal @register="registerModal" :title="title" width="720" v-bind="$attrs" destroyOnClose @ok="handleSubmit">
|
||||||
|
<BasicForm @register="registerForm">
|
||||||
|
<template #processOperationPicker="{ model, field }">
|
||||||
|
<a-input-group compact style="display: flex; width: 100%">
|
||||||
|
<a-input v-model:value="model[field]" read-only placeholder="请选择工序" style="flex: 1" />
|
||||||
|
<a-button type="primary" :disabled="isDetail" @click="openProcessSelect">选择工序</a-button>
|
||||||
|
<a-button v-if="model.processOperationId && !isDetail" @click="clearProcess">清除</a-button>
|
||||||
|
</a-input-group>
|
||||||
|
</template>
|
||||||
|
<template #downtimeMainTypePicker="{ model, field }">
|
||||||
|
<a-input-group compact style="display: flex; width: 100%">
|
||||||
|
<a-input v-model:value="model[field]" read-only placeholder="请先选工序,再选主类型" style="flex: 1" />
|
||||||
|
<a-button type="primary" :disabled="isDetail || !model.processOperationId" @click="openMainTypeSelect">
|
||||||
|
选择主类型
|
||||||
|
</a-button>
|
||||||
|
<a-button v-if="model.downtimeMainTypeId && !isDetail" @click="clearMainType">清除</a-button>
|
||||||
|
</a-input-group>
|
||||||
|
</template>
|
||||||
|
<template #distinguishColorPicker="{ model, field }">
|
||||||
|
<div style="display: flex; align-items: center; gap: 12px; width: 100%">
|
||||||
|
<input
|
||||||
|
type="color"
|
||||||
|
:value="normalizeColorValue(model[field])"
|
||||||
|
:disabled="isDetail"
|
||||||
|
style="width: 48px; height: 32px; padding: 0; border: 1px solid #d9d9d9; cursor: pointer"
|
||||||
|
@input="(e) => onColorInput(model, field, e)"
|
||||||
|
/>
|
||||||
|
<a-input v-model:value="model[field]" :disabled="isDetail" placeholder="如 #1890ff" allow-clear style="flex: 1" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</BasicForm>
|
||||||
|
<MesXslProcessOperationSelectModal @register="registerProcessModal" @select="onProcessSelect" />
|
||||||
|
<MesXslDowntimeMainTypeSelectModal @register="registerMainTypeModal" @select="onMainTypeSelect" />
|
||||||
|
</BasicModal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed, ref, unref } from 'vue';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
|
||||||
|
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||||
|
import { formSchema } from '../MesXslDowntimeType.data';
|
||||||
|
import { saveOrUpdate } from '../MesXslDowntimeType.api';
|
||||||
|
import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue';
|
||||||
|
import MesXslDowntimeMainTypeSelectModal from './MesXslDowntimeMainTypeSelectModal.vue';
|
||||||
|
|
||||||
|
const { createMessage } = useMessage();
|
||||||
|
const emit = defineEmits(['register', 'success']);
|
||||||
|
const isUpdate = ref(true);
|
||||||
|
const isDetail = ref(false);
|
||||||
|
|
||||||
|
const [registerProcessModal, { openModal: openProcessModal }] = useModal();
|
||||||
|
const [registerMainTypeModal, { openModal: openMainTypeModal }] = useModal();
|
||||||
|
|
||||||
|
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = useForm({
|
||||||
|
labelWidth: 110,
|
||||||
|
schemas: formSchema,
|
||||||
|
showActionButtonGroup: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||||
|
await resetFields();
|
||||||
|
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
|
||||||
|
isUpdate.value = !!data?.isUpdate;
|
||||||
|
isDetail.value = !data?.showFooter;
|
||||||
|
if (unref(isUpdate)) await setFieldsValue({ ...data.record });
|
||||||
|
else await setFieldsValue({ status: '0', downtimeMaintenance: '0', displayOrder: 0 });
|
||||||
|
setProps({ disabled: !data?.showFooter });
|
||||||
|
});
|
||||||
|
|
||||||
|
const title = computed(() =>
|
||||||
|
!unref(isUpdate) ? '新增停机类型' : unref(isDetail) ? '停机类型详情' : '编辑停机类型',
|
||||||
|
);
|
||||||
|
|
||||||
|
function normalizeColorValue(val: unknown) {
|
||||||
|
const s = val == null ? '' : String(val).trim();
|
||||||
|
if (!s) {
|
||||||
|
return '#1890ff';
|
||||||
|
}
|
||||||
|
return s.startsWith('#') ? s : `#${s}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onColorInput(model: Recordable, field: string, e: Event) {
|
||||||
|
model[field] = (e.target as HTMLInputElement).value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function openProcessSelect() {
|
||||||
|
const vals = getFieldsValue();
|
||||||
|
openProcessModal(true, { processOperationId: vals.processOperationId });
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearProcess() {
|
||||||
|
setFieldsValue({
|
||||||
|
processOperationId: '',
|
||||||
|
processOperationName: '',
|
||||||
|
downtimeMainTypeId: '',
|
||||||
|
downtimeMainTypeName: '',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function onProcessSelect(payload: { processOperationId?: string; processOperationName?: string }) {
|
||||||
|
const vals = getFieldsValue();
|
||||||
|
const pid = payload.processOperationId || '';
|
||||||
|
if (vals.downtimeMainTypeId && vals.processOperationId && vals.processOperationId !== pid) {
|
||||||
|
setFieldsValue({
|
||||||
|
processOperationId: pid,
|
||||||
|
processOperationName: payload.processOperationName || '',
|
||||||
|
downtimeMainTypeId: '',
|
||||||
|
downtimeMainTypeName: '',
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setFieldsValue({
|
||||||
|
processOperationId: pid,
|
||||||
|
processOperationName: payload.processOperationName || '',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function openMainTypeSelect() {
|
||||||
|
const vals = getFieldsValue();
|
||||||
|
if (!vals.processOperationId) {
|
||||||
|
createMessage.warning('请先选择所属工序');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
openMainTypeModal(true, {
|
||||||
|
processOperationId: vals.processOperationId,
|
||||||
|
downtimeMainTypeId: vals.downtimeMainTypeId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearMainType() {
|
||||||
|
setFieldsValue({ downtimeMainTypeId: '', downtimeMainTypeName: '' });
|
||||||
|
}
|
||||||
|
|
||||||
|
function onMainTypeSelect(payload: { downtimeMainTypeId?: string; downtimeMainTypeName?: string }) {
|
||||||
|
setFieldsValue({
|
||||||
|
downtimeMainTypeId: payload.downtimeMainTypeId || '',
|
||||||
|
downtimeMainTypeName: payload.downtimeMainTypeName || '',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleSubmit() {
|
||||||
|
try {
|
||||||
|
const values = await validate();
|
||||||
|
setModalProps({ confirmLoading: true });
|
||||||
|
await saveOrUpdate(values, isUpdate.value);
|
||||||
|
closeModal();
|
||||||
|
emit('success');
|
||||||
|
} finally {
|
||||||
|
setModalProps({ confirmLoading: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user