Merge branch '生产及设备基础资料'

This commit is contained in:
2026-05-19 10:17:03 +08:00
34 changed files with 2031 additions and 69 deletions

View File

@@ -37,19 +37,22 @@ CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_main_type` (
SET @mes_tenant_id = 1002; SET @mes_tenant_id = 1002;
SET @mes_base_pid = ( SET @mes_equip_pid = (
SELECT MIN(`id`) FROM `sys_permission` SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料') WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
); );
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001'); SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
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`) 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()) VALUES ('1860000000000000119', @mes_equip_pid, '停机主类型', '/xslmes/mesXslDowntimeMainType', 'xslmes/mesXslDowntimeMainType/MesXslDowntimeMainTypeList', NULL, 1, NULL, '1', 9, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
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` = 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`); `keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`), `icon` = 'ant-design:partition-outlined';
UPDATE `sys_permission` SET `icon` = 'ant-design:partition-outlined' WHERE `id` = '1860000000000000119' AND `del_flag` = 0;
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`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
('1860000000000000120', '1860000000000000119', '新增', 2, 'mes:mes_xsl_downtime_main_type:add', '1', '1', 0, 'admin', NOW()), ('1860000000000000120', '1860000000000000119', '新增', 2, 'mes:mes_xsl_downtime_main_type:add', '1', '1', 0, 'admin', NOW()),

View File

@@ -45,19 +45,22 @@ CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_type` (
SET @mes_tenant_id = 1002; SET @mes_tenant_id = 1002;
SET @mes_base_pid = ( SET @mes_equip_pid = (
SELECT MIN(`id`) FROM `sys_permission` SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料') WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
); );
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001'); SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
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`) 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()) VALUES ('1860000000000000126', @mes_equip_pid, '停机类型', '/xslmes/mesXslDowntimeType', 'xslmes/mesXslDowntimeType/MesXslDowntimeTypeList', NULL, 1, NULL, '1', 10, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
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` = 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`); `keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`), `icon` = 'ant-design:pause-circle-outlined';
UPDATE `sys_permission` SET `icon` = 'ant-design:pause-circle-outlined' WHERE `id` = '1860000000000000126' AND `del_flag` = 0;
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`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
('1860000000000000127', '1860000000000000126', '新增', 2, 'mes:mes_xsl_downtime_type:add', '1', '1', 0, 'admin', NOW()), ('1860000000000000127', '1860000000000000126', '新增', 2, 'mes:mes_xsl_downtime_type:add', '1', '1', 0, 'admin', NOW()),

View File

@@ -56,14 +56,15 @@ WHERE d.`dict_code` = 'xslmes_equipment_maintain_distinct'
SET @mes_tenant_id = 1002; SET @mes_tenant_id = 1002;
SET @mes_base_pid = ( SET @mes_equip_pid = (
SELECT MIN(`id`) FROM `sys_permission` SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料') WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
); );
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001'); SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
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`) 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()) VALUES ('1860000000000000070', @mes_equip_pid, '设备类别', '/xslmes/mesXslEquipmentCategory', 'xslmes/mesXslEquipmentCategory/MesXslEquipmentCategoryList', NULL, 1, NULL, '1', 2, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
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`),

View File

@@ -0,0 +1,31 @@
-- 设备管理目录 MES管理 下迁出 MES基础资料 同级已执行旧版 mes-xsl-equipment-ledger-menu-permission 时用
SET NAMES utf8mb4;
SET @mes_equip_root_parent = (
SELECT `parent_id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
LIMIT 1
);
SET @mes_equip_root_parent = IFNULL(@mes_equip_root_parent, (
SELECT `parent_id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
LIMIT 1
));
SET @mes_equip_root_sort = IFNULL((
SELECT `sort_no` + 1 FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
ORDER BY `sort_no` DESC
LIMIT 1
), 51);
UPDATE `sys_permission`
SET
`parent_id` = @mes_equip_root_parent,
`sort_no` = @mes_equip_root_sort,
`menu_type` = 0,
`is_leaf` = 0,
`hidden` = 0,
`status` = '1',
`del_flag` = 0
WHERE `id` = '1860000000000000133';

View File

