Compare commits
38 Commits
b496a03190
...
SCADA系统测试
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67ca5287e2 | ||
|
|
50b74f484f | ||
|
|
a102ed46f2 | ||
|
|
2ed796c1a1 | ||
| 4a4bcb3fab | |||
| a1181e49fc | |||
|
|
c11f3104cb | ||
| 5800b6b61c | |||
|
|
878961649d | ||
|
|
9461ba39e0 | ||
| 36015f26d9 | |||
| 6733f5f641 | |||
| 23a6b717d7 | |||
| f2bfb001f2 | |||
|
|
2ffb3b4ebe | ||
| a22a573c0d | |||
|
|
21ffca5ded | ||
|
|
4571208ad9 | ||
|
|
5b3c59b632 | ||
|
|
890f7ea666 | ||
|
|
2e034eb6f2 | ||
|
|
8032f4c39c | ||
| e3b6915fbe | |||
| 530a0f13e7 | |||
|
|
3bfaec8cbc | ||
|
|
1b280af9e2 | ||
| 576bbfabdf | |||
| f2ca204147 | |||
| cfd7ca0a7e | |||
|
|
cea4781397 | ||
|
|
9201c7ca15 | ||
| f4d2ef21c8 | |||
| 44c6527a84 | |||
| 504dced34b | |||
| e7654ef0f6 | |||
| 31de1a0968 | |||
| 965bdf44db | |||
| 7b573cebdd |
@@ -148,3 +148,60 @@ WHERE id IN (
|
||||
'1860000000000000041',
|
||||
'1860000000000000051'
|
||||
);
|
||||
|
||||
-- ======================================================
|
||||
-- 新增菜单:原材料检验项目
|
||||
-- ======================================================
|
||||
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 ('1860000000000000061', '1860000000000000001', '原材料检验项目', '/mes/rawmaterialinspectitem', 'mes/material/MesRawMaterialInspectItemList', 'MesRawMaterialInspectItemList', 1, NULL, '1', 6, 1, 1, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id=VALUES(parent_id), name=VALUES(name), url=VALUES(url), component=VALUES(component), component_name=VALUES(component_name),
|
||||
menu_type=VALUES(menu_type), perms=VALUES(perms), perms_type=VALUES(perms_type), sort_no=VALUES(sort_no),
|
||||
is_route=VALUES(is_route), is_leaf=VALUES(is_leaf), hidden=VALUES(hidden), status=VALUES(status), del_flag=VALUES(del_flag),
|
||||
keep_alive=VALUES(keep_alive), internal_or_external=VALUES(internal_or_external);
|
||||
INSERT INTO sys_permission(id,parent_id,name,menu_type,perms,perms_type,status,del_flag,create_by,create_time) VALUES
|
||||
('1860000000000000062','1860000000000000061','新增',2,'mes:mes_raw_material_inspect_item:add','1','1',0,'admin',NOW()),
|
||||
('1860000000000000063','1860000000000000061','编辑',2,'mes:mes_raw_material_inspect_item:edit','1','1',0,'admin',NOW()),
|
||||
('1860000000000000064','1860000000000000061','删除',2,'mes:mes_raw_material_inspect_item:delete','1','1',0,'admin',NOW()),
|
||||
('1860000000000000065','1860000000000000061','批量删除',2,'mes:mes_raw_material_inspect_item:deleteBatch','1','1',0,'admin',NOW()),
|
||||
('1860000000000000066','1860000000000000061','导出',2,'mes:mes_raw_material_inspect_item:exportXls','1','1',0,'admin',NOW()),
|
||||
('1860000000000000067','1860000000000000061','导入',2,'mes:mes_raw_material_inspect_item:importExcel','1','1',0,'admin',NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id=VALUES(parent_id), name=VALUES(name), menu_type=VALUES(menu_type), perms=VALUES(perms), perms_type=VALUES(perms_type),
|
||||
status=VALUES(status), del_flag=VALUES(del_flag);
|
||||
|
||||
-- ======================================================
|
||||
-- 新增菜单:原材料检验标准
|
||||
-- ======================================================
|
||||
INSERT INTO sys_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 ('1860000000000000071', '1860000000000000001', '原材料检验标准', '/mes/rawmaterialinspectstd', 'mes/material/MesRawMaterialInspectStdList', 'MesRawMaterialInspectStdList', 1, NULL, '1', 7, 1, 1, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id=VALUES(parent_id), name=VALUES(name), url=VALUES(url), component=VALUES(component), component_name=VALUES(component_name),
|
||||
menu_type=VALUES(menu_type), perms=VALUES(perms), perms_type=VALUES(perms_type), sort_no=VALUES(sort_no),
|
||||
is_route=VALUES(is_route), is_leaf=VALUES(is_leaf), hidden=VALUES(hidden), status=VALUES(status), del_flag=VALUES(del_flag),
|
||||
keep_alive=VALUES(keep_alive), internal_or_external=VALUES(internal_or_external);
|
||||
INSERT INTO sys_permission(id,parent_id,name,menu_type,perms,perms_type,status,del_flag,create_by,create_time) VALUES
|
||||
('1860000000000000072','1860000000000000071','新增',2,'mes:mes_raw_material_inspect_std:add','1','1',0,'admin',NOW()),
|
||||
('1860000000000000073','1860000000000000071','编辑',2,'mes:mes_raw_material_inspect_std:edit','1','1',0,'admin',NOW()),
|
||||
('1860000000000000074','1860000000000000071','删除',2,'mes:mes_raw_material_inspect_std:delete','1','1',0,'admin',NOW()),
|
||||
('1860000000000000075','1860000000000000071','批量删除',2,'mes:mes_raw_material_inspect_std:deleteBatch','1','1',0,'admin',NOW()),
|
||||
('1860000000000000076','1860000000000000071','启用停用',2,'mes:mes_raw_material_inspect_std:enable','1','1',0,'admin',NOW()),
|
||||
('1860000000000000077','1860000000000000071','导出',2,'mes:mes_raw_material_inspect_std:exportXls','1','1',0,'admin',NOW()),
|
||||
('1860000000000000078','1860000000000000071','导入',2,'mes:mes_raw_material_inspect_std:importExcel','1','1',0,'admin',NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id=VALUES(parent_id), name=VALUES(name), menu_type=VALUES(menu_type), perms=VALUES(perms), perms_type=VALUES(perms_type),
|
||||
status=VALUES(status), del_flag=VALUES(del_flag);
|
||||
|
||||
-- 新增菜单授权:admin
|
||||
INSERT INTO sys_role_permission(id, role_id, permission_id, operate_date, operate_ip)
|
||||
SELECT REPLACE(UUID(),'-',''), 'f6817f48af4fb3af11b9e8bf182f618b', p.id, NOW(), '127.0.0.1'
|
||||
FROM sys_permission p
|
||||
WHERE p.id IN (
|
||||
'1860000000000000061','1860000000000000062','1860000000000000063','1860000000000000064','1860000000000000065','1860000000000000066','1860000000000000067',
|
||||
'1860000000000000071','1860000000000000072','1860000000000000073','1860000000000000074','1860000000000000075','1860000000000000076','1860000000000000077','1860000000000000078'
|
||||
) AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM sys_role_permission rp
|
||||
WHERE rp.role_id = 'f6817f48af4fb3af11b9e8bf182f618b'
|
||||
AND rp.permission_id = p.id
|
||||
);
|
||||
|
||||
63
jeecg-boot/db/mes-process-operation-menu-permission.sql
Normal file
63
jeecg-boot/db/mes-process-operation-menu-permission.sql
Normal file
@@ -0,0 +1,63 @@
|
||||
-- MES 工序管理:建表 + 菜单 + 按钮权限 + 租户 admin 授权(可整文件一次执行)
|
||||
-- 权限前缀与 Controller、前端 v-auth 一致:mes:mes_process_operation:*
|
||||
-- 修改租户:改 SET @mes_tenant_id;仅建表可只执行下面 CREATE 段或单独文件 mes-process-operation.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_process_operation` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`operation_code` varchar(64) NOT NULL COMMENT '工序编码',
|
||||
`operation_name` varchar(128) NOT NULL COMMENT '工序名称',
|
||||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mpo_operation_code` (`operation_code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES工序管理';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000060', @mes_base_pid, '工序管理', '/xslmes/mesXslProcessOperation', 'xslmes/mesXslProcessOperation/MesXslProcessOperationList', NULL, 1, NULL, '1', 9, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000061', '1860000000000000060', '新增', 2, 'mes:mes_process_operation:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000062', '1860000000000000060', '编辑', 2, 'mes:mes_process_operation:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000063', '1860000000000000060', '删除', 2, 'mes:mes_process_operation:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000064', '1860000000000000060', '批量删除', 2, 'mes:mes_process_operation:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000065', '1860000000000000060', '导出', 2, 'mes:mes_process_operation:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000066', '1860000000000000060', '导入', 2, 'mes:mes_process_operation:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000060',
|
||||
'1860000000000000061', '1860000000000000062', '1860000000000000063', '1860000000000000064',
|
||||
'1860000000000000065', '1860000000000000066'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
18
jeecg-boot/db/mes-process-operation.sql
Normal file
18
jeecg-boot/db/mes-process-operation.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- 仅建表(与 Flyway V3.9.2_53 表结构一致)。建表+菜单+授权请执行 mes-process-operation-menu-permission.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_process_operation` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`operation_code` varchar(64) NOT NULL COMMENT '工序编码',
|
||||
`operation_name` varchar(128) NOT NULL COMMENT '工序名称',
|
||||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mpo_operation_code` (`operation_code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES工序管理';
|
||||
79
jeecg-boot/db/mes-xsl-downtime-main-type-menu-permission.sql
Normal file
79
jeecg-boot/db/mes-xsl-downtime-main-type-menu-permission.sql
Normal file
@@ -0,0 +1,79 @@
|
||||
-- MES 停机主类型:字典 + 建表 + 菜单 + 按钮 + 租户 admin 授权(可整文件一次执行)
|
||||
-- 权限前缀与 Controller、前端 v-auth 一致:mes:mes_xsl_downtime_main_type:*
|
||||
-- 父菜单:MES基础资料 / MES资料;修改租户改 SET @mes_tenant_id
|
||||
-- 新环境也可依赖 Flyway:V3.9.2_64__mes_xsl_downtime_main_type.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES停机主类型是否启用', 'xslmes_downtime_main_type_status', '0启用1停用', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_downtime_main_type_status' AND `del_flag` = 0);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '启用', '0', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_main_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '0');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '停用', '1', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_main_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_main_type` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序 mes_xsl_process_operation.id',
|
||||
`process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
|
||||
`downtime_type` varchar(500) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||
`display_order` int NOT NULL DEFAULT '0' COMMENT '显示顺序(升序)',
|
||||
`distinguish_color` varchar(500) DEFAULT NULL COMMENT '区分颜色(十六进制色值,如#1890ff)',
|
||||
`status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_downtime_main_type_status:0启用1停用)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mdmt_tenant_type` (`tenant_id`, `downtime_type`),
|
||||
KEY `idx_mdmt_process` (`process_operation_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机主类型';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000119', @mes_base_pid, '停机主类型', '/xslmes/mesXslDowntimeMainType', 'xslmes/mesXslDowntimeMainType/MesXslDowntimeMainTypeList', NULL, 1, NULL, '1', 18, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000120', '1860000000000000119', '新增', 2, 'mes:mes_xsl_downtime_main_type:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000121', '1860000000000000119', '编辑', 2, 'mes:mes_xsl_downtime_main_type:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000122', '1860000000000000119', '删除', 2, 'mes:mes_xsl_downtime_main_type:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000123', '1860000000000000119', '批量删除', 2, 'mes:mes_xsl_downtime_main_type:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000124', '1860000000000000119', '导出', 2, 'mes:mes_xsl_downtime_main_type:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000125', '1860000000000000119', '导入', 2, 'mes:mes_xsl_downtime_main_type:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000119',
|
||||
'1860000000000000120', '1860000000000000121', '1860000000000000122', '1860000000000000123',
|
||||
'1860000000000000124', '1860000000000000125'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
22
jeecg-boot/db/mes-xsl-downtime-main-type.sql
Normal file
22
jeecg-boot/db/mes-xsl-downtime-main-type.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
-- 仅建表 mes_xsl_downtime_main_type。完整初始化请执行 mes-xsl-downtime-main-type-menu-permission.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_main_type` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序 mes_xsl_process_operation.id',
|
||||
`process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
|
||||
`downtime_type` varchar(500) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||
`display_order` int NOT NULL DEFAULT '0' COMMENT '显示顺序(升序)',
|
||||
`distinguish_color` varchar(500) DEFAULT NULL COMMENT '区分颜色(十六进制色值,如#1890ff)',
|
||||
`status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_downtime_main_type_status:0启用1停用)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mdmt_tenant_type` (`tenant_id`, `downtime_type`),
|
||||
KEY `idx_mdmt_process` (`process_operation_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机主类型';
|
||||
87
jeecg-boot/db/mes-xsl-downtime-type-menu-permission.sql
Normal file
87
jeecg-boot/db/mes-xsl-downtime-type-menu-permission.sql
Normal file
@@ -0,0 +1,87 @@
|
||||
-- MES 停机类型:字典 + 建表 + 菜单 + 按钮 + 租户 admin 授权(可整文件一次执行)
|
||||
-- 权限前缀:mes:mes_xsl_downtime_type:*
|
||||
-- 依赖:mes_xsl_process_operation、mes_xsl_downtime_main_type;父菜单 MES基础资料
|
||||
-- Flyway:V3.9.2_65__mes_xsl_downtime_type.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
-- 责任区分、故障等级为手填,不初始化字典;已上线库请执行 mes-xsl-downtime-type-remove-unused-dict.sql
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES停机类型是否启用', 'xslmes_downtime_type_status', '0启用1停用', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_downtime_type_status' AND `del_flag` = 0);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '启用', '0', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '0');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '停用', '1', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_downtime_type_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_type` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序 mes_xsl_process_operation.id',
|
||||
`process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
|
||||
`downtime_main_type_id` varchar(32) NOT NULL COMMENT '所属主类型 mes_xsl_downtime_main_type.id',
|
||||
`downtime_main_type_name` varchar(500) DEFAULT NULL COMMENT '主类型名称冗余(停机主类型.downtime_type)',
|
||||
`downtime_type` varchar(500) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||
`display_order` int NOT NULL DEFAULT '0' COMMENT '显示顺序(升序,必填)',
|
||||
`distinguish_color` varchar(500) DEFAULT NULL COMMENT '区分颜色(十六进制色值)',
|
||||
`responsibility_distinct` varchar(500) DEFAULT NULL COMMENT '责任区分(手填)',
|
||||
`fault_level` varchar(500) DEFAULT NULL COMMENT '故障等级(手填)',
|
||||
`downtime_maintenance` varchar(1) DEFAULT '0' COMMENT '是否停机维修(字典yn:1是0否)',
|
||||
`status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_downtime_type_status:0启用1停用)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mdt_tenant_type` (`tenant_id`, `downtime_type`),
|
||||
KEY `idx_mdt_process` (`process_operation_id`),
|
||||
KEY `idx_mdt_main_type` (`downtime_main_type_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机类型';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000126', @mes_base_pid, '停机类型', '/xslmes/mesXslDowntimeType', 'xslmes/mesXslDowntimeType/MesXslDowntimeTypeList', NULL, 1, NULL, '1', 19, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000127', '1860000000000000126', '新增', 2, 'mes:mes_xsl_downtime_type:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000128', '1860000000000000126', '编辑', 2, 'mes:mes_xsl_downtime_type:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000129', '1860000000000000126', '删除', 2, 'mes:mes_xsl_downtime_type:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000130', '1860000000000000126', '批量删除', 2, 'mes:mes_xsl_downtime_type:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000131', '1860000000000000126', '导出', 2, 'mes:mes_xsl_downtime_type:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000132', '1860000000000000126', '导入', 2, 'mes:mes_xsl_downtime_type:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000126',
|
||||
'1860000000000000127', '1860000000000000128', '1860000000000000129', '1860000000000000130',
|
||||
'1860000000000000131', '1860000000000000132'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
11
jeecg-boot/db/mes-xsl-downtime-type-remove-unused-dict.sql
Normal file
11
jeecg-boot/db/mes-xsl-downtime-type-remove-unused-dict.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
-- 删除停机类型模块中已废弃的字典(责任区分、故障等级已改为手填,不再使用下拉字典)
|
||||
-- 保留:xslmes_downtime_type_status(是否启用)、xslmes_downtime_main_type_status(停机主类型是否启用)
|
||||
-- 执行后请在系统管理刷新字典缓存,或重新登录
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
DELETE i FROM `sys_dict_item` i
|
||||
INNER JOIN `sys_dict` d ON i.`dict_id` = d.`id`
|
||||
WHERE d.`dict_code` IN ('xslmes_downtime_responsibility', 'xslmes_downtime_fault_level');
|
||||
|
||||
DELETE FROM `sys_dict`
|
||||
WHERE `dict_code` IN ('xslmes_downtime_responsibility', 'xslmes_downtime_fault_level');
|
||||
28
jeecg-boot/db/mes-xsl-downtime-type.sql
Normal file
28
jeecg-boot/db/mes-xsl-downtime-type.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
-- 仅建表 mes_xsl_downtime_type。完整初始化请执行 mes-xsl-downtime-type-menu-permission.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_type` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序 mes_xsl_process_operation.id',
|
||||
`process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
|
||||
`downtime_main_type_id` varchar(32) NOT NULL COMMENT '所属主类型 mes_xsl_downtime_main_type.id',
|
||||
`downtime_main_type_name` varchar(500) DEFAULT NULL COMMENT '主类型名称冗余(停机主类型.downtime_type)',
|
||||
`downtime_type` varchar(500) NOT NULL COMMENT '停机类型(同租户未删除数据中唯一)',
|
||||
`display_order` int NOT NULL DEFAULT '0' COMMENT '显示顺序(升序,必填)',
|
||||
`distinguish_color` varchar(500) DEFAULT NULL COMMENT '区分颜色(十六进制色值)',
|
||||
`responsibility_distinct` varchar(500) DEFAULT NULL COMMENT '责任区分(手填)',
|
||||
`fault_level` varchar(500) DEFAULT NULL COMMENT '故障等级(手填)',
|
||||
`downtime_maintenance` varchar(1) DEFAULT '0' COMMENT '是否停机维修(字典yn:1是0否)',
|
||||
`status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_downtime_type_status:0启用1停用)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mdt_tenant_type` (`tenant_id`, `downtime_type`),
|
||||
KEY `idx_mdt_process` (`process_operation_id`),
|
||||
KEY `idx_mdt_main_type` (`downtime_main_type_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机类型';
|
||||
98
jeecg-boot/db/mes-xsl-equipment-category-menu-permission.sql
Normal file
98
jeecg-boot/db/mes-xsl-equipment-category-menu-permission.sql
Normal file
@@ -0,0 +1,98 @@
|
||||
-- MES 设备类别:建表 + 字典 + 菜单 + 按钮权限 + 租户 admin 授权(可整文件一次执行)
|
||||
-- 权限前缀与 Controller、前端 v-auth 一致:mes:mes_xsl_equipment_category:*
|
||||
-- 修改租户:改 SET @mes_tenant_id;Flyway 已含同内容时可只执行本脚本做手工补数
|
||||
-- 仅建表见 mes-xsl-equipment-category.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_equipment_category` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`category_name` varchar(128) NOT NULL COMMENT '设备类别名称',
|
||||
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序主键 mes_process_operation.id',
|
||||
`process_operation_name` varchar(128) DEFAULT NULL COMMENT '工序名称冗余展示',
|
||||
`inspect_distinct` varchar(32) NOT NULL COMMENT '点检区分 字典xslmes_equipment_inspect_distinct:generic通用 distinct区分',
|
||||
`maintain_distinct` varchar(32) NOT NULL COMMENT '保养区分 字典xslmes_equipment_maintain_distinct:maintain保养 distinct区分',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mec_tenant_name` (`tenant_id`, `category_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES设备类别';
|
||||
|
||||
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_inspect_distinct', '设备类别点检区分:通用/区分', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_equipment_inspect_distinct' 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, '通用', 'generic', 1, 1, 'admin', NOW()
|
||||
FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_equipment_inspect_distinct'
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.`id` AND i.`item_value` = 'generic');
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '区分', 'distinct', 2, 1, 'admin', NOW()
|
||||
FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_equipment_inspect_distinct'
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.`id` AND i.`item_value` = 'distinct');
|
||||
|
||||
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_maintain_distinct', '设备类别保养区分:保养/区分', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_equipment_maintain_distinct' 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, '保养', 'maintain', 1, 1, 'admin', NOW()
|
||||
FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_equipment_maintain_distinct'
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.`id` AND i.`item_value` = 'maintain');
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '区分', 'distinct', 2, 1, 'admin', NOW()
|
||||
FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_equipment_maintain_distinct'
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.`id` AND i.`item_value` = 'distinct');
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000070', @mes_base_pid, '设备类别', '/xslmes/mesXslEquipmentCategory', 'xslmes/mesXslEquipmentCategory/MesXslEquipmentCategoryList', NULL, 1, NULL, '1', 10, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000071', '1860000000000000070', '新增', 2, 'mes:mes_xsl_equipment_category:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000072', '1860000000000000070', '编辑', 2, 'mes:mes_xsl_equipment_category:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000073', '1860000000000000070', '删除', 2, 'mes:mes_xsl_equipment_category:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000074', '1860000000000000070', '批量删除', 2, 'mes:mes_xsl_equipment_category:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000075', '1860000000000000070', '导出', 2, 'mes:mes_xsl_equipment_category:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000076', '1860000000000000070', '导入', 2, 'mes:mes_xsl_equipment_category:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000070',
|
||||
'1860000000000000071', '1860000000000000072', '1860000000000000073', '1860000000000000074',
|
||||
'1860000000000000075', '1860000000000000076'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
21
jeecg-boot/db/mes-xsl-equipment-category.sql
Normal file
21
jeecg-boot/db/mes-xsl-equipment-category.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
-- 仅建表:MES 设备类别 mes_xsl_equipment_category
|
||||
-- 完整初始化(字典、菜单、租户授权)请执行 mes-xsl-equipment-category-menu-permission.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_equipment_category` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`category_name` varchar(128) NOT NULL COMMENT '设备类别名称',
|
||||
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序主键 mes_process_operation.id',
|
||||
`process_operation_name` varchar(128) DEFAULT NULL COMMENT '工序名称冗余展示',
|
||||
`inspect_distinct` varchar(32) NOT NULL COMMENT '点检区分 字典xslmes_equipment_inspect_distinct:generic通用 distinct区分',
|
||||
`maintain_distinct` varchar(32) NOT NULL COMMENT '保养区分 字典xslmes_equipment_maintain_distinct:maintain保养 distinct区分',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mec_tenant_name` (`tenant_id`, `category_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES设备类别';
|
||||
66
jeecg-boot/db/mes-xsl-equipment-part-menu-permission.sql
Normal file
66
jeecg-boot/db/mes-xsl-equipment-part-menu-permission.sql
Normal file
@@ -0,0 +1,66 @@
|
||||
-- MES 设备部位:建表 + 菜单 + 按钮权限 + 租户 admin 授权(可整文件一次执行)
|
||||
-- 权限前缀与 Controller、前端 v-auth 一致:mes:mes_xsl_equipment_part:*
|
||||
-- 依赖:mes_xsl_equipment_category;修改租户改 SET @mes_tenant_id
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_equipment_part` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`equipment_category_id` varchar(32) NOT NULL COMMENT '所属设备类别主键 mes_xsl_equipment_category.id',
|
||||
`equipment_category_name` varchar(128) DEFAULT NULL COMMENT '设备类别名称冗余展示',
|
||||
`part_name` varchar(128) NOT NULL COMMENT '部位名称',
|
||||
`part_code` varchar(64) NOT NULL COMMENT '部位代码(同租户未删除数据中唯一)',
|
||||
`part_description` varchar(500) DEFAULT NULL COMMENT '部位描述',
|
||||
`enable_status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_unit_status:0启用1停用)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mep_tenant_partcode` (`tenant_id`, `part_code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES设备部位';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000084', @mes_base_pid, '设备部位', '/xslmes/mesXslEquipmentPart', 'xslmes/mesXslEquipmentPart/MesXslEquipmentPartList', NULL, 1, NULL, '1', 12, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000085', '1860000000000000084', '新增', 2, 'mes:mes_xsl_equipment_part:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000086', '1860000000000000084', '编辑', 2, 'mes:mes_xsl_equipment_part:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000087', '1860000000000000084', '删除', 2, 'mes:mes_xsl_equipment_part:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000088', '1860000000000000084', '批量删除', 2, 'mes:mes_xsl_equipment_part:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000089', '1860000000000000084', '导出', 2, 'mes:mes_xsl_equipment_part:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000090', '1860000000000000084', '导入', 2, 'mes:mes_xsl_equipment_part:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000084',
|
||||
'1860000000000000085', '1860000000000000086', '1860000000000000087', '1860000000000000088',
|
||||
'1860000000000000089', '1860000000000000090'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
22
jeecg-boot/db/mes-xsl-equipment-part.sql
Normal file
22
jeecg-boot/db/mes-xsl-equipment-part.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
-- 仅建表:MES 设备部位 mes_xsl_equipment_part
|
||||
-- 完整初始化(菜单、租户授权)请执行 mes-xsl-equipment-part-menu-permission.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_equipment_part` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`equipment_category_id` varchar(32) NOT NULL COMMENT '所属设备类别主键 mes_xsl_equipment_category.id',
|
||||
`equipment_category_name` varchar(128) DEFAULT NULL COMMENT '设备类别名称冗余展示',
|
||||
`part_name` varchar(128) NOT NULL COMMENT '部位名称',
|
||||
`part_code` varchar(64) NOT NULL COMMENT '部位代码(同租户未删除数据中唯一)',
|
||||
`part_description` varchar(500) DEFAULT NULL COMMENT '部位描述',
|
||||
`enable_status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_unit_status:0启用1停用)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mep_tenant_partcode` (`tenant_id`, `part_code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES设备部位';
|
||||
69
jeecg-boot/db/mes-xsl-equipment-sub-part-menu-permission.sql
Normal file
69
jeecg-boot/db/mes-xsl-equipment-sub-part-menu-permission.sql
Normal file
@@ -0,0 +1,69 @@
|
||||
-- MES 设备小部位:建表 + 菜单 + 按钮权限 + 租户 admin 授权(可整文件一次执行)
|
||||
-- 权限前缀与 Controller、前端 v-auth 一致:mes:mes_xsl_equipment_sub_part:*
|
||||
-- 依赖:mes_xsl_equipment_category、mes_xsl_equipment_part;二级菜单父级为「MES XSL / XSLMES管理」(sys_permission.id 1900000000000000300 或按名称解析)
|
||||
-- 修改租户改 SET @mes_tenant_id;已跑过 Flyway 的旧库可另执行 V3.9.2_60 仅改 parent_id
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_equipment_sub_part` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`equipment_category_id` varchar(32) NOT NULL COMMENT '所属设备类别主键 mes_xsl_equipment_category.id',
|
||||
`equipment_category_name` varchar(128) DEFAULT NULL COMMENT '设备类别名称冗余展示',
|
||||
`equipment_part_id` varchar(32) NOT NULL COMMENT '所属设备大部位主键 mes_xsl_equipment_part.id',
|
||||
`equipment_part_name` varchar(128) DEFAULT NULL COMMENT '设备大部位名称冗余(mes_xsl_equipment_part.part_name)',
|
||||
`sub_part_name` varchar(128) NOT NULL COMMENT '小部位名称',
|
||||
`sub_part_code` varchar(64) NOT NULL COMMENT '小部位代码(同租户未删除数据中唯一)',
|
||||
`sub_part_description` varchar(500) DEFAULT NULL COMMENT '部位描述',
|
||||
`enable_status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_unit_status:0启用1停用)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mesp_tenant_subcode` (`tenant_id`, `sub_part_code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES设备小部位';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @xslmes_root_pid = (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES XSL', 'XSLMES管理', 'XSLMES')
|
||||
);
|
||||
SET @xslmes_root_pid = IFNULL(@xslmes_root_pid, '1900000000000000300');
|
||||
|
||||
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())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000092', '1860000000000000091', '新增', 2, 'mes:mes_xsl_equipment_sub_part:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000093', '1860000000000000091', '编辑', 2, 'mes:mes_xsl_equipment_sub_part:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000094', '1860000000000000091', '删除', 2, 'mes:mes_xsl_equipment_sub_part:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000095', '1860000000000000091', '批量删除', 2, 'mes:mes_xsl_equipment_sub_part:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000096', '1860000000000000091', '导出', 2, 'mes:mes_xsl_equipment_sub_part:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000097', '1860000000000000091', '导入', 2, 'mes:mes_xsl_equipment_sub_part:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000091',
|
||||
'1860000000000000092', '1860000000000000093', '1860000000000000094', '1860000000000000095',
|
||||
'1860000000000000096', '1860000000000000097'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
24
jeecg-boot/db/mes-xsl-equipment-sub-part.sql
Normal file
24
jeecg-boot/db/mes-xsl-equipment-sub-part.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- 仅建表:MES 设备小部位 mes_xsl_equipment_sub_part
|
||||
-- 完整初始化(建表 + 菜单 + 租户授权)请执行 mes-xsl-equipment-sub-part-menu-permission.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_equipment_sub_part` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`equipment_category_id` varchar(32) NOT NULL COMMENT '所属设备类别主键 mes_xsl_equipment_category.id',
|
||||
`equipment_category_name` varchar(128) DEFAULT NULL COMMENT '设备类别名称冗余展示',
|
||||
`equipment_part_id` varchar(32) NOT NULL COMMENT '所属设备大部位主键 mes_xsl_equipment_part.id',
|
||||
`equipment_part_name` varchar(128) DEFAULT NULL COMMENT '设备大部位名称冗余(mes_xsl_equipment_part.part_name)',
|
||||
`sub_part_name` varchar(128) NOT NULL COMMENT '小部位名称',
|
||||
`sub_part_code` varchar(64) NOT NULL COMMENT '小部位代码(同租户未删除数据中唯一)',
|
||||
`sub_part_description` varchar(500) DEFAULT NULL COMMENT '部位描述',
|
||||
`enable_status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否启用(字典xslmes_unit_status:0启用1停用)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mesp_tenant_subcode` (`tenant_id`, `sub_part_code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES设备小部位';
|
||||
69
jeecg-boot/db/mes-xsl-equipment-type-menu-fix.sql
Normal file
69
jeecg-boot/db/mes-xsl-equipment-type-menu-fix.sql
Normal file
@@ -0,0 +1,69 @@
|
||||
-- 设备类型菜单/按钮补全并挂到 MES基础资料(解决仅 UPDATE 时 id 077 不存在、菜单与权限均不显示)
|
||||
-- 可重复执行;修改租户改 SET @mes_tenant_id
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT `id` FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
|
||||
));
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
UPDATE `sys_permission`
|
||||
SET `is_leaf` = 0
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000077', @mes_base_pid, '设备类型', '/xslmes/mesXslEquipmentType', 'xslmes/mesXslEquipmentType/MesXslEquipmentTypeList', NULL, 1, NULL, '1', 11, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000078', '1860000000000000077', '新增', 2, 'mes:mes_xsl_equipment_type:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000079', '1860000000000000077', '编辑', 2, 'mes:mes_xsl_equipment_type:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000080', '1860000000000000077', '删除', 2, 'mes:mes_xsl_equipment_type:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000081', '1860000000000000077', '批量删除', 2, 'mes:mes_xsl_equipment_type:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000082', '1860000000000000077', '导出', 2, 'mes:mes_xsl_equipment_type:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000083', '1860000000000000077', '导入', 2, 'mes:mes_xsl_equipment_type:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`),
|
||||
`perms_type` = VALUES(`perms_type`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
UPDATE `sys_permission` p
|
||||
INNER JOIN (SELECT @mes_base_pid AS `pid`) x ON 1 = 1
|
||||
SET p.`parent_id` = x.`pid`,
|
||||
p.`is_leaf` = 0,
|
||||
p.`url` = '/xslmes/mesXslEquipmentType',
|
||||
p.`component` = 'xslmes/mesXslEquipmentType/MesXslEquipmentTypeList',
|
||||
p.`hidden` = 0,
|
||||
p.`del_flag` = 0,
|
||||
p.`status` = '1',
|
||||
p.`update_time` = NOW()
|
||||
WHERE p.`menu_type` = 1
|
||||
AND p.`url` = '/xslmes/mesXslEquipmentType'
|
||||
AND p.`id` <> '1860000000000000077';
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000077',
|
||||
'1860000000000000078', '1860000000000000079', '1860000000000000080',
|
||||
'1860000000000000081', '1860000000000000082', '1860000000000000083'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
65
jeecg-boot/db/mes-xsl-equipment-type-menu-permission.sql
Normal file
65
jeecg-boot/db/mes-xsl-equipment-type-menu-permission.sql
Normal file
@@ -0,0 +1,65 @@
|
||||
-- MES 设备类型:建表 + 菜单 + 按钮权限 + 租户 admin 授权(可整文件一次执行)
|
||||
-- 权限前缀与 Controller、前端 v-auth 一致:mes:mes_xsl_equipment_type:*
|
||||
-- 依赖:mes_process_operation、mes_xsl_equipment_category;修改租户改 SET @mes_tenant_id
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_equipment_type` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`type_name` varchar(128) NOT NULL COMMENT '设备类型名称',
|
||||
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序主键 mes_process_operation.id',
|
||||
`process_operation_name` varchar(128) DEFAULT NULL COMMENT '工序名称冗余展示',
|
||||
`equipment_category_id` varchar(32) NOT NULL COMMENT '所属设备类别主键 mes_xsl_equipment_category.id',
|
||||
`equipment_category_name` varchar(128) DEFAULT NULL COMMENT '设备类别名称冗余展示',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_met_tenant_typename` (`tenant_id`, `type_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES设备类型';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000077', @mes_base_pid, '设备类型', '/xslmes/mesXslEquipmentType', 'xslmes/mesXslEquipmentType/MesXslEquipmentTypeList', NULL, 1, NULL, '1', 11, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000078', '1860000000000000077', '新增', 2, 'mes:mes_xsl_equipment_type:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000079', '1860000000000000077', '编辑', 2, 'mes:mes_xsl_equipment_type:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000080', '1860000000000000077', '删除', 2, 'mes:mes_xsl_equipment_type:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000081', '1860000000000000077', '批量删除', 2, 'mes:mes_xsl_equipment_type:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000082', '1860000000000000077', '导出', 2, 'mes:mes_xsl_equipment_type:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000083', '1860000000000000077', '导入', 2, 'mes:mes_xsl_equipment_type:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000077',
|
||||
'1860000000000000078', '1860000000000000079', '1860000000000000080', '1860000000000000081',
|
||||
'1860000000000000082', '1860000000000000083'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
21
jeecg-boot/db/mes-xsl-equipment-type.sql
Normal file
21
jeecg-boot/db/mes-xsl-equipment-type.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
-- 仅建表:MES 设备类型 mes_xsl_equipment_type
|
||||
-- 完整初始化(菜单、租户授权)请执行 mes-xsl-equipment-type-menu-permission.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_equipment_type` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`type_name` varchar(128) NOT NULL COMMENT '设备类型名称',
|
||||
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序主键 mes_process_operation.id',
|
||||
`process_operation_name` varchar(128) DEFAULT NULL COMMENT '工序名称冗余展示',
|
||||
`equipment_category_id` varchar(32) NOT NULL COMMENT '所属设备类别主键 mes_xsl_equipment_category.id',
|
||||
`equipment_category_name` varchar(128) DEFAULT NULL COMMENT '设备类别名称冗余展示',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_met_tenant_typename` (`tenant_id`, `type_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES设备类型';
|
||||
89
jeecg-boot/db/mes-xsl-manufacturer-menu-permission.sql
Normal file
89
jeecg-boot/db/mes-xsl-manufacturer-menu-permission.sql
Normal file
@@ -0,0 +1,89 @@
|
||||
-- MES 厂家信息:字典 + 建表 + 菜单 + 按钮 + 租户 admin 授权(可整文件一次执行)
|
||||
-- 权限前缀与 Controller、前端 v-auth 一致:mes:mes_xsl_manufacturer:*
|
||||
-- 父菜单:MES基础资料 / MES资料(与备品件等脚本相同 @mes_base_pid);修改租户改 SET @mes_tenant_id
|
||||
-- 新环境也可依赖 Flyway:V3.9.2_63__mes_xsl_manufacturer.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_manufacturer_category', '模具厂家、胶囊厂家、设备厂家', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_manufacturer_category' 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, '模具厂家', 'mold', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_manufacturer_category' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'mold');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '胶囊厂家', 'capsule', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_manufacturer_category' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'capsule');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '设备厂家', 'equipment', 3, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_manufacturer_category' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'equipment');
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES厂家是否有效', 'xslmes_manufacturer_valid', '0有效1无效', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_manufacturer_valid' 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_manufacturer_valid' 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_manufacturer_valid' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_manufacturer` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`manufacturer_category` varchar(500) NOT NULL COMMENT '厂家类别(字典xslmes_manufacturer_category:mold模具 capsule胶囊 equipment设备)',
|
||||
`manufacturer_name` varchar(500) NOT NULL COMMENT '厂家名称(同租户未删除数据中唯一)',
|
||||
`valid_status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否有效(字典xslmes_manufacturer_valid:0有效1无效)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mxm_tenant_name` (`tenant_id`, `manufacturer_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES厂家信息';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000112', @mes_base_pid, '厂家信息', '/xslmes/mesXslManufacturer', 'xslmes/mesXslManufacturer/MesXslManufacturerList', NULL, 1, NULL, '1', 17, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000113', '1860000000000000112', '新增', 2, 'mes:mes_xsl_manufacturer:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000114', '1860000000000000112', '编辑', 2, 'mes:mes_xsl_manufacturer:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000115', '1860000000000000112', '删除', 2, 'mes:mes_xsl_manufacturer:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000116', '1860000000000000112', '批量删除', 2, 'mes:mes_xsl_manufacturer:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000117', '1860000000000000112', '导出', 2, 'mes:mes_xsl_manufacturer:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000118', '1860000000000000112', '导入', 2, 'mes:mes_xsl_manufacturer:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000112',
|
||||
'1860000000000000113', '1860000000000000114', '1860000000000000115', '1860000000000000116',
|
||||
'1860000000000000117', '1860000000000000118'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
18
jeecg-boot/db/mes-xsl-manufacturer.sql
Normal file
18
jeecg-boot/db/mes-xsl-manufacturer.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- 仅建表 mes_xsl_manufacturer。完整初始化(厂家类别/是否有效字典、菜单、租户授权)请执行 mes-xsl-manufacturer-menu-permission.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_manufacturer` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`manufacturer_category` varchar(500) NOT NULL COMMENT '厂家类别(字典xslmes_manufacturer_category:mold模具 capsule胶囊 equipment设备)',
|
||||
`manufacturer_name` varchar(500) NOT NULL COMMENT '厂家名称(同租户未删除数据中唯一)',
|
||||
`valid_status` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否有效(字典xslmes_manufacturer_valid:0有效1无效)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mxm_tenant_name` (`tenant_id`, `manufacturer_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES厂家信息';
|
||||
@@ -0,0 +1,93 @@
|
||||
-- 工序管理、设备类别、设备类型:挂到「MES基础资料」下,并修复权限树(is_leaf)与租户 admin 授权
|
||||
-- 适用:菜单曾在 MES XSL 根下或 is_leaf=1 导致角色授权页不显示按钮权限
|
||||
-- 修改租户:改 SET @mes_tenant_id
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT `id` FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
|
||||
));
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
UPDATE `sys_permission`
|
||||
SET `is_leaf` = 0
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000060', @mes_base_pid, '工序管理', '/xslmes/mesXslProcessOperation', 'xslmes/mesXslProcessOperation/MesXslProcessOperationList', NULL, 1, NULL, '1', 9, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||
`is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000061', '1860000000000000060', '新增', 2, 'mes:mes_process_operation:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000062', '1860000000000000060', '编辑', 2, 'mes:mes_process_operation:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000063', '1860000000000000060', '删除', 2, 'mes:mes_process_operation:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000064', '1860000000000000060', '批量删除', 2, 'mes:mes_process_operation:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000065', '1860000000000000060', '导出', 2, 'mes:mes_process_operation:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000066', '1860000000000000060', '导入', 2, 'mes:mes_process_operation:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `perms` = VALUES(`perms`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000070', @mes_base_pid, '设备类别', '/xslmes/mesXslEquipmentCategory', 'xslmes/mesXslEquipmentCategory/MesXslEquipmentCategoryList', NULL, 1, NULL, '1', 10, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||
`is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000071', '1860000000000000070', '新增', 2, 'mes:mes_xsl_equipment_category:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000072', '1860000000000000070', '编辑', 2, 'mes:mes_xsl_equipment_category:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000073', '1860000000000000070', '删除', 2, 'mes:mes_xsl_equipment_category:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000074', '1860000000000000070', '批量删除', 2, 'mes:mes_xsl_equipment_category:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000075', '1860000000000000070', '导出', 2, 'mes:mes_xsl_equipment_category:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000076', '1860000000000000070', '导入', 2, 'mes:mes_xsl_equipment_category:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `perms` = VALUES(`perms`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000077', @mes_base_pid, '设备类型', '/xslmes/mesXslEquipmentType', 'xslmes/mesXslEquipmentType/MesXslEquipmentTypeList', NULL, 1, NULL, '1', 11, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||
`is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000078', '1860000000000000077', '新增', 2, 'mes:mes_xsl_equipment_type:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000079', '1860000000000000077', '编辑', 2, 'mes:mes_xsl_equipment_type:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000080', '1860000000000000077', '删除', 2, 'mes:mes_xsl_equipment_type:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000081', '1860000000000000077', '批量删除', 2, 'mes:mes_xsl_equipment_type:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000082', '1860000000000000077', '导出', 2, 'mes:mes_xsl_equipment_type:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000083', '1860000000000000077', '导入', 2, 'mes:mes_xsl_equipment_type:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `perms` = VALUES(`perms`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
UPDATE `sys_permission` SET `name` = '新增' WHERE `id` = '1860000000000000061' AND `name` = '添加';
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000060',
|
||||
'1860000000000000061', '1860000000000000062', '1860000000000000063',
|
||||
'1860000000000000064', '1860000000000000065', '1860000000000000066',
|
||||
'1860000000000000070',
|
||||
'1860000000000000071', '1860000000000000072', '1860000000000000073',
|
||||
'1860000000000000074', '1860000000000000075', '1860000000000000076',
|
||||
'1860000000000000077',
|
||||
'1860000000000000078', '1860000000000000079', '1860000000000000080',
|
||||
'1860000000000000081', '1860000000000000082', '1860000000000000083'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
79
jeecg-boot/db/mes-xsl-process-and-category-menu-fix.sql
Normal file
79
jeecg-boot/db/mes-xsl-process-and-category-menu-fix.sql
Normal file
@@ -0,0 +1,79 @@
|
||||
-- 工序管理(060)、设备类别(070):补全菜单/按钮、挂 MES基础资料、修复 is_leaf、租户 admin 授权
|
||||
-- 可重复执行;修改租户改 SET @mes_tenant_id
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT `id` FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
|
||||
));
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
UPDATE `sys_permission`
|
||||
SET `is_leaf` = 0
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料');
|
||||
|
||||
-- 工序管理
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000060', @mes_base_pid, '工序管理', '/xslmes/mesXslProcessOperation', 'xslmes/mesXslProcessOperation/MesXslProcessOperationList', NULL, 1, NULL, '1', 9, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000061', '1860000000000000060', '新增', 2, 'mes:mes_process_operation:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000062', '1860000000000000060', '编辑', 2, 'mes:mes_process_operation:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000063', '1860000000000000060', '删除', 2, 'mes:mes_process_operation:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000064', '1860000000000000060', '批量删除', 2, 'mes:mes_process_operation:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000065', '1860000000000000060', '导出', 2, 'mes:mes_process_operation:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000066', '1860000000000000060', '导入', 2, 'mes:mes_process_operation:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`),
|
||||
`perms_type` = VALUES(`perms_type`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
UPDATE `sys_permission` SET `name` = '新增' WHERE `id` = '1860000000000000061' AND `name` = '添加';
|
||||
|
||||
-- 设备类别
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000070', @mes_base_pid, '设备类别', '/xslmes/mesXslEquipmentCategory', 'xslmes/mesXslEquipmentCategory/MesXslEquipmentCategoryList', NULL, 1, NULL, '1', 10, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000071', '1860000000000000070', '新增', 2, 'mes:mes_xsl_equipment_category:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000072', '1860000000000000070', '编辑', 2, 'mes:mes_xsl_equipment_category:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000073', '1860000000000000070', '删除', 2, 'mes:mes_xsl_equipment_category:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000074', '1860000000000000070', '批量删除', 2, 'mes:mes_xsl_equipment_category:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000075', '1860000000000000070', '导出', 2, 'mes:mes_xsl_equipment_category:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000076', '1860000000000000070', '导入', 2, 'mes:mes_xsl_equipment_category:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`),
|
||||
`perms_type` = VALUES(`perms_type`), `is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000060',
|
||||
'1860000000000000061', '1860000000000000062', '1860000000000000063',
|
||||
'1860000000000000064', '1860000000000000065', '1860000000000000066',
|
||||
'1860000000000000070',
|
||||
'1860000000000000071', '1860000000000000072', '1860000000000000073',
|
||||
'1860000000000000074', '1860000000000000075', '1860000000000000076'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
66
jeecg-boot/db/mes-xsl-raw-material-inspect-record-menu.sql
Normal file
66
jeecg-boot/db/mes-xsl-raw-material-inspect-record-menu.sql
Normal file
@@ -0,0 +1,66 @@
|
||||
-- 原材料送检记录菜单与权限(挂到 MES管理)
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @mes_parent_id = (
|
||||
SELECT id
|
||||
FROM sys_permission
|
||||
WHERE url = '/mes' AND menu_type = 0
|
||||
ORDER BY create_time ASC
|
||||
LIMIT 1
|
||||
);
|
||||
SET @mes_parent_id = IFNULL(@mes_parent_id, '1860000000000000001');
|
||||
|
||||
-- 二级菜单:原材料送检记录
|
||||
INSERT INTO sys_permission(
|
||||
id, parent_id, name, url, component, component_name, menu_type, perms, perms_type, sort_no,
|
||||
is_route, is_leaf, hidden, status, del_flag, keep_alive, internal_or_external, create_by, create_time
|
||||
)
|
||||
VALUES (
|
||||
'1860000000000099111', @mes_parent_id, '原材料送检记录',
|
||||
'/xslmes/mesXslRawMaterialInspectRecordList',
|
||||
'xslmes/mesXslRawMaterialInspectRecord/MesXslRawMaterialInspectRecordList',
|
||||
'MesXslRawMaterialInspectRecordList', 1, NULL, '1', 22,
|
||||
1, 1, 0, '1', 0, 1, 0, 'admin', NOW()
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id = VALUES(parent_id),
|
||||
name = VALUES(name),
|
||||
url = VALUES(url),
|
||||
component = VALUES(component),
|
||||
component_name = VALUES(component_name),
|
||||
menu_type = VALUES(menu_type),
|
||||
perms = VALUES(perms),
|
||||
perms_type = VALUES(perms_type),
|
||||
sort_no = VALUES(sort_no),
|
||||
is_route = VALUES(is_route),
|
||||
is_leaf = VALUES(is_leaf),
|
||||
hidden = VALUES(hidden),
|
||||
status = VALUES(status),
|
||||
del_flag = VALUES(del_flag),
|
||||
keep_alive = VALUES(keep_alive),
|
||||
internal_or_external = VALUES(internal_or_external);
|
||||
|
||||
-- 按钮权限
|
||||
INSERT INTO sys_permission(id, parent_id, name, menu_type, perms, perms_type, status, del_flag, create_by, create_time) VALUES
|
||||
('1860000000000099112', '1860000000000099111', '编辑', 2, 'xslmes:mes_xsl_raw_material_inspect_record:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000099113', '1860000000000099111', '导出', 2, 'xslmes:mes_xsl_raw_material_inspect_record:exportXls', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
parent_id = VALUES(parent_id),
|
||||
name = VALUES(name),
|
||||
menu_type = VALUES(menu_type),
|
||||
perms = VALUES(perms),
|
||||
perms_type = VALUES(perms_type),
|
||||
status = VALUES(status),
|
||||
del_flag = VALUES(del_flag);
|
||||
|
||||
-- admin 角色授权
|
||||
INSERT INTO sys_role_permission(id, role_id, permission_id, operate_date, operate_ip)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'f6817f48af4fb3af11b9e8bf182f618b', p.id, NOW(), '127.0.0.1'
|
||||
FROM sys_permission p
|
||||
WHERE p.id IN ('1860000000000099111', '1860000000000099112', '1860000000000099113')
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM sys_role_permission rp
|
||||
WHERE rp.role_id = 'f6817f48af4fb3af11b9e8bf182f618b'
|
||||
AND rp.permission_id = p.id
|
||||
);
|
||||
36
jeecg-boot/db/mes-xsl-raw-material-inspect-record-reset.sql
Normal file
36
jeecg-boot/db/mes-xsl-raw-material-inspect-record-reset.sql
Normal file
@@ -0,0 +1,36 @@
|
||||
-- 原材料送检记录测试数据重置脚本(稳妥版)
|
||||
-- 作用:
|
||||
-- 1) 将存在送检记录关联的原材料卡片检测结果重置为「未检(0)」
|
||||
-- 2) 清空原材料送检记录主表/子表数据
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
-- 执行前计数(便于确认是否命中数据)
|
||||
SELECT COUNT(1) AS before_record_count FROM mes_xsl_raw_material_inspect_record;
|
||||
SELECT COUNT(1) AS before_record_line_count FROM mes_xsl_raw_material_inspect_record_line;
|
||||
|
||||
-- 回写原材料卡片检测结果为未检(0):只重置存在送检记录关联的卡片
|
||||
UPDATE mes_xsl_raw_material_card c
|
||||
JOIN (
|
||||
SELECT DISTINCT r.raw_material_card_id AS card_id
|
||||
FROM mes_xsl_raw_material_inspect_record r
|
||||
WHERE r.raw_material_card_id IS NOT NULL
|
||||
AND r.raw_material_card_id <> ''
|
||||
) t ON t.card_id = c.id
|
||||
SET c.test_result = '0',
|
||||
c.update_time = NOW();
|
||||
|
||||
-- 先删子表,再删主表
|
||||
DELETE FROM mes_xsl_raw_material_inspect_record_line
|
||||
WHERE record_id IN (
|
||||
SELECT id FROM mes_xsl_raw_material_inspect_record
|
||||
);
|
||||
|
||||
DELETE FROM mes_xsl_raw_material_inspect_record;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- 执行后计数
|
||||
SELECT COUNT(1) AS remaining_record_count FROM mes_xsl_raw_material_inspect_record;
|
||||
SELECT COUNT(1) AS remaining_record_line_count FROM mes_xsl_raw_material_inspect_record_line;
|
||||
80
jeecg-boot/db/mes-xsl-raw-material-inspect-record.sql
Normal file
80
jeecg-boot/db/mes-xsl-raw-material-inspect-record.sql
Normal file
@@ -0,0 +1,80 @@
|
||||
-- 原材料送检记录(主表 + 子表)
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_raw_material_inspect_record` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`raw_material_card_id` varchar(32) DEFAULT NULL COMMENT '原材料卡片ID',
|
||||
`barcode` varchar(128) DEFAULT NULL COMMENT '条码',
|
||||
`batch_no` varchar(128) DEFAULT NULL COMMENT '批次号',
|
||||
`material_id` varchar(32) DEFAULT NULL COMMENT '物料ID',
|
||||
`material_name` varchar(200) DEFAULT NULL COMMENT '物料名称',
|
||||
`inspect_status` varchar(10) DEFAULT '0' COMMENT '检验状态(字典 xslmes_inspect_status:0待检 1合格 2不合格)',
|
||||
`inspect_time` datetime DEFAULT NULL COMMENT '送检时间',
|
||||
`result_time` datetime DEFAULT NULL COMMENT '判定时间',
|
||||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_xsl_rm_ir_card` (`raw_material_card_id`),
|
||||
KEY `idx_xsl_rm_ir_status` (`inspect_status`),
|
||||
KEY `idx_xsl_rm_ir_time` (`inspect_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='原材料送检记录';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_raw_material_inspect_record_line` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`record_id` varchar(32) NOT NULL COMMENT '送检记录主表ID',
|
||||
`inspect_std_id` varchar(32) DEFAULT NULL COMMENT '检验标准ID',
|
||||
`inspect_item_id` varchar(32) DEFAULT NULL COMMENT '检验项目ID',
|
||||
`inspect_item_name` varchar(200) DEFAULT NULL COMMENT '检验项目名称',
|
||||
`allow_min` decimal(24,6) DEFAULT NULL COMMENT '容许最小值',
|
||||
`include_min_flag` int NOT NULL DEFAULT '0' COMMENT '包含最小值:1是 0否',
|
||||
`allow_max` decimal(24,6) DEFAULT NULL COMMENT '容许最大值',
|
||||
`include_max_flag` int NOT NULL DEFAULT '0' COMMENT '包含最大值:1是 0否',
|
||||
`inspect_value` decimal(24,6) DEFAULT NULL COMMENT '检验值',
|
||||
`pass_flag` varchar(10) DEFAULT '0' COMMENT '判定状态(字典 xslmes_inspect_status:0待检 1合格 2不合格)',
|
||||
`sort_no` int DEFAULT NULL COMMENT '排序',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_xsl_rm_irl_record` (`record_id`),
|
||||
KEY `idx_xsl_rm_irl_item` (`inspect_item_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='原材料送检记录-检验明细';
|
||||
|
||||
-- 字典:送检状态
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`)
|
||||
SELECT REPLACE(UUID(), '-', ''), '送检状态', 'xslmes_inspect_status', '原材料送检状态:待检/合格/不合格', 0, 'admin', NOW(), 0
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_inspect_status' AND `del_flag` = 0
|
||||
);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `description`, `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_inspect_status'
|
||||
AND d.`del_flag` = 0
|
||||
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`, `description`, `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_inspect_status'
|
||||
AND d.`del_flag` = 0
|
||||
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`, `description`, `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_inspect_status'
|
||||
AND d.`del_flag` = 0
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_dict_item` i WHERE i.dict_id = d.id AND i.item_value = '2'
|
||||
);
|
||||
37
jeecg-boot/db/mes-xsl-raw-material-summary-menu.sql
Normal file
37
jeecg-boot/db/mes-xsl-raw-material-summary-menu.sql
Normal file
@@ -0,0 +1,37 @@
|
||||
-- 原材料汇总页面菜单(参考:原材料库存菜单配置)
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
-- 优先复用「原材料库存」的父级菜单;不存在时回退到原固定父级
|
||||
SET @xsl_parent_id = (
|
||||
SELECT parent_id
|
||||
FROM sys_permission
|
||||
WHERE id = '1900000000000000600'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @xsl_parent_id = IFNULL(@xsl_parent_id, '1900000000000000300');
|
||||
|
||||
-- 页面菜单
|
||||
INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`)
|
||||
SELECT '1900000000000000610', @xsl_parent_id, '原材料汇总', '/xslmes/mesXslRawMaterialSummary', 'xslmes/mesXslRawMaterialSummary/MesXslRawMaterialSummaryList', 1, NULL, NULL, 1, NULL, '0', 13.00, 0, 'ant-design:database-outlined', 0, 1, 0, 0, '原材料汇总', 'admin', NOW(), 'admin', NOW(), 0, 0, '1', 0
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '1900000000000000610');
|
||||
|
||||
-- 导出按钮权限
|
||||
INSERT INTO `sys_permission` (`id`, `parent_id`, `name`, `url`, `component`, `is_route`, `component_name`, `redirect`, `menu_type`, `perms`, `perms_type`, `sort_no`, `always_show`, `icon`, `is_leaf`, `keep_alive`, `hidden`, `hide_tab`, `description`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`, `rule_flag`, `status`, `internal_or_external`)
|
||||
SELECT '1900000000000000611', '1900000000000000610', '导出', NULL, NULL, 0, NULL, NULL, 2, 'xslmes:mes_xsl_raw_material_summary:exportXls', '1', 1.00, 0, NULL, 1, 0, 0, 0, NULL, 'admin', NOW(), 'admin', NOW(), 0, 0, '1', 0
|
||||
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '1900000000000000611');
|
||||
|
||||
-- 默认管理员角色授权
|
||||
INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'f6817f48af4fb3af11b9e8bf182f618b', '1900000000000000610', NULL, NOW(), '127.0.0.1'
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission`
|
||||
WHERE `role_id` = 'f6817f48af4fb3af11b9e8bf182f618b' AND `permission_id` = '1900000000000000610'
|
||||
);
|
||||
|
||||
INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `data_rule_ids`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'f6817f48af4fb3af11b9e8bf182f618b', '1900000000000000611', NULL, NOW(), '127.0.0.1'
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission`
|
||||
WHERE `role_id` = 'f6817f48af4fb3af11b9e8bf182f618b' AND `permission_id` = '1900000000000000611'
|
||||
);
|
||||
|
||||
68
jeecg-boot/db/mes-xsl-spare-part-menu-permission.sql
Normal file
68
jeecg-boot/db/mes-xsl-spare-part-menu-permission.sql
Normal file
@@ -0,0 +1,68 @@
|
||||
-- MES 备品件信息:建表 + 菜单 + 按钮权限 + 租户 admin 授权(可整文件一次执行)
|
||||
-- 权限前缀与 Controller、前端 v-auth 一致:mes:mes_xsl_spare_part:*
|
||||
-- 依赖:mes_xsl_spare_parts_category、mes_xsl_unit;父菜单 MES基础资料 / MES资料;修改租户改 SET @mes_tenant_id
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_spare_part` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`spare_part_name` varchar(128) NOT NULL COMMENT '备品件名称(同租户未删除数据中唯一)',
|
||||
`spare_parts_category_id` varchar(32) NOT NULL COMMENT '所属备品件类别 mes_xsl_spare_parts_category.id',
|
||||
`spare_parts_category_name` varchar(128) DEFAULT NULL COMMENT '备品件类别名称冗余',
|
||||
`spec_model` varchar(200) DEFAULT NULL COMMENT '规格型号',
|
||||
`max_stock` decimal(18,4) NOT NULL DEFAULT '0.0000' COMMENT '最大库存',
|
||||
`min_stock` decimal(18,4) NOT NULL DEFAULT '0.0000' COMMENT '最小库存',
|
||||
`unit_id` varchar(36) NOT NULL COMMENT '单位 mes_xsl_unit.id',
|
||||
`unit_name` varchar(100) DEFAULT NULL COMMENT '单位名称冗余',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_msp_tenant_name` (`tenant_id`, `spare_part_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES备品件信息';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000105', @mes_base_pid, '备品件信息', '/xslmes/mesXslSparePart', 'xslmes/mesXslSparePart/MesXslSparePartList', NULL, 1, NULL, '1', 16, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000106', '1860000000000000105', '新增', 2, 'mes:mes_xsl_spare_part:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000107', '1860000000000000105', '编辑', 2, 'mes:mes_xsl_spare_part:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000108', '1860000000000000105', '删除', 2, 'mes:mes_xsl_spare_part:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000109', '1860000000000000105', '批量删除', 2, 'mes:mes_xsl_spare_part:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000110', '1860000000000000105', '导出', 2, 'mes:mes_xsl_spare_part:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000111', '1860000000000000105', '导入', 2, 'mes:mes_xsl_spare_part:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000105',
|
||||
'1860000000000000106', '1860000000000000107', '1860000000000000108', '1860000000000000109',
|
||||
'1860000000000000110', '1860000000000000111'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
24
jeecg-boot/db/mes-xsl-spare-part.sql
Normal file
24
jeecg-boot/db/mes-xsl-spare-part.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- 仅建表:MES 备品件信息 mes_xsl_spare_part
|
||||
-- 完整初始化请执行 mes-xsl-spare-part-menu-permission.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_spare_part` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`spare_part_name` varchar(128) NOT NULL COMMENT '备品件名称(同租户未删除数据中唯一)',
|
||||
`spare_parts_category_id` varchar(32) NOT NULL COMMENT '所属备品件类别 mes_xsl_spare_parts_category.id',
|
||||
`spare_parts_category_name` varchar(128) DEFAULT NULL COMMENT '备品件类别名称冗余',
|
||||
`spec_model` varchar(200) DEFAULT NULL COMMENT '规格型号',
|
||||
`max_stock` decimal(18,4) NOT NULL DEFAULT '0.0000' COMMENT '最大库存',
|
||||
`min_stock` decimal(18,4) NOT NULL DEFAULT '0.0000' COMMENT '最小库存',
|
||||
`unit_id` varchar(36) NOT NULL COMMENT '单位 mes_xsl_unit.id',
|
||||
`unit_name` varchar(100) DEFAULT NULL COMMENT '单位名称冗余',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_msp_tenant_name` (`tenant_id`, `spare_part_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES备品件信息';
|
||||
@@ -0,0 +1,62 @@
|
||||
-- MES 备品件类别:建表 + 菜单 + 按钮权限 + 租户 admin 授权(可整文件一次执行)
|
||||
-- 权限前缀与 Controller、前端 v-auth 一致:mes:mes_xsl_spare_parts_category:*
|
||||
-- 父菜单:MES基础资料 / MES资料;修改租户改 SET @mes_tenant_id
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_spare_parts_category` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`category_name` varchar(128) NOT NULL COMMENT '类别名称(同租户未删除数据中唯一)',
|
||||
`category_description` varchar(500) DEFAULT NULL COMMENT '描述',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mspc_tenant_catname` (`tenant_id`, `category_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES备品件类别';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_base_pid = (
|
||||
SELECT MIN(`id`) FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料')
|
||||
);
|
||||
SET @mes_base_pid = IFNULL(@mes_base_pid, '1860000000000000001');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000098', @mes_base_pid, '备品件类别', '/xslmes/mesXslSparePartsCategory', 'xslmes/mesXslSparePartsCategory/MesXslSparePartsCategoryList', NULL, 1, NULL, '1', 15, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000099', '1860000000000000098', '新增', 2, 'mes:mes_xsl_spare_parts_category:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000100', '1860000000000000098', '编辑', 2, 'mes:mes_xsl_spare_parts_category:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000101', '1860000000000000098', '删除', 2, 'mes:mes_xsl_spare_parts_category:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000102', '1860000000000000098', '批量删除', 2, 'mes:mes_xsl_spare_parts_category:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000103', '1860000000000000098', '导出', 2, 'mes:mes_xsl_spare_parts_category:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000104', '1860000000000000098', '导入', 2, 'mes:mes_xsl_spare_parts_category:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000098',
|
||||
'1860000000000000099', '1860000000000000100', '1860000000000000101', '1860000000000000102',
|
||||
'1860000000000000103', '1860000000000000104'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
18
jeecg-boot/db/mes-xsl-spare-parts-category.sql
Normal file
18
jeecg-boot/db/mes-xsl-spare-parts-category.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- 仅建表:MES 备品件类别 mes_xsl_spare_parts_category
|
||||
-- 完整初始化(建表 + 菜单 + 租户授权)请执行 mes-xsl-spare-parts-category-menu-permission.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_spare_parts_category` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`category_name` varchar(128) NOT NULL COMMENT '类别名称(同租户未删除数据中唯一)',
|
||||
`category_description` varchar(500) DEFAULT NULL COMMENT '描述',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mspc_tenant_catname` (`tenant_id`, `category_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES备品件类别';
|
||||
@@ -43,6 +43,7 @@ import org.jeecg.modules.xslmes.service.MesXslStompNotifyService;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslRawMaterialCardBriefVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -405,12 +406,7 @@ public class MesXslDesktopAnonController {
|
||||
if (oConvertUtils.isEmpty(mesXslWeightRecord.getPlateNumber())) {
|
||||
return Result.error("车牌号不能为空");
|
||||
}
|
||||
// 净重自动计算
|
||||
if (mesXslWeightRecord.getGrossWeight() != null && mesXslWeightRecord.getTareWeight() != null) {
|
||||
mesXslWeightRecord.setNetWeight(
|
||||
mesXslWeightRecord.getGrossWeight().subtract(mesXslWeightRecord.getTareWeight()));
|
||||
}
|
||||
applyWeightBillType(mesXslWeightRecord);
|
||||
applyWeightNetAndBillType(mesXslWeightRecord);
|
||||
applyMaterialTypeDefault(mesXslWeightRecord);
|
||||
weightRecordService.save(mesXslWeightRecord);
|
||||
stompNotify.publishWeightRecordChanged("add", mesXslWeightRecord.getId());
|
||||
@@ -423,12 +419,7 @@ public class MesXslDesktopAnonController {
|
||||
if (oConvertUtils.isEmpty(mesXslWeightRecord.getId())) {
|
||||
return Result.error("主键不能为空");
|
||||
}
|
||||
// 净重自动计算
|
||||
if (mesXslWeightRecord.getGrossWeight() != null && mesXslWeightRecord.getTareWeight() != null) {
|
||||
mesXslWeightRecord.setNetWeight(
|
||||
mesXslWeightRecord.getGrossWeight().subtract(mesXslWeightRecord.getTareWeight()));
|
||||
}
|
||||
applyWeightBillType(mesXslWeightRecord);
|
||||
applyWeightNetAndBillType(mesXslWeightRecord);
|
||||
applyMaterialTypeDefault(mesXslWeightRecord);
|
||||
boolean ok = weightRecordService.updateById(mesXslWeightRecord);
|
||||
if (!ok) {
|
||||
@@ -670,7 +661,7 @@ public class MesXslDesktopAnonController {
|
||||
if (tpl == null) return Result.error("绑定的打印模板不存在");
|
||||
ArrayNode mapping = PrintBizDataMappingUtil.parseMappingArray(bind.getFieldMappingJson());
|
||||
JsonNode bizRoot = objectMapper.valueToTree(card);
|
||||
ObjectNode printData = PrintBizDataMappingUtil.mapBizToPrintData(bizRoot, mapping);
|
||||
ObjectNode printData = PrintBizDataMappingUtil.mapBizToPrintData(bizRoot, mapping, tpl.getTemplateJson());
|
||||
PrintBizDataMappingUtil.fillMissingDataBindingParamKeys(printData, tpl.getTemplateJson());
|
||||
Map<String, Object> out = new HashMap<>(8);
|
||||
out.put("cardId", card.getId());
|
||||
@@ -697,7 +688,7 @@ public class MesXslDesktopAnonController {
|
||||
if (tpl == null) return Result.error("绑定的打印模板不存在");
|
||||
ArrayNode mapping = PrintBizDataMappingUtil.parseMappingArray(bind.getFieldMappingJson());
|
||||
JsonNode bizRoot = objectMapper.valueToTree(entry);
|
||||
ObjectNode printData = PrintBizDataMappingUtil.mapBizToPrintData(bizRoot, mapping);
|
||||
ObjectNode printData = PrintBizDataMappingUtil.mapBizToPrintData(bizRoot, mapping, tpl.getTemplateJson());
|
||||
PrintBizDataMappingUtil.fillMissingDataBindingParamKeys(printData, tpl.getTemplateJson());
|
||||
Map<String, Object> out = new HashMap<>(8);
|
||||
out.put("entryId", entry.getId());
|
||||
@@ -839,18 +830,47 @@ public class MesXslDesktopAnonController {
|
||||
|
||||
// ─────────────────────────── 车辆私有辅助 ────────────────────────────
|
||||
|
||||
private void applyWeightNetAndBillType(MesXslWeightRecord record) {
|
||||
sanitizeNonPositiveWeightsToNull(record);
|
||||
if (isEffectiveWeight(record.getGrossWeight()) && isEffectiveWeight(record.getTareWeight())) {
|
||||
BigDecimal net = record.getGrossWeight().subtract(record.getTareWeight());
|
||||
record.setNetWeight(net.compareTo(BigDecimal.ZERO) >= 0 ? net : BigDecimal.ZERO);
|
||||
} else {
|
||||
record.setNetWeight(null);
|
||||
}
|
||||
applyWeightBillType(record);
|
||||
}
|
||||
|
||||
/** 将 ≤0 的重量视为未录入,避免 JSON/Numeric 占位 0 被当成已称皮重、误判称重完成 */
|
||||
private static void sanitizeNonPositiveWeightsToNull(MesXslWeightRecord record) {
|
||||
if (record.getGrossWeight() != null && record.getGrossWeight().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
record.setGrossWeight(null);
|
||||
}
|
||||
if (record.getTareWeight() != null && record.getTareWeight().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
record.setTareWeight(null);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isEffectiveWeight(BigDecimal w) {
|
||||
return w != null && w.compareTo(BigDecimal.ZERO) > 0;
|
||||
}
|
||||
|
||||
private void applyWeightBillType(MesXslWeightRecord record) {
|
||||
if (record.getGrossWeight() != null && record.getTareWeight() != null) {
|
||||
boolean g = isEffectiveWeight(record.getGrossWeight());
|
||||
boolean t = isEffectiveWeight(record.getTareWeight());
|
||||
if (g && t) {
|
||||
record.setBillType("2");
|
||||
return;
|
||||
}
|
||||
if (record.getGrossWeight() != null) {
|
||||
if (g) {
|
||||
record.setBillType("1");
|
||||
return;
|
||||
}
|
||||
if (record.getTareWeight() != null) {
|
||||
if (t) {
|
||||
record.setBillType("3");
|
||||
return;
|
||||
}
|
||||
record.setBillType(null);
|
||||
}
|
||||
|
||||
private void applyMaterialTypeDefault(MesXslWeightRecord record) {
|
||||
|
||||
@@ -0,0 +1,324 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslProcessOperation;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslDowntimeMainTypeService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslProcessOperationService;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* MES 停机主类型
|
||||
*/
|
||||
@Tag(name = "MES停机主类型")
|
||||
@RestController
|
||||
@RequestMapping("/xslmes/mesXslDowntimeMainType")
|
||||
@Slf4j
|
||||
public class MesXslDowntimeMainTypeController extends JeecgController<MesXslDowntimeMainType, IMesXslDowntimeMainTypeService> {
|
||||
|
||||
private static final Set<String> STATUS_VALUES = Set.of("0", "1");
|
||||
private static final Pattern COLOR_HEX = Pattern.compile("^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$");
|
||||
|
||||
@Autowired
|
||||
private IMesXslDowntimeMainTypeService mesXslDowntimeMainTypeService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslProcessOperationService mesXslProcessOperationService;
|
||||
|
||||
@Operation(summary = "MES停机主类型-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslDowntimeMainType>> queryPageList(
|
||||
MesXslDowntimeMainType model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslDowntimeMainType> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机主类型列表默认按显示顺序升序-----------
|
||||
queryWrapper.orderByAsc("display_order").orderByDesc("create_time");
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机主类型列表默认按显示顺序升序-----------
|
||||
Page<MesXslDowntimeMainType> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslDowntimeMainType> pageList = mesXslDowntimeMainTypeService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机主类型-添加")
|
||||
@Operation(summary = "MES停机主类型-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_main_type:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslDowntimeMainType model) {
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机主类型保存前校验-----------
|
||||
String err = validateForSave(model, null);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机主类型保存前校验-----------
|
||||
mesXslDowntimeMainTypeService.save(model);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机主类型-编辑")
|
||||
@Operation(summary = "MES停机主类型-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_main_type:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslDowntimeMainType model) {
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机主类型保存前校验-----------
|
||||
String err = validateForSave(model, model.getId());
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机主类型保存前校验-----------
|
||||
mesXslDowntimeMainTypeService.updateById(model);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机主类型-删除")
|
||||
@Operation(summary = "MES停机主类型-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_main_type:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslDowntimeMainTypeService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机主类型-批量删除")
|
||||
@Operation(summary = "MES停机主类型-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_main_type:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslDowntimeMainTypeService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES停机主类型-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslDowntimeMainType> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslDowntimeMainType entity = mesXslDowntimeMainTypeService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "校验停机类型是否重复(同租户未删除数据;dataId 为编辑时当前主键)")
|
||||
@GetMapping(value = "/checkDowntimeType")
|
||||
public Result<String> checkDowntimeType(
|
||||
@RequestParam(name = "downtimeType", required = true) String downtimeType,
|
||||
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||
if (oConvertUtils.isEmpty(downtimeType) || downtimeType.trim().isEmpty()) {
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
MesXslDowntimeMainType ctx = new MesXslDowntimeMainType();
|
||||
if (mesXslDowntimeMainTypeService.isDowntimeTypeDuplicated(downtimeType.trim(), dataId, ctx)) {
|
||||
return Result.error("停机类型不能重复");
|
||||
}
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_main_type:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslDowntimeMainType model) {
|
||||
return super.exportXls(request, model, MesXslDowntimeMainType.class, "MES停机主类型");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_main_type:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机主类型导入:类型唯一、工序编码解析、颜色与启用状态校验-----------
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> ent : fileMap.entrySet()) {
|
||||
MultipartFile file = ent.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<MesXslDowntimeMainType> list =
|
||||
ExcelImportUtil.importExcel(file.getInputStream(), MesXslDowntimeMainType.class, params);
|
||||
if (list == null) {
|
||||
list = List.of();
|
||||
}
|
||||
Set<String> typesInFile = new HashSet<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MesXslDowntimeMainType row = list.get(i);
|
||||
int rowNo = i + 1;
|
||||
if (row == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
|
||||
}
|
||||
String dt = row.getDowntimeType();
|
||||
if (dt != null) {
|
||||
dt = dt.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(dt)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条停机类型不能为空");
|
||||
}
|
||||
row.setDowntimeType(dt);
|
||||
if (!typesInFile.add(dt)) {
|
||||
return Result.error("文件导入失败:停机类型【" + dt + "】在导入文件中重复");
|
||||
}
|
||||
if (mesXslDowntimeMainTypeService.isDowntimeTypeDuplicated(dt, null, row)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条停机类型【" + dt + "】不能重复(同租户未删除数据中已存在)");
|
||||
}
|
||||
String opCode = row.getImportOperationCode();
|
||||
if (opCode != null) {
|
||||
opCode = opCode.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(opCode)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条工序编码不能为空");
|
||||
}
|
||||
MesXslProcessOperation op = findProcessByOperationCode(opCode, row);
|
||||
if (op == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条工序编码【" + opCode + "】不存在");
|
||||
}
|
||||
row.setProcessOperationId(op.getId());
|
||||
row.setProcessOperationName(op.getOperationName());
|
||||
|
||||
if (row.getDisplayOrder() == null) {
|
||||
row.setDisplayOrder(0);
|
||||
}
|
||||
String colorErr = normalizeColor(row);
|
||||
if (colorErr != null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条" + colorErr);
|
||||
}
|
||||
String st = row.getStatus();
|
||||
if (oConvertUtils.isEmpty(st)) {
|
||||
row.setStatus("0");
|
||||
} else {
|
||||
st = st.trim();
|
||||
if (!STATUS_VALUES.contains(st)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条是否启用无效(须为 0 启用或 1 停用)");
|
||||
}
|
||||
row.setStatus(st);
|
||||
}
|
||||
row.setImportOperationCode(null);
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
mesXslDowntimeMainTypeService.saveBatch(list);
|
||||
log.info("停机主类型Excel导入完成,耗时{}ms,行数={}", System.currentTimeMillis() - start, list.size());
|
||||
return Result.ok("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.error(msg, e);
|
||||
if (msg != null && msg.indexOf("Duplicate entry") >= 0) {
|
||||
return Result.error("文件导入失败: 存在重复数据(停机类型不能重复)");
|
||||
}
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机主类型导入:类型唯一、工序编码解析、颜色与启用状态校验-----------
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机主类型保存前校验与工序名称回填-----------
|
||||
private String validateForSave(MesXslDowntimeMainType model, String excludeId) {
|
||||
if (oConvertUtils.isEmpty(model.getDowntimeType()) || model.getDowntimeType().trim().isEmpty()) {
|
||||
return "停机类型不能为空";
|
||||
}
|
||||
String dt = model.getDowntimeType().trim();
|
||||
model.setDowntimeType(dt);
|
||||
if (mesXslDowntimeMainTypeService.isDowntimeTypeDuplicated(dt, excludeId, model)) {
|
||||
return "停机类型不能重复";
|
||||
}
|
||||
if (oConvertUtils.isEmpty(model.getProcessOperationId())) {
|
||||
return "请选择所属工序";
|
||||
}
|
||||
MesXslProcessOperation op = mesXslProcessOperationService.getById(model.getProcessOperationId());
|
||||
if (op == null) {
|
||||
return "所属工序不存在";
|
||||
}
|
||||
model.setProcessOperationName(op.getOperationName());
|
||||
|
||||
if (model.getDisplayOrder() == null) {
|
||||
model.setDisplayOrder(0);
|
||||
}
|
||||
|
||||
String colorErr = normalizeColor(model);
|
||||
if (colorErr != null) {
|
||||
return colorErr;
|
||||
}
|
||||
|
||||
String st = model.getStatus();
|
||||
if (oConvertUtils.isEmpty(st)) {
|
||||
model.setStatus("0");
|
||||
} else {
|
||||
st = st.trim();
|
||||
if (!STATUS_VALUES.contains(st)) {
|
||||
return "是否启用取值无效";
|
||||
}
|
||||
model.setStatus(st);
|
||||
}
|
||||
model.setImportOperationCode(null);
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String normalizeColor(MesXslDowntimeMainType model) {
|
||||
String color = model.getDistinguishColor();
|
||||
if (oConvertUtils.isEmpty(color)) {
|
||||
model.setDistinguishColor(null);
|
||||
return null;
|
||||
}
|
||||
color = color.trim();
|
||||
if (!color.startsWith("#")) {
|
||||
color = "#" + color;
|
||||
}
|
||||
if (!COLOR_HEX.matcher(color).matches()) {
|
||||
return "区分颜色格式无效(须为十六进制色值,如 #1890ff)";
|
||||
}
|
||||
model.setDistinguishColor(color.toLowerCase());
|
||||
return null;
|
||||
}
|
||||
|
||||
private MesXslProcessOperation findProcessByOperationCode(String operationCode, MesXslDowntimeMainType context) {
|
||||
LambdaQueryWrapper<MesXslProcessOperation> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslProcessOperation::getOperationCode, operationCode.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslProcessOperation::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslProcessOperation::getDelFlag));
|
||||
Integer tenantId = context != null ? context.getTenantId() : null;
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslProcessOperation::getTenantId, tenantId);
|
||||
}
|
||||
List<MesXslProcessOperation> found = mesXslProcessOperationService.list(w);
|
||||
if (found == null || found.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return found.get(0);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机主类型保存前校验与工序名称回填-----------
|
||||
}
|
||||
@@ -0,0 +1,433 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeType;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslProcessOperation;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslDowntimeMainTypeService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslDowntimeTypeService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslProcessOperationService;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* MES 停机类型
|
||||
*/
|
||||
@Tag(name = "MES停机类型")
|
||||
@RestController
|
||||
@RequestMapping("/xslmes/mesXslDowntimeType")
|
||||
@Slf4j
|
||||
public class MesXslDowntimeTypeController extends JeecgController<MesXslDowntimeType, IMesXslDowntimeTypeService> {
|
||||
|
||||
private static final Set<String> STATUS_VALUES = Set.of("0", "1");
|
||||
private static final Set<String> YN_VALUES = Set.of("0", "1");
|
||||
private static final Pattern COLOR_HEX = Pattern.compile("^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$");
|
||||
|
||||
@Autowired
|
||||
private IMesXslDowntimeTypeService mesXslDowntimeTypeService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslProcessOperationService mesXslProcessOperationService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslDowntimeMainTypeService mesXslDowntimeMainTypeService;
|
||||
|
||||
@Operation(summary = "MES停机类型-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslDowntimeType>> queryPageList(
|
||||
MesXslDowntimeType model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslDowntimeType> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型列表默认按显示顺序升序-----------
|
||||
queryWrapper.orderByAsc("display_order").orderByDesc("create_time");
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型列表默认按显示顺序升序-----------
|
||||
Page<MesXslDowntimeType> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslDowntimeType> pageList = mesXslDowntimeTypeService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机类型-添加")
|
||||
@Operation(summary = "MES停机类型-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_type:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslDowntimeType model) {
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型保存前校验-----------
|
||||
String err = validateForSave(model, null);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型保存前校验-----------
|
||||
mesXslDowntimeTypeService.save(model);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机类型-编辑")
|
||||
@Operation(summary = "MES停机类型-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_type:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslDowntimeType model) {
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型保存前校验-----------
|
||||
String err = validateForSave(model, model.getId());
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型保存前校验-----------
|
||||
mesXslDowntimeTypeService.updateById(model);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机类型-删除")
|
||||
@Operation(summary = "MES停机类型-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_type:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslDowntimeTypeService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机类型-批量删除")
|
||||
@Operation(summary = "MES停机类型-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_type:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslDowntimeTypeService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES停机类型-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslDowntimeType> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslDowntimeType entity = mesXslDowntimeTypeService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "校验停机类型是否重复(同租户未删除数据;dataId 为编辑时当前主键)")
|
||||
@GetMapping(value = "/checkDowntimeType")
|
||||
public Result<String> checkDowntimeType(
|
||||
@RequestParam(name = "downtimeType", required = true) String downtimeType,
|
||||
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||
if (oConvertUtils.isEmpty(downtimeType) || downtimeType.trim().isEmpty()) {
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
MesXslDowntimeType ctx = new MesXslDowntimeType();
|
||||
if (mesXslDowntimeTypeService.isDowntimeTypeDuplicated(downtimeType.trim(), dataId, ctx)) {
|
||||
return Result.error("停机类型不能重复");
|
||||
}
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_type:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslDowntimeType model) {
|
||||
return super.exportXls(request, model, MesXslDowntimeType.class, "MES停机类型");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_type:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型导入:必填校验、类型唯一、工序与主类型解析-----------
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> ent : fileMap.entrySet()) {
|
||||
MultipartFile file = ent.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<MesXslDowntimeType> list =
|
||||
ExcelImportUtil.importExcel(file.getInputStream(), MesXslDowntimeType.class, params);
|
||||
if (list == null) {
|
||||
list = List.of();
|
||||
}
|
||||
Set<String> typesInFile = new HashSet<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MesXslDowntimeType row = list.get(i);
|
||||
int rowNo = i + 1;
|
||||
if (row == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
|
||||
}
|
||||
String err = validateImportRow(row, rowNo, typesInFile);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
mesXslDowntimeTypeService.saveBatch(list);
|
||||
log.info("停机类型Excel导入完成,耗时{}ms,行数={}", System.currentTimeMillis() - start, list.size());
|
||||
return Result.ok("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.error(msg, e);
|
||||
if (msg != null && msg.indexOf("Duplicate entry") >= 0) {
|
||||
return Result.error("文件导入失败: 存在重复数据(停机类型不能重复)");
|
||||
}
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型导入:必填校验、类型唯一、工序与主类型解析-----------
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型保存前校验、关联工序与主类型回填-----------
|
||||
private String validateForSave(MesXslDowntimeType model, String excludeId) {
|
||||
if (oConvertUtils.isEmpty(model.getProcessOperationId())) {
|
||||
return "请选择所属工序";
|
||||
}
|
||||
MesXslProcessOperation op = mesXslProcessOperationService.getById(model.getProcessOperationId());
|
||||
if (op == null) {
|
||||
return "所属工序不存在";
|
||||
}
|
||||
model.setProcessOperationName(op.getOperationName());
|
||||
|
||||
if (oConvertUtils.isEmpty(model.getDowntimeMainTypeId())) {
|
||||
return "请选择所属主类型";
|
||||
}
|
||||
String mainErr = fillAndValidateMainType(model);
|
||||
if (mainErr != null) {
|
||||
return mainErr;
|
||||
}
|
||||
|
||||
if (oConvertUtils.isEmpty(model.getDowntimeType()) || model.getDowntimeType().trim().isEmpty()) {
|
||||
return "停机类型不能为空";
|
||||
}
|
||||
String dt = model.getDowntimeType().trim();
|
||||
model.setDowntimeType(dt);
|
||||
if (mesXslDowntimeTypeService.isDowntimeTypeDuplicated(dt, excludeId, model)) {
|
||||
return "停机类型不能重复";
|
||||
}
|
||||
|
||||
if (model.getDisplayOrder() == null) {
|
||||
return "显示顺序不能为空";
|
||||
}
|
||||
|
||||
String colorErr = normalizeColor(model);
|
||||
if (colorErr != null) {
|
||||
return colorErr;
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】责任区分、故障等级改为手填文本,仅 trim-----------
|
||||
model.setResponsibilityDistinct(trimToNull(model.getResponsibilityDistinct()));
|
||||
model.setFaultLevel(trimToNull(model.getFaultLevel()));
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】责任区分、故障等级改为手填文本,仅 trim-----------
|
||||
|
||||
String dm = model.getDowntimeMaintenance();
|
||||
if (oConvertUtils.isEmpty(dm)) {
|
||||
model.setDowntimeMaintenance("0");
|
||||
} else {
|
||||
dm = dm.trim();
|
||||
if (!YN_VALUES.contains(dm)) {
|
||||
return "是否停机维修取值无效";
|
||||
}
|
||||
model.setDowntimeMaintenance(dm);
|
||||
}
|
||||
|
||||
String st = model.getStatus();
|
||||
if (oConvertUtils.isEmpty(st)) {
|
||||
model.setStatus("0");
|
||||
} else {
|
||||
st = st.trim();
|
||||
if (!STATUS_VALUES.contains(st)) {
|
||||
return "是否启用取值无效";
|
||||
}
|
||||
model.setStatus(st);
|
||||
}
|
||||
model.setImportOperationCode(null);
|
||||
model.setImportMainTypeName(null);
|
||||
return null;
|
||||
}
|
||||
|
||||
private String fillAndValidateMainType(MesXslDowntimeType model) {
|
||||
MesXslDowntimeMainType main = mesXslDowntimeMainTypeService.getById(model.getDowntimeMainTypeId());
|
||||
if (main == null) {
|
||||
return "所属主类型不存在";
|
||||
}
|
||||
if (!model.getProcessOperationId().equals(main.getProcessOperationId())) {
|
||||
return "所属主类型与所选工序不匹配";
|
||||
}
|
||||
model.setDowntimeMainTypeName(main.getDowntimeType());
|
||||
return null;
|
||||
}
|
||||
|
||||
private String validateImportRow(MesXslDowntimeType row, int rowNo, Set<String> typesInFile) {
|
||||
String opCode = row.getImportOperationCode();
|
||||
if (opCode != null) {
|
||||
opCode = opCode.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(opCode)) {
|
||||
return "文件导入失败:第 " + rowNo + " 条工序编码不能为空";
|
||||
}
|
||||
MesXslProcessOperation op = findProcessByOperationCode(opCode, row);
|
||||
if (op == null) {
|
||||
return "文件导入失败:第 " + rowNo + " 条工序编码【" + opCode + "】不存在";
|
||||
}
|
||||
row.setProcessOperationId(op.getId());
|
||||
row.setProcessOperationName(op.getOperationName());
|
||||
|
||||
String mainName = row.getImportMainTypeName();
|
||||
if (mainName != null) {
|
||||
mainName = mainName.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(mainName)) {
|
||||
return "文件导入失败:第 " + rowNo + " 条主类型名称不能为空";
|
||||
}
|
||||
MesXslDowntimeMainType main = findMainTypeByNameAndProcess(mainName, op.getId(), row);
|
||||
if (main == null) {
|
||||
return "文件导入失败:第 " + rowNo + " 条主类型【" + mainName + "】在所选工序下不存在";
|
||||
}
|
||||
row.setDowntimeMainTypeId(main.getId());
|
||||
row.setDowntimeMainTypeName(main.getDowntimeType());
|
||||
|
||||
String dt = row.getDowntimeType();
|
||||
if (dt != null) {
|
||||
dt = dt.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(dt)) {
|
||||
return "文件导入失败:第 " + rowNo + " 条停机类型不能为空";
|
||||
}
|
||||
row.setDowntimeType(dt);
|
||||
if (!typesInFile.add(dt)) {
|
||||
return "文件导入失败:停机类型【" + dt + "】在导入文件中重复";
|
||||
}
|
||||
if (mesXslDowntimeTypeService.isDowntimeTypeDuplicated(dt, null, row)) {
|
||||
return "文件导入失败:第 " + rowNo + " 条停机类型【" + dt + "】不能重复(同租户未删除数据中已存在)";
|
||||
}
|
||||
if (row.getDisplayOrder() == null) {
|
||||
return "文件导入失败:第 " + rowNo + " 条显示顺序不能为空";
|
||||
}
|
||||
|
||||
String colorErr = normalizeColor(row);
|
||||
if (colorErr != null) {
|
||||
return "文件导入失败:第 " + rowNo + " 条" + colorErr;
|
||||
}
|
||||
|
||||
row.setResponsibilityDistinct(trimToNull(row.getResponsibilityDistinct()));
|
||||
row.setFaultLevel(trimToNull(row.getFaultLevel()));
|
||||
|
||||
String dm = row.getDowntimeMaintenance();
|
||||
if (oConvertUtils.isEmpty(dm)) {
|
||||
row.setDowntimeMaintenance("0");
|
||||
} else {
|
||||
dm = dm.trim();
|
||||
if (!YN_VALUES.contains(dm)) {
|
||||
return "文件导入失败:第 " + rowNo + " 条是否停机维修无效";
|
||||
}
|
||||
row.setDowntimeMaintenance(dm);
|
||||
}
|
||||
|
||||
String st = row.getStatus();
|
||||
if (oConvertUtils.isEmpty(st)) {
|
||||
row.setStatus("0");
|
||||
} else {
|
||||
st = st.trim();
|
||||
if (!STATUS_VALUES.contains(st)) {
|
||||
return "文件导入失败:第 " + rowNo + " 条是否启用无效";
|
||||
}
|
||||
row.setStatus(st);
|
||||
}
|
||||
row.setImportOperationCode(null);
|
||||
row.setImportMainTypeName(null);
|
||||
return null;
|
||||
}
|
||||
|
||||
private MesXslDowntimeMainType findMainTypeByNameAndProcess(
|
||||
String mainTypeName, String processOperationId, MesXslDowntimeType context) {
|
||||
LambdaQueryWrapper<MesXslDowntimeMainType> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslDowntimeMainType::getDowntimeType, mainTypeName.trim());
|
||||
w.eq(MesXslDowntimeMainType::getProcessOperationId, processOperationId);
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslDowntimeMainType::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslDowntimeMainType::getDelFlag));
|
||||
Integer tenantId = context != null ? context.getTenantId() : null;
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslDowntimeMainType::getTenantId, tenantId);
|
||||
}
|
||||
w.last("LIMIT 1");
|
||||
return mesXslDowntimeMainTypeService.getOne(w, false);
|
||||
}
|
||||
|
||||
private MesXslProcessOperation findProcessByOperationCode(String operationCode, MesXslDowntimeType context) {
|
||||
LambdaQueryWrapper<MesXslProcessOperation> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslProcessOperation::getOperationCode, operationCode.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslProcessOperation::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslProcessOperation::getDelFlag));
|
||||
Integer tenantId = context != null ? context.getTenantId() : null;
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslProcessOperation::getTenantId, tenantId);
|
||||
}
|
||||
List<MesXslProcessOperation> found = mesXslProcessOperationService.list(w);
|
||||
if (found == null || found.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return found.get(0);
|
||||
}
|
||||
|
||||
private static String trimToNull(String value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
String v = value.trim();
|
||||
return v.isEmpty() ? null : v;
|
||||
}
|
||||
|
||||
private static String normalizeColor(MesXslDowntimeType model) {
|
||||
String color = model.getDistinguishColor();
|
||||
if (oConvertUtils.isEmpty(color)) {
|
||||
model.setDistinguishColor(null);
|
||||
return null;
|
||||
}
|
||||
color = color.trim();
|
||||
if (!color.startsWith("#")) {
|
||||
color = "#" + color;
|
||||
}
|
||||
if (!COLOR_HEX.matcher(color).matches()) {
|
||||
return "区分颜色格式无效(须为十六进制色值,如 #1890ff)";
|
||||
}
|
||||
model.setDistinguishColor(color.toLowerCase());
|
||||
return null;
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型保存前校验、关联工序与主类型回填-----------
|
||||
}
|
||||
@@ -0,0 +1,300 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslEquipmentCategory;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslProcessOperation;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslEquipmentCategoryService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslProcessOperationService;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* MES 设备类别
|
||||
*/
|
||||
@Tag(name = "MES设备类别")
|
||||
@RestController
|
||||
@RequestMapping("/xslmes/mesXslEquipmentCategory")
|
||||
@Slf4j
|
||||
public class MesXslEquipmentCategoryController extends JeecgController<MesXslEquipmentCategory, IMesXslEquipmentCategoryService> {
|
||||
|
||||
private static final Set<String> INSPECT_DISTINCT = Set.of("generic", "distinct");
|
||||
private static final Set<String> MAINTAIN_DISTINCT = Set.of("maintain", "distinct");
|
||||
|
||||
@Autowired
|
||||
private IMesXslEquipmentCategoryService mesXslEquipmentCategoryService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslProcessOperationService mesXslProcessOperationService;
|
||||
|
||||
@Operation(summary = "MES设备类别-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslEquipmentCategory>> queryPageList(
|
||||
MesXslEquipmentCategory model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslEquipmentCategory> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
Page<MesXslEquipmentCategory> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslEquipmentCategory> pageList = mesXslEquipmentCategoryService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES设备类别-添加")
|
||||
@Operation(summary = "MES设备类别-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_category:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslEquipmentCategory model) {
|
||||
//update-begin---author:jiangxh ---date:20260514 for:【MES】设备类别:名称唯一、工序与字典校验、冗余工序名称-----------
|
||||
String err = validateForSave(model, null);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260514 for:【MES】设备类别:名称唯一、工序与字典校验、冗余工序名称-----------
|
||||
mesXslEquipmentCategoryService.save(model);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES设备类别-编辑")
|
||||
@Operation(summary = "MES设备类别-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_category:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslEquipmentCategory model) {
|
||||
//update-begin---author:jiangxh ---date:20260514 for:【MES】设备类别:名称唯一、工序与字典校验、冗余工序名称-----------
|
||||
String err = validateForSave(model, model.getId());
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260514 for:【MES】设备类别:名称唯一、工序与字典校验、冗余工序名称-----------
|
||||
mesXslEquipmentCategoryService.updateById(model);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES设备类别-删除")
|
||||
@Operation(summary = "MES设备类别-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_category:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslEquipmentCategoryService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES设备类别-批量删除")
|
||||
@Operation(summary = "MES设备类别-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_category:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslEquipmentCategoryService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES设备类别-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslEquipmentCategory> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslEquipmentCategory entity = mesXslEquipmentCategoryService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "校验设备类别名称是否重复(仅未删除数据;同租户,dataId 为编辑时当前主键)")
|
||||
@GetMapping(value = "/checkCategoryName")
|
||||
public Result<String> checkCategoryName(
|
||||
@RequestParam(name = "categoryName", required = true) String categoryName,
|
||||
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||
if (oConvertUtils.isEmpty(categoryName) || categoryName.trim().isEmpty()) {
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
MesXslEquipmentCategory ctx = new MesXslEquipmentCategory();
|
||||
if (mesXslEquipmentCategoryService.isCategoryNameDuplicated(categoryName.trim(), dataId, ctx)) {
|
||||
return Result.error("该类别名称已存在");
|
||||
}
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_category:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslEquipmentCategory model) {
|
||||
return super.exportXls(request, model, MesXslEquipmentCategory.class, "MES设备类别");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_category:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
//update-begin---author:jiangxh ---date:20260514 for:【MES】设备类别导入:名称唯一、工序编码解析、字典取值校验-----------
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> ent : fileMap.entrySet()) {
|
||||
MultipartFile file = ent.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<MesXslEquipmentCategory> list = ExcelImportUtil.importExcel(file.getInputStream(), MesXslEquipmentCategory.class, params);
|
||||
if (list == null) {
|
||||
list = List.of();
|
||||
}
|
||||
Set<String> namesInFile = new HashSet<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MesXslEquipmentCategory row = list.get(i);
|
||||
int rowNo = i + 1;
|
||||
if (row == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
|
||||
}
|
||||
String name = row.getCategoryName();
|
||||
if (name != null) {
|
||||
name = name.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(name)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条类别名称不能为空");
|
||||
}
|
||||
row.setCategoryName(name);
|
||||
if (!namesInFile.add(name)) {
|
||||
return Result.error("文件导入失败:类别名称【" + name + "】在导入文件中重复");
|
||||
}
|
||||
if (mesXslEquipmentCategoryService.isCategoryNameDuplicated(name, null, row)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条类别名称【" + name + "】已存在(未删除数据中不允许重复)");
|
||||
}
|
||||
String opCode = row.getImportOperationCode();
|
||||
if (opCode != null) {
|
||||
opCode = opCode.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(opCode)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条工序编码不能为空");
|
||||
}
|
||||
MesXslProcessOperation op = findProcessByOperationCode(opCode, row);
|
||||
if (op == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条工序编码【" + opCode + "】不存在或未删除数据中无匹配");
|
||||
}
|
||||
row.setProcessOperationId(op.getId());
|
||||
row.setProcessOperationName(op.getOperationName());
|
||||
row.setImportOperationCode(null);
|
||||
|
||||
String ins = row.getInspectDistinct();
|
||||
if (ins != null) {
|
||||
ins = ins.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(ins) || !INSPECT_DISTINCT.contains(ins)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条点检区分须为字典项值 generic 或 distinct");
|
||||
}
|
||||
row.setInspectDistinct(ins);
|
||||
|
||||
String mtn = row.getMaintainDistinct();
|
||||
if (mtn != null) {
|
||||
mtn = mtn.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(mtn) || !MAINTAIN_DISTINCT.contains(mtn)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条保养区分须为字典项值 maintain 或 distinct");
|
||||
}
|
||||
row.setMaintainDistinct(mtn);
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
mesXslEquipmentCategoryService.saveBatch(list);
|
||||
log.info("设备类别Excel导入完成,耗时{}ms,行数={}", System.currentTimeMillis() - start, list.size());
|
||||
return Result.ok("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.error(msg, e);
|
||||
if (msg != null && msg.indexOf("Duplicate entry") >= 0) {
|
||||
return Result.error("文件导入失败: 存在重复数据(类别名称在未删除数据中需唯一)");
|
||||
}
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260514 for:【MES】设备类别导入:名称唯一、工序编码解析、字典取值校验-----------
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260514 for:【MES】设备类别保存前校验与工序名称回填-----------
|
||||
private String validateForSave(MesXslEquipmentCategory model, String excludeId) {
|
||||
if (oConvertUtils.isEmpty(model.getCategoryName()) || model.getCategoryName().trim().isEmpty()) {
|
||||
return "类别名称不能为空";
|
||||
}
|
||||
String cn = model.getCategoryName().trim();
|
||||
model.setCategoryName(cn);
|
||||
if (mesXslEquipmentCategoryService.isCategoryNameDuplicated(cn, excludeId, model)) {
|
||||
return "类别名称已存在";
|
||||
}
|
||||
if (oConvertUtils.isEmpty(model.getProcessOperationId())) {
|
||||
return "请选择所属工序";
|
||||
}
|
||||
MesXslProcessOperation op = mesXslProcessOperationService.getById(model.getProcessOperationId());
|
||||
if (op == null) {
|
||||
return "所属工序不存在";
|
||||
}
|
||||
model.setProcessOperationName(op.getOperationName());
|
||||
|
||||
String ins = model.getInspectDistinct();
|
||||
if (ins != null) {
|
||||
ins = ins.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(ins) || !INSPECT_DISTINCT.contains(ins)) {
|
||||
return "点检区分不合法(须为字典项值 generic 或 distinct)";
|
||||
}
|
||||
model.setInspectDistinct(ins);
|
||||
|
||||
String mtn = model.getMaintainDistinct();
|
||||
if (mtn != null) {
|
||||
mtn = mtn.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(mtn) || !MAINTAIN_DISTINCT.contains(mtn)) {
|
||||
return "保养区分不合法(须为字典项值 maintain 或 distinct)";
|
||||
}
|
||||
model.setMaintainDistinct(mtn);
|
||||
model.setImportOperationCode(null);
|
||||
return null;
|
||||
}
|
||||
|
||||
private MesXslProcessOperation findProcessByOperationCode(String operationCode, MesXslEquipmentCategory context) {
|
||||
LambdaQueryWrapper<MesXslProcessOperation> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslProcessOperation::getOperationCode, operationCode.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslProcessOperation::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslProcessOperation::getDelFlag));
|
||||
Integer tenantId = context != null ? context.getTenantId() : null;
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslProcessOperation::getTenantId, tenantId);
|
||||
}
|
||||
List<MesXslProcessOperation> found = mesXslProcessOperationService.list(w);
|
||||
if (found == null || found.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return found.get(0);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260514 for:【MES】设备类别保存前校验与工序名称回填-----------
|
||||
}
|
||||
@@ -0,0 +1,284 @@
|
||||
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.MesXslEquipmentCategory;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslEquipmentPart;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslEquipmentCategoryService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslEquipmentPartService;
|
||||
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/mesXslEquipmentPart")
|
||||
@Slf4j
|
||||
public class MesXslEquipmentPartController extends JeecgController<MesXslEquipmentPart, IMesXslEquipmentPartService> {
|
||||
|
||||
private static final Set<String> ENABLE_STATUS = Set.of("0", "1");
|
||||
|
||||
@Autowired
|
||||
private IMesXslEquipmentPartService mesXslEquipmentPartService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslEquipmentCategoryService mesXslEquipmentCategoryService;
|
||||
|
||||
@Operation(summary = "MES设备部位-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslEquipmentPart>> queryPageList(
|
||||
MesXslEquipmentPart model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslEquipmentPart> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
Page<MesXslEquipmentPart> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslEquipmentPart> pageList = mesXslEquipmentPartService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES设备部位-添加")
|
||||
@Operation(summary = "MES设备部位-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_part:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslEquipmentPart model) {
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】设备部位:部位代码唯一、设备类别与启用状态校验、冗余类别名称-----------
|
||||
String err = validateForSave(model, null);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】设备部位:部位代码唯一、设备类别与启用状态校验、冗余类别名称-----------
|
||||
mesXslEquipmentPartService.save(model);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES设备部位-编辑")
|
||||
@Operation(summary = "MES设备部位-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_part:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslEquipmentPart model) {
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】设备部位:部位代码唯一、设备类别与启用状态校验、冗余类别名称-----------
|
||||
String err = validateForSave(model, model.getId());
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】设备部位:部位代码唯一、设备类别与启用状态校验、冗余类别名称-----------
|
||||
mesXslEquipmentPartService.updateById(model);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES设备部位-删除")
|
||||
@Operation(summary = "MES设备部位-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_part:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslEquipmentPartService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES设备部位-批量删除")
|
||||
@Operation(summary = "MES设备部位-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_part:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslEquipmentPartService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES设备部位-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslEquipmentPart> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslEquipmentPart entity = mesXslEquipmentPartService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "校验部位代码是否重复(同租户未删除数据;dataId 为编辑时当前主键)")
|
||||
@GetMapping(value = "/checkPartCode")
|
||||
public Result<String> checkPartCode(
|
||||
@RequestParam(name = "partCode", required = true) String partCode,
|
||||
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||
if (oConvertUtils.isEmpty(partCode) || partCode.trim().isEmpty()) {
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
MesXslEquipmentPart ctx = new MesXslEquipmentPart();
|
||||
if (mesXslEquipmentPartService.isPartCodeDuplicated(partCode.trim(), dataId, ctx)) {
|
||||
return Result.error("部位代码不能重复");
|
||||
}
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_part:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslEquipmentPart model) {
|
||||
return super.exportXls(request, model, MesXslEquipmentPart.class, "MES设备部位");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_part:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】设备部位导入:部位代码唯一、设备类别名称解析、启用状态校验-----------
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> ent : fileMap.entrySet()) {
|
||||
MultipartFile file = ent.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<MesXslEquipmentPart> list = ExcelImportUtil.importExcel(file.getInputStream(), MesXslEquipmentPart.class, params);
|
||||
if (list == null) {
|
||||
list = List.of();
|
||||
}
|
||||
Set<String> codesInFile = new HashSet<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MesXslEquipmentPart row = list.get(i);
|
||||
int rowNo = i + 1;
|
||||
if (row == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
|
||||
}
|
||||
String pc = row.getPartCode();
|
||||
if (pc != null) {
|
||||
pc = pc.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(pc)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条部位代码不能为空");
|
||||
}
|
||||
row.setPartCode(pc);
|
||||
String catName = row.getImportCategoryName();
|
||||
if (catName != null) {
|
||||
catName = catName.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(catName)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条设备类别名称不能为空");
|
||||
}
|
||||
MesXslEquipmentCategory cat =
|
||||
mesXslEquipmentCategoryService.findOneActiveByNameAndTenant(catName, row.getTenantId());
|
||||
if (cat == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条设备类别名称【" + catName + "】不存在或未删除数据中无匹配");
|
||||
}
|
||||
row.setEquipmentCategoryId(cat.getId());
|
||||
row.setEquipmentCategoryName(cat.getCategoryName());
|
||||
row.setImportCategoryName(null);
|
||||
if (!codesInFile.add(pc)) {
|
||||
return Result.error("文件导入失败:部位代码【" + pc + "】在导入文件中重复(部位代码不能重复)");
|
||||
}
|
||||
if (mesXslEquipmentPartService.isPartCodeDuplicated(pc, null, row)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条部位代码【" + pc + "】不能重复(同租户未删除数据中已存在)");
|
||||
}
|
||||
|
||||
if (row.getPartName() != null) {
|
||||
row.setPartName(row.getPartName().trim());
|
||||
}
|
||||
if (row.getPartDescription() != null) {
|
||||
row.setPartDescription(row.getPartDescription().trim());
|
||||
}
|
||||
|
||||
String en = row.getEnableStatus();
|
||||
if (en != null) {
|
||||
en = en.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(en)) {
|
||||
en = "0";
|
||||
}
|
||||
if (!ENABLE_STATUS.contains(en)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条是否启用须为字典项值 0 或 1(xslmes_unit_status)");
|
||||
}
|
||||
row.setEnableStatus(en);
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
mesXslEquipmentPartService.saveBatch(list);
|
||||
log.info("设备部位Excel导入完成,耗时{}ms,行数={}", System.currentTimeMillis() - start, list.size());
|
||||
return Result.ok("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.error(msg, e);
|
||||
if (msg != null && msg.indexOf("Duplicate entry") >= 0) {
|
||||
return Result.error("文件导入失败: 存在重复数据(部位代码不能重复)");
|
||||
}
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】设备部位导入:部位代码唯一、设备类别名称解析、启用状态校验-----------
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】设备部位保存前校验与类别名称回填-----------
|
||||
private String validateForSave(MesXslEquipmentPart model, String excludeId) {
|
||||
if (oConvertUtils.isEmpty(model.getEquipmentCategoryId())) {
|
||||
return "请选择所属设备类别";
|
||||
}
|
||||
MesXslEquipmentCategory cat = mesXslEquipmentCategoryService.getById(model.getEquipmentCategoryId());
|
||||
if (cat == null) {
|
||||
return "所属设备类别不存在";
|
||||
}
|
||||
model.setEquipmentCategoryName(cat.getCategoryName());
|
||||
|
||||
if (oConvertUtils.isEmpty(model.getPartCode()) || model.getPartCode().trim().isEmpty()) {
|
||||
return "部位代码不能为空";
|
||||
}
|
||||
String pc = model.getPartCode().trim();
|
||||
model.setPartCode(pc);
|
||||
if (mesXslEquipmentPartService.isPartCodeDuplicated(pc, excludeId, model)) {
|
||||
return "部位代码不能重复";
|
||||
}
|
||||
|
||||
if (oConvertUtils.isEmpty(model.getPartName()) || model.getPartName().trim().isEmpty()) {
|
||||
return "部位名称不能为空";
|
||||
}
|
||||
model.setPartName(model.getPartName().trim());
|
||||
|
||||
String en = model.getEnableStatus();
|
||||
if (en != null) {
|
||||
en = en.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(en)) {
|
||||
en = "0";
|
||||
}
|
||||
if (!ENABLE_STATUS.contains(en)) {
|
||||
return "是否启用不合法(须为字典项值 0 或 1,xslmes_unit_status)";
|
||||
}
|
||||
model.setEnableStatus(en);
|
||||
|
||||
if (model.getPartDescription() != null) {
|
||||
model.setPartDescription(model.getPartDescription().trim());
|
||||
}
|
||||
model.setImportCategoryName(null);
|
||||
return null;
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】设备部位保存前校验与类别名称回填-----------
|
||||
}
|
||||
@@ -0,0 +1,325 @@
|
||||
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.MesXslEquipmentCategory;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslEquipmentPart;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslEquipmentSubPart;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslEquipmentCategoryService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslEquipmentPartService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslEquipmentSubPartService;
|
||||
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/mesXslEquipmentSubPart")
|
||||
@Slf4j
|
||||
public class MesXslEquipmentSubPartController extends JeecgController<MesXslEquipmentSubPart, IMesXslEquipmentSubPartService> {
|
||||
|
||||
private static final Set<String> ENABLE_STATUS = Set.of("0", "1");
|
||||
|
||||
@Autowired
|
||||
private IMesXslEquipmentSubPartService mesXslEquipmentSubPartService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslEquipmentCategoryService mesXslEquipmentCategoryService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslEquipmentPartService mesXslEquipmentPartService;
|
||||
|
||||
@Operation(summary = "MES设备小部位-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslEquipmentSubPart>> queryPageList(
|
||||
MesXslEquipmentSubPart model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslEquipmentSubPart> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
Page<MesXslEquipmentSubPart> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslEquipmentSubPart> pageList = mesXslEquipmentSubPartService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES设备小部位-添加")
|
||||
@Operation(summary = "MES设备小部位-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_sub_part:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslEquipmentSubPart model) {
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】设备小部位保存前校验:类别/大部位一致、小部位代码唯一、冗余名称-----------
|
||||
String err = validateForSave(model, null);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】设备小部位保存前校验:类别/大部位一致、小部位代码唯一、冗余名称-----------
|
||||
mesXslEquipmentSubPartService.save(model);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES设备小部位-编辑")
|
||||
@Operation(summary = "MES设备小部位-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_sub_part:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslEquipmentSubPart model) {
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】设备小部位保存前校验:类别/大部位一致、小部位代码唯一、冗余名称-----------
|
||||
String err = validateForSave(model, model.getId());
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】设备小部位保存前校验:类别/大部位一致、小部位代码唯一、冗余名称-----------
|
||||
mesXslEquipmentSubPartService.updateById(model);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES设备小部位-删除")
|
||||
@Operation(summary = "MES设备小部位-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_sub_part:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslEquipmentSubPartService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES设备小部位-批量删除")
|
||||
@Operation(summary = "MES设备小部位-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_sub_part:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslEquipmentSubPartService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES设备小部位-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslEquipmentSubPart> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslEquipmentSubPart entity = mesXslEquipmentSubPartService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "校验小部位代码是否重复(同租户未删除数据;dataId 为编辑时当前主键)")
|
||||
@GetMapping(value = "/checkSubPartCode")
|
||||
public Result<String> checkSubPartCode(
|
||||
@RequestParam(name = "subPartCode", required = true) String subPartCode,
|
||||
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||
if (oConvertUtils.isEmpty(subPartCode) || subPartCode.trim().isEmpty()) {
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
MesXslEquipmentSubPart ctx = new MesXslEquipmentSubPart();
|
||||
if (mesXslEquipmentSubPartService.isSubPartCodeDuplicated(subPartCode.trim(), dataId, ctx)) {
|
||||
return Result.error("小部位代码不能重复");
|
||||
}
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_sub_part:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslEquipmentSubPart model) {
|
||||
return super.exportXls(request, model, MesXslEquipmentSubPart.class, "MES设备小部位");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_sub_part:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】设备小部位导入:小部位代码唯一、类别名称与大部位代码解析、与大部位类别一致性-----------
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> ent : fileMap.entrySet()) {
|
||||
MultipartFile file = ent.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<MesXslEquipmentSubPart> list = ExcelImportUtil.importExcel(file.getInputStream(), MesXslEquipmentSubPart.class, params);
|
||||
if (list == null) {
|
||||
list = List.of();
|
||||
}
|
||||
Set<String> codesInFile = new HashSet<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MesXslEquipmentSubPart row = list.get(i);
|
||||
int rowNo = i + 1;
|
||||
if (row == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
|
||||
}
|
||||
String sc = row.getSubPartCode();
|
||||
if (sc != null) {
|
||||
sc = sc.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(sc)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条小部位代码不能为空");
|
||||
}
|
||||
row.setSubPartCode(sc);
|
||||
String catName = row.getImportCategoryName();
|
||||
if (catName != null) {
|
||||
catName = catName.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(catName)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条设备类别名称不能为空");
|
||||
}
|
||||
MesXslEquipmentCategory cat =
|
||||
mesXslEquipmentCategoryService.findOneActiveByNameAndTenant(catName, row.getTenantId());
|
||||
if (cat == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条设备类别名称【" + catName + "】不存在或未删除数据中无匹配");
|
||||
}
|
||||
row.setEquipmentCategoryId(cat.getId());
|
||||
row.setEquipmentCategoryName(cat.getCategoryName());
|
||||
|
||||
String ipc = row.getImportEquipmentPartCode();
|
||||
if (ipc != null) {
|
||||
ipc = ipc.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(ipc)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条大部位代码不能为空");
|
||||
}
|
||||
MesXslEquipmentPart part =
|
||||
mesXslEquipmentPartService.findOneActiveByPartCodeAndTenant(ipc, row.getTenantId());
|
||||
if (part == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条大部位代码【" + ipc + "】不存在或未删除数据中无匹配");
|
||||
}
|
||||
if (!cat.getId().equals(part.getEquipmentCategoryId())) {
|
||||
return Result.error(
|
||||
"文件导入失败:第 " + rowNo + " 条设备类别名称与所选大部位不匹配(大部位所属类别须与类别名称一致)");
|
||||
}
|
||||
row.setEquipmentPartId(part.getId());
|
||||
row.setEquipmentPartName(part.getPartName());
|
||||
row.setImportCategoryName(null);
|
||||
row.setImportEquipmentPartCode(null);
|
||||
|
||||
if (oConvertUtils.isEmpty(row.getSubPartName()) || row.getSubPartName().trim().isEmpty()) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条小部位名称不能为空");
|
||||
}
|
||||
row.setSubPartName(row.getSubPartName().trim());
|
||||
|
||||
if (!codesInFile.add(sc)) {
|
||||
return Result.error("文件导入失败:小部位代码【" + sc + "】在导入文件中重复(小部位代码不能重复)");
|
||||
}
|
||||
if (mesXslEquipmentSubPartService.isSubPartCodeDuplicated(sc, null, row)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条小部位代码【" + sc + "】不能重复(同租户未删除数据中已存在)");
|
||||
}
|
||||
|
||||
if (row.getSubPartDescription() != null) {
|
||||
row.setSubPartDescription(row.getSubPartDescription().trim());
|
||||
}
|
||||
|
||||
String en = row.getEnableStatus();
|
||||
if (en != null) {
|
||||
en = en.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(en)) {
|
||||
en = "0";
|
||||
}
|
||||
if (!ENABLE_STATUS.contains(en)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条是否启用须为字典项值 0 或 1(xslmes_unit_status)");
|
||||
}
|
||||
row.setEnableStatus(en);
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
mesXslEquipmentSubPartService.saveBatch(list);
|
||||
log.info("设备小部位Excel导入完成,耗时{}ms,行数={}", System.currentTimeMillis() - start, list.size());
|
||||
return Result.ok("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.error(msg, e);
|
||||
if (msg != null && msg.indexOf("Duplicate entry") >= 0) {
|
||||
return Result.error("文件导入失败: 存在重复数据(小部位代码不能重复)");
|
||||
}
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】设备小部位导入:小部位代码唯一、类别名称与大部位代码解析、与大部位类别一致性-----------
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】设备小部位保存前校验与冗余名称回填-----------
|
||||
private String validateForSave(MesXslEquipmentSubPart model, String excludeId) {
|
||||
if (oConvertUtils.isEmpty(model.getEquipmentCategoryId())) {
|
||||
return "请选择所属设备类别";
|
||||
}
|
||||
MesXslEquipmentCategory cat = mesXslEquipmentCategoryService.getById(model.getEquipmentCategoryId());
|
||||
if (cat == null) {
|
||||
return "所属设备类别不存在";
|
||||
}
|
||||
model.setEquipmentCategoryName(cat.getCategoryName());
|
||||
|
||||
if (oConvertUtils.isEmpty(model.getEquipmentPartId())) {
|
||||
return "请选择所属设备大部位";
|
||||
}
|
||||
MesXslEquipmentPart part = mesXslEquipmentPartService.getById(model.getEquipmentPartId());
|
||||
if (part == null) {
|
||||
return "所属设备大部位不存在";
|
||||
}
|
||||
if (!model.getEquipmentCategoryId().equals(part.getEquipmentCategoryId())) {
|
||||
return "所属设备类别与所选设备大部位不匹配";
|
||||
}
|
||||
model.setEquipmentPartName(part.getPartName());
|
||||
|
||||
if (oConvertUtils.isEmpty(model.getSubPartCode()) || model.getSubPartCode().trim().isEmpty()) {
|
||||
return "小部位代码不能为空";
|
||||
}
|
||||
String sc = model.getSubPartCode().trim();
|
||||
model.setSubPartCode(sc);
|
||||
if (mesXslEquipmentSubPartService.isSubPartCodeDuplicated(sc, excludeId, model)) {
|
||||
return "小部位代码不能重复";
|
||||
}
|
||||
|
||||
if (oConvertUtils.isEmpty(model.getSubPartName()) || model.getSubPartName().trim().isEmpty()) {
|
||||
return "小部位名称不能为空";
|
||||
}
|
||||
model.setSubPartName(model.getSubPartName().trim());
|
||||
|
||||
String en = model.getEnableStatus();
|
||||
if (en != null) {
|
||||
en = en.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(en)) {
|
||||
en = "0";
|
||||
}
|
||||
if (!ENABLE_STATUS.contains(en)) {
|
||||
return "是否启用不合法(须为字典项值 0 或 1,xslmes_unit_status)";
|
||||
}
|
||||
model.setEnableStatus(en);
|
||||
|
||||
if (model.getSubPartDescription() != null) {
|
||||
model.setSubPartDescription(model.getSubPartDescription().trim());
|
||||
}
|
||||
model.setImportCategoryName(null);
|
||||
model.setImportEquipmentPartCode(null);
|
||||
return null;
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】设备小部位保存前校验与冗余名称回填-----------
|
||||
}
|
||||
@@ -0,0 +1,293 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslEquipmentCategory;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslEquipmentType;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslProcessOperation;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslEquipmentCategoryService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslEquipmentTypeService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslProcessOperationService;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* MES 设备类型
|
||||
*/
|
||||
@Tag(name = "MES设备类型")
|
||||
@RestController
|
||||
@RequestMapping("/xslmes/mesXslEquipmentType")
|
||||
@Slf4j
|
||||
public class MesXslEquipmentTypeController extends JeecgController<MesXslEquipmentType, IMesXslEquipmentTypeService> {
|
||||
|
||||
@Autowired
|
||||
private IMesXslEquipmentTypeService mesXslEquipmentTypeService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslProcessOperationService mesXslProcessOperationService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslEquipmentCategoryService mesXslEquipmentCategoryService;
|
||||
|
||||
@Operation(summary = "MES设备类型-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslEquipmentType>> queryPageList(
|
||||
MesXslEquipmentType model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslEquipmentType> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
Page<MesXslEquipmentType> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslEquipmentType> pageList = mesXslEquipmentTypeService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES设备类型-添加")
|
||||
@Operation(summary = "MES设备类型-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_type:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslEquipmentType model) {
|
||||
//update-begin---author:jiangxh ---date:20260514 for:【MES】设备类型:名称唯一、工序与设备类别校验、冗余名称-----------
|
||||
String err = validateForSave(model, null);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260514 for:【MES】设备类型:名称唯一、工序与设备类别校验、冗余名称-----------
|
||||
mesXslEquipmentTypeService.save(model);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES设备类型-编辑")
|
||||
@Operation(summary = "MES设备类型-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_type:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslEquipmentType model) {
|
||||
//update-begin---author:jiangxh ---date:20260514 for:【MES】设备类型:名称唯一、工序与设备类别校验、冗余名称-----------
|
||||
String err = validateForSave(model, model.getId());
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260514 for:【MES】设备类型:名称唯一、工序与设备类别校验、冗余名称-----------
|
||||
mesXslEquipmentTypeService.updateById(model);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES设备类型-删除")
|
||||
@Operation(summary = "MES设备类型-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_type:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslEquipmentTypeService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES设备类型-批量删除")
|
||||
@Operation(summary = "MES设备类型-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_type:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslEquipmentTypeService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES设备类型-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslEquipmentType> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslEquipmentType entity = mesXslEquipmentTypeService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "校验设备类型名称是否重复(仅未删除数据;同租户,dataId 为编辑时当前主键)")
|
||||
@GetMapping(value = "/checkTypeName")
|
||||
public Result<String> checkTypeName(
|
||||
@RequestParam(name = "typeName", required = true) String typeName,
|
||||
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||
if (oConvertUtils.isEmpty(typeName) || typeName.trim().isEmpty()) {
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
MesXslEquipmentType ctx = new MesXslEquipmentType();
|
||||
if (mesXslEquipmentTypeService.isTypeNameDuplicated(typeName.trim(), dataId, ctx)) {
|
||||
return Result.error("该类型名称已存在");
|
||||
}
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_type:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslEquipmentType model) {
|
||||
return super.exportXls(request, model, MesXslEquipmentType.class, "MES设备类型");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_equipment_type:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
//update-begin---author:jiangxh ---date:20260514 for:【MES】设备类型导入:名称唯一、工序编码与设备类别名称解析-----------
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> ent : fileMap.entrySet()) {
|
||||
MultipartFile file = ent.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<MesXslEquipmentType> list = ExcelImportUtil.importExcel(file.getInputStream(), MesXslEquipmentType.class, params);
|
||||
if (list == null) {
|
||||
list = List.of();
|
||||
}
|
||||
Set<String> namesInFile = new HashSet<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MesXslEquipmentType row = list.get(i);
|
||||
int rowNo = i + 1;
|
||||
if (row == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
|
||||
}
|
||||
String tn = row.getTypeName();
|
||||
if (tn != null) {
|
||||
tn = tn.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(tn)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条类型名称不能为空");
|
||||
}
|
||||
row.setTypeName(tn);
|
||||
if (!namesInFile.add(tn)) {
|
||||
return Result.error("文件导入失败:类型名称【" + tn + "】在导入文件中重复");
|
||||
}
|
||||
if (mesXslEquipmentTypeService.isTypeNameDuplicated(tn, null, row)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条类型名称【" + tn + "】已存在(未删除数据中不允许重复)");
|
||||
}
|
||||
String opCode = row.getImportOperationCode();
|
||||
if (opCode != null) {
|
||||
opCode = opCode.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(opCode)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条工序编码不能为空");
|
||||
}
|
||||
MesXslProcessOperation op = findProcessByOperationCode(opCode, row);
|
||||
if (op == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条工序编码【" + opCode + "】不存在或未删除数据中无匹配");
|
||||
}
|
||||
row.setProcessOperationId(op.getId());
|
||||
row.setProcessOperationName(op.getOperationName());
|
||||
row.setImportOperationCode(null);
|
||||
|
||||
String catName = row.getImportCategoryName();
|
||||
if (catName != null) {
|
||||
catName = catName.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(catName)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条设备类别名称不能为空");
|
||||
}
|
||||
MesXslEquipmentCategory cat =
|
||||
mesXslEquipmentCategoryService.findOneActiveByNameAndTenant(catName, row.getTenantId());
|
||||
if (cat == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条设备类别名称【" + catName + "】不存在或未删除数据中无匹配");
|
||||
}
|
||||
row.setEquipmentCategoryId(cat.getId());
|
||||
row.setEquipmentCategoryName(cat.getCategoryName());
|
||||
row.setImportCategoryName(null);
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
mesXslEquipmentTypeService.saveBatch(list);
|
||||
log.info("设备类型Excel导入完成,耗时{}ms,行数={}", System.currentTimeMillis() - start, list.size());
|
||||
return Result.ok("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.error(msg, e);
|
||||
if (msg != null && msg.indexOf("Duplicate entry") >= 0) {
|
||||
return Result.error("文件导入失败: 存在重复数据(类型名称在未删除数据中需唯一)");
|
||||
}
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260514 for:【MES】设备类型导入:名称唯一、工序编码与设备类别名称解析-----------
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260514 for:【MES】设备类型保存前校验与工序、类别名称回填-----------
|
||||
private String validateForSave(MesXslEquipmentType model, String excludeId) {
|
||||
if (oConvertUtils.isEmpty(model.getTypeName()) || model.getTypeName().trim().isEmpty()) {
|
||||
return "类型名称不能为空";
|
||||
}
|
||||
String tn = model.getTypeName().trim();
|
||||
model.setTypeName(tn);
|
||||
if (mesXslEquipmentTypeService.isTypeNameDuplicated(tn, excludeId, model)) {
|
||||
return "类型名称已存在";
|
||||
}
|
||||
if (oConvertUtils.isEmpty(model.getProcessOperationId())) {
|
||||
return "请选择所属工序";
|
||||
}
|
||||
MesXslProcessOperation op = mesXslProcessOperationService.getById(model.getProcessOperationId());
|
||||
if (op == null) {
|
||||
return "所属工序不存在";
|
||||
}
|
||||
model.setProcessOperationName(op.getOperationName());
|
||||
|
||||
if (oConvertUtils.isEmpty(model.getEquipmentCategoryId())) {
|
||||
return "请选择所属设备类别";
|
||||
}
|
||||
MesXslEquipmentCategory cat = mesXslEquipmentCategoryService.getById(model.getEquipmentCategoryId());
|
||||
if (cat == null) {
|
||||
return "所属设备类别不存在";
|
||||
}
|
||||
model.setEquipmentCategoryName(cat.getCategoryName());
|
||||
|
||||
model.setImportOperationCode(null);
|
||||
model.setImportCategoryName(null);
|
||||
return null;
|
||||
}
|
||||
|
||||
private MesXslProcessOperation findProcessByOperationCode(String operationCode, MesXslEquipmentType context) {
|
||||
LambdaQueryWrapper<MesXslProcessOperation> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslProcessOperation::getOperationCode, operationCode.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslProcessOperation::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslProcessOperation::getDelFlag));
|
||||
Integer tenantId = context != null ? context.getTenantId() : null;
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslProcessOperation::getTenantId, tenantId);
|
||||
}
|
||||
List<MesXslProcessOperation> found = mesXslProcessOperationService.list(w);
|
||||
if (found == null || found.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return found.get(0);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260514 for:【MES】设备类型保存前校验与工序、类别名称回填-----------
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
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.MesXslManufacturer;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslManufacturerService;
|
||||
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/mesXslManufacturer")
|
||||
@Slf4j
|
||||
public class MesXslManufacturerController extends JeecgController<MesXslManufacturer, IMesXslManufacturerService> {
|
||||
|
||||
private static final Set<String> MANUFACTURER_CATEGORIES = Set.of("mold", "capsule", "equipment");
|
||||
private static final Set<String> VALID_STATUS = Set.of("0", "1");
|
||||
|
||||
@Autowired
|
||||
private IMesXslManufacturerService mesXslManufacturerService;
|
||||
|
||||
@Operation(summary = "MES厂家信息-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslManufacturer>> queryPageList(
|
||||
MesXslManufacturer model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslManufacturer> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
Page<MesXslManufacturer> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslManufacturer> pageList = mesXslManufacturerService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES厂家信息-添加")
|
||||
@Operation(summary = "MES厂家信息-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_manufacturer:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslManufacturer model) {
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】厂家信息保存前校验:类别字典值、名称唯一、有效状态-----------
|
||||
String err = validateForSave(model, null);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】厂家信息保存前校验:类别字典值、名称唯一、有效状态-----------
|
||||
mesXslManufacturerService.save(model);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES厂家信息-编辑")
|
||||
@Operation(summary = "MES厂家信息-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_manufacturer:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslManufacturer model) {
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】厂家信息保存前校验:类别字典值、名称唯一、有效状态-----------
|
||||
String err = validateForSave(model, model.getId());
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】厂家信息保存前校验:类别字典值、名称唯一、有效状态-----------
|
||||
mesXslManufacturerService.updateById(model);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES厂家信息-删除")
|
||||
@Operation(summary = "MES厂家信息-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_manufacturer:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslManufacturerService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES厂家信息-批量删除")
|
||||
@Operation(summary = "MES厂家信息-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_manufacturer:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslManufacturerService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES厂家信息-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslManufacturer> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslManufacturer entity = mesXslManufacturerService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "校验厂家名称是否重复(同租户未删除数据;dataId 为编辑时当前主键)")
|
||||
@GetMapping(value = "/checkManufacturerName")
|
||||
public Result<String> checkManufacturerName(
|
||||
@RequestParam(name = "manufacturerName", required = true) String manufacturerName,
|
||||
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||
if (oConvertUtils.isEmpty(manufacturerName) || manufacturerName.trim().isEmpty()) {
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
MesXslManufacturer ctx = new MesXslManufacturer();
|
||||
if (mesXslManufacturerService.isManufacturerNameDuplicated(manufacturerName.trim(), dataId, ctx)) {
|
||||
return Result.error("厂家名称不能重复");
|
||||
}
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_manufacturer:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslManufacturer model) {
|
||||
return super.exportXls(request, model, MesXslManufacturer.class, "MES厂家信息");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_manufacturer:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】厂家信息导入:名称唯一、文件内去重、类别与有效状态校验-----------
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> ent : fileMap.entrySet()) {
|
||||
MultipartFile file = ent.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<MesXslManufacturer> list =
|
||||
ExcelImportUtil.importExcel(file.getInputStream(), MesXslManufacturer.class, params);
|
||||
if (list == null) {
|
||||
list = List.of();
|
||||
}
|
||||
Set<String> namesInFile = new HashSet<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MesXslManufacturer row = list.get(i);
|
||||
int rowNo = i + 1;
|
||||
if (row == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
|
||||
}
|
||||
String name = row.getManufacturerName();
|
||||
if (name != null) {
|
||||
name = name.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(name)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条厂家名称不能为空");
|
||||
}
|
||||
row.setManufacturerName(name);
|
||||
if (!namesInFile.add(name)) {
|
||||
return Result.error("文件导入失败:厂家名称【" + name + "】在导入文件中重复");
|
||||
}
|
||||
String cat = row.getManufacturerCategory();
|
||||
if (oConvertUtils.isEmpty(cat) || !MANUFACTURER_CATEGORIES.contains(cat.trim())) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条厂家类别无效(须为模具厂家/胶囊厂家/设备厂家对应字典值)");
|
||||
}
|
||||
row.setManufacturerCategory(cat.trim());
|
||||
String vs = row.getValidStatus();
|
||||
if (oConvertUtils.isEmpty(vs)) {
|
||||
row.setValidStatus("0");
|
||||
} else {
|
||||
vs = vs.trim();
|
||||
if (!VALID_STATUS.contains(vs)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条是否有效无效(须为有效或无效对应字典值)");
|
||||
}
|
||||
row.setValidStatus(vs);
|
||||
}
|
||||
if (mesXslManufacturerService.isManufacturerNameDuplicated(name, null, row)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条厂家名称【" + name + "】不能重复(同租户未删除数据中已存在)");
|
||||
}
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
mesXslManufacturerService.saveBatch(list);
|
||||
log.info("厂家信息Excel导入完成,耗时{}ms,行数={}", System.currentTimeMillis() - start, list.size());
|
||||
return Result.ok("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.error(msg, e);
|
||||
if (msg != null && msg.indexOf("Duplicate entry") >= 0) {
|
||||
return Result.error("文件导入失败: 存在重复数据(厂家名称不能重复)");
|
||||
}
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】厂家信息导入:名称唯一、文件内去重、类别与有效状态校验-----------
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】厂家信息保存前校验-----------
|
||||
private String validateForSave(MesXslManufacturer model, String excludeId) {
|
||||
if (oConvertUtils.isEmpty(model.getManufacturerCategory()) || model.getManufacturerCategory().trim().isEmpty()) {
|
||||
return "厂家类别不能为空";
|
||||
}
|
||||
String cat = model.getManufacturerCategory().trim();
|
||||
if (!MANUFACTURER_CATEGORIES.contains(cat)) {
|
||||
return "厂家类别无效";
|
||||
}
|
||||
model.setManufacturerCategory(cat);
|
||||
if (oConvertUtils.isEmpty(model.getManufacturerName()) || model.getManufacturerName().trim().isEmpty()) {
|
||||
return "厂家名称不能为空";
|
||||
}
|
||||
String name = model.getManufacturerName().trim();
|
||||
model.setManufacturerName(name);
|
||||
if (mesXslManufacturerService.isManufacturerNameDuplicated(name, excludeId, model)) {
|
||||
return "厂家名称不能重复";
|
||||
}
|
||||
String vs = model.getValidStatus();
|
||||
if (oConvertUtils.isEmpty(vs)) {
|
||||
model.setValidStatus("0");
|
||||
} else {
|
||||
vs = vs.trim();
|
||||
if (!VALID_STATUS.contains(vs)) {
|
||||
return "是否有效取值无效";
|
||||
}
|
||||
model.setValidStatus(vs);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】厂家信息保存前校验-----------
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
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.MesXslProcessOperation;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslProcessOperationService;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* MES 工序管理
|
||||
*/
|
||||
@Tag(name = "MES工序管理")
|
||||
@RestController
|
||||
@RequestMapping("/xslmes/mesXslProcessOperation")
|
||||
@Slf4j
|
||||
public class MesXslProcessOperationController extends JeecgController<MesXslProcessOperation, IMesXslProcessOperationService> {
|
||||
|
||||
@Autowired
|
||||
private IMesXslProcessOperationService mesXslProcessOperationService;
|
||||
|
||||
@Operation(summary = "MES工序管理-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslProcessOperation>> queryPageList(
|
||||
MesXslProcessOperation model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslProcessOperation> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
Page<MesXslProcessOperation> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslProcessOperation> pageList = mesXslProcessOperationService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES工序管理-添加")
|
||||
@Operation(summary = "MES工序管理-添加")
|
||||
@RequiresPermissions("mes:mes_process_operation:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslProcessOperation model) {
|
||||
//update-begin---author:jiangxh ---date:20260514 for:【MES】工序编码、名称必填;同租户工序编码不可重复-----------
|
||||
if (oConvertUtils.isEmpty(model.getOperationCode()) || oConvertUtils.isEmpty(model.getOperationName())) {
|
||||
return Result.error("工序编码、工序名称不能为空");
|
||||
}
|
||||
String code = model.getOperationCode().trim();
|
||||
model.setOperationCode(code);
|
||||
if (mesXslProcessOperationService.isOperationCodeDuplicated(code, null, model)) {
|
||||
return Result.error("工序编码已存在");
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260514 for:【MES】工序编码、名称必填;同租户工序编码不可重复-----------
|
||||
mesXslProcessOperationService.save(model);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES工序管理-编辑")
|
||||
@Operation(summary = "MES工序管理-编辑")
|
||||
@RequiresPermissions("mes:mes_process_operation:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslProcessOperation model) {
|
||||
//update-begin---author:jiangxh ---date:20260514 for:【MES】工序编码、名称必填;同租户工序编码不可重复-----------
|
||||
if (oConvertUtils.isEmpty(model.getOperationCode()) || oConvertUtils.isEmpty(model.getOperationName())) {
|
||||
return Result.error("工序编码、工序名称不能为空");
|
||||
}
|
||||
String code = model.getOperationCode().trim();
|
||||
model.setOperationCode(code);
|
||||
if (mesXslProcessOperationService.isOperationCodeDuplicated(code, model.getId(), model)) {
|
||||
return Result.error("工序编码已存在");
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260514 for:【MES】工序编码、名称必填;同租户工序编码不可重复-----------
|
||||
mesXslProcessOperationService.updateById(model);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES工序管理-删除")
|
||||
@Operation(summary = "MES工序管理-通过id删除")
|
||||
@RequiresPermissions("mes:mes_process_operation:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslProcessOperationService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES工序管理-批量删除")
|
||||
@Operation(summary = "MES工序管理-批量删除")
|
||||
@RequiresPermissions("mes:mes_process_operation:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslProcessOperationService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES工序管理-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslProcessOperation> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslProcessOperation entity = mesXslProcessOperationService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "校验工序编码是否重复(仅未删除数据;同租户,dataId 为编辑时当前主键)")
|
||||
@GetMapping(value = "/checkOperationCode")
|
||||
public Result<String> checkOperationCode(
|
||||
@RequestParam(name = "operationCode", required = true) String operationCode,
|
||||
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||
if (oConvertUtils.isEmpty(operationCode) || operationCode.trim().isEmpty()) {
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
MesXslProcessOperation ctx = new MesXslProcessOperation();
|
||||
if (mesXslProcessOperationService.isOperationCodeDuplicated(operationCode.trim(), dataId, ctx)) {
|
||||
return Result.error("该工序编码已存在");
|
||||
}
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_process_operation:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslProcessOperation model) {
|
||||
return super.exportXls(request, model, MesXslProcessOperation.class, "MES工序管理");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_process_operation:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
//update-begin---author:jiangxh ---date:20260514 for:【MES】工序导入:文件内编码不重复,且与库中未删除数据不重复-----------
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> ent : fileMap.entrySet()) {
|
||||
MultipartFile file = ent.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<MesXslProcessOperation> list = ExcelImportUtil.importExcel(file.getInputStream(), MesXslProcessOperation.class, params);
|
||||
if (list == null) {
|
||||
list = List.of();
|
||||
}
|
||||
Set<String> codesInFile = new HashSet<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MesXslProcessOperation row = list.get(i);
|
||||
int rowNo = i + 1;
|
||||
if (row == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
|
||||
}
|
||||
String code = row.getOperationCode();
|
||||
if (code != null) {
|
||||
code = code.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(code)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条工序编码不能为空");
|
||||
}
|
||||
row.setOperationCode(code);
|
||||
if (oConvertUtils.isEmpty(row.getOperationName()) || row.getOperationName().trim().isEmpty()) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条工序名称不能为空");
|
||||
}
|
||||
row.setOperationName(row.getOperationName().trim());
|
||||
if (!codesInFile.add(code)) {
|
||||
return Result.error("文件导入失败:工序编码【" + code + "】在导入文件中重复");
|
||||
}
|
||||
if (mesXslProcessOperationService.isOperationCodeDuplicated(code, null, row)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条工序编码【" + code + "】已存在(未删除数据中不允许重复)");
|
||||
}
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
mesXslProcessOperationService.saveBatch(list);
|
||||
log.info("工序Excel导入完成,耗时{}ms,行数={}", System.currentTimeMillis() - start, list.size());
|
||||
return Result.ok("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.error(msg, e);
|
||||
if (msg != null && msg.indexOf("Duplicate entry") >= 0) {
|
||||
return Result.error("文件导入失败: 存在重复数据(工序编码在未删除数据中需唯一)");
|
||||
}
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260514 for:【MES】工序导入:文件内编码不重复,且与库中未删除数据不重复-----------
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,12 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
@@ -32,6 +36,8 @@ import org.jeecg.modules.print.support.PrintServerPdfJobService;
|
||||
import org.jeecg.modules.print.util.PrintBizDataMappingUtil;
|
||||
import org.jeecg.modules.xslmes.constant.MesXslPrintConstants;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialCard;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecord;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRawMaterialInspectRecordMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRawMaterialCardService;
|
||||
import org.jeecg.modules.xslmes.service.MesXslStompNotifyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -72,6 +78,8 @@ public class MesXslRawMaterialCardController extends JeecgController<MesXslRawMa
|
||||
private IPrintTemplateService printTemplateService;
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
@Autowired
|
||||
private MesXslRawMaterialInspectRecordMapper inspectRecordMapper;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
@@ -82,8 +90,11 @@ public class MesXslRawMaterialCardController extends JeecgController<MesXslRawMa
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
if (mesXslRawMaterialCard == null) {
|
||||
mesXslRawMaterialCard = new MesXslRawMaterialCard();
|
||||
}
|
||||
// 库区条件:去掉实体上的值避免 QueryGenerator 再拼一班;用 TRIM 与看板聚合一致(避免首尾空格导致「有汇总无明细」)
|
||||
String rawWarehouseArea = mesXslRawMaterialCard != null ? mesXslRawMaterialCard.getWarehouseArea() : null;
|
||||
String rawWarehouseArea = mesXslRawMaterialCard.getWarehouseArea();
|
||||
String areaEq = oConvertUtils.isNotEmpty(rawWarehouseArea) ? rawWarehouseArea.trim() : "";
|
||||
boolean filterByWarehouseArea = !areaEq.isEmpty();
|
||||
if (filterByWarehouseArea) {
|
||||
@@ -114,9 +125,34 @@ public class MesXslRawMaterialCardController extends JeecgController<MesXslRawMa
|
||||
}
|
||||
Page<MesXslRawMaterialCard> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslRawMaterialCard> pageList = mesXslRawMaterialCardService.page(page, queryWrapper);
|
||||
fillPendingInspectFlag(pageList.getRecords());
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
private void fillPendingInspectFlag(List<MesXslRawMaterialCard> cards) {
|
||||
if (cards == null || cards.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Set<String> cardIds = cards.stream()
|
||||
.map(MesXslRawMaterialCard::getId)
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.collect(Collectors.toSet());
|
||||
if (cardIds.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<MesXslRawMaterialInspectRecord> pendingList = inspectRecordMapper.selectList(
|
||||
new QueryWrapper<MesXslRawMaterialInspectRecord>()
|
||||
.select("raw_material_card_id")
|
||||
.in("raw_material_card_id", cardIds)
|
||||
.eq("inspect_status", "0")
|
||||
.groupBy("raw_material_card_id"));
|
||||
Set<String> pendingCardIds = pendingList == null ? Collections.emptySet() : pendingList.stream()
|
||||
.map(MesXslRawMaterialInspectRecord::getRawMaterialCardId)
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.collect(Collectors.toSet());
|
||||
cards.forEach(card -> card.setHasPendingInspect(pendingCardIds.contains(card.getId())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
@@ -228,7 +264,7 @@ public class MesXslRawMaterialCardController extends JeecgController<MesXslRawMa
|
||||
ArrayNode mapping =
|
||||
PrintBizDataMappingUtil.parseMappingArray(bind.getFieldMappingJson());
|
||||
JsonNode bizRoot = objectMapper.valueToTree(card);
|
||||
ObjectNode printData = PrintBizDataMappingUtil.mapBizToPrintData(bizRoot, mapping);
|
||||
ObjectNode printData = PrintBizDataMappingUtil.mapBizToPrintData(bizRoot, mapping, tpl.getTemplateJson());
|
||||
PrintBizDataMappingUtil.fillMissingDataBindingParamKeys(printData, tpl.getTemplateJson());
|
||||
Map<String, Object> out = new HashMap<>(8);
|
||||
out.put("cardId", card.getId());
|
||||
|
||||
@@ -218,7 +218,7 @@ public class MesXslRawMaterialEntryController extends JeecgController<MesXslRawM
|
||||
}
|
||||
ArrayNode mapping = PrintBizDataMappingUtil.parseMappingArray(bind.getFieldMappingJson());
|
||||
JsonNode bizRoot = objectMapper.valueToTree(entry);
|
||||
ObjectNode printData = PrintBizDataMappingUtil.mapBizToPrintData(bizRoot, mapping);
|
||||
ObjectNode printData = PrintBizDataMappingUtil.mapBizToPrintData(bizRoot, mapping, tpl.getTemplateJson());
|
||||
PrintBizDataMappingUtil.fillMissingDataBindingParamKeys(printData, tpl.getTemplateJson());
|
||||
Map<String, Object> out = new HashMap<>(8);
|
||||
out.put("entryId", entry.getId());
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
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 java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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.modules.xslmes.entity.MesXslRawMaterialInspectRecord;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecordLine;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRawMaterialInspectRecordService;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslRawMaterialInspectRecordPage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
@Tag(name = "原材料送检记录")
|
||||
@RestController
|
||||
@RequestMapping("/xslmes/mesXslRawMaterialInspectRecord")
|
||||
public class MesXslRawMaterialInspectRecordController
|
||||
extends JeecgController<MesXslRawMaterialInspectRecord, IMesXslRawMaterialInspectRecordService> {
|
||||
|
||||
@Autowired private IMesXslRawMaterialInspectRecordService inspectRecordService;
|
||||
|
||||
@Operation(summary = "原材料送检记录-分页列表查询")
|
||||
@GetMapping("/list")
|
||||
public Result<IPage<MesXslRawMaterialInspectRecord>> queryPageList(
|
||||
MesXslRawMaterialInspectRecord query,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslRawMaterialInspectRecord> queryWrapper =
|
||||
QueryGenerator.initQueryWrapper(query, req.getParameterMap());
|
||||
queryWrapper.orderByDesc("inspect_time");
|
||||
IPage<MesXslRawMaterialInspectRecord> pageList =
|
||||
inspectRecordService.page(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "原材料送检记录-送检")
|
||||
@Operation(summary = "原材料送检记录-送检(由原材料卡片生成)")
|
||||
@RequiresPermissions("xslmes:mes_xsl_raw_material_card:edit")
|
||||
@PostMapping("/createByCard")
|
||||
public Result<MesXslRawMaterialInspectRecord> createByCard(@RequestBody Map<String, Object> body) {
|
||||
String rawMaterialCardId =
|
||||
body.get("rawMaterialCardId") == null ? "" : body.get("rawMaterialCardId").toString();
|
||||
if (StringUtils.isBlank(rawMaterialCardId)) {
|
||||
return Result.error("rawMaterialCardId不能为空");
|
||||
}
|
||||
MesXslRawMaterialInspectRecord record =
|
||||
inspectRecordService.createByRawMaterialCardId(rawMaterialCardId.trim());
|
||||
return Result.OK("送检成功", record);
|
||||
}
|
||||
|
||||
@Operation(summary = "原材料送检记录-通过id查询")
|
||||
@GetMapping("/queryById")
|
||||
public Result<MesXslRawMaterialInspectRecord> queryById(@RequestParam(name = "id") String id) {
|
||||
MesXslRawMaterialInspectRecord db = inspectRecordService.getById(id);
|
||||
if (db == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(db);
|
||||
}
|
||||
|
||||
@Operation(summary = "原材料送检记录-按主表查询子表")
|
||||
@GetMapping("/queryLineListByRecordId")
|
||||
public Result<List<MesXslRawMaterialInspectRecordLine>> queryLineListByRecordId(
|
||||
@RequestParam(name = "id") String id) {
|
||||
return Result.OK(inspectRecordService.selectLinesByRecordId(id));
|
||||
}
|
||||
|
||||
@AutoLog(value = "原材料送检记录-录入检验结果前加载明细")
|
||||
@Operation(summary = "原材料送检记录-录入检验结果前加载明细")
|
||||
@RequiresPermissions("xslmes:mes_xsl_raw_material_inspect_record:edit")
|
||||
@PostMapping("/prepareResultEntry")
|
||||
public Result<List<MesXslRawMaterialInspectRecordLine>> prepareResultEntry(
|
||||
@RequestBody Map<String, Object> body) {
|
||||
String id = body.get("id") == null ? "" : body.get("id").toString();
|
||||
if (StringUtils.isBlank(id)) {
|
||||
return Result.error("id不能为空");
|
||||
}
|
||||
return Result.OK(inspectRecordService.prepareResultEntryLines(id.trim()));
|
||||
}
|
||||
|
||||
@AutoLog(value = "原材料送检记录-保存检验结果")
|
||||
@Operation(summary = "原材料送检记录-保存检验结果")
|
||||
@RequiresPermissions("xslmes:mes_xsl_raw_material_inspect_record:edit")
|
||||
@PostMapping("/saveInspectResult")
|
||||
public Result<String> saveInspectResult(@RequestBody MesXslRawMaterialInspectRecordPage page) {
|
||||
if (StringUtils.isBlank(page.getId())) {
|
||||
return Result.error("id不能为空");
|
||||
}
|
||||
inspectRecordService.saveInspectResult(page.getId(), page.getLineList());
|
||||
return Result.OK("保存成功");
|
||||
}
|
||||
|
||||
@RequiresPermissions("xslmes:mes_xsl_raw_material_inspect_record:exportXls")
|
||||
@RequestMapping("/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslRawMaterialInspectRecord query) {
|
||||
return super.exportXls(request, query, MesXslRawMaterialInspectRecord.class, "原材料送检记录");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
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 java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialSummary;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* 原材料汇总
|
||||
*/
|
||||
@Tag(name = "原材料汇总")
|
||||
@RestController
|
||||
@RequestMapping("/xslmes/mesXslRawMaterialSummary")
|
||||
@Slf4j
|
||||
public class MesXslRawMaterialSummaryController {
|
||||
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Operation(summary = "原材料汇总-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslRawMaterialSummary>> queryPageList(
|
||||
MesXslRawMaterialSummary query,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
List<Object> params = new ArrayList<>();
|
||||
String groupedSql = buildGroupedSql(query, params);
|
||||
String countSql = "SELECT COUNT(1) FROM (" + groupedSql + ") t";
|
||||
Long total = jdbcTemplate.queryForObject(countSql, Long.class, params.toArray());
|
||||
long totalCount = total == null ? 0L : total;
|
||||
|
||||
int offset = Math.max((pageNo - 1) * pageSize, 0);
|
||||
String pageSql = groupedSql + " ORDER BY warehouseName, materialName LIMIT ? OFFSET ?";
|
||||
List<Object> pageParams = new ArrayList<>(params);
|
||||
pageParams.add(pageSize);
|
||||
pageParams.add(offset);
|
||||
List<MesXslRawMaterialSummary> rows = queryRows(pageSql, pageParams);
|
||||
|
||||
Page<MesXslRawMaterialSummary> page = new Page<>(pageNo, pageSize, totalCount);
|
||||
page.setRecords(rows);
|
||||
return Result.OK(page);
|
||||
}
|
||||
|
||||
@RequiresPermissions("xslmes:mes_xsl_raw_material_summary:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslRawMaterialSummary query) {
|
||||
List<Object> params = new ArrayList<>();
|
||||
String groupedSql = buildGroupedSql(query, params) + " ORDER BY warehouseName, materialName";
|
||||
List<MesXslRawMaterialSummary> exportList = queryRows(groupedSql, params);
|
||||
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "原材料汇总");
|
||||
mv.addObject(NormalExcelConstants.CLASS, MesXslRawMaterialSummary.class);
|
||||
mv.addObject(
|
||||
NormalExcelConstants.PARAMS,
|
||||
new ExportParams("原材料汇总报表", "导出人:" + (sysUser == null ? "admin" : sysUser.getRealname()), "原材料汇总", ExcelType.XSSF));
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
|
||||
String exportFields = request.getParameter(NormalExcelConstants.EXPORT_FIELDS);
|
||||
if (oConvertUtils.isNotEmpty(exportFields)) {
|
||||
mv.addObject(NormalExcelConstants.EXPORT_FIELDS, exportFields);
|
||||
}
|
||||
return mv;
|
||||
}
|
||||
|
||||
private String buildGroupedSql(MesXslRawMaterialSummary query, List<Object> params) {
|
||||
String warehouseExpr = "COALESCE(NULLIF(TRIM(i.warehouse_name),''), TRIM(w.warehouse_name))";
|
||||
String materialNameExpr = "COALESCE(NULLIF(TRIM(i.material_name),''), TRIM(m.material_name))";
|
||||
String materialCodeExpr = "COALESCE(NULLIF(TRIM(i.material_code),''), TRIM(m.material_code))";
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT ")
|
||||
.append(warehouseExpr).append(" AS warehouseName, ")
|
||||
.append(materialNameExpr).append(" AS materialName, ")
|
||||
.append(materialCodeExpr).append(" AS materialCode, ")
|
||||
.append("SUM(COALESCE(i.total_packages,0)) AS totalPackages, ")
|
||||
.append("SUM(COALESCE(i.total_weight,0)) AS totalWeight ")
|
||||
.append("FROM mes_xsl_raw_material_inventory i ")
|
||||
.append("LEFT JOIN mes_xsl_warehouse w ON w.id = i.warehouse_id ")
|
||||
.append("AND (w.del_flag = 0 OR w.del_flag IS NULL) ")
|
||||
.append("LEFT JOIN mes_mixer_material m ON m.id = i.material_id ")
|
||||
.append("AND (m.del_flag = 0 OR m.del_flag IS NULL) ")
|
||||
// mes_xsl_raw_material_inventory 表当前无 del_flag 字段,这里使用恒真条件避免 SQL 报错
|
||||
.append("WHERE 1=1 ");
|
||||
|
||||
if (query != null && StringUtils.isNotBlank(query.getWarehouseName())) {
|
||||
sql.append("AND ").append(warehouseExpr).append(" LIKE ? ");
|
||||
params.add("%" + query.getWarehouseName().trim() + "%");
|
||||
}
|
||||
if (query != null && StringUtils.isNotBlank(query.getMaterialName())) {
|
||||
sql.append("AND ").append(materialNameExpr).append(" LIKE ? ");
|
||||
params.add("%" + query.getMaterialName().trim() + "%");
|
||||
}
|
||||
if (query != null && StringUtils.isNotBlank(query.getMaterialCode())) {
|
||||
sql.append("AND ").append(materialCodeExpr).append(" LIKE ? ");
|
||||
params.add("%" + query.getMaterialCode().trim() + "%");
|
||||
}
|
||||
|
||||
sql.append("GROUP BY ")
|
||||
.append(warehouseExpr).append(", ")
|
||||
.append(materialNameExpr).append(", ")
|
||||
.append(materialCodeExpr);
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
private List<MesXslRawMaterialSummary> queryRows(String sql, List<Object> params) {
|
||||
return jdbcTemplate.query(
|
||||
sql,
|
||||
rs -> {
|
||||
List<MesXslRawMaterialSummary> list = new ArrayList<>();
|
||||
int seq = 1;
|
||||
while (rs.next()) {
|
||||
MesXslRawMaterialSummary row = new MesXslRawMaterialSummary();
|
||||
row.setWarehouseName(trim(rs.getString("warehouseName")));
|
||||
row.setMaterialName(trim(rs.getString("materialName")));
|
||||
row.setMaterialCode(trim(rs.getString("materialCode")));
|
||||
row.setTotalPackages(rs.getBigDecimal("totalPackages"));
|
||||
row.setTotalWeight(rs.getBigDecimal("totalWeight"));
|
||||
row.setId(row.getWarehouseName() + "_" + row.getMaterialCode() + "_" + seq++);
|
||||
list.add(row);
|
||||
}
|
||||
return list;
|
||||
},
|
||||
params.toArray());
|
||||
}
|
||||
|
||||
private String trim(String v) {
|
||||
return v == null ? "" : v.trim();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,320 @@
|
||||
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.math.BigDecimal;
|
||||
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.MesXslSparePart;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslSparePartsCategory;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslUnit;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslSparePartService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslSparePartsCategoryService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslUnitService;
|
||||
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/mesXslSparePart")
|
||||
@Slf4j
|
||||
public class MesXslSparePartController extends JeecgController<MesXslSparePart, IMesXslSparePartService> {
|
||||
|
||||
@Autowired
|
||||
private IMesXslSparePartService mesXslSparePartService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslSparePartsCategoryService mesXslSparePartsCategoryService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslUnitService mesXslUnitService;
|
||||
|
||||
@Operation(summary = "MES备品件信息-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslSparePart>> queryPageList(
|
||||
MesXslSparePart model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslSparePart> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
Page<MesXslSparePart> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslSparePart> pageList = mesXslSparePartService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES备品件信息-添加")
|
||||
@Operation(summary = "MES备品件信息-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_spare_part:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslSparePart model) {
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】备品件信息保存前校验:名称唯一、类别与单位回填、库存上下限-----------
|
||||
String err = validateForSave(model, null);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】备品件信息保存前校验:名称唯一、类别与单位回填、库存上下限-----------
|
||||
mesXslSparePartService.save(model);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES备品件信息-编辑")
|
||||
@Operation(summary = "MES备品件信息-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_spare_part:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslSparePart model) {
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】备品件信息保存前校验:名称唯一、类别与单位回填、库存上下限-----------
|
||||
String err = validateForSave(model, model.getId());
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】备品件信息保存前校验:名称唯一、类别与单位回填、库存上下限-----------
|
||||
mesXslSparePartService.updateById(model);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES备品件信息-删除")
|
||||
@Operation(summary = "MES备品件信息-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_spare_part:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslSparePartService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES备品件信息-批量删除")
|
||||
@Operation(summary = "MES备品件信息-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_spare_part:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslSparePartService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES备品件信息-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslSparePart> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslSparePart entity = mesXslSparePartService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "校验备品件名称是否重复(同租户未删除数据;dataId 为编辑时当前主键)")
|
||||
@GetMapping(value = "/checkSparePartName")
|
||||
public Result<String> checkSparePartName(
|
||||
@RequestParam(name = "sparePartName", required = true) String sparePartName,
|
||||
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||
if (oConvertUtils.isEmpty(sparePartName) || sparePartName.trim().isEmpty()) {
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
MesXslSparePart ctx = new MesXslSparePart();
|
||||
if (mesXslSparePartService.isSparePartNameDuplicated(sparePartName.trim(), dataId, ctx)) {
|
||||
return Result.error("备品件名称不能重复");
|
||||
}
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_spare_part:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslSparePart model) {
|
||||
return super.exportXls(request, model, MesXslSparePart.class, "MES备品件信息");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_spare_part:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】备品件信息导入:名称唯一、类别名称与单位编码解析、库存校验-----------
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> ent : fileMap.entrySet()) {
|
||||
MultipartFile file = ent.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<MesXslSparePart> list = ExcelImportUtil.importExcel(file.getInputStream(), MesXslSparePart.class, params);
|
||||
if (list == null) {
|
||||
list = List.of();
|
||||
}
|
||||
Set<String> namesInFile = new HashSet<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MesXslSparePart row = list.get(i);
|
||||
int rowNo = i + 1;
|
||||
if (row == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
|
||||
}
|
||||
String pn = row.getSparePartName();
|
||||
if (pn != null) {
|
||||
pn = pn.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(pn)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条备品件名称不能为空");
|
||||
}
|
||||
row.setSparePartName(pn);
|
||||
if (!namesInFile.add(pn)) {
|
||||
return Result.error("文件导入失败:备品件名称【" + pn + "】在导入文件中重复");
|
||||
}
|
||||
if (mesXslSparePartService.isSparePartNameDuplicated(pn, null, row)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条备品件名称【" + pn + "】不能重复(同租户未删除数据中已存在)");
|
||||
}
|
||||
|
||||
String catName = row.getImportCategoryName();
|
||||
if (catName != null) {
|
||||
catName = catName.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(catName)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条备品件类别名称不能为空");
|
||||
}
|
||||
MesXslSparePartsCategory cat =
|
||||
mesXslSparePartsCategoryService.findOneActiveByCategoryNameAndTenant(catName, row.getTenantId());
|
||||
if (cat == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条备品件类别名称【" + catName + "】不存在或未删除数据中无匹配");
|
||||
}
|
||||
row.setSparePartsCategoryId(cat.getId());
|
||||
row.setSparePartsCategoryName(cat.getCategoryName());
|
||||
row.setImportCategoryName(null);
|
||||
|
||||
String ucode = row.getImportUnitCode();
|
||||
if (ucode != null) {
|
||||
ucode = ucode.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(ucode)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条单位编码不能为空");
|
||||
}
|
||||
MesXslUnit unit = mesXslUnitService.findOneActiveByUnitCodeAndTenant(ucode, row.getTenantId());
|
||||
if (unit == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条单位编码【" + ucode + "】不存在或未删除数据中无匹配");
|
||||
}
|
||||
String st = unit.getStatus();
|
||||
if (st != null && "1".equals(st.trim())) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条单位编码【" + ucode + "】对应单位已停用");
|
||||
}
|
||||
row.setUnitId(unit.getId());
|
||||
row.setUnitName(unit.getUnitName());
|
||||
row.setImportUnitCode(null);
|
||||
|
||||
String errStock = normalizeAndValidateStocks(row, rowNo);
|
||||
if (errStock != null) {
|
||||
return Result.error(errStock);
|
||||
}
|
||||
|
||||
if (row.getSpecModel() != null) {
|
||||
row.setSpecModel(row.getSpecModel().trim());
|
||||
}
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
mesXslSparePartService.saveBatch(list);
|
||||
log.info("备品件信息Excel导入完成,耗时{}ms,行数={}", System.currentTimeMillis() - start, list.size());
|
||||
return Result.ok("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.error(msg, e);
|
||||
if (msg != null && msg.indexOf("Duplicate entry") >= 0) {
|
||||
return Result.error("文件导入失败: 存在重复数据(备品件名称不能重复)");
|
||||
}
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】备品件信息导入:名称唯一、类别名称与单位编码解析、库存校验-----------
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】备品件信息保存前校验与冗余名称回填-----------
|
||||
private String validateForSave(MesXslSparePart model, String excludeId) {
|
||||
if (oConvertUtils.isEmpty(model.getSparePartName()) || model.getSparePartName().trim().isEmpty()) {
|
||||
return "备品件名称不能为空";
|
||||
}
|
||||
String pn = model.getSparePartName().trim();
|
||||
model.setSparePartName(pn);
|
||||
if (mesXslSparePartService.isSparePartNameDuplicated(pn, excludeId, model)) {
|
||||
return "备品件名称不能重复";
|
||||
}
|
||||
|
||||
if (oConvertUtils.isEmpty(model.getSparePartsCategoryId())) {
|
||||
return "请选择所属备品件类别";
|
||||
}
|
||||
MesXslSparePartsCategory cat = mesXslSparePartsCategoryService.getById(model.getSparePartsCategoryId());
|
||||
if (cat == null) {
|
||||
return "所属备品件类别不存在";
|
||||
}
|
||||
model.setSparePartsCategoryName(cat.getCategoryName());
|
||||
|
||||
if (oConvertUtils.isEmpty(model.getUnitId())) {
|
||||
return "请选择单位";
|
||||
}
|
||||
MesXslUnit unit = mesXslUnitService.getById(model.getUnitId());
|
||||
if (unit == null) {
|
||||
return "所选单位不存在";
|
||||
}
|
||||
String ust = unit.getStatus();
|
||||
if (ust != null && "1".equals(ust.trim())) {
|
||||
return "所选单位已停用,请重新选择";
|
||||
}
|
||||
model.setUnitName(unit.getUnitName());
|
||||
|
||||
String errStock = normalizeAndValidateStocks(model, null);
|
||||
if (errStock != null) {
|
||||
return errStock;
|
||||
}
|
||||
|
||||
if (model.getSpecModel() != null) {
|
||||
model.setSpecModel(model.getSpecModel().trim());
|
||||
}
|
||||
model.setImportCategoryName(null);
|
||||
model.setImportUnitCode(null);
|
||||
return null;
|
||||
}
|
||||
|
||||
/** 规范化 max/min 库存并校验;rowNo 非空时错误信息带行号(导入用) */
|
||||
private String normalizeAndValidateStocks(MesXslSparePart model, Integer rowNo) {
|
||||
BigDecimal max = model.getMaxStock();
|
||||
BigDecimal min = model.getMinStock();
|
||||
if (max == null || min == null) {
|
||||
return rowNo == null ? "最大库存、最小库存不能为空" : "文件导入失败:第 " + rowNo + " 条最大库存、最小库存不能为空";
|
||||
}
|
||||
max = max.stripTrailingZeros();
|
||||
min = min.stripTrailingZeros();
|
||||
model.setMaxStock(max);
|
||||
model.setMinStock(min);
|
||||
if (max.compareTo(BigDecimal.ZERO) < 0 || min.compareTo(BigDecimal.ZERO) < 0) {
|
||||
return rowNo == null ? "最大库存、最小库存不能为负数" : "文件导入失败:第 " + rowNo + " 条最大库存、最小库存不能为负数";
|
||||
}
|
||||
if (max.compareTo(min) < 0) {
|
||||
return rowNo == null ? "最大库存不能小于最小库存" : "文件导入失败:第 " + rowNo + " 条最大库存不能小于最小库存";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】备品件信息保存前校验与冗余名称回填-----------
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
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.MesXslSparePartsCategory;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslSparePartsCategoryService;
|
||||
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/mesXslSparePartsCategory")
|
||||
@Slf4j
|
||||
public class MesXslSparePartsCategoryController extends JeecgController<MesXslSparePartsCategory, IMesXslSparePartsCategoryService> {
|
||||
|
||||
@Autowired
|
||||
private IMesXslSparePartsCategoryService mesXslSparePartsCategoryService;
|
||||
|
||||
@Operation(summary = "MES备品件类别-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslSparePartsCategory>> queryPageList(
|
||||
MesXslSparePartsCategory model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslSparePartsCategory> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
Page<MesXslSparePartsCategory> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslSparePartsCategory> pageList = mesXslSparePartsCategoryService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES备品件类别-添加")
|
||||
@Operation(summary = "MES备品件类别-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_spare_parts_category:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslSparePartsCategory model) {
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】备品件类别保存前校验:类别名称唯一、描述 trim-----------
|
||||
String err = validateForSave(model, null);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】备品件类别保存前校验:类别名称唯一、描述 trim-----------
|
||||
mesXslSparePartsCategoryService.save(model);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES备品件类别-编辑")
|
||||
@Operation(summary = "MES备品件类别-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_spare_parts_category:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslSparePartsCategory model) {
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】备品件类别保存前校验:类别名称唯一、描述 trim-----------
|
||||
String err = validateForSave(model, model.getId());
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】备品件类别保存前校验:类别名称唯一、描述 trim-----------
|
||||
mesXslSparePartsCategoryService.updateById(model);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES备品件类别-删除")
|
||||
@Operation(summary = "MES备品件类别-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_spare_parts_category:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslSparePartsCategoryService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES备品件类别-批量删除")
|
||||
@Operation(summary = "MES备品件类别-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_spare_parts_category:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslSparePartsCategoryService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES备品件类别-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslSparePartsCategory> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslSparePartsCategory entity = mesXslSparePartsCategoryService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "校验备品件类别名称是否重复(同租户未删除数据;dataId 为编辑时当前主键)")
|
||||
@GetMapping(value = "/checkCategoryName")
|
||||
public Result<String> checkCategoryName(
|
||||
@RequestParam(name = "categoryName", required = true) String categoryName,
|
||||
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||
if (oConvertUtils.isEmpty(categoryName) || categoryName.trim().isEmpty()) {
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
MesXslSparePartsCategory ctx = new MesXslSparePartsCategory();
|
||||
if (mesXslSparePartsCategoryService.isCategoryNameDuplicated(categoryName.trim(), dataId, ctx)) {
|
||||
return Result.error("类别名称不能重复");
|
||||
}
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_spare_parts_category:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslSparePartsCategory model) {
|
||||
return super.exportXls(request, model, MesXslSparePartsCategory.class, "MES备品件类别");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_spare_parts_category:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】备品件类别导入:类别名称唯一、文件内去重-----------
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> ent : fileMap.entrySet()) {
|
||||
MultipartFile file = ent.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<MesXslSparePartsCategory> list =
|
||||
ExcelImportUtil.importExcel(file.getInputStream(), MesXslSparePartsCategory.class, params);
|
||||
if (list == null) {
|
||||
list = List.of();
|
||||
}
|
||||
Set<String> namesInFile = new HashSet<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MesXslSparePartsCategory row = list.get(i);
|
||||
int rowNo = i + 1;
|
||||
if (row == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
|
||||
}
|
||||
String name = row.getCategoryName();
|
||||
if (name != null) {
|
||||
name = name.trim();
|
||||
}
|
||||
if (oConvertUtils.isEmpty(name)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条类别名称不能为空");
|
||||
}
|
||||
row.setCategoryName(name);
|
||||
if (!namesInFile.add(name)) {
|
||||
return Result.error("文件导入失败:类别名称【" + name + "】在导入文件中重复");
|
||||
}
|
||||
if (mesXslSparePartsCategoryService.isCategoryNameDuplicated(name, null, row)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条类别名称【" + name + "】不能重复(同租户未删除数据中已存在)");
|
||||
}
|
||||
if (row.getCategoryDescription() != null) {
|
||||
row.setCategoryDescription(row.getCategoryDescription().trim());
|
||||
}
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
mesXslSparePartsCategoryService.saveBatch(list);
|
||||
log.info("备品件类别Excel导入完成,耗时{}ms,行数={}", System.currentTimeMillis() - start, list.size());
|
||||
return Result.ok("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.error(msg, e);
|
||||
if (msg != null && msg.indexOf("Duplicate entry") >= 0) {
|
||||
return Result.error("文件导入失败: 存在重复数据(类别名称不能重复)");
|
||||
}
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】备品件类别导入:类别名称唯一、文件内去重-----------
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】备品件类别保存前校验-----------
|
||||
private String validateForSave(MesXslSparePartsCategory model, String excludeId) {
|
||||
if (oConvertUtils.isEmpty(model.getCategoryName()) || model.getCategoryName().trim().isEmpty()) {
|
||||
return "类别名称不能为空";
|
||||
}
|
||||
String name = model.getCategoryName().trim();
|
||||
model.setCategoryName(name);
|
||||
if (mesXslSparePartsCategoryService.isCategoryNameDuplicated(name, excludeId, model)) {
|
||||
return "类别名称不能重复";
|
||||
}
|
||||
if (model.getCategoryDescription() != null) {
|
||||
model.setCategoryDescription(model.getCategoryDescription().trim());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】备品件类别保存前校验-----------
|
||||
}
|
||||
@@ -72,9 +72,9 @@ public class MesXslWeightRecordController extends JeecgController<MesXslWeightRe
|
||||
String seq = String.format("%03d", new Random().nextInt(1000));
|
||||
mesXslWeightRecord.setBillNo("BDH-" + dateStr + seq);
|
||||
}
|
||||
computeBillType(mesXslWeightRecord);
|
||||
applyMaterialTypeDefault(mesXslWeightRecord);
|
||||
computeNetWeight(mesXslWeightRecord);
|
||||
computeBillType(mesXslWeightRecord);
|
||||
mesXslWeightRecordService.save(mesXslWeightRecord);
|
||||
stompNotifyService.publishWeightRecordChanged("add", mesXslWeightRecord.getId());
|
||||
return Result.OK("添加成功!");
|
||||
@@ -85,9 +85,9 @@ public class MesXslWeightRecordController extends JeecgController<MesXslWeightRe
|
||||
@RequiresPermissions("xslmes:mes_xsl_weight_record:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslWeightRecord mesXslWeightRecord) {
|
||||
computeBillType(mesXslWeightRecord);
|
||||
applyMaterialTypeDefault(mesXslWeightRecord);
|
||||
computeNetWeight(mesXslWeightRecord);
|
||||
computeBillType(mesXslWeightRecord);
|
||||
mesXslWeightRecordService.updateById(mesXslWeightRecord);
|
||||
stompNotifyService.publishWeightRecordChanged("edit", mesXslWeightRecord.getId());
|
||||
return Result.OK("编辑成功!");
|
||||
@@ -137,26 +137,47 @@ public class MesXslWeightRecordController extends JeecgController<MesXslWeightRe
|
||||
}
|
||||
|
||||
private void computeNetWeight(MesXslWeightRecord record) {
|
||||
sanitizeNonPositiveWeightsToNull(record);
|
||||
BigDecimal gross = record.getGrossWeight();
|
||||
BigDecimal tare = record.getTareWeight();
|
||||
if (gross != null && tare != null) {
|
||||
if (isEffectiveWeight(gross) && isEffectiveWeight(tare)) {
|
||||
BigDecimal net = gross.subtract(tare);
|
||||
record.setNetWeight(net.compareTo(BigDecimal.ZERO) >= 0 ? net : BigDecimal.ZERO);
|
||||
} else {
|
||||
record.setNetWeight(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void computeBillType(MesXslWeightRecord record) {
|
||||
if (record.getGrossWeight() != null && record.getTareWeight() != null) {
|
||||
boolean g = isEffectiveWeight(record.getGrossWeight());
|
||||
boolean t = isEffectiveWeight(record.getTareWeight());
|
||||
if (g && t) {
|
||||
record.setBillType("2");
|
||||
return;
|
||||
}
|
||||
if (record.getGrossWeight() != null) {
|
||||
if (g) {
|
||||
record.setBillType("1");
|
||||
return;
|
||||
}
|
||||
if (record.getTareWeight() != null) {
|
||||
if (t) {
|
||||
record.setBillType("3");
|
||||
return;
|
||||
}
|
||||
record.setBillType(null);
|
||||
}
|
||||
|
||||
/** 将 ≤0 的重量视为未录入,避免占位 0 误判称重完成 */
|
||||
private static void sanitizeNonPositiveWeightsToNull(MesXslWeightRecord record) {
|
||||
if (record.getGrossWeight() != null && record.getGrossWeight().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
record.setGrossWeight(null);
|
||||
}
|
||||
if (record.getTareWeight() != null && record.getTareWeight().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
record.setTareWeight(null);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isEffectiveWeight(BigDecimal w) {
|
||||
return w != null && w.compareTo(BigDecimal.ZERO) > 0;
|
||||
}
|
||||
|
||||
private void applyMaterialTypeDefault(MesXslWeightRecord record) {
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 停机主类型(表 mes_xsl_downtime_main_type)
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_downtime_main_type")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES停机主类型")
|
||||
public class MesXslDowntimeMainType implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "所属工序主键")
|
||||
private String processOperationId;
|
||||
|
||||
@Excel(name = "工序名称", width = 24)
|
||||
@Schema(description = "工序名称冗余")
|
||||
private String processOperationName;
|
||||
|
||||
@Excel(name = "停机类型", width = 24)
|
||||
@Schema(description = "停机类型(同租户未删除数据中唯一)")
|
||||
private String downtimeType;
|
||||
|
||||
@Excel(name = "显示顺序", width = 12)
|
||||
@Schema(description = "显示顺序(升序)")
|
||||
private Integer displayOrder;
|
||||
|
||||
@Excel(name = "区分颜色", width = 16)
|
||||
@Schema(description = "区分颜色(十六进制色值)")
|
||||
private String distinguishColor;
|
||||
|
||||
@Excel(name = "是否启用", width = 12, dicCode = "xslmes_downtime_main_type_status")
|
||||
@Dict(dicCode = "xslmes_downtime_main_type_status")
|
||||
@Schema(description = "是否启用(字典 xslmes_downtime_main_type_status:0启用1停用)")
|
||||
private String status;
|
||||
|
||||
/** Excel 导入用:工序编码,不落库 */
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "工序编码", width = 18)
|
||||
@Schema(description = "导入用工序编码")
|
||||
private String importOperationCode;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
private String createBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 停机类型(表 mes_xsl_downtime_type)
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_downtime_type")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES停机类型")
|
||||
public class MesXslDowntimeType implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "所属工序主键")
|
||||
private String processOperationId;
|
||||
|
||||
@Excel(name = "工序名称", width = 24)
|
||||
@Schema(description = "工序名称冗余")
|
||||
private String processOperationName;
|
||||
|
||||
@Schema(description = "所属停机主类型主键")
|
||||
private String downtimeMainTypeId;
|
||||
|
||||
@Excel(name = "所属主类型", width = 24)
|
||||
@Schema(description = "主类型名称冗余")
|
||||
private String downtimeMainTypeName;
|
||||
|
||||
@Excel(name = "停机类型", width = 24)
|
||||
@Schema(description = "停机类型(同租户未删除数据中唯一)")
|
||||
private String downtimeType;
|
||||
|
||||
@Excel(name = "显示顺序", width = 12)
|
||||
@Schema(description = "显示顺序(升序,必填)")
|
||||
private Integer displayOrder;
|
||||
|
||||
@Excel(name = "区分颜色", width = 16)
|
||||
@Schema(description = "区分颜色(十六进制色值)")
|
||||
private String distinguishColor;
|
||||
|
||||
@Excel(name = "责任区分", width = 20)
|
||||
@Schema(description = "责任区分(手填)")
|
||||
private String responsibilityDistinct;
|
||||
|
||||
@Excel(name = "故障等级", width = 16)
|
||||
@Schema(description = "故障等级(手填)")
|
||||
private String faultLevel;
|
||||
|
||||
@Excel(name = "是否停机维修", width = 14, dicCode = "yn")
|
||||
@Dict(dicCode = "yn")
|
||||
@Schema(description = "是否停机维修(字典 yn:1是0否)")
|
||||
private String downtimeMaintenance;
|
||||
|
||||
@Excel(name = "是否启用", width = 12, dicCode = "xslmes_downtime_type_status")
|
||||
@Dict(dicCode = "xslmes_downtime_type_status")
|
||||
@Schema(description = "是否启用(字典 xslmes_downtime_type_status:0启用1停用)")
|
||||
private String status;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "工序编码", width = 18)
|
||||
@Schema(description = "导入用工序编码")
|
||||
private String importOperationCode;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "主类型名称", width = 24)
|
||||
@Schema(description = "导入用停机主类型名称")
|
||||
private String importMainTypeName;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
private String createBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 设备类别(表 mes_xsl_equipment_category)
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_equipment_category")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES设备类别")
|
||||
public class MesXslEquipmentCategory implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Excel(name = "类别名称", width = 22)
|
||||
@Schema(description = "设备类别名称(同租户未删除数据中唯一)")
|
||||
private String categoryName;
|
||||
|
||||
@Schema(description = "所属工序主键")
|
||||
private String processOperationId;
|
||||
|
||||
@Excel(name = "工序名称", width = 24)
|
||||
@Schema(description = "工序名称冗余,用于列表与导出展示")
|
||||
private String processOperationName;
|
||||
|
||||
@Excel(name = "点检区分", width = 14, dicCode = "xslmes_equipment_inspect_distinct")
|
||||
@Dict(dicCode = "xslmes_equipment_inspect_distinct")
|
||||
@Schema(description = "点检区分(字典 xslmes_equipment_inspect_distinct)")
|
||||
private String inspectDistinct;
|
||||
|
||||
@Excel(name = "保养区分", width = 14, dicCode = "xslmes_equipment_maintain_distinct")
|
||||
@Dict(dicCode = "xslmes_equipment_maintain_distinct")
|
||||
@Schema(description = "保养区分(字典 xslmes_equipment_maintain_distinct)")
|
||||
private String maintainDistinct;
|
||||
|
||||
/** Excel 导入用:工序编码,不落库 */
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "工序编码", width = 18)
|
||||
@Schema(description = "导入用工序编码(仅导入模板)")
|
||||
private String importOperationCode;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
private String createBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 设备部位(表 mes_xsl_equipment_part)
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_equipment_part")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES设备部位")
|
||||
public class MesXslEquipmentPart implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "所属设备类别主键")
|
||||
private String equipmentCategoryId;
|
||||
|
||||
@Excel(name = "类别名称", width = 22)
|
||||
@Schema(description = "设备类别名称冗余展示")
|
||||
private String equipmentCategoryName;
|
||||
|
||||
@Excel(name = "部位名称", width = 20)
|
||||
@Schema(description = "部位名称")
|
||||
private String partName;
|
||||
|
||||
@Excel(name = "部位代码", width = 16)
|
||||
@Schema(description = "部位代码(同租户未删除数据中唯一)")
|
||||
private String partCode;
|
||||
|
||||
@Excel(name = "部位描述", width = 28)
|
||||
@Schema(description = "部位描述")
|
||||
private String partDescription;
|
||||
|
||||
@Excel(name = "是否启用", width = 12, dicCode = "xslmes_unit_status")
|
||||
@Dict(dicCode = "xslmes_unit_status")
|
||||
@Schema(description = "是否启用(字典xslmes_unit_status:0启用1停用)")
|
||||
private String enableStatus;
|
||||
|
||||
/** Excel 导入用:设备类别名称,不落库 */
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "设备类别名称", width = 22)
|
||||
@Schema(description = "导入用设备类别名称")
|
||||
private String importCategoryName;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
private String createBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 设备小部位(表 mes_xsl_equipment_sub_part)
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_equipment_sub_part")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES设备小部位")
|
||||
public class MesXslEquipmentSubPart implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "所属设备类别主键")
|
||||
private String equipmentCategoryId;
|
||||
|
||||
@Excel(name = "类别名称", width = 22)
|
||||
@Schema(description = "设备类别名称冗余展示")
|
||||
private String equipmentCategoryName;
|
||||
|
||||
@Schema(description = "所属设备大部位主键 mes_xsl_equipment_part.id")
|
||||
private String equipmentPartId;
|
||||
|
||||
@Excel(name = "大部位名称", width = 20)
|
||||
@Schema(description = "设备大部位名称冗余")
|
||||
private String equipmentPartName;
|
||||
|
||||
@Excel(name = "小部位名称", width = 20)
|
||||
@Schema(description = "小部位名称")
|
||||
private String subPartName;
|
||||
|
||||
@Excel(name = "小部位代码", width = 16)
|
||||
@Schema(description = "小部位代码(同租户未删除数据中唯一)")
|
||||
private String subPartCode;
|
||||
|
||||
@Excel(name = "部位描述", width = 28)
|
||||
@Schema(description = "部位描述")
|
||||
private String subPartDescription;
|
||||
|
||||
@Excel(name = "是否启用", width = 12, dicCode = "xslmes_unit_status")
|
||||
@Dict(dicCode = "xslmes_unit_status")
|
||||
@Schema(description = "是否启用(字典xslmes_unit_status:0启用1停用)")
|
||||
private String enableStatus;
|
||||
|
||||
/** Excel 导入用:设备类别名称,不落库 */
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "设备类别名称", width = 22)
|
||||
@Schema(description = "导入用设备类别名称")
|
||||
private String importCategoryName;
|
||||
|
||||
/** Excel 导入用:大部位代码 mes_xsl_equipment_part.part_code,不落库 */
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "大部位代码", width = 16)
|
||||
@Schema(description = "导入用设备大部位代码")
|
||||
private String importEquipmentPartCode;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
private String createBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 设备类型(表 mes_xsl_equipment_type)
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_equipment_type")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES设备类型")
|
||||
public class MesXslEquipmentType implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Excel(name = "类型名称", width = 22)
|
||||
@Schema(description = "设备类型名称(同租户未删除数据中唯一)")
|
||||
private String typeName;
|
||||
|
||||
@Schema(description = "所属工序主键")
|
||||
private String processOperationId;
|
||||
|
||||
@Excel(name = "工序名称", width = 24)
|
||||
@Schema(description = "工序名称冗余展示")
|
||||
private String processOperationName;
|
||||
|
||||
@Schema(description = "所属设备类别主键")
|
||||
private String equipmentCategoryId;
|
||||
|
||||
@Excel(name = "类别名称", width = 22)
|
||||
@Schema(description = "设备类别名称冗余展示")
|
||||
private String equipmentCategoryName;
|
||||
|
||||
/** Excel 导入用:工序编码,不落库 */
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "工序编码", width = 18)
|
||||
@Schema(description = "导入用工序编码")
|
||||
private String importOperationCode;
|
||||
|
||||
/** Excel 导入用:设备类别名称(与设备类别维护中名称一致),不落库 */
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "设备类别名称", width = 22)
|
||||
@Schema(description = "导入用设备类别名称")
|
||||
private String importCategoryName;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
private String createBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
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_manufacturer)
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_manufacturer")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES厂家信息")
|
||||
public class MesXslManufacturer implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Excel(name = "厂家类别", width = 16, dicCode = "xslmes_manufacturer_category")
|
||||
@Dict(dicCode = "xslmes_manufacturer_category")
|
||||
@Schema(description = "厂家类别(字典 xslmes_manufacturer_category)")
|
||||
private String manufacturerCategory;
|
||||
|
||||
@Excel(name = "厂家名称", width = 28)
|
||||
@Schema(description = "厂家名称(同租户未删除数据中唯一)")
|
||||
private String manufacturerName;
|
||||
|
||||
@Excel(name = "是否有效", width = 12, dicCode = "xslmes_manufacturer_valid")
|
||||
@Dict(dicCode = "xslmes_manufacturer_valid")
|
||||
@Schema(description = "是否有效(字典 xslmes_manufacturer_valid:0有效1无效)")
|
||||
private String validStatus;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
private String createBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
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.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 工序管理(表 mes_process_operation)
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_process_operation")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES工序管理")
|
||||
public class MesXslProcessOperation implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Excel(name = "工序编码", width = 20)
|
||||
@Schema(description = "工序编码(同租户内唯一)")
|
||||
private String operationCode;
|
||||
|
||||
@Excel(name = "工序名称", width = 24)
|
||||
@Schema(description = "工序名称")
|
||||
private String operationName;
|
||||
|
||||
@Excel(name = "备注", width = 28)
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
@@ -138,4 +139,8 @@ public class MesXslRawMaterialCard implements Serializable {
|
||||
|
||||
@Schema(description = "租户ID")
|
||||
private Integer tenantId;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "是否存在待检送检记录(前端控制送检按钮显隐)")
|
||||
private Boolean hasPendingInspect;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
@Data
|
||||
@TableName("mes_xsl_raw_material_inspect_record")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "原材料送检记录")
|
||||
public class MesXslRawMaterialInspectRecord implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "原材料卡片ID")
|
||||
private String rawMaterialCardId;
|
||||
|
||||
@Excel(name = "条码", width = 20)
|
||||
@Schema(description = "条码")
|
||||
private String barcode;
|
||||
|
||||
@Excel(name = "批次号", width = 20)
|
||||
@Schema(description = "批次号")
|
||||
private String batchNo;
|
||||
|
||||
@Schema(description = "物料ID")
|
||||
private String materialId;
|
||||
|
||||
@Excel(name = "物料名称", width = 20)
|
||||
@Schema(description = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
@Excel(name = "检验状态", width = 12, dicCode = "xslmes_inspect_status")
|
||||
@Dict(dicCode = "xslmes_inspect_status")
|
||||
@Schema(description = "检验状态(xslmes_inspect_status:0待检 1合格 2不合格)")
|
||||
private String inspectStatus;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "送检时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "送检时间")
|
||||
private Date inspectTime;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "判定时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "判定时间")
|
||||
private Date resultTime;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "租户ID")
|
||||
private Integer tenantId;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "送检明细")
|
||||
private List<MesXslRawMaterialInspectRecordLine> lineList;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
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.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
@Data
|
||||
@TableName("mes_xsl_raw_material_inspect_record_line")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "原材料送检记录-检验明细")
|
||||
public class MesXslRawMaterialInspectRecordLine implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "送检记录主表ID")
|
||||
private String recordId;
|
||||
|
||||
@Schema(description = "检验标准ID")
|
||||
private String inspectStdId;
|
||||
|
||||
@Schema(description = "检验项目ID")
|
||||
private String inspectItemId;
|
||||
|
||||
@Schema(description = "检验项目名称")
|
||||
private String inspectItemName;
|
||||
|
||||
@Schema(description = "容许最小值")
|
||||
private BigDecimal allowMin;
|
||||
|
||||
@Schema(description = "包含最小值 1是 0否")
|
||||
private Integer includeMinFlag;
|
||||
|
||||
@Schema(description = "容许最大值")
|
||||
private BigDecimal allowMax;
|
||||
|
||||
@Schema(description = "包含最大值 1是 0否")
|
||||
private Integer includeMaxFlag;
|
||||
|
||||
@Schema(description = "检验值")
|
||||
private BigDecimal inspectValue;
|
||||
|
||||
@Dict(dicCode = "xslmes_inspect_status")
|
||||
@Schema(description = "明细判定状态(xslmes_inspect_status:0待检 1合格 2不合格)")
|
||||
private String passFlag;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sortNo;
|
||||
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* 原材料汇总(按仓库+物料)
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "原材料汇总")
|
||||
public class MesXslRawMaterialSummary implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
|
||||
@Excel(name = "所在仓库", width = 20)
|
||||
@Schema(description = "所在仓库")
|
||||
private String warehouseName;
|
||||
|
||||
@Excel(name = "物料名称", width = 20)
|
||||
@Schema(description = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
@Excel(name = "物料编码", width = 20)
|
||||
@Schema(description = "物料编码")
|
||||
private String materialCode;
|
||||
|
||||
@Excel(name = "总包数", width = 15)
|
||||
@Schema(description = "总包数")
|
||||
private BigDecimal totalPackages;
|
||||
|
||||
@Excel(name = "总重量", width = 15)
|
||||
@Schema(description = "总重量")
|
||||
private BigDecimal totalWeight;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 备品件信息(表 mes_xsl_spare_part)
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_spare_part")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES备品件信息")
|
||||
public class MesXslSparePart implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Excel(name = "备品件名称", width = 22)
|
||||
@Schema(description = "备品件名称(同租户未删除数据中唯一)")
|
||||
private String sparePartName;
|
||||
|
||||
@Schema(description = "所属备品件类别主键")
|
||||
private String sparePartsCategoryId;
|
||||
|
||||
@Excel(name = "类别名称", width = 20)
|
||||
@Schema(description = "备品件类别名称冗余")
|
||||
private String sparePartsCategoryName;
|
||||
|
||||
@Excel(name = "规格型号", width = 20)
|
||||
@Schema(description = "规格型号")
|
||||
private String specModel;
|
||||
|
||||
@Excel(name = "最大库存", width = 14)
|
||||
@Schema(description = "最大库存")
|
||||
private BigDecimal maxStock;
|
||||
|
||||
@Excel(name = "最小库存", width = 14)
|
||||
@Schema(description = "最小库存")
|
||||
private BigDecimal minStock;
|
||||
|
||||
@Schema(description = "单位 mes_xsl_unit.id")
|
||||
private String unitId;
|
||||
|
||||
@Excel(name = "单位名称", width = 14)
|
||||
@Schema(description = "单位名称冗余")
|
||||
private String unitName;
|
||||
|
||||
/** Excel 导入用:备品件类别名称,不落库 */
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "备品件类别名称", width = 22)
|
||||
@Schema(description = "导入用备品件类别名称")
|
||||
private String importCategoryName;
|
||||
|
||||
/** Excel 导入用:单位编码 mes_xsl_unit.unit_code,不落库 */
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "单位编码", width = 16)
|
||||
@Schema(description = "导入用单位编码")
|
||||
private String importUnitCode;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
private String createBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
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.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 备品件类别(表 mes_xsl_spare_parts_category)
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_spare_parts_category")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES备品件类别")
|
||||
public class MesXslSparePartsCategory implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Excel(name = "类别名称", width = 24)
|
||||
@Schema(description = "类别名称(同租户未删除数据中唯一)")
|
||||
private String categoryName;
|
||||
|
||||
@Excel(name = "描述", width = 36)
|
||||
@Schema(description = "描述")
|
||||
private String categoryDescription;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
private String createBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType;
|
||||
|
||||
/**
|
||||
* MES 停机主类型
|
||||
*/
|
||||
public interface MesXslDowntimeMainTypeMapper extends BaseMapper<MesXslDowntimeMainType> {}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeType;
|
||||
|
||||
/**
|
||||
* MES 停机类型
|
||||
*/
|
||||
public interface MesXslDowntimeTypeMapper extends BaseMapper<MesXslDowntimeType> {}
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslEquipmentCategory;
|
||||
|
||||
/**
|
||||
* MES 设备类别 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface MesXslEquipmentCategoryMapper extends BaseMapper<MesXslEquipmentCategory> {}
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslEquipmentPart;
|
||||
|
||||
/**
|
||||
* MES 设备部位 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface MesXslEquipmentPartMapper extends BaseMapper<MesXslEquipmentPart> {}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslEquipmentSubPart;
|
||||
|
||||
public interface MesXslEquipmentSubPartMapper extends BaseMapper<MesXslEquipmentSubPart> {}
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslEquipmentType;
|
||||
|
||||
/**
|
||||
* MES 设备类型 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface MesXslEquipmentTypeMapper extends BaseMapper<MesXslEquipmentType> {}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslManufacturer;
|
||||
|
||||
/**
|
||||
* MES 厂家信息
|
||||
*/
|
||||
public interface MesXslManufacturerMapper extends BaseMapper<MesXslManufacturer> {}
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslProcessOperation;
|
||||
|
||||
/**
|
||||
* MES 工序管理 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface MesXslProcessOperationMapper extends BaseMapper<MesXslProcessOperation> {}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecordLine;
|
||||
|
||||
public interface MesXslRawMaterialInspectRecordLineMapper
|
||||
extends BaseMapper<MesXslRawMaterialInspectRecordLine> {}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecord;
|
||||
|
||||
public interface MesXslRawMaterialInspectRecordMapper
|
||||
extends BaseMapper<MesXslRawMaterialInspectRecord> {}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslSparePart;
|
||||
|
||||
public interface MesXslSparePartMapper extends BaseMapper<MesXslSparePart> {}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslSparePartsCategory;
|
||||
|
||||
public interface MesXslSparePartsCategoryMapper extends BaseMapper<MesXslSparePartsCategory> {}
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* MES XSL 业务模块(Maven 工程名:jeecg-module-xslmes)。
|
||||
* 包含:客户管理({@link org.jeecg.modules.xslmes.entity.MesXslCustomer})等。
|
||||
* 包含:客户管理({@link org.jeecg.modules.xslmes.entity.MesXslCustomer})、工序管理({@link org.jeecg.modules.xslmes.entity.MesXslProcessOperation})、设备类别({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentCategory})、设备类型({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentType})、设备部位({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentPart})、设备小部位({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentSubPart})、备品件类别({@link org.jeecg.modules.xslmes.entity.MesXslSparePartsCategory})、备品件信息({@link org.jeecg.modules.xslmes.entity.MesXslSparePart})、厂家信息({@link org.jeecg.modules.xslmes.entity.MesXslManufacturer})、停机主类型({@link org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType})、停机类型({@link org.jeecg.modules.xslmes.entity.MesXslDowntimeType})等。
|
||||
*/
|
||||
package org.jeecg.modules.xslmes;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType;
|
||||
|
||||
public interface IMesXslDowntimeMainTypeService extends IService<MesXslDowntimeMainType> {
|
||||
|
||||
/**
|
||||
* 停机类型是否已被占用(仅统计未删除:del_flag 为 0 或 null)。租户与拦截器注入逻辑一致。
|
||||
*
|
||||
* @param downtimeType 停机类型(已 trim 后传入)
|
||||
* @param excludeId 编辑时排除自身主键,新增传 null
|
||||
* @param context 当前提交的实体(可取 tenantId;可为 null)
|
||||
*/
|
||||
boolean isDowntimeTypeDuplicated(String downtimeType, String excludeId, MesXslDowntimeMainType context);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeType;
|
||||
|
||||
public interface IMesXslDowntimeTypeService extends IService<MesXslDowntimeType> {
|
||||
|
||||
/**
|
||||
* 停机类型名称是否已被占用(仅统计未删除:del_flag 为 0 或 null)。租户与拦截器注入逻辑一致。
|
||||
*/
|
||||
boolean isDowntimeTypeDuplicated(String downtimeType, String excludeId, MesXslDowntimeType context);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslEquipmentCategory;
|
||||
|
||||
public interface IMesXslEquipmentCategoryService extends IService<MesXslEquipmentCategory> {
|
||||
|
||||
/**
|
||||
* 类别名称是否已被占用(仅统计未删除:del_flag 为 0 或 null)。租户与 MybatisInterceptor 注入逻辑一致。
|
||||
*
|
||||
* @param categoryName 类别名称(已 trim 后传入)
|
||||
* @param excludeId 编辑时排除自身主键,新增传 null
|
||||
* @param context 当前提交的实体(可取 tenantId;可为 null)
|
||||
*/
|
||||
boolean isCategoryNameDuplicated(String categoryName, String excludeId, MesXslEquipmentCategory context);
|
||||
|
||||
/**
|
||||
* 按类别名称在未删除数据中查询一条(同租户;名称需 trim 后传入)。用于设备类型关联类别解析等。
|
||||
*
|
||||
* @param categoryName 类别名称
|
||||
* @param tenantId 租户 ID,可为 null(不按租户过滤)
|
||||
*/
|
||||
MesXslEquipmentCategory findOneActiveByNameAndTenant(String categoryName, Integer tenantId);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslEquipmentPart;
|
||||
|
||||
public interface IMesXslEquipmentPartService extends IService<MesXslEquipmentPart> {
|
||||
|
||||
/**
|
||||
* 按部位代码在指定租户下查找一条未删除记录(用于设备小部位导入解析等)。
|
||||
*
|
||||
* @param partCode 部位代码(已 trim)
|
||||
* @param tenantId 租户 ID,可为 null(不按租户过滤)
|
||||
*/
|
||||
MesXslEquipmentPart findOneActiveByPartCodeAndTenant(String partCode, Integer tenantId);
|
||||
|
||||
/**
|
||||
* 部位代码是否已被占用:同租户下未删除数据中部位代码不可重复。租户与 MybatisInterceptor 注入逻辑一致。
|
||||
*
|
||||
* @param partCode 部位代码(已 trim 后传入)
|
||||
* @param excludeId 编辑时排除自身主键,新增传 null
|
||||
* @param context 当前提交的实体(可取 tenantId;可为 null)
|
||||
*/
|
||||
boolean isPartCodeDuplicated(String partCode, String excludeId, MesXslEquipmentPart context);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslEquipmentSubPart;
|
||||
|
||||
public interface IMesXslEquipmentSubPartService extends IService<MesXslEquipmentSubPart> {
|
||||
|
||||
/**
|
||||
* 小部位代码是否已被占用:同租户下未删除数据中小部位代码不可重复。
|
||||
*
|
||||
* @param subPartCode 小部位代码(已 trim 后传入)
|
||||
* @param excludeId 编辑时排除自身主键,新增传 null
|
||||
* @param context 当前提交的实体(可取 tenantId;可为 null)
|
||||
*/
|
||||
boolean isSubPartCodeDuplicated(String subPartCode, String excludeId, MesXslEquipmentSubPart context);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslEquipmentType;
|
||||
|
||||
public interface IMesXslEquipmentTypeService extends IService<MesXslEquipmentType> {
|
||||
|
||||
/**
|
||||
* 类型名称是否已被占用(仅统计未删除:del_flag 为 0 或 null)。租户与 MybatisInterceptor 注入逻辑一致。
|
||||
*
|
||||
* @param typeName 类型名称(已 trim 后传入)
|
||||
* @param excludeId 编辑时排除自身主键,新增传 null
|
||||
* @param context 当前提交的实体(可取 tenantId;可为 null)
|
||||
*/
|
||||
boolean isTypeNameDuplicated(String typeName, String excludeId, MesXslEquipmentType context);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslManufacturer;
|
||||
|
||||
public interface IMesXslManufacturerService extends IService<MesXslManufacturer> {
|
||||
|
||||
/**
|
||||
* 厂家名称是否已被占用(仅统计未删除:del_flag 为 0 或 null)。租户与拦截器注入逻辑一致。
|
||||
*
|
||||
* @param manufacturerName 厂家名称(已 trim 后传入)
|
||||
* @param excludeId 编辑时排除自身主键,新增传 null
|
||||
* @param context 当前提交的实体(可取 tenantId;可为 null)
|
||||
*/
|
||||
boolean isManufacturerNameDuplicated(String manufacturerName, String excludeId, MesXslManufacturer context);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslProcessOperation;
|
||||
|
||||
public interface IMesXslProcessOperationService extends IService<MesXslProcessOperation> {
|
||||
|
||||
/**
|
||||
* 工序编码是否已被占用(仅统计未删除:del_flag 为 0 或 null)。租户与 MybatisInterceptor 注入逻辑一致。
|
||||
*
|
||||
* @param operationCode 工序编码(已 trim 后传入)
|
||||
* @param excludeId 编辑时排除自身主键,新增传 null
|
||||
* @param context 当前提交的实体(可取 tenantId;可为 null)
|
||||
*/
|
||||
boolean isOperationCodeDuplicated(String operationCode, String excludeId, MesXslProcessOperation context);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecord;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecordLine;
|
||||
|
||||
public interface IMesXslRawMaterialInspectRecordService
|
||||
extends IService<MesXslRawMaterialInspectRecord> {
|
||||
|
||||
MesXslRawMaterialInspectRecord createByRawMaterialCardId(String rawMaterialCardId);
|
||||
|
||||
List<MesXslRawMaterialInspectRecordLine> selectLinesByRecordId(String recordId);
|
||||
|
||||
List<MesXslRawMaterialInspectRecordLine> prepareResultEntryLines(String recordId);
|
||||
|
||||
void saveInspectResult(String recordId, List<MesXslRawMaterialInspectRecordLine> lineList);
|
||||
|
||||
String evaluatePassFlag(
|
||||
BigDecimal inspectValue,
|
||||
BigDecimal allowMin,
|
||||
Integer includeMinFlag,
|
||||
BigDecimal allowMax,
|
||||
Integer includeMaxFlag);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslSparePart;
|
||||
|
||||
public interface IMesXslSparePartService extends IService<MesXslSparePart> {
|
||||
|
||||
/**
|
||||
* 备品件名称是否已被占用(同租户未删除数据中唯一)。
|
||||
*/
|
||||
boolean isSparePartNameDuplicated(String sparePartName, String excludeId, MesXslSparePart context);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslSparePartsCategory;
|
||||
|
||||
public interface IMesXslSparePartsCategoryService extends IService<MesXslSparePartsCategory> {
|
||||
|
||||
/**
|
||||
* 备品件类别名称是否已被占用(仅统计未删除:del_flag 为 0 或 null)。租户与 MybatisInterceptor 注入逻辑一致。
|
||||
*
|
||||
* @param categoryName 类别名称(已 trim 后传入)
|
||||
* @param excludeId 编辑时排除自身主键,新增传 null
|
||||
* @param context 当前提交的实体(可取 tenantId;可为 null)
|
||||
*/
|
||||
boolean isCategoryNameDuplicated(String categoryName, String excludeId, MesXslSparePartsCategory context);
|
||||
|
||||
/**
|
||||
* 按类别名称在未删除数据中查询一条(同租户),用于备品件信息导入解析等。
|
||||
*/
|
||||
MesXslSparePartsCategory findOneActiveByCategoryNameAndTenant(String categoryName, Integer tenantId);
|
||||
}
|
||||
@@ -12,4 +12,9 @@ public interface IMesXslUnitService extends IService<MesXslUnit> {
|
||||
|
||||
/** 单位分类(sys_category)选中节点及其所有下级 id,用于列表筛选 */
|
||||
List<String> listDescendantCategoryIds(String rootId);
|
||||
|
||||
/**
|
||||
* 按单位编码在未删除数据中查询一条(同租户),用于备品件信息导入解析等。
|
||||
*/
|
||||
MesXslUnit findOneActiveByUnitCodeAndTenant(String unitCode, Integer tenantId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslDowntimeMainTypeMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslDowntimeMainTypeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MesXslDowntimeMainTypeServiceImpl extends ServiceImpl<MesXslDowntimeMainTypeMapper, MesXslDowntimeMainType>
|
||||
implements IMesXslDowntimeMainTypeService {
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||
@Override
|
||||
public boolean isDowntimeTypeDuplicated(String downtimeType, String excludeId, MesXslDowntimeMainType context) {
|
||||
if (oConvertUtils.isEmpty(downtimeType)) {
|
||||
return false;
|
||||
}
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
LambdaQueryWrapper<MesXslDowntimeMainType> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslDowntimeMainType::getDowntimeType, downtimeType.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslDowntimeMainType::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslDowntimeMainType::getDelFlag));
|
||||
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||
w.ne(MesXslDowntimeMainType::getId, excludeId);
|
||||
}
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslDowntimeMainType::getTenantId, tenantId);
|
||||
}
|
||||
return this.count(w) > 0;
|
||||
}
|
||||
|
||||
private static Integer resolveTenantId(MesXslDowntimeMainType context) {
|
||||
if (context != null && context.getTenantId() != null) {
|
||||
return context.getTenantId();
|
||||
}
|
||||
String ts = TenantContext.getTenant();
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
try {
|
||||
ts = TokenUtils.getTenantIdByRequest(SpringContextUtils.getHttpServletRequest());
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return Integer.parseInt(ts.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeType;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslDowntimeTypeMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslDowntimeTypeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MesXslDowntimeTypeServiceImpl extends ServiceImpl<MesXslDowntimeTypeMapper, MesXslDowntimeType>
|
||||
implements IMesXslDowntimeTypeService {
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260518 for:【MES】停机类型名称同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||
@Override
|
||||
public boolean isDowntimeTypeDuplicated(String downtimeType, String excludeId, MesXslDowntimeType context) {
|
||||
if (oConvertUtils.isEmpty(downtimeType)) {
|
||||
return false;
|
||||
}
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
LambdaQueryWrapper<MesXslDowntimeType> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslDowntimeType::getDowntimeType, downtimeType.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslDowntimeType::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslDowntimeType::getDelFlag));
|
||||
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||
w.ne(MesXslDowntimeType::getId, excludeId);
|
||||
}
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslDowntimeType::getTenantId, tenantId);
|
||||
}
|
||||
return this.count(w) > 0;
|
||||
}
|
||||
|
||||
private static Integer resolveTenantId(MesXslDowntimeType context) {
|
||||
if (context != null && context.getTenantId() != null) {
|
||||
return context.getTenantId();
|
||||
}
|
||||
String ts = TenantContext.getTenant();
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
try {
|
||||
ts = TokenUtils.getTenantIdByRequest(SpringContextUtils.getHttpServletRequest());
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return Integer.parseInt(ts.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260518 for:【MES】停机类型名称同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
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.MesXslEquipmentCategory;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslEquipmentCategoryMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslEquipmentCategoryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MesXslEquipmentCategoryServiceImpl extends ServiceImpl<MesXslEquipmentCategoryMapper, MesXslEquipmentCategory>
|
||||
implements IMesXslEquipmentCategoryService {
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260514 for:【MES】设备类别名称同租户唯一;仅统计未删除(del_flag=0 或 null)-----------
|
||||
@Override
|
||||
public boolean isCategoryNameDuplicated(String categoryName, String excludeId, MesXslEquipmentCategory context) {
|
||||
if (oConvertUtils.isEmpty(categoryName)) {
|
||||
return false;
|
||||
}
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
LambdaQueryWrapper<MesXslEquipmentCategory> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslEquipmentCategory::getCategoryName, categoryName.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslEquipmentCategory::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslEquipmentCategory::getDelFlag));
|
||||
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||
w.ne(MesXslEquipmentCategory::getId, excludeId);
|
||||
}
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslEquipmentCategory::getTenantId, tenantId);
|
||||
}
|
||||
return this.count(w) > 0;
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260514 for:【MES】设备类型按类别名称解析关联,提供未删除单条查询-----------
|
||||
@Override
|
||||
public MesXslEquipmentCategory findOneActiveByNameAndTenant(String categoryName, Integer tenantId) {
|
||||
if (oConvertUtils.isEmpty(categoryName)) {
|
||||
return null;
|
||||
}
|
||||
LambdaQueryWrapper<MesXslEquipmentCategory> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslEquipmentCategory::getCategoryName, categoryName.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslEquipmentCategory::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslEquipmentCategory::getDelFlag));
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslEquipmentCategory::getTenantId, tenantId);
|
||||
}
|
||||
w.last("LIMIT 1");
|
||||
return this.getOne(w, false);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260514 for:【MES】设备类型按类别名称解析关联,提供未删除单条查询-----------
|
||||
|
||||
private static Integer resolveTenantId(MesXslEquipmentCategory 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:20260514 for:【MES】设备类别名称同租户唯一;仅统计未删除(del_flag=0 或 null)-----------
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
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.MesXslEquipmentPart;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslEquipmentPartMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslEquipmentPartService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MesXslEquipmentPartServiceImpl extends ServiceImpl<MesXslEquipmentPartMapper, MesXslEquipmentPart>
|
||||
implements IMesXslEquipmentPartService {
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】设备部位代码同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||
@Override
|
||||
public boolean isPartCodeDuplicated(String partCode, String excludeId, MesXslEquipmentPart context) {
|
||||
if (oConvertUtils.isEmpty(partCode)) {
|
||||
return false;
|
||||
}
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
LambdaQueryWrapper<MesXslEquipmentPart> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslEquipmentPart::getPartCode, partCode.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslEquipmentPart::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslEquipmentPart::getDelFlag));
|
||||
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||
w.ne(MesXslEquipmentPart::getId, excludeId);
|
||||
}
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslEquipmentPart::getTenantId, tenantId);
|
||||
}
|
||||
return this.count(w) > 0;
|
||||
}
|
||||
|
||||
private static Integer resolveTenantId(MesXslEquipmentPart 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:20260515 for:【MES】设备部位代码同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】设备部位按代码+租户查询单条,供设备小部位导入解析大部位-----------
|
||||
@Override
|
||||
public MesXslEquipmentPart findOneActiveByPartCodeAndTenant(String partCode, Integer tenantId) {
|
||||
if (oConvertUtils.isEmpty(partCode)) {
|
||||
return null;
|
||||
}
|
||||
LambdaQueryWrapper<MesXslEquipmentPart> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslEquipmentPart::getPartCode, partCode.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslEquipmentPart::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslEquipmentPart::getDelFlag));
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslEquipmentPart::getTenantId, tenantId);
|
||||
}
|
||||
w.last("LIMIT 1");
|
||||
return this.getOne(w, false);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】设备部位按代码+租户查询单条,供设备小部位导入解析大部位-----------
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslEquipmentSubPart;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslEquipmentSubPartMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslEquipmentSubPartService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MesXslEquipmentSubPartServiceImpl extends ServiceImpl<MesXslEquipmentSubPartMapper, MesXslEquipmentSubPart>
|
||||
implements IMesXslEquipmentSubPartService {
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】设备小部位代码同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||
@Override
|
||||
public boolean isSubPartCodeDuplicated(String subPartCode, String excludeId, MesXslEquipmentSubPart context) {
|
||||
if (oConvertUtils.isEmpty(subPartCode)) {
|
||||
return false;
|
||||
}
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
LambdaQueryWrapper<MesXslEquipmentSubPart> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslEquipmentSubPart::getSubPartCode, subPartCode.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslEquipmentSubPart::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslEquipmentSubPart::getDelFlag));
|
||||
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||
w.ne(MesXslEquipmentSubPart::getId, excludeId);
|
||||
}
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslEquipmentSubPart::getTenantId, tenantId);
|
||||
}
|
||||
return this.count(w) > 0;
|
||||
}
|
||||
|
||||
private static Integer resolveTenantId(MesXslEquipmentSubPart 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:20260515 for:【MES】设备小部位代码同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslEquipmentType;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslEquipmentTypeMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslEquipmentTypeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MesXslEquipmentTypeServiceImpl extends ServiceImpl<MesXslEquipmentTypeMapper, MesXslEquipmentType>
|
||||
implements IMesXslEquipmentTypeService {
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260514 for:【MES】设备类型名称同租户唯一;仅统计未删除(del_flag=0 或 null)-----------
|
||||
@Override
|
||||
public boolean isTypeNameDuplicated(String typeName, String excludeId, MesXslEquipmentType context) {
|
||||
if (oConvertUtils.isEmpty(typeName)) {
|
||||
return false;
|
||||
}
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
LambdaQueryWrapper<MesXslEquipmentType> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslEquipmentType::getTypeName, typeName.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslEquipmentType::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslEquipmentType::getDelFlag));
|
||||
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||
w.ne(MesXslEquipmentType::getId, excludeId);
|
||||
}
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslEquipmentType::getTenantId, tenantId);
|
||||
}
|
||||
return this.count(w) > 0;
|
||||
}
|
||||
|
||||
private static Integer resolveTenantId(MesXslEquipmentType 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:20260514 for:【MES】设备类型名称同租户唯一;仅统计未删除(del_flag=0 或 null)-----------
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslManufacturer;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslManufacturerMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslManufacturerService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MesXslManufacturerServiceImpl extends ServiceImpl<MesXslManufacturerMapper, MesXslManufacturer>
|
||||
implements IMesXslManufacturerService {
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】厂家名称同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||
@Override
|
||||
public boolean isManufacturerNameDuplicated(String manufacturerName, String excludeId, MesXslManufacturer context) {
|
||||
if (oConvertUtils.isEmpty(manufacturerName)) {
|
||||
return false;
|
||||
}
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
LambdaQueryWrapper<MesXslManufacturer> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslManufacturer::getManufacturerName, manufacturerName.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslManufacturer::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslManufacturer::getDelFlag));
|
||||
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||
w.ne(MesXslManufacturer::getId, excludeId);
|
||||
}
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslManufacturer::getTenantId, tenantId);
|
||||
}
|
||||
return this.count(w) > 0;
|
||||
}
|
||||
|
||||
private static Integer resolveTenantId(MesXslManufacturer 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:20260515 for:【MES】厂家名称同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
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.MesXslProcessOperation;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslProcessOperationMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslProcessOperationService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MesXslProcessOperationServiceImpl extends ServiceImpl<MesXslProcessOperationMapper, MesXslProcessOperation>
|
||||
implements IMesXslProcessOperationService {
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260514 for:【MES】工序编码同租户唯一;仅统计未删除(del_flag=0 或 null)-----------
|
||||
@Override
|
||||
public boolean isOperationCodeDuplicated(String operationCode, String excludeId, MesXslProcessOperation context) {
|
||||
if (oConvertUtils.isEmpty(operationCode)) {
|
||||
return false;
|
||||
}
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
LambdaQueryWrapper<MesXslProcessOperation> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslProcessOperation::getOperationCode, operationCode.trim());
|
||||
// 仅与「未删除」数据判重:del_flag=0 或历史空值视为正常行,排除已删除(del_flag=1)
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslProcessOperation::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslProcessOperation::getDelFlag));
|
||||
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||
w.ne(MesXslProcessOperation::getId, excludeId);
|
||||
}
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslProcessOperation::getTenantId, tenantId);
|
||||
}
|
||||
return this.count(w) > 0;
|
||||
}
|
||||
|
||||
/** 与 MybatisInterceptor 注入 tenant_id 的取值顺序尽量一致,避免前端未传 tenantId 时查不到已存在数据 */
|
||||
private static Integer resolveTenantId(MesXslProcessOperation 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:20260514 for:【MES】工序编码同租户唯一;仅统计未删除(del_flag=0 或 null)-----------
|
||||
}
|
||||
@@ -0,0 +1,302 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.modules.mes.material.entity.MesMaterial;
|
||||
import org.jeecg.modules.mes.material.entity.MesMixerMaterial;
|
||||
import org.jeecg.modules.mes.material.entity.MesRawMaterialInspectStd;
|
||||
import org.jeecg.modules.mes.material.entity.MesRawMaterialInspectStdLine;
|
||||
import org.jeecg.modules.mes.material.mapper.MesMaterialMapper;
|
||||
import org.jeecg.modules.mes.material.mapper.MesMixerMaterialMapper;
|
||||
import org.jeecg.modules.mes.material.mapper.MesRawMaterialInspectStdLineMapper;
|
||||
import org.jeecg.modules.mes.material.mapper.MesRawMaterialInspectStdMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialCard;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecord;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecordLine;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRawMaterialInspectRecordLineMapper;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRawMaterialInspectRecordMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRawMaterialCardService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRawMaterialInspectRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MesXslRawMaterialInspectRecordServiceImpl
|
||||
extends ServiceImpl<MesXslRawMaterialInspectRecordMapper, MesXslRawMaterialInspectRecord>
|
||||
implements IMesXslRawMaterialInspectRecordService {
|
||||
|
||||
private static final String CARD_TEST_RESULT_UNTESTED = "0";
|
||||
private static final String CARD_TEST_RESULT_PASS = "1";
|
||||
private static final String CARD_TEST_RESULT_FAIL = "2";
|
||||
private static final String STATUS_PENDING = "0";
|
||||
private static final String STATUS_PASS = "1";
|
||||
private static final String STATUS_FAIL = "2";
|
||||
|
||||
@Autowired private IMesXslRawMaterialCardService rawMaterialCardService;
|
||||
@Autowired private MesXslRawMaterialInspectRecordLineMapper recordLineMapper;
|
||||
@Autowired private MesMaterialMapper mesMaterialMapper;
|
||||
@Autowired private MesMixerMaterialMapper mesMixerMaterialMapper;
|
||||
@Autowired private MesRawMaterialInspectStdMapper inspectStdMapper;
|
||||
@Autowired private MesRawMaterialInspectStdLineMapper inspectStdLineMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public MesXslRawMaterialInspectRecord createByRawMaterialCardId(String rawMaterialCardId) {
|
||||
MesXslRawMaterialCard card = rawMaterialCardService.getById(rawMaterialCardId);
|
||||
if (card == null) {
|
||||
throw new JeecgBootException("未找到原材料卡片");
|
||||
}
|
||||
long pendingCount =
|
||||
this.lambdaQuery()
|
||||
.eq(MesXslRawMaterialInspectRecord::getRawMaterialCardId, rawMaterialCardId)
|
||||
.eq(MesXslRawMaterialInspectRecord::getInspectStatus, STATUS_PENDING)
|
||||
.count();
|
||||
if (pendingCount > 0) {
|
||||
throw new JeecgBootException("该原材料卡片已存在待检送检记录,不能重复送检");
|
||||
}
|
||||
String cardTestResult = normalize(card.getTestResult());
|
||||
if (StringUtils.isNotBlank(cardTestResult) && !CARD_TEST_RESULT_UNTESTED.equals(cardTestResult)) {
|
||||
throw new JeecgBootException("仅未检状态的原材料卡片允许送检");
|
||||
}
|
||||
MesXslRawMaterialInspectRecord entity = new MesXslRawMaterialInspectRecord();
|
||||
entity.setRawMaterialCardId(card.getId());
|
||||
entity.setBarcode(card.getBarcode());
|
||||
entity.setBatchNo(card.getBatchNo());
|
||||
entity.setMaterialId(card.getMaterialId());
|
||||
entity.setMaterialName(card.getMaterialName());
|
||||
entity.setInspectStatus(STATUS_PENDING);
|
||||
entity.setInspectTime(new Date());
|
||||
this.save(entity);
|
||||
// 送检后将卡片检测结果置为待检
|
||||
MesXslRawMaterialCard updateCard = new MesXslRawMaterialCard();
|
||||
updateCard.setId(card.getId());
|
||||
updateCard.setTestResult(CARD_TEST_RESULT_UNTESTED);
|
||||
rawMaterialCardService.updateById(updateCard);
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MesXslRawMaterialInspectRecordLine> selectLinesByRecordId(String recordId) {
|
||||
return recordLineMapper.selectList(
|
||||
new LambdaQueryWrapper<MesXslRawMaterialInspectRecordLine>()
|
||||
.eq(MesXslRawMaterialInspectRecordLine::getRecordId, recordId)
|
||||
.orderByAsc(MesXslRawMaterialInspectRecordLine::getSortNo));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<MesXslRawMaterialInspectRecordLine> prepareResultEntryLines(String recordId) {
|
||||
MesXslRawMaterialInspectRecord record = this.getById(recordId);
|
||||
if (record == null) {
|
||||
throw new JeecgBootException("送检记录不存在");
|
||||
}
|
||||
List<MesXslRawMaterialInspectRecordLine> current = selectLinesByRecordId(recordId);
|
||||
if (!current.isEmpty()) {
|
||||
return current;
|
||||
}
|
||||
|
||||
MesRawMaterialInspectStd std = resolveEnableInspectStd(record.getMaterialId(), record.getMaterialName());
|
||||
if (std == null) {
|
||||
throw new JeecgBootException("未找到已启用的原材料检验标准,请先维护并启用检验标准");
|
||||
}
|
||||
List<MesRawMaterialInspectStdLine> stdLines =
|
||||
inspectStdLineMapper.selectList(
|
||||
new LambdaQueryWrapper<MesRawMaterialInspectStdLine>()
|
||||
.eq(MesRawMaterialInspectStdLine::getStdId, std.getId())
|
||||
.orderByAsc(MesRawMaterialInspectStdLine::getSortNo));
|
||||
if (stdLines.isEmpty()) {
|
||||
throw new JeecgBootException("当前检验标准未配置明细检验项目");
|
||||
}
|
||||
|
||||
int sortNo = 0;
|
||||
List<MesXslRawMaterialInspectRecordLine> out = new ArrayList<>(stdLines.size());
|
||||
for (MesRawMaterialInspectStdLine stdLine : stdLines) {
|
||||
MesXslRawMaterialInspectRecordLine line = new MesXslRawMaterialInspectRecordLine();
|
||||
line.setRecordId(recordId);
|
||||
line.setInspectStdId(std.getId());
|
||||
line.setInspectItemId(stdLine.getInspectItemId());
|
||||
line.setInspectItemName(stdLine.getInspectItemName());
|
||||
line.setAllowMin(stdLine.getAllowMin());
|
||||
line.setIncludeMinFlag(stdLine.getIncludeMinFlag() == null ? 0 : stdLine.getIncludeMinFlag());
|
||||
line.setAllowMax(stdLine.getAllowMax());
|
||||
line.setIncludeMaxFlag(stdLine.getIncludeMaxFlag() == null ? 0 : stdLine.getIncludeMaxFlag());
|
||||
line.setPassFlag(STATUS_PENDING);
|
||||
line.setSortNo(sortNo++);
|
||||
recordLineMapper.insert(line);
|
||||
out.add(line);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveInspectResult(String recordId, List<MesXslRawMaterialInspectRecordLine> lineList) {
|
||||
MesXslRawMaterialInspectRecord record = this.getById(recordId);
|
||||
if (record == null) {
|
||||
throw new JeecgBootException("送检记录不存在");
|
||||
}
|
||||
if (lineList == null || lineList.isEmpty()) {
|
||||
throw new JeecgBootException("请至少录入一条检验结果");
|
||||
}
|
||||
|
||||
boolean allPass = true;
|
||||
for (MesXslRawMaterialInspectRecordLine line : lineList) {
|
||||
if (StringUtils.isBlank(line.getId())) {
|
||||
throw new JeecgBootException("明细ID不能为空,请刷新后重试");
|
||||
}
|
||||
MesXslRawMaterialInspectRecordLine dbLine = recordLineMapper.selectById(line.getId());
|
||||
if (dbLine == null || !recordId.equals(dbLine.getRecordId())) {
|
||||
throw new JeecgBootException("明细不存在或不属于当前送检记录");
|
||||
}
|
||||
String passFlag =
|
||||
evaluatePassFlag(
|
||||
line.getInspectValue(),
|
||||
dbLine.getAllowMin(),
|
||||
dbLine.getIncludeMinFlag(),
|
||||
dbLine.getAllowMax(),
|
||||
dbLine.getIncludeMaxFlag());
|
||||
dbLine.setInspectValue(line.getInspectValue());
|
||||
dbLine.setPassFlag(passFlag);
|
||||
recordLineMapper.updateById(dbLine);
|
||||
if (!STATUS_PASS.equals(passFlag)) {
|
||||
allPass = false;
|
||||
}
|
||||
}
|
||||
|
||||
record.setInspectStatus(allPass ? STATUS_PASS : STATUS_FAIL);
|
||||
record.setResultTime(new Date());
|
||||
this.updateById(record);
|
||||
// 判定完成后回写原材料卡片检测结果
|
||||
if (StringUtils.isNotBlank(record.getRawMaterialCardId())) {
|
||||
MesXslRawMaterialCard card = new MesXslRawMaterialCard();
|
||||
card.setId(record.getRawMaterialCardId());
|
||||
card.setTestResult(allPass ? CARD_TEST_RESULT_PASS : CARD_TEST_RESULT_FAIL);
|
||||
rawMaterialCardService.updateById(card);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String evaluatePassFlag(
|
||||
BigDecimal inspectValue,
|
||||
BigDecimal allowMin,
|
||||
Integer includeMinFlag,
|
||||
BigDecimal allowMax,
|
||||
Integer includeMaxFlag) {
|
||||
if (inspectValue == null) {
|
||||
return STATUS_FAIL;
|
||||
}
|
||||
if (allowMin != null) {
|
||||
int cmpMin = inspectValue.compareTo(allowMin);
|
||||
boolean includeMin = includeMinFlag != null && includeMinFlag == 1;
|
||||
if (includeMin ? cmpMin < 0 : cmpMin <= 0) {
|
||||
return STATUS_FAIL;
|
||||
}
|
||||
}
|
||||
if (allowMax != null) {
|
||||
int cmpMax = inspectValue.compareTo(allowMax);
|
||||
boolean includeMax = includeMaxFlag != null && includeMaxFlag == 1;
|
||||
if (includeMax ? cmpMax > 0 : cmpMax >= 0) {
|
||||
return STATUS_FAIL;
|
||||
}
|
||||
}
|
||||
return STATUS_PASS;
|
||||
}
|
||||
|
||||
private MesRawMaterialInspectStd resolveEnableInspectStd(String materialId, String materialName) {
|
||||
String normalizedMaterialId = normalize(materialId);
|
||||
if (StringUtils.isBlank(normalizedMaterialId)) {
|
||||
log.warn("送检标准匹配失败:送检记录物料ID为空,materialName={}", materialName);
|
||||
return null;
|
||||
}
|
||||
List<MesRawMaterialInspectStd> allStds =
|
||||
inspectStdMapper.selectList(
|
||||
new LambdaQueryWrapper<MesRawMaterialInspectStd>()
|
||||
.and(
|
||||
w ->
|
||||
w.eq(MesRawMaterialInspectStd::getDelFlag, 0)
|
||||
.or()
|
||||
.isNull(MesRawMaterialInspectStd::getDelFlag))
|
||||
.orderByDesc(MesRawMaterialInspectStd::getEnableFlag)
|
||||
.orderByDesc(MesRawMaterialInspectStd::getEffectiveDate)
|
||||
.orderByDesc(MesRawMaterialInspectStd::getCreateTime));
|
||||
if (allStds.isEmpty()) {
|
||||
log.warn("送检标准匹配失败:没有可用检验标准,materialId={}", materialId);
|
||||
return null;
|
||||
}
|
||||
|
||||
String mappedMixerMaterialId = mapMaterialIdToMixerMaterialId(normalizedMaterialId);
|
||||
|
||||
// 第一优先级:仅在启用标准中匹配
|
||||
MesRawMaterialInspectStd matchedEnabled = matchByMaterialId(allStds, normalizedMaterialId, mappedMixerMaterialId, true);
|
||||
if (matchedEnabled != null) {
|
||||
return matchedEnabled;
|
||||
}
|
||||
|
||||
// 第二优先级:若未启用标准,则回退到同物料最新标准(避免业务无法录入)
|
||||
MesRawMaterialInspectStd matchedAny = matchByMaterialId(allStds, normalizedMaterialId, mappedMixerMaterialId, false);
|
||||
if (matchedAny != null) {
|
||||
log.warn(
|
||||
"送检标准未找到启用版本,已回退到未启用标准 stdId={}, materialId={}, mappedMixerMaterialId={}, enableFlag={}",
|
||||
matchedAny.getId(),
|
||||
materialId,
|
||||
mappedMixerMaterialId,
|
||||
matchedAny.getEnableFlag());
|
||||
return matchedAny;
|
||||
}
|
||||
|
||||
log.warn(
|
||||
"送检标准匹配失败(仅物料ID匹配),materialId={}, mappedMixerMaterialId={}, materialName={}, stdCount={}",
|
||||
materialId,
|
||||
mappedMixerMaterialId,
|
||||
materialName,
|
||||
allStds.size());
|
||||
return null;
|
||||
}
|
||||
|
||||
private MesRawMaterialInspectStd matchByMaterialId(
|
||||
List<MesRawMaterialInspectStd> standards,
|
||||
String normalizedMaterialId,
|
||||
String mappedMixerMaterialId,
|
||||
boolean onlyEnabled) {
|
||||
for (MesRawMaterialInspectStd std : standards) {
|
||||
if (onlyEnabled && !Objects.equals(std.getEnableFlag(), 1)) {
|
||||
continue;
|
||||
}
|
||||
String stdMaterialId = normalize(std.getMixerMaterialId());
|
||||
if (Objects.equals(normalizedMaterialId, stdMaterialId)) {
|
||||
return std;
|
||||
}
|
||||
if (StringUtils.isNotBlank(mappedMixerMaterialId) && Objects.equals(mappedMixerMaterialId, stdMaterialId)) {
|
||||
return std;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String mapMaterialIdToMixerMaterialId(String materialId) {
|
||||
MesMaterial material = mesMaterialMapper.selectById(materialId);
|
||||
if (material == null || StringUtils.isBlank(material.getMaterialCode())) {
|
||||
return null;
|
||||
}
|
||||
MesMixerMaterial mixerMaterial =
|
||||
mesMixerMaterialMapper.selectOne(
|
||||
new LambdaQueryWrapper<MesMixerMaterial>()
|
||||
.eq(MesMixerMaterial::getMaterialCode, StringUtils.trimToEmpty(material.getMaterialCode()))
|
||||
.last("LIMIT 1"));
|
||||
return mixerMaterial == null ? null : normalize(mixerMaterial.getId());
|
||||
}
|
||||
|
||||
private String normalize(String value) {
|
||||
return StringUtils.trimToEmpty(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
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.MesXslSparePart;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslSparePartMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslSparePartService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MesXslSparePartServiceImpl extends ServiceImpl<MesXslSparePartMapper, MesXslSparePart> implements IMesXslSparePartService {
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】备品件名称同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||
@Override
|
||||
public boolean isSparePartNameDuplicated(String sparePartName, String excludeId, MesXslSparePart context) {
|
||||
if (oConvertUtils.isEmpty(sparePartName)) {
|
||||
return false;
|
||||
}
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
LambdaQueryWrapper<MesXslSparePart> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslSparePart::getSparePartName, sparePartName.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslSparePart::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslSparePart::getDelFlag));
|
||||
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||
w.ne(MesXslSparePart::getId, excludeId);
|
||||
}
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslSparePart::getTenantId, tenantId);
|
||||
}
|
||||
return this.count(w) > 0;
|
||||
}
|
||||
|
||||
private static Integer resolveTenantId(MesXslSparePart 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:20260515 for:【MES】备品件名称同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
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.MesXslSparePartsCategory;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslSparePartsCategoryMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslSparePartsCategoryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MesXslSparePartsCategoryServiceImpl extends ServiceImpl<MesXslSparePartsCategoryMapper, MesXslSparePartsCategory>
|
||||
implements IMesXslSparePartsCategoryService {
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】备品件类别名称同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||
@Override
|
||||
public boolean isCategoryNameDuplicated(String categoryName, String excludeId, MesXslSparePartsCategory context) {
|
||||
if (oConvertUtils.isEmpty(categoryName)) {
|
||||
return false;
|
||||
}
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
LambdaQueryWrapper<MesXslSparePartsCategory> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslSparePartsCategory::getCategoryName, categoryName.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslSparePartsCategory::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslSparePartsCategory::getDelFlag));
|
||||
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||
w.ne(MesXslSparePartsCategory::getId, excludeId);
|
||||
}
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslSparePartsCategory::getTenantId, tenantId);
|
||||
}
|
||||
return this.count(w) > 0;
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】备品件类别按名称+租户查询单条,供备品件信息导入解析-----------
|
||||
@Override
|
||||
public MesXslSparePartsCategory findOneActiveByCategoryNameAndTenant(String categoryName, Integer tenantId) {
|
||||
if (oConvertUtils.isEmpty(categoryName)) {
|
||||
return null;
|
||||
}
|
||||
LambdaQueryWrapper<MesXslSparePartsCategory> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslSparePartsCategory::getCategoryName, categoryName.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslSparePartsCategory::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslSparePartsCategory::getDelFlag));
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslSparePartsCategory::getTenantId, tenantId);
|
||||
}
|
||||
w.last("LIMIT 1");
|
||||
return this.getOne(w, false);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】备品件类别按名称+租户查询单条,供备品件信息导入解析-----------
|
||||
|
||||
private static Integer resolveTenantId(MesXslSparePartsCategory 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:20260515 for:【MES】备品件类别名称同租户不可重复;仅统计未删除(del_flag=0 或 null)-----------
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
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.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslUnit;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslUnitMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslUnitService;
|
||||
@@ -18,4 +20,20 @@ public class MesXslUnitServiceImpl extends ServiceImpl<MesXslUnitMapper, MesXslU
|
||||
public List<String> listDescendantCategoryIds(String rootId) {
|
||||
return baseMapper.listDescendantCategoryIds(rootId);
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260515 for:【MES】单位按编码+租户查询单条,供备品件信息导入解析-----------
|
||||
@Override
|
||||
public MesXslUnit findOneActiveByUnitCodeAndTenant(String unitCode, Integer tenantId) {
|
||||
if (oConvertUtils.isEmpty(unitCode)) {
|
||||
return null;
|
||||
}
|
||||
LambdaQueryWrapper<MesXslUnit> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslUnit::getUnitCode, unitCode.trim());
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslUnit::getTenantId, tenantId);
|
||||
}
|
||||
w.last("LIMIT 1");
|
||||
return this.getOne(w, false);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260515 for:【MES】单位按编码+租户查询单条,供备品件信息导入解析-----------
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.jeecg.modules.xslmes.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialInspectRecord;
|
||||
|
||||
/** 原材料送检记录主子表保存页。 */
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MesXslRawMaterialInspectRecordPage extends MesXslRawMaterialInspectRecord {}
|
||||
255
jeecg-boot/jeecg-module-system/jeecg-system-biz/docs/代码修改日志
Normal file
255
jeecg-boot/jeecg-module-system/jeecg-system-biz/docs/代码修改日志
Normal file
@@ -0,0 +1,255 @@
|
||||
-- author:jiangxh---date:20260513--for: 【MES】MES基础资料下新增工序管理(mes_process_operation,与原材料检验项目同级菜单) ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_53__mes_process_operation.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mes/material/entity/MesProcessOperation.java
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mes/material/mapper/MesProcessOperationMapper.java
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mes/material/service/IMesProcessOperationService.java
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mes/material/service/impl/MesProcessOperationServiceImpl.java
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mes/material/controller/MesProcessOperationController.java
|
||||
jeecg-boot/db/mes-process-operation.sql
|
||||
jeecgboot-vue3/src/views/mes/processoperation/index.vue
|
||||
jeecgboot-vue3/src/views/mes/material/MesProcessOperationList.vue
|
||||
jeecgboot-vue3/src/views/mes/material/MesProcessOperation.data.ts
|
||||
jeecgboot-vue3/src/views/mes/material/MesProcessOperation.api.ts
|
||||
jeecgboot-vue3/src/views/mes/material/modules/MesProcessOperationModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260513--for: 【MES】补全工序管理后端/前端/Flyway 源码文件 ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_53__mes_process_operation.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mes/material/entity/MesProcessOperation.java
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mes/material/mapper/MesProcessOperationMapper.java
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mes/material/service/IMesProcessOperationService.java
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mes/material/service/impl/MesProcessOperationServiceImpl.java
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mes/material/controller/MesProcessOperationController.java
|
||||
jeecg-boot/db/mes-process-operation.sql
|
||||
jeecgboot-vue3/src/views/mes/processoperation/index.vue
|
||||
jeecgboot-vue3/src/views/mes/material/MesProcessOperationList.vue
|
||||
jeecgboot-vue3/src/views/mes/material/MesProcessOperation.data.ts
|
||||
jeecgboot-vue3/src/views/mes/material/MesProcessOperation.api.ts
|
||||
jeecgboot-vue3/src/views/mes/material/modules/MesProcessOperationModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260513--for: 【MES】工序管理-工序编码同租户下不可重复 ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mes/material/service/IMesProcessOperationService.java
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mes/material/service/impl/MesProcessOperationServiceImpl.java
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mes/material/controller/MesProcessOperationController.java
|
||||
|
||||
-- author:jiangxh---date:20260514--for: 【MES】工序管理迁至 jeecg-module-xslmes,前端 xslmes/mesXslProcessOperation,菜单挂 MES基础资料、租户1002 授权脚本,Flyway V3.9.2_54 同步路由组件 ---
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslProcessOperation.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslProcessOperationMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslProcessOperationService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslProcessOperationServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslProcessOperationController.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/package-info.java
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_54__mes_process_operation_menu_xslmes_mes_base.sql
|
||||
jeecg-boot/db/mes-process-operation-menu-permission.sql
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslProcessOperation/MesXslProcessOperationList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslProcessOperation/MesXslProcessOperation.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslProcessOperation/MesXslProcessOperation.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslProcessOperation/components/MesXslProcessOperationModal.vue
|
||||
jeecgboot-vue3/src/views/mes/processoperation/index.vue
|
||||
|
||||
-- author:jiangxh---date:20260514--for: 【MES】mes-process-operation-menu-permission.sql 增补建表段,避免只执行菜单脚本未建表 ---
|
||||
jeecg-boot/db/mes-process-operation-menu-permission.sql
|
||||
jeecg-boot/db/mes-process-operation.sql
|
||||
|
||||
-- author:jiangxh---date:20260514--for: 【MES】工序编码唯一:排除已删除、表单异步校验接口、Excel 导入校验 ---
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslProcessOperationServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslProcessOperationService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslProcessOperationController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslProcessOperation/MesXslProcessOperation.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslProcessOperation/MesXslProcessOperation.data.ts
|
||||
|
||||
-- author:jiangxh---date:20260514--for: 【MES】MES基础资料下新增设备类别(mes_xsl_equipment_category,关联工序、点检/保养字典、类别名称同租户唯一) ---
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslEquipmentCategory.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslEquipmentCategoryMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslEquipmentCategoryService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslEquipmentCategoryServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipmentCategoryController.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/package-info.java
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_55__mes_xsl_equipment_category.sql
|
||||
jeecg-boot/db/mes-xsl-equipment-category-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-equipment-category.sql
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentCategory/MesXslEquipmentCategoryList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentCategory/MesXslEquipmentCategory.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentCategory/MesXslEquipmentCategory.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentCategory/components/MesXslEquipmentCategoryModal.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260514--for: 【MES】MES基础资料下新增设备类型(mes_xsl_equipment_type,关联工序与设备类别、类型名称同租户唯一) ---
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslEquipmentType.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslEquipmentTypeMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslEquipmentTypeService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslEquipmentTypeServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipmentTypeController.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslEquipmentCategoryService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslEquipmentCategoryServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/package-info.java
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_56__mes_xsl_equipment_type.sql
|
||||
jeecg-boot/db/mes-xsl-equipment-type-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-equipment-type.sql
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentType/MesXslEquipmentTypeList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentType/MesXslEquipmentType.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentType/MesXslEquipmentType.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentType/components/MesXslEquipmentTypeModal.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentType/components/MesXslEquipmentCategorySelectModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260515--for: 【MES】MES基础资料下新增设备部位(mes_xsl_equipment_part,关联设备类别、部位代码同租户唯一、是否启用xslmes_unit_status) ---
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslEquipmentPart.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslEquipmentPartMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslEquipmentPartService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslEquipmentPartServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipmentPartController.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/package-info.java
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_57__mes_xsl_equipment_part.sql
|
||||
jeecg-boot/db/mes-xsl-equipment-part-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-equipment-part.sql
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentPart/MesXslEquipmentPartList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentPart/MesXslEquipmentPart.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentPart/MesXslEquipmentPart.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentPart/components/MesXslEquipmentPartModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260515--for: 【MES】设备部位:部位代码不能重复(文案与保存/导入顺序、选类别后重验代码) ---
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipmentPartController.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslEquipmentPartService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslEquipmentPartServiceImpl.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentPart/MesXslEquipmentPart.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentPart/components/MesXslEquipmentPartModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260515--for: 【MES】设备部位:明确部位代码仅同租户全局唯一(不按设备类别);去掉选类别后重验部位代码 ---
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentPart/MesXslEquipmentPart.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentPart/components/MesXslEquipmentPartModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260515--for: 【MES】设备部位:部门名称字段改为部位名称(dept_name->part_name,实体partName) ---
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslEquipmentPart.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipmentPartController.java
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_58__mes_xsl_equipment_part_dept_name_to_part_name.sql
|
||||
jeecg-boot/db/mes-xsl-equipment-part.sql
|
||||
jeecg-boot/db/mes-xsl-equipment-part-menu-permission.sql
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentPart/MesXslEquipmentPart.data.ts
|
||||
|
||||
-- author:jiangxh---date:20260515--for: 【MES】新增设备小部位(mes_xsl_equipment_sub_part,挂 MES 基础资料,类别/大部位冗余、小部位代码同租户唯一) ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_59__mes_xsl_equipment_sub_part.sql
|
||||
jeecg-boot/db/mes-xsl-equipment-sub-part-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-equipment-sub-part.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslEquipmentSubPart.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslEquipmentSubPartMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslEquipmentSubPartService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslEquipmentSubPartServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipmentSubPartController.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslEquipmentPartService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslEquipmentPartServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/package-info.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentSubPart/MesXslEquipmentSubPartList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentSubPart/MesXslEquipmentSubPart.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentSubPart/MesXslEquipmentSubPart.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentSubPart/components/MesXslEquipmentSubPartModal.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentSubPart/components/MesXslEquipmentPartSelectModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260515--for: 【MES】设备小部位菜单挂到 MES XSL(XSLMES管理)父级下 ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_60__mes_xsl_equipment_sub_part_menu_xslmes_root.sql
|
||||
jeecg-boot/db/mes-xsl-equipment-sub-part-menu-permission.sql
|
||||
|
||||
-- author:jiangxh---date:20260515--for: 【MES】新增备品件类别(mes_xsl_spare_parts_category,挂 MES 基础资料,类别名称同租户唯一) ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_61__mes_xsl_spare_parts_category.sql
|
||||
jeecg-boot/db/mes-xsl-spare-parts-category-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-spare-parts-category.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslSparePartsCategory.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslSparePartsCategoryMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslSparePartsCategoryService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslSparePartsCategoryServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslSparePartsCategoryController.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/package-info.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslSparePartsCategory/MesXslSparePartsCategoryList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslSparePartsCategory/MesXslSparePartsCategory.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslSparePartsCategory/MesXslSparePartsCategory.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslSparePartsCategory/components/MesXslSparePartsCategoryModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260515--for: 【MES】新增备品件信息(mes_xsl_spare_part,挂 MES 基础资料,名称同租户唯一、类别与单位冗余、库存上下限) ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_62__mes_xsl_spare_part.sql
|
||||
jeecg-boot/db/mes-xsl-spare-part-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-spare-part.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslSparePart.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslSparePartMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslSparePartService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslSparePartServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslSparePartController.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslSparePartsCategoryService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslSparePartsCategoryServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslUnitService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslUnitServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/package-info.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslSparePartsCategory/components/MesXslSparePartsCategorySelectModal.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslSparePart/MesXslSparePartList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslSparePart/MesXslSparePart.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslSparePart/MesXslSparePart.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslSparePart/components/MesXslSparePartModal.vue
|
||||
-- author:jiangxh---date:20260515--for: 【MES】厂家信息(厂家类别字典、名称同租户唯一、是否有效) ---
|
||||
jeecg-boot/db/mes-xsl-manufacturer-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-manufacturer.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_63__mes_xsl_manufacturer.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslManufacturer.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslManufacturerMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslManufacturerService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslManufacturerServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslManufacturerController.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/package-info.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslManufacturer/MesXslManufacturerList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslManufacturer/MesXslManufacturer.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslManufacturer/MesXslManufacturer.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslManufacturer/components/MesXslManufacturerModal.vue
|
||||
-- author:jiangxh---date:20260518--for: 【MES】停机主类型(所属工序、停机类型唯一、显示顺序、区分颜色、是否启用) ---
|
||||
jeecg-boot/db/mes-xsl-downtime-main-type-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-downtime-main-type.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_64__mes_xsl_downtime_main_type.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslDowntimeMainType.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslDowntimeMainTypeMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslDowntimeMainTypeService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslDowntimeMainTypeServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeMainTypeController.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/package-info.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainTypeList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainType.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainType.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/components/MesXslDowntimeMainTypeModal.vue
|
||||
-- author:jiangxh---date:20260518--for: 【MES】停机类型(工序+主类型+停机类型、责任区分、故障等级、停机维修、色卡) ---
|
||||
jeecg-boot/db/mes-xsl-downtime-type-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-downtime-type.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_65__mes_xsl_downtime_type.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslDowntimeType.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslDowntimeTypeMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslDowntimeTypeService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslDowntimeTypeServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeTypeController.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/package-info.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeTypeList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeType.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeType.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/components/MesXslDowntimeTypeModal.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/components/MesXslDowntimeMainTypeSelectModal.vue
|
||||
-- author:jiangxh---date:20260518--for: 【MES】停机类型责任区分、故障等级改为手填(非字典) ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_66__mes_xsl_downtime_type_text_fields.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslDowntimeType.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeTypeController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeType.data.ts
|
||||
jeecg-boot/db/mes-xsl-downtime-type.sql
|
||||
jeecg-boot/db/mes-xsl-downtime-type-menu-permission.sql
|
||||
-- author:jiangxh---date:20260518--for: 【MES】停机主类型/停机类型/厂家信息业务字符字段统一 varchar(500) ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_67__mes_xsl_varchar500_biz_fields.sql
|
||||
jeecg-boot/db/mes-xsl-downtime-main-type.sql
|
||||
jeecg-boot/db/mes-xsl-downtime-main-type-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-manufacturer.sql
|
||||
jeecg-boot/db/mes-xsl-manufacturer-menu-permission.sql
|
||||
-- author:jiangxh---date:20260518--for: 【MES】删除停机类型废弃字典(责任区分、故障等级改手填后) ---
|
||||
jeecg-boot/db/mes-xsl-downtime-type-remove-unused-dict.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_68__mes_xsl_downtime_remove_unused_dict.sql
|
||||
jeecg-boot/db/mes-xsl-downtime-type-menu-permission.sql
|
||||
-- author:jiangxh---date:20260518--for: 【MES】工序管理/设备类别/设备类型菜单挂 MES基础资料并修复权限树与租户授权 ---
|
||||
jeecg-boot/db/mes-xsl-move-process-equipment-menus-to-mes-base.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_69__mes_xsl_move_process_equipment_menus_to_mes_base.sql
|
||||
-- author:jiangxh---date:20260518--for: 【MES】设备类型菜单补全 INSERT(077 未建时仅 UPDATE 无效)---
|
||||
jeecg-boot/db/mes-xsl-equipment-type-menu-fix.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_70__mes_xsl_equipment_type_menu_ensure.sql
|
||||
-- author:jiangxh---date:20260518--for: 【MES】工序管理/设备类别菜单与按钮权限补全及租户授权 ---
|
||||
jeecg-boot/db/mes-xsl-process-and-category-menu-fix.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_71__mes_xsl_process_and_category_menu_ensure.sql
|
||||
jeecg-boot/db/mes-process-operation-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-equipment-category-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-move-process-equipment-menus-to-mes-base.sql
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.jeecg.modules.mes.material.constant;
|
||||
|
||||
/**
|
||||
* 原材料检验标准等 MES 物料模块的打印业务编码:与「业务打印绑定」中 biz_code、print_biz_perm_entity.perm_id 一致。
|
||||
*/
|
||||
public final class MesMaterialPrintConstants {
|
||||
|
||||
/** 原材料检验标准列表页菜单(sys_permission.id,见 Flyway V3.9.2_62) */
|
||||
public static final String RAW_MATERIAL_INSPECT_STD_MENU_PERM_ID = "1900000000000000730";
|
||||
|
||||
/** 历史或手工绑定时可能使用的语义型 biz_code(服务端 prepareNativePrint 会作为次选查询) */
|
||||
public static final String RAW_MATERIAL_INSPECT_STD_SEMANTIC_BIZ_CODE = "MES_RAW_MATERIAL_INSPECT_STD";
|
||||
|
||||
private MesMaterialPrintConstants() {}
|
||||
}
|
||||
@@ -3,22 +3,40 @@ package org.jeecg.modules.mes.material.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 com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
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.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
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.modules.mes.material.constant.MesMaterialPrintConstants;
|
||||
import org.jeecg.modules.mes.material.entity.MesRawMaterialInspectStd;
|
||||
import org.jeecg.modules.mes.material.entity.MesRawMaterialInspectStdLine;
|
||||
import org.jeecg.modules.mes.material.service.IMesRawMaterialInspectStdService;
|
||||
import org.jeecg.modules.mes.material.vo.MesRawMaterialInspectStdPage;
|
||||
import org.jeecg.modules.print.entity.PrintBizPermEntity;
|
||||
import org.jeecg.modules.print.entity.PrintBizTemplateBind;
|
||||
import org.jeecg.modules.print.entity.PrintTemplate;
|
||||
import org.jeecg.modules.print.service.IPrintBizPermEntityService;
|
||||
import org.jeecg.modules.print.service.IPrintBizTemplateBindService;
|
||||
import org.jeecg.modules.print.service.IPrintTemplateService;
|
||||
import org.jeecg.modules.print.support.PrintServerEnvironmentService;
|
||||
import org.jeecg.modules.print.support.PrintServerPdfJobService;
|
||||
import org.jeecg.modules.print.util.PrintBizDataMappingUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -31,6 +49,12 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
public class MesRawMaterialInspectStdController extends JeecgController<MesRawMaterialInspectStd, IMesRawMaterialInspectStdService> {
|
||||
|
||||
@Autowired private IMesRawMaterialInspectStdService mesRawMaterialInspectStdService;
|
||||
@Autowired private PrintServerEnvironmentService printServerEnvironmentService;
|
||||
@Autowired private PrintServerPdfJobService printServerPdfJobService;
|
||||
@Autowired private IPrintBizTemplateBindService printBizTemplateBindService;
|
||||
@Autowired private IPrintBizPermEntityService printBizPermEntityService;
|
||||
@Autowired private IPrintTemplateService printTemplateService;
|
||||
@Autowired private ObjectMapper objectMapper;
|
||||
|
||||
@GetMapping("/list")
|
||||
public Result<IPage<MesRawMaterialInspectStd>> queryPageList(
|
||||
@@ -114,6 +138,136 @@ public class MesRawMaterialInspectStdController extends JeecgController<MesRawMa
|
||||
return Result.OK(flag == 1 ? "已启用" : "已停用");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询可用打印机(与原材料卡片 {@code MesXslRawMaterialCardController#queryPrinters} 一致)。
|
||||
*/
|
||||
@Operation(summary = "MES-原材料检验标准-查询可用打印机")
|
||||
@GetMapping("/queryPrinters")
|
||||
@RequiresPermissions(
|
||||
value = {"mes:mes_raw_material_inspect_std:edit", "mes:mes_raw_material_inspect_std:exportXls"},
|
||||
logical = Logical.OR)
|
||||
public Result<Map<String, Object>> queryPrinters() {
|
||||
return Result.OK(printServerEnvironmentService.buildPrinterQueryResult());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据业务打印绑定生成模板 JSON + 映射后的 printData,供前端生成 PDF 后调用 printPdf(与原材料卡片 prepareNativePrint 一致)。
|
||||
*/
|
||||
@Operation(summary = "MES-原材料检验标准-准备原生打印数据")
|
||||
@GetMapping("/prepareNativePrint")
|
||||
@RequiresPermissions("mes:mes_raw_material_inspect_std:edit")
|
||||
public Result<Map<String, Object>> prepareNativePrint(@RequestParam(name = "id") String id) {
|
||||
try {
|
||||
MesRawMaterialInspectStd main = mesRawMaterialInspectStdService.getById(id);
|
||||
if (main == null) {
|
||||
return Result.error("未找到原材料检验标准");
|
||||
}
|
||||
PrintBizTemplateBind bind = resolveInspectStdPrintBind();
|
||||
if (bind == null) {
|
||||
return Result.error(
|
||||
"请先在「业务打印绑定」中配置原材料检验标准与打印模板;业务编码需为当前列表菜单的权限 id,或与 print_biz_perm_entity 中该业务实体一致");
|
||||
}
|
||||
PrintTemplate tpl = printTemplateService.getById(bind.getTemplateId());
|
||||
if (tpl == null) {
|
||||
return Result.error("绑定的打印模板不存在");
|
||||
}
|
||||
List<MesRawMaterialInspectStdLine> lines = mesRawMaterialInspectStdService.selectLinesByStdId(id);
|
||||
MesRawMaterialInspectStdPage pageVo = new MesRawMaterialInspectStdPage();
|
||||
BeanUtils.copyProperties(main, pageVo);
|
||||
pageVo.setLineList(lines);
|
||||
ArrayNode mapping = PrintBizDataMappingUtil.parseMappingArray(bind.getFieldMappingJson());
|
||||
JsonNode bizRoot = objectMapper.valueToTree(pageVo);
|
||||
ObjectNode printData = PrintBizDataMappingUtil.mapBizToPrintData(bizRoot, mapping, tpl.getTemplateJson());
|
||||
PrintBizDataMappingUtil.fillMissingDataBindingParamKeys(printData, tpl.getTemplateJson());
|
||||
Map<String, Object> out = new HashMap<>(8);
|
||||
out.put("stdId", main.getId());
|
||||
out.put("templateCode", bind.getTemplateCode());
|
||||
out.put("templateJson", tpl.getTemplateJson());
|
||||
out.put("paperWidthMm", tpl.getPaperWidthMm());
|
||||
out.put("paperHeightMm", tpl.getPaperHeightMm());
|
||||
out.put("paperOrientation", tpl.getPaperOrientation());
|
||||
out.put("printData", objectMapper.convertValue(printData, Map.class));
|
||||
return Result.OK(out);
|
||||
} catch (Exception e) {
|
||||
log.error("原材料检验标准准备打印数据失败 id={}", id, e);
|
||||
return Result.error("准备打印数据失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将前端生成的 PDF Base64 提交到服务器打印机(与原材料卡片 printPdf 一致)。
|
||||
*/
|
||||
@AutoLog(value = "MES-原材料检验标准-PDF后端打印")
|
||||
@Operation(summary = "MES-原材料检验标准-PDF后端打印")
|
||||
@PostMapping("/printPdf")
|
||||
@RequiresPermissions("mes:mes_raw_material_inspect_std:edit")
|
||||
public Result<String> printPdf(@RequestBody Map<String, Object> body) {
|
||||
String sid = String.valueOf(body.getOrDefault("id", "")).trim();
|
||||
String printerName = String.valueOf(body.getOrDefault("printerName", "")).trim();
|
||||
String pdfBase64 = String.valueOf(body.getOrDefault("pdfBase64", "")).trim();
|
||||
String fileName = String.valueOf(body.getOrDefault("fileName", "")).trim();
|
||||
if (StringUtils.isBlank(sid)) {
|
||||
return Result.error("id 不能为空");
|
||||
}
|
||||
MesRawMaterialInspectStd std = mesRawMaterialInspectStdService.getById(sid);
|
||||
if (std == null) {
|
||||
return Result.error("未找到原材料检验标准");
|
||||
}
|
||||
String prefix =
|
||||
StringUtils.isNotBlank(std.getStandardNo()) ? std.getStandardNo() : std.getId();
|
||||
String fn =
|
||||
StringUtils.isNotBlank(fileName) ? fileName : ("原材料检验标准-" + prefix + ".pdf");
|
||||
return printServerPdfJobService.submitPdfBase64(
|
||||
printerName, pdfBase64, fn, "RAW_INSPECT_STD_" + prefix);
|
||||
}
|
||||
|
||||
private PrintBizTemplateBind resolveInspectStdPrintBind() {
|
||||
PrintBizTemplateBind bind =
|
||||
printBizTemplateBindService.getByBizCode(MesMaterialPrintConstants.RAW_MATERIAL_INSPECT_STD_MENU_PERM_ID);
|
||||
if (bind != null) {
|
||||
return bind;
|
||||
}
|
||||
bind =
|
||||
printBizTemplateBindService.getByBizCode(MesMaterialPrintConstants.RAW_MATERIAL_INSPECT_STD_SEMANTIC_BIZ_CODE);
|
||||
if (bind != null) {
|
||||
return bind;
|
||||
}
|
||||
// 不同环境菜单 id 不一致:按 print_biz_perm_entity 中指向本实体的任意 perm_id 解析绑定
|
||||
String entityFqn = MesRawMaterialInspectStd.class.getName();
|
||||
List<PrintBizPermEntity> permRows =
|
||||
printBizPermEntityService.lambdaQuery().eq(PrintBizPermEntity::getEntityClass, entityFqn).list();
|
||||
for (PrintBizPermEntity row : permRows) {
|
||||
if (StringUtils.isBlank(row.getPermId())) {
|
||||
continue;
|
||||
}
|
||||
bind = printBizTemplateBindService.getByBizCode(row.getPermId());
|
||||
if (bind != null) {
|
||||
return bind;
|
||||
}
|
||||
}
|
||||
// 最后兜底:业务名称与绑定页一致(避免 perm 映射表未同步时仍找不到)
|
||||
List<PrintBizTemplateBind> byName =
|
||||
printBizTemplateBindService
|
||||
.lambdaQuery()
|
||||
.eq(PrintBizTemplateBind::getBizName, "原材料检验标准")
|
||||
.orderByDesc(PrintBizTemplateBind::getCreateTime)
|
||||
.last("LIMIT 8")
|
||||
.list();
|
||||
if (byName.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
if (byName.size() == 1) {
|
||||
return byName.get(0);
|
||||
}
|
||||
for (PrintBizTemplateBind b : byName) {
|
||||
PrintBizPermEntity pe = printBizPermEntityService.getByPermId(b.getBizCode());
|
||||
if (pe != null && entityFqn.equals(StringUtils.trimToEmpty(pe.getEntityClass()))) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return byName.get(0);
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_raw_material_inspect_std:exportXls")
|
||||
@RequestMapping("/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesRawMaterialInspectStd model) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user