@@ -0,0 +1,131 @@
-- MES 设备台账字典 + 建表 + 设备管理目录菜单 + 设备台账菜单 + 按钮 + 租户 admin 授权可整文件一次执行
-- 权限前缀mes:mes_xsl_equipment_ledger:*
-- 父菜单设备管理目录 MES基础资料 同级 MES管理 子级子菜单设备台账
-- 修改租户 SET @mes_tenant_id新环境也可依赖 Flyway V3.9.2_72__mes_xsl_equipment_ledger.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_equipment_ledger_status', '在用/停用/报废', 0, 'admin', NOW(), 0, 0
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_equipment_ledger_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_equipment_ledger_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_equipment_ledger_status' 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', 3, 1, 'admin', NOW() FROM `sys_dict` d
WHERE d.`dict_code` = 'xslmes_equipment_ledger_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '2');
CREATE TABLE IF NOT EXISTS `mes_xsl_equipment_ledger` (
`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 '工序名称冗余',
`equipment_name` varchar(500) NOT NULL COMMENT '设备名称同租户未删除唯一',
`equipment_code` varchar(128) NOT NULL COMMENT '设备编号同租户未删除唯一',
`manufacturer_id` varchar(32) DEFAULT NULL COMMENT '所属设备厂家 mes_xsl_manufacturer.id',
`manufacturer_name` varchar(500) DEFAULT NULL COMMENT '设备厂家名称冗余',
`equipment_category_id` varchar(32) DEFAULT NULL COMMENT '设备类别 mes_xsl_equipment_category.id',
`equipment_category_name` varchar(500) DEFAULT NULL COMMENT '设备类别名称冗余',
`equipment_type_id` varchar(32) DEFAULT NULL COMMENT '设备类型 mes_xsl_equipment_type.id',
`equipment_type_name` varchar(500) DEFAULT NULL COMMENT '设备类型名称冗余',
`factory_id` varchar(32) DEFAULT NULL COMMENT '所属工厂厂家信息',
`factory_name` varchar(500) DEFAULT NULL COMMENT '所属工厂名称冗余',
`equipment_model` varchar(500) DEFAULT NULL COMMENT '设备型号',
`equipment_status` varchar(1) NOT NULL DEFAULT '0' COMMENT '设备状态 字典xslmes_equipment_ledger_status0在用1停用2报废',
`serial_no` varchar(500) DEFAULT NULL COMMENT '序列号',
`nameplate` varchar(500) DEFAULT NULL COMMENT '铭牌',
`maintain_dept_id` varchar(32) DEFAULT NULL COMMENT '维修部门 sys_depart.id',
`maintain_person` varchar(500) DEFAULT NULL COMMENT '维修人员',
`manage_dept_id` varchar(32) DEFAULT NULL COMMENT '主管部门 sys_depart.id',
`doc_file_no` varchar(500) DEFAULT NULL COMMENT '资料文件编号',
`production_date` date DEFAULT NULL COMMENT '生产日期',
`purchase_date` date DEFAULT NULL COMMENT '购买日期',
`use_date` date DEFAULT NULL COMMENT '使用日期',
`vendor_contact` varchar(500) DEFAULT NULL COMMENT '厂商联系人',
`asset_value` varchar(128) DEFAULT NULL COMMENT '价值',
`controlled_pda` varchar(500) DEFAULT NULL COMMENT '受控PDA',
`overproduction_ratio` varchar(128) DEFAULT NULL COMMENT '超产比率',
`effective_volume` varchar(128) DEFAULT NULL COMMENT '有效体积',
`enabled_flag` varchar(1) NOT NULL DEFAULT '1' COMMENT '是否启用 字典yn1是0否',
`equipment_desc` varchar(1000) DEFAULT NULL COMMENT '设备描述',
`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_mel_tenant_code` (`tenant_id`, `equipment_code`),
KEY `idx_mel_tenant_name` (`tenant_id`, `equipment_name`),
KEY `idx_mel_process` (`process_operation_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES设备台账';
SET @mes_tenant_id = 1002;
-- MES基础资料同级取其 parent_id通常为 NULL MES管理 并列
SET @mes_equip_root_parent = (
SELECT `parent_id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
LIMIT 1
);
SET @mes_equip_root_parent = IFNULL(@mes_equip_root_parent, (
SELECT `parent_id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
LIMIT 1
));
SET @mes_equip_root_sort = IFNULL((
SELECT `sort_no` + 1 FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
ORDER BY `sort_no` DESC
LIMIT 1
), 51);
UPDATE `sys_permission`
SET `is_leaf` = 0
WHERE `id` = '1860000000000000133' AND `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 ('1860000000000000133', @mes_equip_root_parent, '设备管理', '/xslmes/equipment', 'layouts/RouteView', 'MesEquipmentLayout', 0, NULL, '1', @mes_equip_root_sort, 1, 0, 0, '1', 0, 0, 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`), `icon` = 'ant-design:tool-outlined', `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
UPDATE `sys_permission` SET `icon` = 'ant-design:tool-outlined' WHERE `id` = '1860000000000000133' AND `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 ('1860000000000000134', '1860000000000000133', '设备台账', '/xslmes/mesXslEquipmentLedger', 'xslmes/mesXslEquipmentLedger/MesXslEquipmentLedgerList', 'MesXslEquipmentLedgerList', 1, NULL, '1', 1, 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`),
`is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
('1860000000000000135', '1860000000000000134', '新增', 2, 'mes:mes_xsl_equipment_ledger:add', '1', '1', 0, 'admin', NOW()),
('1860000000000000136', '1860000000000000134', '编辑', 2, 'mes:mes_xsl_equipment_ledger:edit', '1', '1', 0, 'admin', NOW()),
('1860000000000000137', '1860000000000000134', '删除', 2, 'mes:mes_xsl_equipment_ledger:delete', '1', '1', 0, 'admin', NOW()),
('1860000000000000138', '1860000000000000134', '批量删除', 2, 'mes:mes_xsl_equipment_ledger:deleteBatch', '1', '1', 0, 'admin', NOW()),
('1860000000000000139', '1860000000000000134', '导出', 2, 'mes:mes_xsl_equipment_ledger:exportXls', '1', '1', 0, 'admin', NOW()),
('1860000000000000140', '1860000000000000134', '导入', 2, 'mes:mes_xsl_equipment_ledger: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`),
`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 (
'1860000000000000133',
'1860000000000000134',
'1860000000000000135', '1860000000000000136', '1860000000000000137', '1860000000000000138',
'1860000000000000139', '1860000000000000140'
)
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
);

View File

@@ -0,0 +1,46 @@
-- MES 设备台账仅建表完整初始化请执行 mes-xsl-equipment-ledger-menu-permission.sql
SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS `mes_xsl_equipment_ledger` (
`id` varchar(32) NOT NULL COMMENT '主键',
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序',
`process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
`equipment_name` varchar(500) NOT NULL COMMENT '设备名称',
`equipment_code` varchar(128) NOT NULL COMMENT '设备编号',
`manufacturer_id` varchar(32) DEFAULT NULL COMMENT '所属设备厂家',
`manufacturer_name` varchar(500) DEFAULT NULL COMMENT '设备厂家名称冗余',
`equipment_category_id` varchar(32) DEFAULT NULL COMMENT '设备类别',
`equipment_category_name` varchar(500) DEFAULT NULL COMMENT '设备类别名称冗余',
`equipment_type_id` varchar(32) DEFAULT NULL COMMENT '设备类型',
`equipment_type_name` varchar(500) DEFAULT NULL COMMENT '设备类型名称冗余',
`factory_id` varchar(32) DEFAULT NULL COMMENT '所属工厂',
`factory_name` varchar(500) DEFAULT NULL COMMENT '所属工厂名称冗余',
`equipment_model` varchar(500) DEFAULT NULL COMMENT '设备型号',
`equipment_status` varchar(1) NOT NULL DEFAULT '0' COMMENT '设备状态',
`serial_no` varchar(500) DEFAULT NULL COMMENT '序列号',
`nameplate` varchar(500) DEFAULT NULL COMMENT '铭牌',
`maintain_dept_id` varchar(32) DEFAULT NULL COMMENT '维修部门',
`maintain_person` varchar(500) DEFAULT NULL COMMENT '维修人员',
`manage_dept_id` varchar(32) DEFAULT NULL COMMENT '主管部门',
`doc_file_no` varchar(500) DEFAULT NULL COMMENT '资料文件编号',
`production_date` date DEFAULT NULL COMMENT '生产日期',
`purchase_date` date DEFAULT NULL COMMENT '购买日期',
`use_date` date DEFAULT NULL COMMENT '使用日期',
`vendor_contact` varchar(500) DEFAULT NULL COMMENT '厂商联系人',
`asset_value` varchar(128) DEFAULT NULL COMMENT '价值',
`controlled_pda` varchar(500) DEFAULT NULL COMMENT '受控PDA',
`overproduction_ratio` varchar(128) DEFAULT NULL COMMENT '超产比率',
`effective_volume` varchar(128) DEFAULT NULL COMMENT '有效体积',
`enabled_flag` varchar(1) NOT NULL DEFAULT '1' COMMENT '是否启用',
`equipment_desc` varchar(1000) DEFAULT NULL COMMENT '设备描述',
`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 '删除标记',
PRIMARY KEY (`id`),
KEY `idx_mel_tenant_code` (`tenant_id`, `equipment_code`),
KEY `idx_mel_tenant_name` (`tenant_id`, `equipment_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES设备台账';

View File

@@ -0,0 +1,10 @@
-- 设备管理目录及指定子菜单图标可重复执行
SET NAMES utf8mb4;
UPDATE `sys_permission` SET `icon` = 'ant-design:tool-outlined' WHERE `id` = '1860000000000000133' AND `del_flag` = 0;
UPDATE `sys_permission` SET `icon` = 'ant-design:apartment-outlined' WHERE `id` = '1860000000000000091' AND `del_flag` = 0;
UPDATE `sys_permission` SET `icon` = 'ant-design:tags-outlined' WHERE `id` = '1860000000000000098' AND `del_flag` = 0;
UPDATE `sys_permission` SET `icon` = 'ant-design:shopping-outlined' WHERE `id` = '1860000000000000105' AND `del_flag` = 0;
UPDATE `sys_permission` SET `icon` = 'ant-design:shop-outlined' WHERE `id` = '1860000000000000112' AND `del_flag` = 0;
UPDATE `sys_permission` SET `icon` = 'ant-design:partition-outlined' WHERE `id` = '1860000000000000119' AND `del_flag` = 0;
UPDATE `sys_permission` SET `icon` = 'ant-design:pause-circle-outlined' WHERE `id` = '1860000000000000126' AND `del_flag` = 0;

View File

@@ -24,14 +24,15 @@ CREATE TABLE IF NOT EXISTS `mes_xsl_equipment_part` (
SET @mes_tenant_id = 1002; SET @mes_tenant_id = 1002;
SET @mes_base_pid = ( SET @mes_equip_pid = (
SELECT MIN(`id`) FROM `sys_permission` SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料') WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
); );
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001'); SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
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`) 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 ('1860000000000000084', @mes_base_pid, '设备部位', '/xslmes/mesXslEquipmentPart', 'xslmes/mesXslEquipmentPart/MesXslEquipmentPartList', NULL, 1, NULL, '1', 12, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW()) VALUES ('1860000000000000084', @mes_equip_pid, '设备部位', '/xslmes/mesXslEquipmentPart', 'xslmes/mesXslEquipmentPart/MesXslEquipmentPartList', NULL, 1, NULL, '1', 4, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
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`),

View File

@@ -27,19 +27,22 @@ CREATE TABLE IF NOT EXISTS `mes_xsl_equipment_sub_part` (
SET @mes_tenant_id = 1002; SET @mes_tenant_id = 1002;
SET @xslmes_root_pid = ( SET @mes_equip_pid = (
SELECT MIN(`id`) FROM `sys_permission` SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES XSL', 'XSLMES管理', 'XSLMES') WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
); );
SET @xslmes_root_pid = IFNULL(@xslmes_root_pid, '1900000000000000300'); SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
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`) 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 ('1860000000000000091', @xslmes_root_pid, '设备小部位', '/xslmes/mesXslEquipmentSubPart', 'xslmes/mesXslEquipmentSubPart/MesXslEquipmentSubPartList', NULL, 1, NULL, '1', 14, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW()) VALUES ('1860000000000000091', @mes_equip_pid, '设备小部位', '/xslmes/mesXslEquipmentSubPart', 'xslmes/mesXslEquipmentSubPart/MesXslEquipmentSubPartList', NULL, 1, NULL, '1', 5, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
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` = 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`); `keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`), `icon` = 'ant-design:apartment-outlined';
UPDATE `sys_permission` SET `icon` = 'ant-design:apartment-outlined' WHERE `id` = '1860000000000000091' AND `del_flag` = 0;
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`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
('1860000000000000092', '1860000000000000091', '新增', 2, 'mes:mes_xsl_equipment_sub_part:add', '1', '1', 0, 'admin', NOW()), ('1860000000000000092', '1860000000000000091', '新增', 2, 'mes:mes_xsl_equipment_sub_part:add', '1', '1', 0, 'admin', NOW()),

View File

@@ -1,26 +1,22 @@
-- 设备类型菜单/按钮补全并挂到 MES基础资料解决仅 UPDATE id 077 不存在菜单与权限均不显示 -- 设备类型菜单/按钮补全并挂到设备管理解决仅 UPDATE id 077 不存在菜单与权限均不显示
-- 可重复执行修改租户改 SET @mes_tenant_id -- 可重复执行修改租户改 SET @mes_tenant_id
SET NAMES utf8mb4; SET NAMES utf8mb4;
SET @mes_tenant_id = 1002; SET @mes_tenant_id = 1002;
SET @mes_base_pid = ( SET @mes_equip_pid = (
SELECT `id` FROM `sys_permission` SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料' WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1 LIMIT 1
); );
SET @mes_base_pid = IFNULL(@mes_base_pid, ( SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
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` UPDATE `sys_permission`
SET `is_leaf` = 0 SET `is_leaf` = 0
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料'); WHERE `id` = @mes_equip_pid;
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`) 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()) VALUES ('1860000000000000077', @mes_equip_pid, '设备类型', '/xslmes/mesXslEquipmentType', 'xslmes/mesXslEquipmentType/MesXslEquipmentTypeList', NULL, 1, NULL, '1', 3, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `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`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
@@ -39,7 +35,7 @@ ON DUPLICATE KEY UPDATE
`perms_type` = VALUES(`perms_type`), `is_leaf` = 1, `status` = '1', `del_flag` = 0; `perms_type` = VALUES(`perms_type`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
UPDATE `sys_permission` p UPDATE `sys_permission` p
INNER JOIN (SELECT @mes_base_pid AS `pid`) x ON 1 = 1 INNER JOIN (SELECT @mes_equip_pid AS `pid`) x ON 1 = 1
SET p.`parent_id` = x.`pid`, SET p.`parent_id` = x.`pid`,
p.`is_leaf` = 0, p.`is_leaf` = 0,
p.`url` = '/xslmes/mesXslEquipmentType', p.`url` = '/xslmes/mesXslEquipmentType',

View File

@@ -23,14 +23,15 @@ CREATE TABLE IF NOT EXISTS `mes_xsl_equipment_type` (
SET @mes_tenant_id = 1002; SET @mes_tenant_id = 1002;
SET @mes_base_pid = ( SET @mes_equip_pid = (
SELECT MIN(`id`) FROM `sys_permission` SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料') WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
); );
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001'); SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
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`) 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()) VALUES ('1860000000000000077', @mes_equip_pid, '设备类型', '/xslmes/mesXslEquipmentType', 'xslmes/mesXslEquipmentType/MesXslEquipmentTypeList', NULL, 1, NULL, '1', 3, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
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`),

View File

@@ -1,6 +1,6 @@
-- MES 厂家信息字典 + 建表 + 菜单 + 按钮 + 租户 admin 授权可整文件一次执行 -- MES 厂家信息字典 + 建表 + 菜单 + 按钮 + 租户 admin 授权可整文件一次执行
-- 权限前缀与 Controller前端 v-auth 一致mes:mes_xsl_manufacturer:* -- 权限前缀与 Controller前端 v-auth 一致mes:mes_xsl_manufacturer:*
-- 父菜单MES基础资料 / MES资料与备品件等脚本相同 @mes_base_pid修改租户改 SET @mes_tenant_id -- 父菜单设备管理@mes_equip_pid修改租户改 SET @mes_tenant_id
-- 新环境也可依赖 FlywayV3.9.2_63__mes_xsl_manufacturer.sql与本文内容一致重复执行幂等 -- 新环境也可依赖 FlywayV3.9.2_63__mes_xsl_manufacturer.sql与本文内容一致重复执行幂等
SET NAMES utf8mb4; SET NAMES utf8mb4;
@@ -47,19 +47,22 @@ CREATE TABLE IF NOT EXISTS `mes_xsl_manufacturer` (
SET @mes_tenant_id = 1002; SET @mes_tenant_id = 1002;
SET @mes_base_pid = ( SET @mes_equip_pid = (
SELECT MIN(`id`) FROM `sys_permission` SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料') WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
); );
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001'); SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
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`) 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 ('1860000000000000112', @mes_base_pid, '厂家信息', '/xslmes/mesXslManufacturer', 'xslmes/mesXslManufacturer/MesXslManufacturerList', NULL, 1, NULL, '1', 17, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW()) VALUES ('1860000000000000112', @mes_equip_pid, '厂家信息', '/xslmes/mesXslManufacturer', 'xslmes/mesXslManufacturer/MesXslManufacturerList', NULL, 1, NULL, '1', 8, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
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` = 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`); `keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`), `icon` = 'ant-design:shop-outlined';
UPDATE `sys_permission` SET `icon` = 'ant-design:shop-outlined' WHERE `id` = '1860000000000000112' AND `del_flag` = 0;
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`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
('1860000000000000113', '1860000000000000112', '新增', 2, 'mes:mes_xsl_manufacturer:add', '1', '1', 0, 'admin', NOW()), ('1860000000000000113', '1860000000000000112', '新增', 2, 'mes:mes_xsl_manufacturer:add', '1', '1', 0, 'admin', NOW()),

View File

@@ -0,0 +1,62 @@
-- 将设备类别/类型/部位/小部位备品件厂家停机类菜单挂到设备管理目录下工序管理仍留 MES基础资料
-- 前置已执行 mes-xsl-equipment-ledger-menu-permission.sql Flyway V3.9.2_72 创建设备管理目录 id=1860000000000000133
-- 修改租户 SET @mes_tenant_id
SET NAMES utf8mb4;
SET @mes_tenant_id = 1002;
SET @mes_equip_pid = (
SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
);
SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
UPDATE `sys_permission`
SET `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0
WHERE `id` = @mes_equip_pid;
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 1, `is_leaf` = 0 WHERE `id` = '1860000000000000134';
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 2, `is_leaf` = 0 WHERE `id` = '1860000000000000070';
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 3, `is_leaf` = 0 WHERE `id` = '1860000000000000077';
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 4, `is_leaf` = 0 WHERE `id` = '1860000000000000084';
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 5, `is_leaf` = 0 WHERE `id` = '1860000000000000091';
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 6, `is_leaf` = 0 WHERE `id` = '1860000000000000098';
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 7, `is_leaf` = 0 WHERE `id` = '1860000000000000105';
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 8, `is_leaf` = 0 WHERE `id` = '1860000000000000112';
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 9, `is_leaf` = 0 WHERE `id` = '1860000000000000119';
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 10, `is_leaf` = 0 WHERE `id` = '1860000000000000126';
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 (
@mes_equip_pid,
'1860000000000000134',
'1860000000000000070',
'1860000000000000071', '1860000000000000072', '1860000000000000073', '1860000000000000074', '1860000000000000075', '1860000000000000076',
'1860000000000000077',
'1860000000000000078', '1860000000000000079', '1860000000000000080', '1860000000000000081', '1860000000000000082', '1860000000000000083',
'1860000000000000084',
'1860000000000000085', '1860000000000000086', '1860000000000000087', '1860000000000000088', '1860000000000000089', '1860000000000000090',
'1860000000000000091',
'1860000000000000092', '1860000000000000093', '1860000000000000094', '1860000000000000095', '1860000000000000096', '1860000000000000097',
'1860000000000000098',
'1860000000000000099', '1860000000000000100', '1860000000000000101', '1860000000000000102', '1860000000000000103', '1860000000000000104',
'1860000000000000105',
'1860000000000000106', '1860000000000000107', '1860000000000000108', '1860000000000000109', '1860000000000000110', '1860000000000000111',
'1860000000000000112',
'1860000000000000113', '1860000000000000114', '1860000000000000115', '1860000000000000116', '1860000000000000117', '1860000000000000118',
'1860000000000000119',
'1860000000000000120', '1860000000000000121', '1860000000000000122', '1860000000000000123', '1860000000000000124', '1860000000000000125',
'1860000000000000126',
'1860000000000000127', '1860000000000000128', '1860000000000000129', '1860000000000000130', '1860000000000000131', '1860000000000000132',
'1860000000000000135', '1860000000000000136', '1860000000000000137', '1860000000000000138', '1860000000000000139', '1860000000000000140'
)
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
);

View File

@@ -1,4 +1,4 @@
-- 工序管理设备类别设备类型挂到MES基础资料修复权限树is_leaf与租户 admin 授权 -- 工序管理MES基础资料设备类别设备类型挂设备管理修复权限树is_leaf与租户 admin 授权
-- 适用菜单曾在 MES XSL 根下或 is_leaf=1 导致角色授权页不显示按钮权限 -- 适用菜单曾在 MES XSL 根下或 is_leaf=1 导致角色授权页不显示按钮权限
-- 修改租户 SET @mes_tenant_id -- 修改租户 SET @mes_tenant_id
SET NAMES utf8mb4; SET NAMES utf8mb4;
@@ -16,10 +16,21 @@ SET @mes_base_pid = IFNULL(@mes_base_pid, (
)); ));
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001'); SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
SET @mes_equip_pid = (
SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
);
SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
UPDATE `sys_permission` UPDATE `sys_permission`
SET `is_leaf` = 0 SET `is_leaf` = 0
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料'); WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料');
UPDATE `sys_permission`
SET `is_leaf` = 0
WHERE `id` = @mes_equip_pid;
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`) 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()) 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 ON DUPLICATE KEY UPDATE
@@ -37,7 +48,7 @@ ON DUPLICATE KEY UPDATE
`parent_id` = VALUES(`parent_id`), `perms` = VALUES(`perms`), `is_leaf` = 1, `status` = '1', `del_flag` = 0; `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`) 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()) VALUES ('1860000000000000070', @mes_equip_pid, '设备类别', '/xslmes/mesXslEquipmentCategory', 'xslmes/mesXslEquipmentCategory/MesXslEquipmentCategoryList', NULL, 1, NULL, '1', 2, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
`parent_id` = VALUES(`parent_id`), `url` = VALUES(`url`), `component` = VALUES(`component`), `parent_id` = VALUES(`parent_id`), `url` = VALUES(`url`), `component` = VALUES(`component`),
`is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0; `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
@@ -53,7 +64,7 @@ ON DUPLICATE KEY UPDATE
`parent_id` = VALUES(`parent_id`), `perms` = VALUES(`perms`), `is_leaf` = 1, `status` = '1', `del_flag` = 0; `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`) 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()) VALUES ('1860000000000000077', @mes_equip_pid, '设备类型', '/xslmes/mesXslEquipmentType', 'xslmes/mesXslEquipmentType/MesXslEquipmentTypeList', NULL, 1, NULL, '1', 3, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`),
`is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0; `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;

View File

@@ -1,4 +1,4 @@
-- 工序管理(060)设备类别(070)补全菜单/按钮 MES基础资料修复 is_leaf租户 admin 授权 -- 工序管理(060) MES基础资料设备类别(070)挂设备管理修复 is_leaf租户 admin 授权
-- 可重复执行修改租户改 SET @mes_tenant_id -- 可重复执行修改租户改 SET @mes_tenant_id
SET NAMES utf8mb4; SET NAMES utf8mb4;
@@ -15,10 +15,21 @@ SET @mes_base_pid = IFNULL(@mes_base_pid, (
)); ));
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001'); SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
SET @mes_equip_pid = (
SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
);
SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
UPDATE `sys_permission` UPDATE `sys_permission`
SET `is_leaf` = 0 SET `is_leaf` = 0
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料'); WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料');
UPDATE `sys_permission`
SET `is_leaf` = 0
WHERE `id` = @mes_equip_pid;
-- 工序管理 -- 工序管理
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`) 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()) VALUES ('1860000000000000060', @mes_base_pid, '工序管理', '/xslmes/mesXslProcessOperation', 'xslmes/mesXslProcessOperation/MesXslProcessOperationList', NULL, 1, NULL, '1', 9, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
@@ -42,7 +53,7 @@ UPDATE `sys_permission` SET `name` = '新增' WHERE `id` = '1860000000000000061'
-- 设备类别 -- 设备类别
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`) 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()) VALUES ('1860000000000000070', @mes_equip_pid, '设备类别', '/xslmes/mesXslEquipmentCategory', 'xslmes/mesXslEquipmentCategory/MesXslEquipmentCategoryList', NULL, 1, NULL, '1', 2, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `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`), `menu_type` = VALUES(`menu_type`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),

View File

@@ -26,19 +26,22 @@ CREATE TABLE IF NOT EXISTS `mes_xsl_spare_part` (
SET @mes_tenant_id = 1002; SET @mes_tenant_id = 1002;
SET @mes_base_pid = ( SET @mes_equip_pid = (
SELECT MIN(`id`) FROM `sys_permission` SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料') WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
); );
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001'); SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
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`) 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 ('1860000000000000105', @mes_base_pid, '备品件信息', '/xslmes/mesXslSparePart', 'xslmes/mesXslSparePart/MesXslSparePartList', NULL, 1, NULL, '1', 16, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW()) VALUES ('1860000000000000105', @mes_equip_pid, '备品件信息', '/xslmes/mesXslSparePart', 'xslmes/mesXslSparePart/MesXslSparePartList', NULL, 1, NULL, '1', 7, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
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` = 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`); `keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`), `icon` = 'ant-design:shopping-outlined';
UPDATE `sys_permission` SET `icon` = 'ant-design:shopping-outlined' WHERE `id` = '1860000000000000105' AND `del_flag` = 0;
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`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
('1860000000000000106', '1860000000000000105', '新增', 2, 'mes:mes_xsl_spare_part:add', '1', '1', 0, 'admin', NOW()), ('1860000000000000106', '1860000000000000105', '新增', 2, 'mes:mes_xsl_spare_part:add', '1', '1', 0, 'admin', NOW()),

View File

@@ -20,19 +20,22 @@ CREATE TABLE IF NOT EXISTS `mes_xsl_spare_parts_category` (
SET @mes_tenant_id = 1002; SET @mes_tenant_id = 1002;
SET @mes_base_pid = ( SET @mes_equip_pid = (
SELECT MIN(`id`) FROM `sys_permission` SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料') WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
); );
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001'); SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
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`) 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 ('1860000000000000098', @mes_base_pid, '备品件类别', '/xslmes/mesXslSparePartsCategory', 'xslmes/mesXslSparePartsCategory/MesXslSparePartsCategoryList', NULL, 1, NULL, '1', 15, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW()) VALUES ('1860000000000000098', @mes_equip_pid, '备品件类别', '/xslmes/mesXslSparePartsCategory', 'xslmes/mesXslSparePartsCategory/MesXslSparePartsCategoryList', NULL, 1, NULL, '1', 6, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
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` = 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`); `keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`), `icon` = 'ant-design:tags-outlined';
UPDATE `sys_permission` SET `icon` = 'ant-design:tags-outlined' WHERE `id` = '1860000000000000098' AND `del_flag` = 0;
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`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
('1860000000000000099', '1860000000000000098', '新增', 2, 'mes:mes_xsl_spare_parts_category:add', '1', '1', 0, 'admin', NOW()), ('1860000000000000099', '1860000000000000098', '新增', 2, 'mes:mes_xsl_spare_parts_category:add', '1', '1', 0, 'admin', NOW()),

View File

@@ -0,0 +1,319 @@
package org.jeecg.modules.xslmes.controller;
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 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.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentLedgerService;
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/mesXslEquipmentLedger")
@Slf4j
public class MesXslEquipmentLedgerController extends JeecgController<MesXslEquipmentLedger, IMesXslEquipmentLedgerService> {
private static final Set<String> EQUIPMENT_STATUS = Set.of("0", "1", "2");
private static final Set<String> ENABLED_FLAGS = Set.of("0", "1");
@Autowired
private IMesXslEquipmentLedgerService mesXslEquipmentLedgerService;
@Operation(summary = "MES设备台账-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslEquipmentLedger>> queryPageList(
MesXslEquipmentLedger model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslEquipmentLedger> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
Page<MesXslEquipmentLedger> page = new Page<>(pageNo, pageSize);
IPage<MesXslEquipmentLedger> pageList = mesXslEquipmentLedgerService.page(page, queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "MES设备台账-添加")
@Operation(summary = "MES设备台账-添加")
@RequiresPermissions("mes:mes_xsl_equipment_ledger:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody MesXslEquipmentLedger 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】设备台账保存前校验-----------
mesXslEquipmentLedgerService.save(model);
return Result.OK("添加成功!");
}
@AutoLog(value = "MES设备台账-编辑")
@Operation(summary = "MES设备台账-编辑")
@RequiresPermissions("mes:mes_xsl_equipment_ledger:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody MesXslEquipmentLedger 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】设备台账保存前校验-----------
mesXslEquipmentLedgerService.updateById(model);
return Result.OK("编辑成功!");
}
@AutoLog(value = "MES设备台账-删除")
@Operation(summary = "MES设备台账-通过id删除")
@RequiresPermissions("mes:mes_xsl_equipment_ledger:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
mesXslEquipmentLedgerService.removeById(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "MES设备台账-批量删除")
@Operation(summary = "MES设备台账-批量删除")
@RequiresPermissions("mes:mes_xsl_equipment_ledger:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
mesXslEquipmentLedgerService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@Operation(summary = "MES设备台账-通过id查询")
@GetMapping(value = "/queryById")
public Result<MesXslEquipmentLedger> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslEquipmentLedger entity = mesXslEquipmentLedgerService.getById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@Operation(summary = "校验设备编号是否重复")
@GetMapping(value = "/checkEquipmentCode")
public Result<String> checkEquipmentCode(
@RequestParam(name = "equipmentCode", required = true) String equipmentCode,
@RequestParam(name = "dataId", required = false) String dataId) {
if (oConvertUtils.isEmpty(equipmentCode) || equipmentCode.trim().isEmpty()) {
return Result.OK("该值可用!");
}
MesXslEquipmentLedger ctx = new MesXslEquipmentLedger();
if (mesXslEquipmentLedgerService.isEquipmentCodeDuplicated(equipmentCode.trim(), dataId, ctx)) {
return Result.error("设备编号不能重复");
}
return Result.OK("该值可用!");
}
@Operation(summary = "校验设备名称是否重复")
@GetMapping(value = "/checkEquipmentName")
public Result<String> checkEquipmentName(
@RequestParam(name = "equipmentName", required = true) String equipmentName,
@RequestParam(name = "dataId", required = false) String dataId) {
if (oConvertUtils.isEmpty(equipmentName) || equipmentName.trim().isEmpty()) {
return Result.OK("该值可用!");
}
MesXslEquipmentLedger ctx = new MesXslEquipmentLedger();
if (mesXslEquipmentLedgerService.isEquipmentNameDuplicated(equipmentName.trim(), dataId, ctx)) {
return Result.error("设备名称不能重复");
}
return Result.OK("该值可用!");
}
@RequiresPermissions("mes:mes_xsl_equipment_ledger:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslEquipmentLedger model) {
return super.exportXls(request, model, MesXslEquipmentLedger.class, "MES设备台账");
}
@RequiresPermissions("mes:mes_xsl_equipment_ledger:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
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<MesXslEquipmentLedger> list =
ExcelImportUtil.importExcel(file.getInputStream(), MesXslEquipmentLedger.class, params);
if (list == null) {
list = List.of();
}
Set<String> codesInFile = new HashSet<>();
Set<String> namesInFile = new HashSet<>();
for (int i = 0; i < list.size(); i++) {
MesXslEquipmentLedger row = list.get(i);
int rowNo = i + 1;
if (row == null) {
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
}
String err = validateImportRow(row, rowNo, codesInFile, namesInFile);
if (err != null) {
return Result.error(err);
}
}
long start = System.currentTimeMillis();
mesXslEquipmentLedgerService.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);
}
}
}
return Result.error("文件导入失败!");
}
//update-begin---author:jiangxh ---date:20260518 for【MES】设备台账保存与导入校验-----------
private String validateForSave(MesXslEquipmentLedger model, String excludeId) {
if (oConvertUtils.isEmpty(model.getProcessOperationId())) {
return "请选择所属工序";
}
if (oConvertUtils.isEmpty(model.getEquipmentName()) || model.getEquipmentName().trim().isEmpty()) {
return "设备名称不能为空";
}
String name = model.getEquipmentName().trim();
model.setEquipmentName(name);
if (mesXslEquipmentLedgerService.isEquipmentNameDuplicated(name, excludeId, model)) {
return "设备名称不能重复";
}
if (oConvertUtils.isEmpty(model.getEquipmentCode()) || model.getEquipmentCode().trim().isEmpty()) {
return "设备编号不能为空";
}
String code = model.getEquipmentCode().trim();
model.setEquipmentCode(code);
if (mesXslEquipmentLedgerService.isEquipmentCodeDuplicated(code, excludeId, model)) {
return "设备编号不能重复";
}
trimRelationNames(model);
String status = model.getEquipmentStatus();
if (oConvertUtils.isEmpty(status)) {
model.setEquipmentStatus("0");
} else {
status = status.trim();
if (!EQUIPMENT_STATUS.contains(status)) {
return "设备状态无效(须为在用/停用/报废)";
}
model.setEquipmentStatus(status);
}
String enabled = model.getEnabledFlag();
if (oConvertUtils.isEmpty(enabled)) {
model.setEnabledFlag("1");
} else {
enabled = enabled.trim();
if (!ENABLED_FLAGS.contains(enabled)) {
return "是否启用无效(须为是/否)";
}
model.setEnabledFlag(enabled);
}
return null;
}
private String validateImportRow(MesXslEquipmentLedger row, int rowNo, Set<String> codesInFile, Set<String> namesInFile) {
String code = row.getEquipmentCode();
if (code != null) {
code = code.trim();
}
if (oConvertUtils.isEmpty(code)) {
return "文件导入失败:第 " + rowNo + " 条设备编号不能为空";
}
row.setEquipmentCode(code);
if (!codesInFile.add(code)) {
return "文件导入失败:设备编号【" + code + "】在导入文件中重复";
}
if (mesXslEquipmentLedgerService.isEquipmentCodeDuplicated(code, null, row)) {
return "文件导入失败:第 " + rowNo + " 条设备编号【" + code + "】不能重复";
}
String name = row.getEquipmentName();
if (name != null) {
name = name.trim();
}
if (oConvertUtils.isEmpty(name)) {
return "文件导入失败:第 " + rowNo + " 条设备名称不能为空";
}
row.setEquipmentName(name);
if (!namesInFile.add(name)) {
return "文件导入失败:设备名称【" + name + "】在导入文件中重复";
}
if (mesXslEquipmentLedgerService.isEquipmentNameDuplicated(name, null, row)) {
return "文件导入失败:第 " + rowNo + " 条设备名称【" + name + "】不能重复";
}
trimRelationNames(row);
String status = row.getEquipmentStatus();
if (oConvertUtils.isEmpty(status)) {
row.setEquipmentStatus("0");
} else if (!EQUIPMENT_STATUS.contains(status.trim())) {
return "文件导入失败:第 " + rowNo + " 条设备状态无效";
} else {
row.setEquipmentStatus(status.trim());
}
String enabled = row.getEnabledFlag();
if (oConvertUtils.isEmpty(enabled)) {
row.setEnabledFlag("1");
} else if (!ENABLED_FLAGS.contains(enabled.trim())) {
return "文件导入失败:第 " + rowNo + " 条是否启用无效";
} else {
row.setEnabledFlag(enabled.trim());
}
return null;
}
private static void trimRelationNames(MesXslEquipmentLedger model) {
if (model.getProcessOperationName() != null) {
model.setProcessOperationName(model.getProcessOperationName().trim());
}
if (model.getManufacturerName() != null) {
model.setManufacturerName(model.getManufacturerName().trim());
}
if (model.getEquipmentCategoryName() != null) {
model.setEquipmentCategoryName(model.getEquipmentCategoryName().trim());
}
if (model.getEquipmentTypeName() != null) {
model.setEquipmentTypeName(model.getEquipmentTypeName().trim());
}
if (model.getFactoryName() != null) {
model.setFactoryName(model.getFactoryName().trim());
}
}
//update-end---author:jiangxh ---date:20260518 for【MES】设备台账保存与导入校验-----------
}

View File

@@ -0,0 +1,168 @@
package org.jeecg.modules.xslmes.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
/**
* MES 设备台账(表 mes_xsl_equipment_ledger
*/
@Data
@TableName("mes_xsl_equipment_ledger")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES设备台账")
public class MesXslEquipmentLedger implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
@Schema(description = "所属工序主键")
private String processOperationId;
@Excel(name = "工序名称", width = 20)
@Schema(description = "工序名称冗余")
private String processOperationName;
@Excel(name = "设备名称", width = 22)
@Schema(description = "设备名称(同租户未删除数据中唯一)")
private String equipmentName;
@Excel(name = "设备编号", width = 18)
@Schema(description = "设备编号(同租户未删除数据中唯一)")
private String equipmentCode;
@Schema(description = "所属设备厂家主键")
private String manufacturerId;
@Excel(name = "设备厂家", width = 20)
@Schema(description = "设备厂家名称冗余")
private String manufacturerName;
@Schema(description = "设备类别主键")
private String equipmentCategoryId;
@Excel(name = "设备类别", width = 16)
@Schema(description = "设备类别名称冗余")
private String equipmentCategoryName;
@Schema(description = "设备类型主键")
private String equipmentTypeId;
@Excel(name = "设备类型", width = 16)
@Schema(description = "设备类型名称冗余")
private String equipmentTypeName;
@Schema(description = "所属工厂主键(厂家信息)")
private String factoryId;
@Excel(name = "所属工厂", width = 20)
@Schema(description = "所属工厂名称冗余")
private String factoryName;
@Excel(name = "设备型号", width = 16)
@Schema(description = "设备型号")
private String equipmentModel;
@Excel(name = "设备状态", width = 12, dicCode = "xslmes_equipment_ledger_status")
@Dict(dicCode = "xslmes_equipment_ledger_status")
@Schema(description = "设备状态(字典:在用/停用/报废)")
private String equipmentStatus;
@Excel(name = "序列号", width = 18)
@Schema(description = "序列号")
private String serialNo;
@Excel(name = "铭牌", width = 18)
@Schema(description = "铭牌")
private String nameplate;
@Excel(name = "维修部门", width = 16, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Schema(description = "维修部门主键")
private String maintainDeptId;
@Excel(name = "维修人员", width = 12)
@Schema(description = "维修人员")
private String maintainPerson;
@Excel(name = "主管部门", width = 16, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Schema(description = "主管部门主键")
private String manageDeptId;
@Excel(name = "资料文件编号", width = 18)
@Schema(description = "资料文件编号")
private String docFileNo;
@Excel(name = "生产日期", width = 14, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Schema(description = "生产日期")
private Date productionDate;
@Excel(name = "购买日期", width = 14, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Schema(description = "购买日期")
private Date purchaseDate;
@Excel(name = "使用日期", width = 14, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Schema(description = "使用日期")
private Date useDate;
@Excel(name = "厂商联系人", width = 14)
@Schema(description = "厂商联系人")
private String vendorContact;
@Excel(name = "价值", width = 14)
@Schema(description = "价值")
private String assetValue;
@Excel(name = "受控PDA", width = 14)
@Schema(description = "受控PDA")
private String controlledPda;
@Excel(name = "超产比率", width = 12)
@Schema(description = "超产比率")
private String overproductionRatio;
@Excel(name = "有效体积", width = 12)
@Schema(description = "有效体积")
private String effectiveVolume;
@Excel(name = "是否启用", width = 10, dicCode = "yn")
@Dict(dicCode = "yn")
@Schema(description = "是否启用字典yn1是0否")
private String enabledFlag;
@Excel(name = "设备描述", width = 30)
@Schema(description = "设备描述")
private String equipmentDesc;
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;
}

View File

@@ -0,0 +1,6 @@
package org.jeecg.modules.xslmes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
public interface MesXslEquipmentLedgerMapper extends BaseMapper<MesXslEquipmentLedger> {}

View File

@@ -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.MesXslDowntimeMainType})、停机类型({@link org.jeecg.modules.xslmes.entity.MesXslDowntimeType})等。 * 包含:客户管理({@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.MesXslEquipmentLedger})、设备部位({@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;

View File

@@ -0,0 +1,11 @@
package org.jeecg.modules.xslmes.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
public interface IMesXslEquipmentLedgerService extends IService<MesXslEquipmentLedger> {
boolean isEquipmentCodeDuplicated(String equipmentCode, String excludeId, MesXslEquipmentLedger context);
boolean isEquipmentNameDuplicated(String equipmentName, String excludeId, MesXslEquipmentLedger context);
}

View File

@@ -0,0 +1,72 @@
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.MesXslEquipmentLedger;
import org.jeecg.modules.xslmes.mapper.MesXslEquipmentLedgerMapper;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentLedgerService;
import org.springframework.stereotype.Service;
@Service
public class MesXslEquipmentLedgerServiceImpl extends ServiceImpl<MesXslEquipmentLedgerMapper, MesXslEquipmentLedger>
implements IMesXslEquipmentLedgerService {
//update-begin---author:jiangxh ---date:20260518 for【MES】设备台账编号、名称同租户不可重复-----------
@Override
public boolean isEquipmentCodeDuplicated(String equipmentCode, String excludeId, MesXslEquipmentLedger context) {
return isFieldDuplicated(MesXslEquipmentLedger::getEquipmentCode, equipmentCode, excludeId, context);
}
@Override
public boolean isEquipmentNameDuplicated(String equipmentName, String excludeId, MesXslEquipmentLedger context) {
return isFieldDuplicated(MesXslEquipmentLedger::getEquipmentName, equipmentName, excludeId, context);
}
private boolean isFieldDuplicated(
com.baomidou.mybatisplus.core.toolkit.support.SFunction<MesXslEquipmentLedger, String> column,
String value,
String excludeId,
MesXslEquipmentLedger context) {
if (oConvertUtils.isEmpty(value)) {
return false;
}
Integer tenantId = resolveTenantId(context);
LambdaQueryWrapper<MesXslEquipmentLedger> w = new LambdaQueryWrapper<>();
w.eq(column, value.trim());
w.and(q -> q.eq(MesXslEquipmentLedger::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesXslEquipmentLedger::getDelFlag));
if (oConvertUtils.isNotEmpty(excludeId)) {
w.ne(MesXslEquipmentLedger::getId, excludeId);
}
if (tenantId != null) {
w.eq(MesXslEquipmentLedger::getTenantId, tenantId);
}
return this.count(w) > 0;
}
private static Integer resolveTenantId(MesXslEquipmentLedger 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】设备台账编号、名称同租户不可重复-----------
}

View File

@@ -246,6 +246,16 @@ 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 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】设备类型菜单补全 INSERT077 未建时仅 UPDATE 无效)--- -- author:jiangxh---date:20260518--for: 【MES】设备类型菜单补全 INSERT077 未建时仅 UPDATE 无效)---
jeecg-boot/db/mes-xsl-equipment-type-menu-fix.sql jeecg-boot/db/mes-xsl-equipment-type-menu-fix.sql
-- author:jiangxh---date:20260518--for: 【MES】设备管理及子菜单图标 ---
jeecg-boot/db/mes-xsl-equipment-menus-icon.sql
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_75__mes_xsl_equipment_menus_icon.sql
jeecg-boot/db/mes-xsl-equipment-ledger-menu-permission.sql
jeecg-boot/db/mes-xsl-equipment-sub-part-menu-permission.sql
jeecg-boot/db/mes-xsl-spare-parts-category-menu-permission.sql
jeecg-boot/db/mes-xsl-spare-part-menu-permission.sql
jeecg-boot/db/mes-xsl-manufacturer-menu-permission.sql
jeecg-boot/db/mes-xsl-downtime-main-type-menu-permission.sql
jeecg-boot/db/mes-xsl-downtime-type-menu-permission.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 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】工序管理/设备类别菜单与按钮权限补全及租户授权 --- -- author:jiangxh---date:20260518--for: 【MES】工序管理/设备类别菜单与按钮权限补全及租户授权 ---
jeecg-boot/db/mes-xsl-process-and-category-menu-fix.sql jeecg-boot/db/mes-xsl-process-and-category-menu-fix.sql
@@ -253,3 +263,49 @@ jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/
jeecg-boot/db/mes-process-operation-menu-permission.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-equipment-category-menu-permission.sql
jeecg-boot/db/mes-xsl-move-process-equipment-menus-to-mes-base.sql jeecg-boot/db/mes-xsl-move-process-equipment-menus-to-mes-base.sql
-- author:jiangxh---date:20260518--for: 【MES】设备台账管理建表、设备管理菜单、CRUD、编号名称唯一校验 ---
jeecg-boot/db/mes-xsl-equipment-ledger-menu-permission.sql
jeecg-boot/db/mes-xsl-equipment-ledger.sql
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_72__mes_xsl_equipment_ledger.sql
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslEquipmentLedger.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslEquipmentLedgerMapper.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslEquipmentLedgerService.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslEquipmentLedgerServiceImpl.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipmentLedgerController.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/package-info.java
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.api.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedgerList.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/components/MesXslEquipmentLedgerModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/components/MesXslManufacturerSelectModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/components/MesXslEquipmentTypeSelectModal.vue
-- author:jiangxh---date:20260518--for: 【MES】设备管理目录与 MES基础资料 同级(非 MES管理 子菜单) ---
jeecg-boot/db/mes-xsl-equipment-ledger-menu-permission.sql
jeecg-boot/db/mes-xsl-equipment-ledger-menu-parent-fix.sql
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_72__mes_xsl_equipment_ledger.sql
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_73__mes_xsl_equipment_mgmt_menu_parent_fix.sql
-- author:jiangxh---date:20260518--for: 【MES】设备类别/类型/部位/小部位、备品件、厂家、停机类菜单挂「设备管理」目录 ---
jeecg-boot/db/mes-xsl-move-menus-to-equipment-mgmt.sql
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_74__mes_xsl_move_menus_to_equipment_mgmt.sql
jeecg-boot/db/mes-xsl-equipment-category-menu-permission.sql
jeecg-boot/db/mes-xsl-equipment-type-menu-permission.sql
jeecg-boot/db/mes-xsl-equipment-part-menu-permission.sql
jeecg-boot/db/mes-xsl-equipment-sub-part-menu-permission.sql
jeecg-boot/db/mes-xsl-spare-parts-category-menu-permission.sql
jeecg-boot/db/mes-xsl-spare-part-menu-permission.sql
jeecg-boot/db/mes-xsl-manufacturer-menu-permission.sql
jeecg-boot/db/mes-xsl-downtime-main-type-menu-permission.sql
jeecg-boot/db/mes-xsl-downtime-type-menu-permission.sql
jeecg-boot/db/mes-xsl-move-process-equipment-menus-to-mes-base.sql
jeecg-boot/db/mes-xsl-process-and-category-menu-fix.sql
jeecg-boot/db/mes-xsl-equipment-type-menu-fix.sql
-- author:jiangxh---date:20260518--for: 【MES】设备管理及子菜单图标 ---
jeecg-boot/db/mes-xsl-equipment-menus-icon.sql
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_75__mes_xsl_equipment_menus_icon.sql
jeecg-boot/db/mes-xsl-equipment-ledger-menu-permission.sql
jeecg-boot/db/mes-xsl-equipment-sub-part-menu-permission.sql
jeecg-boot/db/mes-xsl-spare-parts-category-menu-permission.sql
jeecg-boot/db/mes-xsl-spare-part-menu-permission.sql
jeecg-boot/db/mes-xsl-manufacturer-menu-permission.sql
jeecg-boot/db/mes-xsl-downtime-main-type-menu-permission.sql
jeecg-boot/db/mes-xsl-downtime-type-menu-permission.sql

View File

@@ -0,0 +1,121 @@
-- MES 设备台账字典 + 建表 + 设备管理目录 + 设备台账菜单 + 按钮 + 租户 admin 授权
SET NAMES utf8mb4;
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
SELECT REPLACE(UUID(), '-', ''), 'MES设备台账状态', 'xslmes_equipment_ledger_status', '在用/停用/报废', 0, 'admin', NOW(), 0, 0
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_equipment_ledger_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_equipment_ledger_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_equipment_ledger_status' 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', 3, 1, 'admin', NOW() FROM `sys_dict` d
WHERE d.`dict_code` = 'xslmes_equipment_ledger_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '2');
CREATE TABLE IF NOT EXISTS `mes_xsl_equipment_ledger` (
`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 '工序名称冗余',
`equipment_name` varchar(500) NOT NULL COMMENT '设备名称同租户未删除唯一',
`equipment_code` varchar(128) NOT NULL COMMENT '设备编号同租户未删除唯一',
`manufacturer_id` varchar(32) DEFAULT NULL COMMENT '所属设备厂家 mes_xsl_manufacturer.id',
`manufacturer_name` varchar(500) DEFAULT NULL COMMENT '设备厂家名称冗余',
`equipment_category_id` varchar(32) DEFAULT NULL COMMENT '设备类别 mes_xsl_equipment_category.id',
`equipment_category_name` varchar(500) DEFAULT NULL COMMENT '设备类别名称冗余',
`equipment_type_id` varchar(32) DEFAULT NULL COMMENT '设备类型 mes_xsl_equipment_type.id',
`equipment_type_name` varchar(500) DEFAULT NULL COMMENT '设备类型名称冗余',
`factory_id` varchar(32) DEFAULT NULL COMMENT '所属工厂厂家信息',
`factory_name` varchar(500) DEFAULT NULL COMMENT '所属工厂名称冗余',
`equipment_model` varchar(500) DEFAULT NULL COMMENT '设备型号',
`equipment_status` varchar(1) NOT NULL DEFAULT '0' COMMENT '设备状态 字典xslmes_equipment_ledger_status0在用1停用2报废',
`serial_no` varchar(500) DEFAULT NULL COMMENT '序列号',
`nameplate` varchar(500) DEFAULT NULL COMMENT '铭牌',
`maintain_dept_id` varchar(32) DEFAULT NULL COMMENT '维修部门 sys_depart.id',
`maintain_person` varchar(500) DEFAULT NULL COMMENT '维修人员',
`manage_dept_id` varchar(32) DEFAULT NULL COMMENT '主管部门 sys_depart.id',
`doc_file_no` varchar(500) DEFAULT NULL COMMENT '资料文件编号',
`production_date` date DEFAULT NULL COMMENT '生产日期',
`purchase_date` date DEFAULT NULL COMMENT '购买日期',
`use_date` date DEFAULT NULL COMMENT '使用日期',
`vendor_contact` varchar(500) DEFAULT NULL COMMENT '厂商联系人',
`asset_value` varchar(128) DEFAULT NULL COMMENT '价值',
`controlled_pda` varchar(500) DEFAULT NULL COMMENT '受控PDA',
`overproduction_ratio` varchar(128) DEFAULT NULL COMMENT '超产比率',
`effective_volume` varchar(128) DEFAULT NULL COMMENT '有效体积',
`enabled_flag` varchar(1) NOT NULL DEFAULT '1' COMMENT '是否启用 字典yn1是0否',
`equipment_desc` varchar(1000) DEFAULT NULL COMMENT '设备描述',
`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_mel_tenant_code` (`tenant_id`, `equipment_code`),
KEY `idx_mel_tenant_name` (`tenant_id`, `equipment_name`),
KEY `idx_mel_process` (`process_operation_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES设备台账';
SET @mes_tenant_id = 1002;
SET @mes_equip_root_parent = (
SELECT `parent_id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
LIMIT 1
);
SET @mes_equip_root_parent = IFNULL(@mes_equip_root_parent, (
SELECT `parent_id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
LIMIT 1
));
SET @mes_equip_root_sort = IFNULL((
SELECT `sort_no` + 1 FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
ORDER BY `sort_no` DESC
LIMIT 1
), 51);
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 ('1860000000000000133', @mes_equip_root_parent, '设备管理', '/xslmes/equipment', 'layouts/RouteView', 'MesEquipmentLayout', 0, NULL, '1', @mes_equip_root_sort, 1, 0, 0, '1', 0, 0, 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`), `is_leaf` = 0, `hidden` = 0, `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 ('1860000000000000134', '1860000000000000133', '设备台账', '/xslmes/mesXslEquipmentLedger', 'xslmes/mesXslEquipmentLedger/MesXslEquipmentLedgerList', 'MesXslEquipmentLedgerList', 1, NULL, '1', 1, 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`),
`is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
('1860000000000000135', '1860000000000000134', '新增', 2, 'mes:mes_xsl_equipment_ledger:add', '1', '1', 0, 'admin', NOW()),
('1860000000000000136', '1860000000000000134', '编辑', 2, 'mes:mes_xsl_equipment_ledger:edit', '1', '1', 0, 'admin', NOW()),
('1860000000000000137', '1860000000000000134', '删除', 2, 'mes:mes_xsl_equipment_ledger:delete', '1', '1', 0, 'admin', NOW()),
('1860000000000000138', '1860000000000000134', '批量删除', 2, 'mes:mes_xsl_equipment_ledger:deleteBatch', '1', '1', 0, 'admin', NOW()),
('1860000000000000139', '1860000000000000134', '导出', 2, 'mes:mes_xsl_equipment_ledger:exportXls', '1', '1', 0, 'admin', NOW()),
('1860000000000000140', '1860000000000000134', '导入', 2, 'mes:mes_xsl_equipment_ledger: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`),
`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 (
'1860000000000000133',
'1860000000000000134',
'1860000000000000135', '1860000000000000136', '1860000000000000137', '1860000000000000138',
'1860000000000000139', '1860000000000000140'
)
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
);

View File

@@ -0,0 +1,31 @@
-- 设备管理目录与 MES基础资料 同级修正 V3.9.2_72 曾挂在 MES管理
SET NAMES utf8mb4;
SET @mes_equip_root_parent = (
SELECT `parent_id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
LIMIT 1
);
SET @mes_equip_root_parent = IFNULL(@mes_equip_root_parent, (
SELECT `parent_id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
LIMIT 1
));
SET @mes_equip_root_sort = IFNULL((
SELECT `sort_no` + 1 FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
ORDER BY `sort_no` DESC
LIMIT 1
), 51);
UPDATE `sys_permission`
SET
`parent_id` = @mes_equip_root_parent,
`sort_no` = @mes_equip_root_sort,
`menu_type` = 0,
`is_leaf` = 0,
`hidden` = 0,
`status` = '1',
`del_flag` = 0
WHERE `id` = '1860000000000000133';

View File

@@ -0,0 +1,60 @@
-- 设备相关子菜单挂到设备管理目录 db/mes-xsl-move-menus-to-equipment-mgmt.sql 一致
SET NAMES utf8mb4;
SET @mes_tenant_id = 1002;
SET @mes_equip_pid = (
SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
);
SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
UPDATE `sys_permission`
SET `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0
WHERE `id` = @mes_equip_pid;
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 1, `is_leaf` = 0 WHERE `id` = '1860000000000000134';
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 2, `is_leaf` = 0 WHERE `id` = '1860000000000000070';
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 3, `is_leaf` = 0 WHERE `id` = '1860000000000000077';
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 4, `is_leaf` = 0 WHERE `id` = '1860000000000000084';
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 5, `is_leaf` = 0 WHERE `id` = '1860000000000000091';
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 6, `is_leaf` = 0 WHERE `id` = '1860000000000000098';
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 7, `is_leaf` = 0 WHERE `id` = '1860000000000000105';
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 8, `is_leaf` = 0 WHERE `id` = '1860000000000000112';
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 9, `is_leaf` = 0 WHERE `id` = '1860000000000000119';
UPDATE `sys_permission` SET `parent_id` = @mes_equip_pid, `sort_no` = 10, `is_leaf` = 0 WHERE `id` = '1860000000000000126';
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 (
@mes_equip_pid,
'1860000000000000134',
'1860000000000000070',
'1860000000000000071', '1860000000000000072', '1860000000000000073', '1860000000000000074', '1860000000000000075', '1860000000000000076',
'1860000000000000077',
'1860000000000000078', '1860000000000000079', '1860000000000000080', '1860000000000000081', '1860000000000000082', '1860000000000000083',
'1860000000000000084',
'1860000000000000085', '1860000000000000086', '1860000000000000087', '1860000000000000088', '1860000000000000089', '1860000000000000090',
'1860000000000000091',
'1860000000000000092', '1860000000000000093', '1860000000000000094', '1860000000000000095', '1860000000000000096', '1860000000000000097',
'1860000000000000098',
'1860000000000000099', '1860000000000000100', '1860000000000000101', '1860000000000000102', '1860000000000000103', '1860000000000000104',
'1860000000000000105',
'1860000000000000106', '1860000000000000107', '1860000000000000108', '1860000000000000109', '1860000000000000110', '1860000000000000111',
'1860000000000000112',
'1860000000000000113', '1860000000000000114', '1860000000000000115', '1860000000000000116', '1860000000000000117', '1860000000000000118',
'1860000000000000119',
'1860000000000000120', '1860000000000000121', '1860000000000000122', '1860000000000000123', '1860000000000000124', '1860000000000000125',
'1860000000000000126',
'1860000000000000127', '1860000000000000128', '1860000000000000129', '1860000000000000130', '1860000000000000131', '1860000000000000132',
'1860000000000000135', '1860000000000000136', '1860000000000000137', '1860000000000000138', '1860000000000000139', '1860000000000000140'
)
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
);

View File

@@ -0,0 +1,10 @@
-- 设备管理目录及指定子菜单图标 db/mes-xsl-equipment-menus-icon.sql 一致
SET NAMES utf8mb4;
UPDATE `sys_permission` SET `icon` = 'ant-design:tool-outlined' WHERE `id` = '1860000000000000133' AND `del_flag` = 0;
UPDATE `sys_permission` SET `icon` = 'ant-design:apartment-outlined' WHERE `id` = '1860000000000000091' AND `del_flag` = 0;
UPDATE `sys_permission` SET `icon` = 'ant-design:tags-outlined' WHERE `id` = '1860000000000000098' AND `del_flag` = 0;
UPDATE `sys_permission` SET `icon` = 'ant-design:shopping-outlined' WHERE `id` = '1860000000000000105' AND `del_flag` = 0;
UPDATE `sys_permission` SET `icon` = 'ant-design:shop-outlined' WHERE `id` = '1860000000000000112' AND `del_flag` = 0;
UPDATE `sys_permission` SET `icon` = 'ant-design:partition-outlined' WHERE `id` = '1860000000000000119' AND `del_flag` = 0;
UPDATE `sys_permission` SET `icon` = 'ant-design:pause-circle-outlined' WHERE `id` = '1860000000000000126' AND `del_flag` = 0;

View File

@@ -0,0 +1,31 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslEquipmentLedger/list',
checkEquipmentCode = '/xslmes/mesXslEquipmentLedger/checkEquipmentCode',
checkEquipmentName = '/xslmes/mesXslEquipmentLedger/checkEquipmentName',
save = '/xslmes/mesXslEquipmentLedger/add',
edit = '/xslmes/mesXslEquipmentLedger/edit',
deleteOne = '/xslmes/mesXslEquipmentLedger/delete',
deleteBatch = '/xslmes/mesXslEquipmentLedger/deleteBatch',
importExcel = '/xslmes/mesXslEquipmentLedger/importExcel',
exportXls = '/xslmes/mesXslEquipmentLedger/exportXls',
queryById = '/xslmes/mesXslEquipmentLedger/queryById',
}
export const list = (params) => defHttp.get({ url: Api.list, params });
export const checkEquipmentCode = (params: { equipmentCode: string; dataId?: string }) =>
defHttp.get({ url: Api.checkEquipmentCode, params }, { successMessageMode: 'none', errorMessageMode: 'none' });
export const checkEquipmentName = (params: { equipmentName: string; dataId?: string }) =>
defHttp.get({ url: Api.checkEquipmentName, params }, { successMessageMode: 'none', errorMessageMode: 'none' });
export const deleteOne = (params, handleSuccess) => defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
export const batchDelete = (params, handleSuccess) => defHttp.delete({ url: Api.deleteBatch, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
export const saveOrUpdate = (params, isUpdate) => {
const url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url, params });
};
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
export const getExportUrl = Api.exportXls;
export const getImportUrl = Api.importExcel;

View File

@@ -0,0 +1,199 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
import { checkEquipmentCode, checkEquipmentName } from './MesXslEquipmentLedger.api';
const colHalf = { span: 12 };
export const columns: BasicColumn[] = [
{ title: '设备编号', align: 'center', dataIndex: 'equipmentCode', width: 130 },
{ title: '设备名称', align: 'center', dataIndex: 'equipmentName', width: 160 },
{ title: '工序', align: 'center', dataIndex: 'processOperationName', width: 120 },
{ title: '设备类别', align: 'center', dataIndex: 'equipmentCategoryName', width: 110 },
{ title: '设备类型', align: 'center', dataIndex: 'equipmentTypeName', width: 110 },
{ title: '设备厂家', align: 'center', dataIndex: 'manufacturerName', width: 120 },
{ title: '所属工厂', align: 'center', dataIndex: 'factoryName', width: 120 },
{ title: '设备状态', align: 'center', dataIndex: 'equipmentStatus_dictText', width: 90 },
{ title: '是否启用', align: 'center', dataIndex: 'enabledFlag_dictText', width: 90 },
{ title: '设备型号', align: 'center', dataIndex: 'equipmentModel', width: 110, defaultHidden: true },
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 165, defaultHidden: true },
];
export const searchFormSchema: FormSchema[] = [
{ label: '设备编号', field: 'equipmentCode', component: 'Input', colProps: { span: 6 } },
{ label: '设备名称', field: 'equipmentName', component: 'Input', colProps: { span: 6 } },
{ label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 6 } },
{
label: '设备状态',
field: 'equipmentStatus',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_equipment_ledger_status' },
colProps: { span: 6 },
},
{
label: '是否启用',
field: 'enabledFlag',
component: 'JDictSelectTag',
componentProps: { dictCode: 'yn' },
colProps: { span: 6 },
},
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{ label: '', field: 'processOperationId', component: 'Input', show: false },
{ label: '', field: 'manufacturerId', component: 'Input', show: false },
{ label: '', field: 'equipmentCategoryId', component: 'Input', show: false },
{ label: '', field: 'equipmentTypeId', component: 'Input', show: false },
{ label: '', field: 'factoryId', component: 'Input', show: false },
{
label: '所属工序',
field: 'processOperationName',
component: 'Input',
slot: 'processOperationPicker',
colProps: colHalf,
dynamicRules: () => [{ required: true, message: '请选择所属工序' }],
},
{
label: '设备编号',
field: 'equipmentCode',
component: 'Input',
colProps: colHalf,
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 checkEquipmentCode({ equipmentCode: v, dataId: model?.id });
return Promise.resolve();
} catch (e: any) {
return Promise.reject(e?.response?.data?.message || e?.message || '设备编号不能重复');
}
},
trigger: 'blur',
},
],
},
{
label: '设备名称',
field: 'equipmentName',
component: 'Input',
colProps: colHalf,
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 checkEquipmentName({ equipmentName: v, dataId: model?.id });
return Promise.resolve();
} catch (e: any) {
return Promise.reject(e?.response?.data?.message || e?.message || '设备名称不能重复');
}
},
trigger: 'blur',
},
],
},
{
label: '所属设备厂家',
field: 'manufacturerName',
component: 'Input',
slot: 'manufacturerPicker',
colProps: colHalf,
},
{
label: '设备类别',
field: 'equipmentCategoryName',
component: 'Input',
slot: 'equipmentCategoryPicker',
colProps: colHalf,
},
{
label: '设备类型',
field: 'equipmentTypeName',
component: 'Input',
slot: 'equipmentTypePicker',
colProps: colHalf,
},
{
label: '所属工厂',
field: 'factoryName',
component: 'Input',
slot: 'factoryPicker',
colProps: colHalf,
},
{ label: '设备型号', field: 'equipmentModel', component: 'Input', colProps: colHalf },
{
label: '设备状态',
field: 'equipmentStatus',
component: 'JDictSelectTag',
defaultValue: '0',
componentProps: { dictCode: 'xslmes_equipment_ledger_status' },
colProps: colHalf,
required: true,
},
{ label: '序列号', field: 'serialNo', component: 'Input', colProps: colHalf },
{ label: '铭牌', field: 'nameplate', component: 'Input', colProps: colHalf },
{
label: '维修部门',
field: 'maintainDeptId',
component: 'JSelectDept',
componentProps: { checkStrictly: true, multiple: false },
colProps: colHalf,
},
{ label: '维修人员', field: 'maintainPerson', component: 'Input', colProps: colHalf },
{
label: '主管部门',
field: 'manageDeptId',
component: 'JSelectDept',
componentProps: { checkStrictly: true, multiple: false },
colProps: colHalf,
},
{ label: '资料文件编号', field: 'docFileNo', component: 'Input', colProps: colHalf },
{
label: '生产日期',
field: 'productionDate',
component: 'DatePicker',
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } },
colProps: colHalf,
},
{
label: '购买日期',
field: 'purchaseDate',
component: 'DatePicker',
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } },
colProps: colHalf,
},
{
label: '使用日期',
field: 'useDate',
component: 'DatePicker',
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } },
colProps: colHalf,
},
{ label: '厂商联系人', field: 'vendorContact', component: 'Input', colProps: colHalf },
{ label: '价值', field: 'assetValue', component: 'Input', colProps: colHalf },
{ label: '受控PDA', field: 'controlledPda', component: 'Input', colProps: colHalf },
{ label: '超产比率', field: 'overproductionRatio', component: 'Input', colProps: colHalf },
{ label: '有效体积', field: 'effectiveVolume', component: 'Input', colProps: colHalf },
{
label: '是否启用',
field: 'enabledFlag',
component: 'JDictSelectTag',
defaultValue: '1',
componentProps: { dictCode: 'yn' },
colProps: colHalf,
required: true,
},
{
label: '设备描述',
field: 'equipmentDesc',
component: 'InputTextArea',
componentProps: { rows: 3 },
colProps: { span: 24 },
},
];

View File

@@ -0,0 +1,127 @@
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button type="primary" v-auth="'mes:mes_xsl_equipment_ledger:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
新增
</a-button>
<a-button
type="primary"
v-auth="'mes:mes_xsl_equipment_ledger:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
<j-upload-button
type="primary"
v-auth="'mes:mes_xsl_equipment_ledger: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_equipment_ledger: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_equipment_ledger:edit' },
]"
:dropDownActions="getDropDownAction(record)"
/>
</template>
</BasicTable>
<MesXslEquipmentLedgerModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" name="xslmes-mesXslEquipmentLedger" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import Icon from '/@/components/Icon';
import MesXslEquipmentLedgerModal from './components/MesXslEquipmentLedgerModal.vue';
import { columns, searchFormSchema } from './MesXslEquipmentLedger.data';
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipmentLedger.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 });
}
function handleDelete(record: Recordable) {
deleteOne({ id: record.id }, handleSuccess);
}
function batchHandleDelete() {
batchDelete({ ids: selectedRowKeys.value.join(',') }, handleSuccess);
}
function handleSuccess() {
reload();
selectedRowKeys.value = [];
}
function getDropDownAction(record: Recordable) {
return [
{ label: '详情', onClick: handleDetail.bind(null, record) },
{
label: '删除',
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
auth: 'mes:mes_xsl_equipment_ledger:delete',
},
];
}
</script>

View File

@@ -0,0 +1,243 @@
<template>
<BasicModal
v-bind="$attrs"
@register="registerModal"
destroyOnClose
:title="title"
:width="MODAL_WIDTH"
:maxHeight="modalContentMaxHeight"
wrap-class-name="mes-xsl-equipment-ledger-modal"
@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(model)">清除</a-button>
</a-input-group>
</template>
<template #manufacturerPicker="{ 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="openManufacturerSelect('manufacturer')">选择</a-button>
<a-button v-if="model.manufacturerId && !isDetail" @click="clearManufacturer(model)">清除</a-button>
</a-input-group>
</template>
<template #equipmentCategoryPicker="{ 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="openCategorySelect">选择</a-button>
<a-button v-if="model.equipmentCategoryId && !isDetail" @click="clearCategory(model)">清除</a-button>
</a-input-group>
</template>
<template #equipmentTypePicker="{ 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="openTypeSelect">选择</a-button>
<a-button v-if="model.equipmentTypeId && !isDetail" @click="clearType(model)">清除</a-button>
</a-input-group>
</template>
<template #factoryPicker="{ 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="openManufacturerSelect('factory')">选择</a-button>
<a-button v-if="model.factoryId && !isDetail" @click="clearFactory(model)">清除</a-button>
</a-input-group>
</template>
</BasicForm>
<MesXslProcessOperationSelectModal @register="registerProcessModal" @select="onProcessSelect" />
<MesXslManufacturerSelectModal
@register="registerManufacturerModal"
:modal-title="manufacturerModalTitle"
@select="onManufacturerSelect"
/>
<MesXslEquipmentCategorySelectModal @register="registerCategoryModal" @select="onCategorySelect" />
<MesXslEquipmentTypeSelectModal @register="registerTypeModal" @select="onTypeSelect" />
</BasicModal>
</template>
<script lang="ts" setup>
import { computed, ref, unref, onMounted } from 'vue';
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { formSchema } from '../MesXslEquipmentLedger.data';
import { saveOrUpdate } from '../MesXslEquipmentLedger.api';
import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue';
import MesXslManufacturerSelectModal from './MesXslManufacturerSelectModal.vue';
import MesXslEquipmentCategorySelectModal from '/@/views/xslmes/mesXslEquipmentType/components/MesXslEquipmentCategorySelectModal.vue';
import MesXslEquipmentTypeSelectModal from './MesXslEquipmentTypeSelectModal.vue';
const emit = defineEmits(['register', 'success']);
const isUpdate = ref(true);
const isDetail = ref(false);
/** 弹窗宽度;须配合 wrap-class-name 覆盖全局 .ant-modal{width:520px} */
const MODAL_WIDTH = 1200;
/** 仅纵向滚动(像素高度,供 ModalWrapper 使用);在基准高度上缩短 20% */
const MODAL_HEIGHT_SCALE = 0.8;
const modalContentMaxHeight = ref(Math.round(600 * MODAL_HEIGHT_SCALE));
onMounted(() => {
const base = Math.min(800, Math.max(480, window.innerHeight - 220));
modalContentMaxHeight.value = Math.round(base * MODAL_HEIGHT_SCALE);
});
const manufacturerPickTarget = ref<'manufacturer' | 'factory'>('manufacturer');
const manufacturerModalTitle = computed(() =>
manufacturerPickTarget.value === 'factory' ? '选择所属工厂' : '选择设备厂家',
);
const [registerProcessModal, { openModal: openProcessModal }] = useModal();
const [registerManufacturerModal, { openModal: openManufacturerModal }] = useModal();
const [registerCategoryModal, { openModal: openCategoryModal }] = useModal();
const [registerTypeModal, { openModal: openTypeModal }] = useModal();
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = useForm({
labelWidth: 110,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: { span: 12 },
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
await resetFields();
setModalProps({
width: MODAL_WIDTH,
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({ equipmentStatus: '0', enabledFlag: '1' });
setProps({ disabled: !data?.showFooter });
});
const title = computed(() =>
!unref(isUpdate) ? '新增设备台账' : unref(isDetail) ? '设备台账详情' : '编辑设备台账',
);
function openProcessSelect() {
const v = getFieldsValue();
openProcessModal(true, { processOperationId: v?.processOperationId });
}
function openManufacturerSelect(target: 'manufacturer' | 'factory') {
manufacturerPickTarget.value = target;
const v = getFieldsValue();
openManufacturerModal(true, {
manufacturerId: target === 'factory' ? v?.factoryId : v?.manufacturerId,
});
}
function openCategorySelect() {
const v = getFieldsValue();
openCategoryModal(true, { equipmentCategoryId: v?.equipmentCategoryId });
}
function openTypeSelect() {
const v = getFieldsValue();
openTypeModal(true, { equipmentTypeId: v?.equipmentTypeId });
}
function onProcessSelect(payload: Recordable) {
setFieldsValue({
processOperationId: payload.processOperationId,
processOperationName: payload.processOperationName,
});
}
function onManufacturerSelect(payload: Recordable) {
if (manufacturerPickTarget.value === 'factory') {
setFieldsValue({
factoryId: payload.manufacturerId,
factoryName: payload.manufacturerName,
});
} else {
setFieldsValue({
manufacturerId: payload.manufacturerId,
manufacturerName: payload.manufacturerName,
});
}
}
function onCategorySelect(payload: Recordable) {
setFieldsValue({
equipmentCategoryId: payload.equipmentCategoryId,
equipmentCategoryName: payload.equipmentCategoryName,
});
}
function onTypeSelect(payload: Recordable) {
setFieldsValue({
equipmentTypeId: payload.equipmentTypeId,
equipmentTypeName: payload.equipmentTypeName,
equipmentCategoryId: payload.equipmentCategoryId || getFieldsValue()?.equipmentCategoryId,
equipmentCategoryName: payload.equipmentCategoryName || getFieldsValue()?.equipmentCategoryName,
});
}
function clearProcess(model: Recordable) {
model.processOperationId = '';
model.processOperationName = '';
}
function clearManufacturer(model: Recordable) {
model.manufacturerId = '';
model.manufacturerName = '';
}
function clearFactory(model: Recordable) {
model.factoryId = '';
model.factoryName = '';
}
function clearCategory(model: Recordable) {
model.equipmentCategoryId = '';
model.equipmentCategoryName = '';
}
function clearType(model: Recordable) {
model.equipmentTypeId = '';
model.equipmentTypeName = '';
}
async function handleSubmit() {
try {
const values = await validate();
if (!values.processOperationId) {
return;
}
setModalProps({ confirmLoading: true });
await saveOrUpdate(values, isUpdate.value);
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>
<style lang="less">
/* 覆盖 jeecg components/Modal/src/index.less 中 .ant-modal { width: 520px } */
.ant-modal-wrap.mes-xsl-equipment-ledger-modal > .ant-modal,
.mes-xsl-equipment-ledger-modal .ant-modal {
width: min(1200px, calc(100vw - 48px)) !important;
max-width: min(1200px, calc(100vw - 48px)) !important;
}
.mes-xsl-equipment-ledger-modal {
.scroll-container .scrollbar__wrap {
overflow-x: hidden !important;
overflow-y: auto !important;
}
.scrollbar__view > div {
overflow-x: hidden;
}
}
</style>

View File

@@ -0,0 +1,94 @@
<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/mesXslEquipmentType/MesXslEquipmentType.api';
const emit = defineEmits(['register', 'select']);
const selectedRow = ref<Recordable | null>(null);
const [registerTable, { reload, getSelectRowKeys, getSelectRows, setSelectedRowKeys, clearSelectedRowKeys }] = useTable({
api: list,
columns: [
{ title: '类型名称', dataIndex: 'typeName', width: 160 },
{ title: '工序名称', dataIndex: 'processOperationName', width: 160 },
{ title: '设备类别', dataIndex: 'equipmentCategoryName', width: 160 },
],
rowKey: 'id',
useSearchForm: true,
formConfig: {
labelWidth: 90,
schemas: [
{ label: '类型名称', field: 'typeName', component: 'Input', colProps: { span: 8 } },
{ label: '类别名称', field: 'equipmentCategoryName', component: 'Input', colProps: { span: 8 } },
],
},
pagination: { pageSize: 10 },
canResize: false,
showIndexColumn: false,
immediate: true,
rowSelection: {
type: 'radio',
columnWidth: 48,
onChange: (_keys, rows) => {
selectedRow.value = rows?.[0] ?? null;
},
},
clickToRowSelect: true,
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
selectedRow.value = null;
clearSelectedRowKeys?.();
setModalProps({ confirmLoading: false });
const tid = data?.equipmentTypeId as string | undefined;
if (tid) {
setSelectedRowKeys?.([tid]);
try {
const raw = await queryById({ id: tid });
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', {
equipmentTypeId: '',
equipmentTypeName: '',
equipmentCategoryId: '',
equipmentCategoryName: '',
});
closeModal();
return;
}
emit('select', {
equipmentTypeId: row.id,
equipmentTypeName: row.typeName || '',
equipmentCategoryId: row.equipmentCategoryId || '',
equipmentCategoryName: row.equipmentCategoryName || '',
});
closeModal();
}
</script>

View File

@@ -0,0 +1,95 @@
<template>
<BasicModal v-bind="$attrs" :title="title" :width="900" @register="registerModal" @ok="handleOk">
<BasicTable @register="registerTable" />
</BasicModal>
</template>
<script lang="ts" setup>
import { computed, ref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicTable, useTable } from '/@/components/Table';
import { list, queryById } from '/@/views/xslmes/mesXslManufacturer/MesXslManufacturer.api';
const props = defineProps<{ modalTitle?: string }>();
const emit = defineEmits(['register', 'select']);
const title = computed(() => props.modalTitle || '选择厂家信息');
const selectedRow = ref<Recordable | null>(null);
const [registerTable, { reload, getSelectRowKeys, getSelectRows, setSelectedRowKeys, clearSelectedRowKeys }] = useTable({
api: list,
columns: [
{ title: '厂家类别', dataIndex: 'manufacturerCategory_dictText', width: 120 },
{ title: '厂家名称', dataIndex: 'manufacturerName', width: 200 },
{ title: '是否有效', dataIndex: 'validStatus_dictText', width: 90 },
],
rowKey: 'id',
useSearchForm: true,
formConfig: {
labelWidth: 90,
schemas: [
{
label: '厂家类别',
field: 'manufacturerCategory',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_manufacturer_category' },
colProps: { span: 8 },
},
{ label: '厂家名称', field: 'manufacturerName', component: 'Input', colProps: { span: 8 } },
],
},
pagination: { pageSize: 10 },
canResize: false,
showIndexColumn: false,
immediate: true,
rowSelection: {
type: 'radio',
columnWidth: 48,
onChange: (_keys, rows) => {
selectedRow.value = rows?.[0] ?? null;
},
},
clickToRowSelect: true,
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
selectedRow.value = null;
clearSelectedRowKeys?.();
setModalProps({ confirmLoading: false });
const mid = data?.manufacturerId 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', { manufacturerId: '', manufacturerName: '' });
closeModal();
return;
}
emit('select', {
manufacturerId: row.id,
manufacturerName: row.manufacturerName || '',
});
closeModal();
}
</script>