10 Commits

99 changed files with 6595 additions and 20 deletions

2
.vscode/launch.json vendored
View File

@@ -8,7 +8,7 @@
"mainClass": "org.jeecg.JeecgSystemApplication",
"projectName": "jeecg-system-start",
"cwd": "${workspaceFolder}/jeecg-boot/jeecg-module-system/jeecg-system-start",
"vmArgs": "-Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8"
"vmArgs": "-Dfile.encoding=UTF-8 -Dspring.main.banner-mode=log -Dspring.banner.charset=UTF-8 -Dlogging.charset.console=GBK"
}
]
}

View File

@@ -27,5 +27,12 @@
"jeecg-boot-platform"
],
"java.debug.settings.console": "integratedTerminal",
"java.debug.settings.vmArgs": "-Dspring.main.banner-mode=log -Dspring.banner.charset=UTF-8 -Dlogging.charset.console=GBK"
"java.debug.settings.vmArgs": "-Dfile.encoding=UTF-8 -Dspring.main.banner-mode=log -Dspring.banner.charset=UTF-8 -Dlogging.charset.console=GBK",
"terminal.integrated.defaultProfile.windows": "PowerShell",
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"args": ["-NoExit", "-Command", "chcp 936 | Out-Null"]
}
}
}

View File

@@ -0,0 +1,92 @@
-- 日罐物料对应信息菜单与权限挂到MES密炼工程目录
SET NAMES utf8mb4;
SET @mixer_parent_id = (
SELECT id
FROM sys_permission
WHERE name = 'MES密炼工程' AND menu_type = 0 AND del_flag = 0
ORDER BY create_time ASC
LIMIT 1
);
SET @mixer_parent_id = IFNULL(@mixer_parent_id, (
SELECT id
FROM sys_permission
WHERE url = '/mes' AND menu_type = 0 AND del_flag = 0
ORDER BY create_time ASC
LIMIT 1
));
SET @mixer_parent_id = IFNULL(@mixer_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 (
'1860000000000099311', @mixer_parent_id, '日罐物料对应信息',
'/mes/daytankmaterialmapinfo',
'mes/daytankmaterialmapinfo/index',
'MesXslDayTankMaterialMapList', 1, NULL, '1', 31,
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
('1860000000000099312', '1860000000000099311', '新增', 2, 'xslmes:mes_xsl_day_tank_material_map:add', '1', '1', 0, 'admin', NOW()),
('1860000000000099313', '1860000000000099311', '编辑', 2, 'xslmes:mes_xsl_day_tank_material_map:edit', '1', '1', 0, 'admin', NOW()),
('1860000000000099314', '1860000000000099311', '删除', 2, 'xslmes:mes_xsl_day_tank_material_map:delete', '1', '1', 0, 'admin', NOW()),
('1860000000000099315', '1860000000000099311', '批量删除', 2, 'xslmes:mes_xsl_day_tank_material_map:deleteBatch', '1', '1', 0, 'admin', NOW()),
('1860000000000099316', '1860000000000099311', '导出', 2, 'xslmes:mes_xsl_day_tank_material_map: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 (
'1860000000000099311',
'1860000000000099312', '1860000000000099313', '1860000000000099314', '1860000000000099315', '1860000000000099316'
)
AND NOT EXISTS (
SELECT 1
FROM sys_role_permission rp
WHERE rp.role_id = 'f6817f48af4fb3af11b9e8bf182f618b'
AND rp.permission_id = p.id
);
-- 强制修复确保菜单路由与组件路径正确避免历史错误路径导致查看组件引用是否正确
UPDATE sys_permission
SET
parent_id = @mixer_parent_id,
url = '/mes/daytankmaterialmapinfo',
component = 'mes/daytankmaterialmapinfo/index',
component_name = 'MesXslDayTankMaterialMapList',
menu_type = 1,
is_route = 1,
is_leaf = 1,
hidden = 0,
status = '1',
del_flag = 0
WHERE id = '1860000000000099311';

View File

@@ -0,0 +1,91 @@
-- MES 设备点检配置主子表建表 + 菜单 + 按钮 + 租户 admin 授权
-- 权限前缀mes:mes_xsl_equip_inspect_config:*
-- 父菜单设备管理类型字典复用 xslmes_im_item_category须先有点检及保养项目功能
-- FlywayV3.9.2_78__mes_xsl_equip_inspect_config.sql
SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS `mes_xsl_equip_inspect_config` (
`id` varchar(32) NOT NULL COMMENT '主键',
`equipment_ledger_id` varchar(32) NOT NULL COMMENT '设备台账主键 mes_xsl_equipment_ledger.id',
`equipment_name` varchar(500) DEFAULT NULL COMMENT '设备名称冗余',
`equipment_code` varchar(500) DEFAULT NULL COMMENT '设备编号冗余',
`config_type` varchar(500) NOT NULL COMMENT '配置类型字典xslmes_im_item_categoryinspect点检/maintain保养同设备同类型唯一',
`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_meic_tenant_equip_type` (`tenant_id`, `equipment_ledger_id`, `config_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES设备点检配置';
CREATE TABLE IF NOT EXISTS `mes_xsl_equip_inspect_config_line` (
`id` varchar(32) NOT NULL COMMENT '主键',
`config_id` varchar(32) NOT NULL COMMENT '主表主键 mes_xsl_equip_inspect_config.id',
`inspect_maintain_item_id` varchar(32) NOT NULL COMMENT '点检及保养项目主键 mes_xsl_inspect_maintain_item.id',
`item_code` varchar(500) DEFAULT NULL COMMENT '点检项目编号冗余',
`item_name` varchar(500) DEFAULT NULL COMMENT '项目名称冗余',
`item_category` varchar(500) DEFAULT NULL COMMENT '项目类别冗余',
`item_type` varchar(500) DEFAULT NULL COMMENT '项目类型冗余',
`equipment_part_name` varchar(500) DEFAULT NULL COMMENT '设备部位名称冗余',
`equipment_sub_part_name` varchar(500) DEFAULT NULL COMMENT '设备小部位名称冗余',
`inspect_method` varchar(500) DEFAULT NULL COMMENT '点检方式冗余',
`judgment_criteria` varchar(500) DEFAULT NULL COMMENT '判断基准冗余',
`sort_no` int DEFAULT '0' 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 '更新时间',
PRIMARY KEY (`id`),
KEY `idx_meicl_config` (`config_id`),
KEY `idx_meicl_item` (`inspect_maintain_item_id`),
UNIQUE KEY `uk_meicl_config_item` (`config_id`, `inspect_maintain_item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES设备点检配置明细';
SET @mes_tenant_id = 1002;
SET @mes_equip_pid = (
SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
);
SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
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 ('1860000000000000148', @mes_equip_pid, '设备点检配置', '/xslmes/mesXslEquipInspectConfig', 'xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfigList', 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`), `icon` = 'ant-design:control-outlined';
UPDATE `sys_permission` SET `icon` = 'ant-design:control-outlined' WHERE `id` = '1860000000000000148' AND `del_flag` = 0;
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
('1860000000000000149', '1860000000000000148', '新增', 2, 'mes:mes_xsl_equip_inspect_config:add', '1', '1', 0, 'admin', NOW()),
('1860000000000000150', '1860000000000000148', '编辑', 2, 'mes:mes_xsl_equip_inspect_config:edit', '1', '1', 0, 'admin', NOW()),
('1860000000000000151', '1860000000000000148', '删除', 2, 'mes:mes_xsl_equip_inspect_config:delete', '1', '1', 0, 'admin', NOW()),
('1860000000000000152', '1860000000000000148', '批量删除', 2, 'mes:mes_xsl_equip_inspect_config:deleteBatch', '1', '1', 0, 'admin', NOW()),
('1860000000000000153', '1860000000000000148', '导出', 2, 'mes:mes_xsl_equip_inspect_config:exportXls', '1', '1', 0, 'admin', NOW()),
('1860000000000000154', '1860000000000000148', '导入', 2, 'mes:mes_xsl_equip_inspect_config: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 (
'1860000000000000148',
'1860000000000000149', '1860000000000000150', '1860000000000000151', '1860000000000000152',
'1860000000000000153', '1860000000000000154'
)
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
);

View File

@@ -0,0 +1,138 @@
-- MES 点检/保养记录主子表建表 + 字典 + 菜单 + 按钮 + 租户 admin 授权
-- 权限前缀mes:mes_xsl_equip_inspect_record:*
-- 父菜单设备管理依赖设备点检配置设备台账
-- FlywayV3.9.2_79__mes_xsl_equip_inspect_record.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_im_inspect_result', '合格/不合格', 0, 'admin', NOW(), 0, 0
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_im_inspect_result' 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`, '合格', 'pass', '', 1, 1, 'admin', NOW()
FROM `sys_dict` d
WHERE d.`dict_code` = 'xslmes_im_inspect_result' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.`id` AND i.`item_value` = 'pass');
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`, '不合格', 'fail', '', 2, 1, 'admin', NOW()
FROM `sys_dict` d
WHERE d.`dict_code` = 'xslmes_im_inspect_result' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.`id` AND i.`item_value` = 'fail');
INSERT INTO `sys_dict`(`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
SELECT REPLACE(UUID(), '-', ''), 'MES点检记录状态', 'xslmes_im_record_status', '待点检/已点检', 0, 'admin', NOW(), 0, 0
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_im_record_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`, '待点检', 'pending', '', 1, 1, 'admin', NOW()
FROM `sys_dict` d
WHERE d.`dict_code` = 'xslmes_im_record_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.`id` AND i.`item_value` = 'pending');
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`, '已点检', 'done', '', 2, 1, 'admin', NOW()
FROM `sys_dict` d
WHERE d.`dict_code` = 'xslmes_im_record_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.`id` AND i.`item_value` = 'done');
CREATE TABLE IF NOT EXISTS `mes_xsl_equip_inspect_record` (
`id` varchar(32) NOT NULL COMMENT '主键',
`record_no` varchar(32) NOT NULL COMMENT '记录编号EC+yyyyMMdd+4位流水租户内按日递增',
`plan_no` varchar(500) DEFAULT NULL COMMENT '计划单号',
`plan_id` varchar(32) DEFAULT NULL COMMENT '计划主键隐藏',
`equipment_ledger_id` varchar(32) NOT NULL COMMENT '设备台账主键 mes_xsl_equipment_ledger.id',
`equipment_code` varchar(500) DEFAULT NULL COMMENT '设备编码冗余',
`equipment_name` varchar(500) DEFAULT NULL COMMENT '设备名称冗余',
`equip_inspect_config_id` varchar(32) DEFAULT NULL COMMENT '设备点检配置主键 mes_xsl_equip_inspect_config.id',
`record_type` varchar(500) NOT NULL COMMENT '类型字典xslmes_im_item_categoryinspect点检/maintain保养',
`inspect_date` date DEFAULT NULL COMMENT '点检日期',
`inspector_user_id` varchar(32) DEFAULT NULL COMMENT '点检人用户ID',
`inspector_username` varchar(500) DEFAULT NULL COMMENT '点检人账号',
`inspector_realname` varchar(500) DEFAULT NULL COMMENT '点检人姓名',
`inspect_result` varchar(500) NOT NULL COMMENT '点检结果字典xslmes_im_inspect_resultpass合格/fail不合格',
`record_status` varchar(500) NOT NULL COMMENT '状态字典xslmes_im_record_statuspending待点检/done已点检',
`handled_flag` varchar(1) DEFAULT NULL COMMENT '是否已处理字典yn1是0否仅不合格记录使用',
`handler_user_id` varchar(32) DEFAULT NULL COMMENT '处理人用户ID',
`handler_username` varchar(500) DEFAULT NULL COMMENT '处理人账号',
`handler_realname` varchar(500) DEFAULT NULL COMMENT '处理人姓名',
`handle_time` datetime DEFAULT NULL COMMENT '处理时间',
`tenant_id` int DEFAULT NULL COMMENT '租户',
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`del_flag` int DEFAULT '0' COMMENT '删除标记0正常1删除',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_meir_tenant_record_no` (`tenant_id`, `record_no`),
KEY `idx_meir_equip_type` (`equipment_ledger_id`, `record_type`),
KEY `idx_meir_inspect_date` (`inspect_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES点检保养记录';
CREATE TABLE IF NOT EXISTS `mes_xsl_equip_inspect_record_line` (
`id` varchar(32) NOT NULL COMMENT '主键',
`record_id` varchar(32) NOT NULL COMMENT '主表主键 mes_xsl_equip_inspect_record.id',
`equip_inspect_config_line_id` varchar(32) NOT NULL COMMENT '设备点检配置明细主键 mes_xsl_equip_inspect_config_line.id',
`inspect_maintain_item_id` varchar(32) DEFAULT NULL COMMENT '点检及保养项目主键冗余',
`item_code` varchar(500) DEFAULT NULL COMMENT '点检项目编号冗余',
`item_name` varchar(500) DEFAULT NULL COMMENT '项目名称冗余',
`item_category` varchar(500) DEFAULT NULL COMMENT '项目类别冗余',
`item_type` varchar(500) DEFAULT NULL COMMENT '项目类型冗余',
`equipment_part_name` varchar(500) DEFAULT NULL COMMENT '设备部位冗余',
`equipment_sub_part_name` varchar(500) DEFAULT NULL COMMENT '设备小部位冗余',
`inspect_method` varchar(500) DEFAULT NULL COMMENT '点检方式冗余',
`judgment_criteria` varchar(500) DEFAULT NULL COMMENT '判断基准冗余',
`line_inspect_result` varchar(500) DEFAULT NULL COMMENT '明细点检结果文本',
`picture_files` varchar(2000) DEFAULT NULL COMMENT '图片上传路径逗号分隔',
`sort_no` int DEFAULT '0' 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 '更新时间',
PRIMARY KEY (`id`),
KEY `idx_meirl_record` (`record_id`),
KEY `idx_meirl_config_line` (`equip_inspect_config_line_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES点检保养记录明细';
SET @mes_tenant_id = 1002;
SET @mes_equip_pid = (
SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
);
SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
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 ('1860000000000000155', @mes_equip_pid, '点检保养记录', '/xslmes/mesXslEquipInspectRecord', 'xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecordList', 'MesXslEquipInspectRecordList', 1, NULL, '1', 13, 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`), `icon` = 'ant-design:file-done-outlined';
UPDATE `sys_permission` SET `icon` = 'ant-design:file-done-outlined' WHERE `id` = '1860000000000000155' AND `del_flag` = 0;
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
('1860000000000000156', '1860000000000000155', '新增', 2, 'mes:mes_xsl_equip_inspect_record:add', '1', '1', 0, 'admin', NOW()),
('1860000000000000157', '1860000000000000155', '编辑', 2, 'mes:mes_xsl_equip_inspect_record:edit', '1', '1', 0, 'admin', NOW()),
('1860000000000000158', '1860000000000000155', '删除', 2, 'mes:mes_xsl_equip_inspect_record:delete', '1', '1', 0, 'admin', NOW()),
('1860000000000000159', '1860000000000000155', '批量删除', 2, 'mes:mes_xsl_equip_inspect_record:deleteBatch', '1', '1', 0, 'admin', NOW()),
('1860000000000000160', '1860000000000000155', '导出', 2, 'mes:mes_xsl_equip_inspect_record:exportXls', '1', '1', 0, 'admin', NOW()),
('1860000000000000161', '1860000000000000155', '导入', 2, 'mes:mes_xsl_equip_inspect_record: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 (
'1860000000000000155',
'1860000000000000156', '1860000000000000157', '1860000000000000158', '1860000000000000159',
'1860000000000000160', '1860000000000000161'
)
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
);

View File

@@ -0,0 +1,92 @@
-- 密炼机动作维护菜单与权限挂到MES密炼工程目录
SET NAMES utf8mb4;
SET @mixer_parent_id = (
SELECT id
FROM sys_permission
WHERE name = 'MES密炼工程' AND menu_type = 0 AND del_flag = 0
ORDER BY create_time ASC
LIMIT 1
);
SET @mixer_parent_id = IFNULL(@mixer_parent_id, (
SELECT id
FROM sys_permission
WHERE url = '/mes' AND menu_type = 0 AND del_flag = 0
ORDER BY create_time ASC
LIMIT 1
));
SET @mixer_parent_id = IFNULL(@mixer_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 (
'1860000000000099211', @mixer_parent_id, '密炼机动作维护',
'/mes/mixeractioninfo',
'mes/mixeractioninfo/index',
'MesXslMixerActionList', 1, NULL, '1', 30,
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
('1860000000000099212', '1860000000000099211', '新增', 2, 'xslmes:mes_xsl_mixer_action:add', '1', '1', 0, 'admin', NOW()),
('1860000000000099213', '1860000000000099211', '编辑', 2, 'xslmes:mes_xsl_mixer_action:edit', '1', '1', 0, 'admin', NOW()),
('1860000000000099214', '1860000000000099211', '删除', 2, 'xslmes:mes_xsl_mixer_action:delete', '1', '1', 0, 'admin', NOW()),
('1860000000000099215', '1860000000000099211', '批量删除', 2, 'xslmes:mes_xsl_mixer_action:deleteBatch', '1', '1', 0, 'admin', NOW()),
('1860000000000099216', '1860000000000099211', '导出', 2, 'xslmes:mes_xsl_mixer_action: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 (
'1860000000000099211',
'1860000000000099212', '1860000000000099213', '1860000000000099214', '1860000000000099215', '1860000000000099216'
)
AND NOT EXISTS (
SELECT 1
FROM sys_role_permission rp
WHERE rp.role_id = 'f6817f48af4fb3af11b9e8bf182f618b'
AND rp.permission_id = p.id
);
-- 强制修复确保菜单路由与组件路径正确避免历史错误路径导致查看组件引用是否正确
UPDATE sys_permission
SET
parent_id = @mixer_parent_id,
url = '/mes/mixeractioninfo',
component = 'mes/mixeractioninfo/index',
component_name = 'MesXslMixerActionList',
menu_type = 1,
is_route = 1,
is_leaf = 1,
hidden = 0,
status = '1',
del_flag = 0
WHERE id = '1860000000000099211';

View File

@@ -0,0 +1,92 @@
-- 密炼机条件维护菜单与权限挂到MES密炼工程目录
SET NAMES utf8mb4;
SET @mixer_parent_id = (
SELECT id
FROM sys_permission
WHERE name = 'MES密炼工程' AND menu_type = 0 AND del_flag = 0
ORDER BY create_time ASC
LIMIT 1
);
SET @mixer_parent_id = IFNULL(@mixer_parent_id, (
SELECT id
FROM sys_permission
WHERE url = '/mes' AND menu_type = 0 AND del_flag = 0
ORDER BY create_time ASC
LIMIT 1
));
SET @mixer_parent_id = IFNULL(@mixer_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 (
'1860000000000099411', @mixer_parent_id, '密炼机条件维护',
'/mes/mixerconditioninfo',
'mes/mixerconditioninfo/index',
'MesXslMixerConditionList', 1, NULL, '1', 32,
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
('1860000000000099412', '1860000000000099411', '新增', 2, 'xslmes:mes_xsl_mixer_condition:add', '1', '1', 0, 'admin', NOW()),
('1860000000000099413', '1860000000000099411', '编辑', 2, 'xslmes:mes_xsl_mixer_condition:edit', '1', '1', 0, 'admin', NOW()),
('1860000000000099414', '1860000000000099411', '删除', 2, 'xslmes:mes_xsl_mixer_condition:delete', '1', '1', 0, 'admin', NOW()),
('1860000000000099415', '1860000000000099411', '批量删除', 2, 'xslmes:mes_xsl_mixer_condition:deleteBatch', '1', '1', 0, 'admin', NOW()),
('1860000000000099416', '1860000000000099411', '导出', 2, 'xslmes:mes_xsl_mixer_condition: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 (
'1860000000000099411',
'1860000000000099412', '1860000000000099413', '1860000000000099414', '1860000000000099415', '1860000000000099416'
)
AND NOT EXISTS (
SELECT 1
FROM sys_role_permission rp
WHERE rp.role_id = 'f6817f48af4fb3af11b9e8bf182f618b'
AND rp.permission_id = p.id
);
-- 强制修复确保菜单路由与组件路径正确
UPDATE sys_permission
SET
parent_id = @mixer_parent_id,
url = '/mes/mixerconditioninfo',
component = 'mes/mixerconditioninfo/index',
component_name = 'MesXslMixerConditionList',
menu_type = 1,
is_route = 1,
is_leaf = 1,
hidden = 0,
status = '1',
del_flag = 0
WHERE id = '1860000000000099411';

View File

@@ -0,0 +1,92 @@
-- 生产订单菜单与权限挂到MES密炼工程目录
SET NAMES utf8mb4;
SET @mixer_parent_id = (
SELECT id
FROM sys_permission
WHERE name = 'MES密炼工程' AND menu_type = 0 AND del_flag = 0
ORDER BY create_time ASC
LIMIT 1
);
SET @mixer_parent_id = IFNULL(@mixer_parent_id, (
SELECT id
FROM sys_permission
WHERE url = '/mes' AND menu_type = 0 AND del_flag = 0
ORDER BY create_time ASC
LIMIT 1
));
SET @mixer_parent_id = IFNULL(@mixer_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 (
'1860000000000099511', @mixer_parent_id, '生产订单',
'/mes/productionorderinfo',
'mes/productionorderinfo/index',
'MesXslProductionOrderList', 1, NULL, '1', 33,
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
('1860000000000099512', '1860000000000099511', '新增', 2, 'xslmes:mes_xsl_production_order:add', '1', '1', 0, 'admin', NOW()),
('1860000000000099513', '1860000000000099511', '编辑', 2, 'xslmes:mes_xsl_production_order:edit', '1', '1', 0, 'admin', NOW()),
('1860000000000099514', '1860000000000099511', '删除', 2, 'xslmes:mes_xsl_production_order:delete', '1', '1', 0, 'admin', NOW()),
('1860000000000099515', '1860000000000099511', '批量删除', 2, 'xslmes:mes_xsl_production_order:deleteBatch', '1', '1', 0, 'admin', NOW()),
('1860000000000099516', '1860000000000099511', '导出', 2, 'xslmes:mes_xsl_production_order: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 (
'1860000000000099511',
'1860000000000099512', '1860000000000099513', '1860000000000099514', '1860000000000099515', '1860000000000099516'
)
AND NOT EXISTS (
SELECT 1
FROM sys_role_permission rp
WHERE rp.role_id = 'f6817f48af4fb3af11b9e8bf182f618b'
AND rp.permission_id = p.id
);
-- 强制修复确保菜单路由与组件路径正确
UPDATE sys_permission
SET
parent_id = @mixer_parent_id,
url = '/mes/productionorderinfo',
component = 'mes/productionorderinfo/index',
component_name = 'MesXslProductionOrderList',
menu_type = 1,
is_route = 1,
is_leaf = 1,
hidden = 0,
status = '1',
del_flag = 0
WHERE id = '1860000000000099511';

View File

@@ -0,0 +1,151 @@
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.Arrays;
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.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslDayTankMaterialMap;
import org.jeecg.modules.xslmes.service.IMesXslDayTankMaterialMapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RequestMethod;
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/mesXslDayTankMaterialMap")
public class MesXslDayTankMaterialMapController
extends JeecgController<MesXslDayTankMaterialMap, IMesXslDayTankMaterialMapService> {
@Autowired private IMesXslDayTankMaterialMapService dayTankMaterialMapService;
@Operation(summary = "日罐物料对应信息-分页列表查询")
@GetMapping("/list")
public Result<IPage<MesXslDayTankMaterialMap>> queryPageList(
MesXslDayTankMaterialMap model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslDayTankMaterialMap> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
IPage<MesXslDayTankMaterialMap> pageList = dayTankMaterialMapService.page(new Page<>(pageNo, pageSize), queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "日罐物料对应信息-添加")
@Operation(summary = "日罐物料对应信息-添加")
@RequiresPermissions("xslmes:mes_xsl_day_tank_material_map:add")
@PostMapping("/add")
public Result<String> add(@RequestBody MesXslDayTankMaterialMap model) {
String err = validateForSave(model);
if (err != null) {
return Result.error(err);
}
dayTankMaterialMapService.fillReferenceFields(model);
if (StringUtils.isBlank(model.getMachineCode()) || StringUtils.isBlank(model.getMachineName())) {
return Result.error("请选择有效的机台名称");
}
if (StringUtils.isBlank(model.getMaterialName())) {
return Result.error("请选择有效的物料名称");
}
dayTankMaterialMapService.save(model);
return Result.OK("添加成功!");
}
@AutoLog(value = "日罐物料对应信息-编辑")
@Operation(summary = "日罐物料对应信息-编辑")
@RequiresPermissions("xslmes:mes_xsl_day_tank_material_map:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody MesXslDayTankMaterialMap model) {
String err = validateForSave(model);
if (err != null) {
return Result.error(err);
}
dayTankMaterialMapService.fillReferenceFields(model);
if (StringUtils.isBlank(model.getMachineCode()) || StringUtils.isBlank(model.getMachineName())) {
return Result.error("请选择有效的机台名称");
}
if (StringUtils.isBlank(model.getMaterialName())) {
return Result.error("请选择有效的物料名称");
}
dayTankMaterialMapService.updateById(model);
return Result.OK("编辑成功!");
}
@AutoLog(value = "日罐物料对应信息-通过id删除")
@Operation(summary = "日罐物料对应信息-通过id删除")
@RequiresPermissions("xslmes:mes_xsl_day_tank_material_map:delete")
@DeleteMapping("/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
dayTankMaterialMapService.removeById(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "日罐物料对应信息-批量删除")
@Operation(summary = "日罐物料对应信息-批量删除")
@RequiresPermissions("xslmes:mes_xsl_day_tank_material_map:deleteBatch")
@DeleteMapping("/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
dayTankMaterialMapService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@Operation(summary = "日罐物料对应信息-通过id查询")
@GetMapping("/queryById")
public Result<MesXslDayTankMaterialMap> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslDayTankMaterialMap entity = dayTankMaterialMapService.getById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@RequiresPermissions("xslmes:mes_xsl_day_tank_material_map:exportXls")
@RequestMapping("/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslDayTankMaterialMap model) {
return super.exportXls(request, model, MesXslDayTankMaterialMap.class, "日罐物料对应信息");
}
private String validateForSave(MesXslDayTankMaterialMap model) {
if (oConvertUtils.isEmpty(model.getEquipmentId()) || StringUtils.isBlank(model.getEquipmentId())) {
return "机台名称不能为空";
}
model.setEquipmentId(model.getEquipmentId().trim());
if (oConvertUtils.isEmpty(model.getMaterialId()) || StringUtils.isBlank(model.getMaterialId())) {
return "物料名称不能为空";
}
model.setMaterialId(model.getMaterialId().trim());
if (model.getUseStatus() == null) {
model.setUseStatus(1);
}
if (model.getAllowSync() == null) {
model.setAllowSync(1);
}
if (model.getSiloCategoryId() != null) {
model.setSiloCategoryId(model.getSiloCategoryId().trim());
}
if (model.getStation() != null) {
model.setStation(model.getStation().trim());
}
if (model.getSiloNo() != null) {
model.setSiloNo(model.getSiloNo().trim());
}
return null;
}
}

View File

@@ -0,0 +1,230 @@
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.util.Arrays;
import java.util.HashSet;
import java.util.List;
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.MesXslEquipInspectConfig;
import org.jeecg.modules.xslmes.entity.MesXslEquipInspectConfigLine;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
import org.jeecg.modules.xslmes.entity.MesXslInspectMaintainItem;
import org.jeecg.modules.xslmes.service.IMesXslEquipInspectConfigService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentLedgerService;
import org.jeecg.modules.xslmes.service.IMesXslInspectMaintainItemService;
import org.jeecg.modules.xslmes.vo.MesXslEquipInspectConfigPage;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
/**
* MES 设备点检配置(主子表)
*/
@Tag(name = "MES设备点检配置")
@RestController
@RequestMapping("/xslmes/mesXslEquipInspectConfig")
@Slf4j
public class MesXslEquipInspectConfigController
extends JeecgController<MesXslEquipInspectConfig, IMesXslEquipInspectConfigService> {
private static final Set<String> CONFIG_TYPE = Set.of("inspect", "maintain");
@Autowired
private IMesXslEquipInspectConfigService mesXslEquipInspectConfigService;
@Autowired
private IMesXslEquipmentLedgerService mesXslEquipmentLedgerService;
@Autowired
private IMesXslInspectMaintainItemService mesXslInspectMaintainItemService;
@Operation(summary = "MES设备点检配置-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslEquipInspectConfig>> queryPageList(
MesXslEquipInspectConfig model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslEquipInspectConfig> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
Page<MesXslEquipInspectConfig> page = new Page<>(pageNo, pageSize);
IPage<MesXslEquipInspectConfig> pageList = mesXslEquipInspectConfigService.page(page, queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "MES设备点检配置-添加")
@Operation(summary = "MES设备点检配置-添加")
@RequiresPermissions("mes:mes_xsl_equip_inspect_config:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody MesXslEquipInspectConfigPage page) {
MesXslEquipInspectConfig main = new MesXslEquipInspectConfig();
BeanUtils.copyProperties(page, main);
//update-begin---author:jiangxh ---date:20260519 for【MES】设备点检配置保存校验-----------
String err = validateForSave(main, page.getLineList(), null);
if (err != null) {
return Result.error(err);
}
//update-end---author:jiangxh ---date:20260519 for【MES】设备点检配置保存校验-----------
mesXslEquipInspectConfigService.saveMain(main, page.getLineList());
return Result.OK("添加成功!");
}
@AutoLog(value = "MES设备点检配置-编辑")
@Operation(summary = "MES设备点检配置-编辑")
@RequiresPermissions("mes:mes_xsl_equip_inspect_config:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody MesXslEquipInspectConfigPage page) {
MesXslEquipInspectConfig main = new MesXslEquipInspectConfig();
BeanUtils.copyProperties(page, main);
//update-begin---author:jiangxh ---date:20260519 for【MES】设备点检配置保存校验-----------
String err = validateForSave(main, page.getLineList(), main.getId());
if (err != null) {
return Result.error(err);
}
//update-end---author:jiangxh ---date:20260519 for【MES】设备点检配置保存校验-----------
mesXslEquipInspectConfigService.updateMain(main, page.getLineList());
return Result.OK("编辑成功!");
}
@AutoLog(value = "MES设备点检配置-删除")
@Operation(summary = "MES设备点检配置-通过id删除")
@RequiresPermissions("mes:mes_xsl_equip_inspect_config:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
mesXslEquipInspectConfigService.delMain(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "MES设备点检配置-批量删除")
@Operation(summary = "MES设备点检配置-批量删除")
@RequiresPermissions("mes:mes_xsl_equip_inspect_config:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
mesXslEquipInspectConfigService.delBatchMain(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@Operation(summary = "MES设备点检配置-通过id查询")
@GetMapping(value = "/queryById")
public Result<MesXslEquipInspectConfig> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslEquipInspectConfig entity = mesXslEquipInspectConfigService.getById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@Operation(summary = "MES设备点检配置-查询明细")
@GetMapping(value = "/queryLineListByConfigId")
public Result<List<MesXslEquipInspectConfigLine>> queryLineListByConfigId(
@RequestParam(name = "id", required = true) String id) {
return Result.OK(mesXslEquipInspectConfigService.selectLinesByConfigId(id));
}
@RequiresPermissions("mes:mes_xsl_equip_inspect_config:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslEquipInspectConfig model) {
return super.exportXls(request, model, MesXslEquipInspectConfig.class, "MES设备点检配置");
}
@RequiresPermissions("mes:mes_xsl_equip_inspect_config:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, MesXslEquipInspectConfig.class);
}
//update-begin---author:jiangxh ---date:20260519 for【MES】设备点检配置主表唯一、明细项目不重复、从点检保养项目带出-----------
private String validateForSave(
MesXslEquipInspectConfig main, List<MesXslEquipInspectConfigLine> lineList, String excludeId) {
if (main == null) {
return "参数不能为空";
}
if (oConvertUtils.isEmpty(main.getEquipmentLedgerId())) {
return "请选择设备台账";
}
MesXslEquipmentLedger ledger = mesXslEquipmentLedgerService.getById(main.getEquipmentLedgerId());
if (ledger == null || isDeleted(ledger.getDelFlag())) {
return "设备台账不存在或已删除";
}
main.setEquipmentName(ledger.getEquipmentName());
main.setEquipmentCode(ledger.getEquipmentCode());
String configType = main.getConfigType();
if (configType != null) {
configType = configType.trim();
}
if (oConvertUtils.isEmpty(configType) || !CONFIG_TYPE.contains(configType)) {
return "类型无效,请选择点检或保养";
}
main.setConfigType(configType);
if (mesXslEquipInspectConfigService.isConfigDuplicated(
main.getEquipmentLedgerId(), configType, excludeId, main)) {
return "该设备在此类型(点检/保养)下已存在配置,不能重复添加";
}
if (lineList == null || lineList.isEmpty()) {
return "请至少添加一条点检项目明细";
}
Set<String> itemIds = new HashSet<>();
int sort = 0;
for (int i = 0; i < lineList.size(); i++) {
MesXslEquipInspectConfigLine line = lineList.get(i);
if (line == null) {
continue;
}
int rowNo = i + 1;
if (oConvertUtils.isEmpty(line.getInspectMaintainItemId())) {
return "" + rowNo + " 行未选择点检及保养项目";
}
String itemId = line.getInspectMaintainItemId().trim();
if (!itemIds.add(itemId)) {
return "" + rowNo + " 行点检项目与前面行重复,同一配置中点检项目不能重复";
}
MesXslInspectMaintainItem item = mesXslInspectMaintainItemService.getById(itemId);
if (item == null || isDeleted(item.getDelFlag())) {
return "" + rowNo + " 行点检及保养项目不存在或已删除";
}
if (!configType.equals(item.getItemCategory())) {
return "" + rowNo + " 行项目类别与配置类型不一致(配置为"
+ ("inspect".equals(configType) ? "点检" : "保养")
+ "";
}
line.setInspectMaintainItemId(itemId);
line.setItemCode(item.getItemCode());
line.setItemName(item.getItemName());
line.setItemCategory(item.getItemCategory());
line.setItemType(item.getItemType());
line.setEquipmentPartName(item.getEquipmentPartName());
line.setEquipmentSubPartName(item.getEquipmentSubPartName());
line.setInspectMethod(item.getInspectMethod());
line.setJudgmentCriteria(item.getJudgmentCriteria());
line.setSortNo(sort++);
}
if (itemIds.isEmpty()) {
return "请至少添加一条点检项目明细";
}
return null;
}
private static boolean isDeleted(Integer delFlag) {
return delFlag != null && delFlag.equals(CommonConstant.DEL_FLAG_1);
}
//update-end---author:jiangxh ---date:20260519 for【MES】设备点检配置主表唯一、明细项目不重复、从点检保养项目带出-----------
}

View File

@@ -0,0 +1,411 @@
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.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
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.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslEquipInspectConfig;
import org.jeecg.modules.xslmes.entity.MesXslEquipInspectRecord;
import org.jeecg.modules.xslmes.entity.MesXslEquipInspectRecordLine;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
import org.jeecg.modules.xslmes.service.IMesXslEquipInspectConfigService;
import org.jeecg.modules.xslmes.service.IMesXslEquipInspectRecordService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentLedgerService;
import org.jeecg.modules.xslmes.util.MesXslEquipInspectBizMsg;
import org.jeecg.modules.xslmes.vo.MesXslEquipInspectRecordBatchCreateDTO;
import org.jeecg.modules.xslmes.vo.MesXslEquipInspectRecordBatchCreateResult;
import org.jeecg.modules.xslmes.vo.MesXslEquipInspectRecordHandleDTO;
import org.jeecg.modules.xslmes.vo.MesXslEquipInspectRecordPage;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
/**
* MES 点检/保养记录(主子表)
*/
@Tag(name = "MES点检保养记录")
@RestController
@RequestMapping("/xslmes/mesXslEquipInspectRecord")
@Slf4j
public class MesXslEquipInspectRecordController
extends JeecgController<MesXslEquipInspectRecord, IMesXslEquipInspectRecordService> {
private static final Set<String> RECORD_TYPE = Set.of("inspect", "maintain");
private static final Set<String> INSPECT_RESULT = Set.of("pass", "fail");
private static final Set<String> RECORD_STATUS = Set.of("pending", "done");
@Autowired
private IMesXslEquipInspectRecordService mesXslEquipInspectRecordService;
@Autowired
private IMesXslEquipmentLedgerService mesXslEquipmentLedgerService;
@Autowired
private IMesXslEquipInspectConfigService mesXslEquipInspectConfigService;
@Operation(summary = "MES点检保养记录-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslEquipInspectRecord>> queryPageList(
MesXslEquipInspectRecord model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslEquipInspectRecord> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
Page<MesXslEquipInspectRecord> page = new Page<>(pageNo, pageSize);
IPage<MesXslEquipInspectRecord> pageList = mesXslEquipInspectRecordService.page(page, queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "MES点检保养记录-添加")
@Operation(summary = "MES点检保养记录-添加")
@RequiresPermissions("mes:mes_xsl_equip_inspect_record:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody MesXslEquipInspectRecordPage page) {
MesXslEquipInspectRecord main = new MesXslEquipInspectRecord();
BeanUtils.copyProperties(page, main);
String err = validateForSave(main, page.getLineList(), null);
if (err != null) {
return Result.error(err);
}
fillRecordNoIfEmpty(main);
fillInspector(main);
mesXslEquipInspectRecordService.saveMain(main, page.getLineList());
return Result.OK("添加成功!");
}
@AutoLog(value = "MES点检保养记录-编辑")
@Operation(summary = "MES点检保养记录-编辑")
@RequiresPermissions("mes:mes_xsl_equip_inspect_record:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody MesXslEquipInspectRecordPage page) {
MesXslEquipInspectRecord main = new MesXslEquipInspectRecord();
BeanUtils.copyProperties(page, main);
//update-begin---author:jiangxh ---date:20260520 for【MES】仅待点检可录入保存后变已点检-----------
if (oConvertUtils.isEmpty(main.getId())) {
return Result.error("记录主键不能为空");
}
MesXslEquipInspectRecord existing = mesXslEquipInspectRecordService.getById(main.getId());
if (existing == null) {
return Result.error("未找到对应数据");
}
if ("done".equals(existing.getRecordStatus())) {
return Result.error("已点检记录不可修改,仅可查看");
}
main.setRecordStatus("done");
String err = validateForEntry(main, page.getLineList());
if (err != null) {
return Result.error(err);
}
fillInspector(main);
mesXslEquipInspectRecordService.updateMain(main, page.getLineList());
return Result.OK("录入成功!");
//update-end---author:jiangxh ---date:20260520 for【MES】仅待点检可录入保存后变已点检-----------
}
@AutoLog(value = "MES点检保养记录-删除")
@Operation(summary = "MES点检保养记录-通过id删除")
@RequiresPermissions("mes:mes_xsl_equip_inspect_record:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
mesXslEquipInspectRecordService.delMain(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "MES点检保养记录-批量删除")
@Operation(summary = "MES点检保养记录-批量删除")
@RequiresPermissions("mes:mes_xsl_equip_inspect_record:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
mesXslEquipInspectRecordService.delBatchMain(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@Operation(summary = "MES点检保养记录-通过id查询")
@GetMapping(value = "/queryById")
public Result<MesXslEquipInspectRecord> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslEquipInspectRecord entity = mesXslEquipInspectRecordService.getById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@Operation(summary = "MES点检保养记录-查询明细")
@GetMapping(value = "/queryLineListByRecordId")
public Result<List<MesXslEquipInspectRecordLine>> queryLineListByRecordId(
@RequestParam(name = "id", required = true) String id) {
return Result.OK(mesXslEquipInspectRecordService.selectLinesByRecordId(id));
}
//update-begin---author:jiangxh ---date:20260521 for【MES】不合格点检记录登记处理人及处理时间-----------
@AutoLog(value = "MES点检保养记录-不合格处理")
@Operation(summary = "MES点检保养记录-不合格处理")
@RequiresPermissions("mes:mes_xsl_equip_inspect_record:edit")
@PostMapping(value = "/handleFail")
public Result<String> handleFail(@RequestBody MesXslEquipInspectRecordHandleDTO dto) {
try {
mesXslEquipInspectRecordService.handleFailRecord(dto);
return Result.OK("处理成功!");
} catch (IllegalArgumentException ex) {
return Result.error(ex.getMessage());
}
}
//update-end---author:jiangxh ---date:20260521 for【MES】不合格点检记录登记处理人及处理时间-----------
@Operation(summary = "MES点检保养记录-生成记录编号")
@GetMapping(value = "/generateRecordNo")
public Result<String> generateRecordNo() {
MesXslEquipInspectRecord ctx = new MesXslEquipInspectRecord();
return Result.OK(mesXslEquipInspectRecordService.generateRecordNo(ctx));
}
@AutoLog(value = "MES点检保养记录-从设备台账批量生成")
@Operation(summary = "MES点检保养记录-从设备台账批量生成")
@RequiresPermissions("mes:mes_xsl_equip_inspect_record:add")
@PostMapping(value = "/batchCreateFromEquipment")
public Result<MesXslEquipInspectRecordBatchCreateResult> batchCreateFromEquipment(
@RequestBody MesXslEquipInspectRecordBatchCreateDTO dto) {
if (dto == null || CollectionUtils.isEmpty(dto.getEquipmentLedgerIds())) {
return Result.error("请先选择设备");
}
String recordType = dto.getRecordType();
if (recordType != null) {
recordType = recordType.trim();
}
if (oConvertUtils.isEmpty(recordType) || !RECORD_TYPE.contains(recordType)) {
return Result.error("类型无效,请使用点检或保养");
}
MesXslEquipInspectRecord inspectorCtx = new MesXslEquipInspectRecord();
fillInspector(inspectorCtx);
MesXslEquipInspectRecordBatchCreateResult result =
mesXslEquipInspectRecordService.batchCreateFromEquipment(
dto.getEquipmentLedgerIds(), recordType, inspectorCtx);
if (result.getSuccessCount() <= 0 && !result.getFailMessages().isEmpty()) {
return Result.error(String.join("", result.getFailMessages()));
}
String msg = "成功生成 " + result.getSuccessCount() + " 条记录";
if (!result.getFailMessages().isEmpty()) {
msg = msg + "" + String.join("", result.getFailMessages());
}
return Result.OK(msg, result);
}
@Operation(summary = "MES点检保养记录-按设备与类型带出配置明细")
@GetMapping(value = "/loadLinesByEquipment")
public Result<List<MesXslEquipInspectRecordLine>> loadLinesByEquipment(
@RequestParam(name = "equipmentLedgerId") String equipmentLedgerId,
@RequestParam(name = "recordType") String recordType) {
String type = recordType != null ? recordType.trim() : "";
if (oConvertUtils.isEmpty(equipmentLedgerId) || !RECORD_TYPE.contains(type)) {
return Result.error("请选择设备与类型(点检/保养)");
}
List<MesXslEquipInspectRecordLine> lines =
mesXslEquipInspectRecordService.buildLinesFromEquipConfig(equipmentLedgerId, type);
if (lines.isEmpty()) {
MesXslEquipmentLedger ledger = mesXslEquipmentLedgerService.getById(equipmentLedgerId);
String equipName =
ledger != null && oConvertUtils.isNotEmpty(ledger.getEquipmentName())
? ledger.getEquipmentName()
: (ledger != null ? ledger.getEquipmentCode() : equipmentLedgerId);
return Result.error(MesXslEquipInspectBizMsg.noConfigMessage(equipName, type));
}
return Result.OK(lines);
}
@RequiresPermissions("mes:mes_xsl_equip_inspect_record:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslEquipInspectRecord model) {
return super.exportXls(request, model, MesXslEquipInspectRecord.class, "MES点检保养记录");
}
@RequiresPermissions("mes:mes_xsl_equip_inspect_record:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, MesXslEquipInspectRecord.class);
}
private void fillRecordNoIfEmpty(MesXslEquipInspectRecord main) {
if (oConvertUtils.isEmpty(main.getRecordNo())) {
main.setRecordNo(mesXslEquipInspectRecordService.generateRecordNo(main));
}
}
private void fillInspector(MesXslEquipInspectRecord main) {
if (SecurityUtils.getSubject() == null || SecurityUtils.getSubject().getPrincipal() == null) {
return;
}
if (!(SecurityUtils.getSubject().getPrincipal() instanceof LoginUser user)) {
return;
}
main.setInspectorUserId(user.getId());
main.setInspectorUsername(user.getUsername());
main.setInspectorRealname(user.getRealname());
}
//update-begin---author:jiangxh ---date:20260520 for【MES】录入点检结果必填项校验保存为已点检-----------
private String validateForEntry(MesXslEquipInspectRecord main, List<MesXslEquipInspectRecordLine> lineList) {
String err = validateForSave(main, lineList, main.getId());
if (err != null) {
return err;
}
if (main.getInspectDate() == null) {
return "请选择点检日期";
}
if (oConvertUtils.isEmpty(main.getInspectorUserId()) && oConvertUtils.isEmpty(main.getInspectorRealname())) {
return "点检人不能为空";
}
String inspectResult = main.getInspectResult();
if (inspectResult != null) {
inspectResult = inspectResult.trim();
}
if (oConvertUtils.isEmpty(inspectResult) || !INSPECT_RESULT.contains(inspectResult)) {
return "请选择点检结果(合格/不合格)";
}
main.setInspectResult(inspectResult);
main.setRecordStatus("done");
//update-begin---author:jiangxh ---date:20260521 for【MES】不合格记录默认未处理-----------
if ("fail".equals(inspectResult)) {
main.setHandledFlag("0");
} else {
main.setHandledFlag(null);
main.setHandlerUserId(null);
main.setHandlerUsername(null);
main.setHandlerRealname(null);
main.setHandleTime(null);
}
//update-end---author:jiangxh ---date:20260521 for【MES】不合格记录默认未处理-----------
return null;
}
//update-end---author:jiangxh ---date:20260520 for【MES】录入点检结果必填项校验保存为已点检-----------
//update-begin---author:jiangxh ---date:20260520 for【MES】点检保养记录保存校验与配置明细关联-----------
private String validateForSave(
MesXslEquipInspectRecord main, List<MesXslEquipInspectRecordLine> lineList, String excludeId) {
if (main == null) {
return "参数不能为空";
}
if (oConvertUtils.isEmpty(main.getEquipmentLedgerId())) {
return "请选择设备";
}
MesXslEquipmentLedger ledger = mesXslEquipmentLedgerService.getById(main.getEquipmentLedgerId());
if (ledger == null || isDeleted(ledger.getDelFlag())) {
return "设备台账不存在或已删除";
}
main.setEquipmentName(ledger.getEquipmentName());
main.setEquipmentCode(ledger.getEquipmentCode());
String recordType = main.getRecordType();
if (recordType != null) {
recordType = recordType.trim();
}
if (oConvertUtils.isEmpty(recordType) || !RECORD_TYPE.contains(recordType)) {
return "类型无效,请选择点检或保养";
}
main.setRecordType(recordType);
if (main.getInspectDate() == null) {
main.setInspectDate(new Date());
}
String recordStatus = main.getRecordStatus();
if (recordStatus != null) {
recordStatus = recordStatus.trim();
}
if (oConvertUtils.isEmpty(recordStatus) || !RECORD_STATUS.contains(recordStatus)) {
return "请选择状态(待点检/已点检)";
}
main.setRecordStatus(recordStatus);
String inspectResult = main.getInspectResult();
if (inspectResult != null) {
inspectResult = inspectResult.trim();
}
if ("done".equals(recordStatus)) {
if (oConvertUtils.isEmpty(inspectResult) || !INSPECT_RESULT.contains(inspectResult)) {
return "已点检时请选择点检结果(合格/不合格)";
}
main.setInspectResult(inspectResult);
} else {
if (oConvertUtils.isNotEmpty(inspectResult) && !INSPECT_RESULT.contains(inspectResult)) {
return "点检结果无效";
}
main.setInspectResult(oConvertUtils.isEmpty(inspectResult) ? null : inspectResult);
}
if (oConvertUtils.isEmpty(main.getRecordNo())) {
return "记录编号不能为空";
}
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<MesXslEquipInspectConfig> cw =
new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<>();
cw.eq(MesXslEquipInspectConfig::getEquipmentLedgerId, main.getEquipmentLedgerId());
cw.eq(MesXslEquipInspectConfig::getConfigType, recordType);
cw.and(
q ->
q.eq(MesXslEquipInspectConfig::getDelFlag, CommonConstant.DEL_FLAG_0)
.or()
.isNull(MesXslEquipInspectConfig::getDelFlag));
MesXslEquipInspectConfig config = mesXslEquipInspectConfigService.getOne(cw, false);
if (config == null) {
String equipName =
oConvertUtils.isNotEmpty(ledger.getEquipmentName())
? ledger.getEquipmentName()
: ledger.getEquipmentCode();
return MesXslEquipInspectBizMsg.noConfigMessage(equipName, recordType);
}
main.setEquipInspectConfigId(config.getId());
if (lineList == null || lineList.isEmpty()) {
return "明细不能为空,请选择设备后自动带出点检项目";
}
Set<String> configLineIds = new HashSet<>();
int sort = 0;
for (int i = 0; i < lineList.size(); i++) {
MesXslEquipInspectRecordLine line = lineList.get(i);
if (line == null) {
continue;
}
int rowNo = i + 1;
if (oConvertUtils.isEmpty(line.getEquipInspectConfigLineId())) {
return "" + rowNo + " 行未关联点检配置明细";
}
String lineId = line.getEquipInspectConfigLineId().trim();
if (!configLineIds.add(lineId)) {
return "" + rowNo + " 行点检配置明细重复";
}
line.setEquipInspectConfigLineId(lineId);
line.setSortNo(sort++);
}
if (configLineIds.isEmpty()) {
return "明细不能为空";
}
return null;
}
private static boolean isDeleted(Integer delFlag) {
return delFlag != null && delFlag.equals(CommonConstant.DEL_FLAG_1);
}
//update-end---author:jiangxh ---date:20260520 for【MES】点检保养记录保存校验与配置明细关联-----------
}

View File

@@ -0,0 +1,167 @@
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.Arrays;
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.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslMixerAction;
import org.jeecg.modules.xslmes.service.IMesXslMixerActionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RequestMethod;
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/mesXslMixerAction")
public class MesXslMixerActionController extends JeecgController<MesXslMixerAction, IMesXslMixerActionService> {
@Autowired private IMesXslMixerActionService mesXslMixerActionService;
@Operation(summary = "密炼机动作维护-分页列表查询")
@GetMapping("/list")
public Result<IPage<MesXslMixerAction>> queryPageList(
MesXslMixerAction model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslMixerAction> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
IPage<MesXslMixerAction> pageList = mesXslMixerActionService.page(new Page<>(pageNo, pageSize), queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "密炼机动作维护-添加")
@Operation(summary = "密炼机动作维护-添加")
@RequiresPermissions("xslmes:mes_xsl_mixer_action:add")
@PostMapping("/add")
public Result<String> add(@RequestBody MesXslMixerAction model) {
String err = validateForSave(model, null);
if (err != null) {
return Result.error(err);
}
mesXslMixerActionService.fillEquipmentName(model);
if (StringUtils.isBlank(model.getEquipmentName())) {
return Result.error("请选择有效的设备名称");
}
mesXslMixerActionService.save(model);
return Result.OK("添加成功!");
}
@AutoLog(value = "密炼机动作维护-编辑")
@Operation(summary = "密炼机动作维护-编辑")
@RequiresPermissions("xslmes:mes_xsl_mixer_action:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody MesXslMixerAction model) {
String err = validateForSave(model, model.getId());
if (err != null) {
return Result.error(err);
}
mesXslMixerActionService.fillEquipmentName(model);
if (StringUtils.isBlank(model.getEquipmentName())) {
return Result.error("请选择有效的设备名称");
}
mesXslMixerActionService.updateById(model);
return Result.OK("编辑成功!");
}
@AutoLog(value = "密炼机动作维护-通过id删除")
@Operation(summary = "密炼机动作维护-通过id删除")
@RequiresPermissions("xslmes:mes_xsl_mixer_action:delete")
@DeleteMapping("/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
mesXslMixerActionService.removeById(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "密炼机动作维护-批量删除")
@Operation(summary = "密炼机动作维护-批量删除")
@RequiresPermissions("xslmes:mes_xsl_mixer_action:deleteBatch")
@DeleteMapping("/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
mesXslMixerActionService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@Operation(summary = "密炼机动作维护-通过id查询")
@GetMapping("/queryById")
public Result<MesXslMixerAction> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslMixerAction entity = mesXslMixerActionService.getById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@Operation(summary = "校验动作名称是否重复")
@GetMapping("/checkActionName")
public Result<String> checkActionName(
@RequestParam(name = "actionName", required = true) String actionName,
@RequestParam(name = "dataId", required = false) String dataId) {
if (oConvertUtils.isEmpty(actionName) || actionName.trim().isEmpty()) {
return Result.OK("该值可用!");
}
if (mesXslMixerActionService.isActionNameDuplicated(actionName, dataId)) {
return Result.error("动作名称不能重复");
}
return Result.OK("该值可用!");
}
@Operation(summary = "校验动作代号是否重复")
@GetMapping("/checkActionCode")
public Result<String> checkActionCode(
@RequestParam(name = "actionCode", required = true) String actionCode,
@RequestParam(name = "dataId", required = false) String dataId) {
if (oConvertUtils.isEmpty(actionCode) || actionCode.trim().isEmpty()) {
return Result.OK("该值可用!");
}
if (mesXslMixerActionService.isActionCodeDuplicated(actionCode, dataId)) {
return Result.error("动作代号不能重复");
}
return Result.OK("该值可用!");
}
@RequiresPermissions("xslmes:mes_xsl_mixer_action:exportXls")
@RequestMapping("/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslMixerAction model) {
return super.exportXls(request, model, MesXslMixerAction.class, "密炼机动作维护");
}
private String validateForSave(MesXslMixerAction model, String excludeId) {
if (oConvertUtils.isEmpty(model.getEquipmentId()) || StringUtils.isBlank(model.getEquipmentId())) {
return "设备名称不能为空";
}
model.setEquipmentId(model.getEquipmentId().trim());
if (oConvertUtils.isEmpty(model.getActionName()) || StringUtils.isBlank(model.getActionName())) {
return "动作名称不能为空";
}
model.setActionName(model.getActionName().trim());
if (mesXslMixerActionService.isActionNameDuplicated(model.getActionName(), excludeId)) {
return "动作名称不能重复";
}
if (oConvertUtils.isEmpty(model.getActionCode()) || StringUtils.isBlank(model.getActionCode())) {
return "动作代号不能为空";
}
model.setActionCode(model.getActionCode().trim());
if (mesXslMixerActionService.isActionCodeDuplicated(model.getActionCode(), excludeId)) {
return "动作代号不能重复";
}
return null;
}
}

View File

@@ -0,0 +1,168 @@
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.Arrays;
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.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslMixerCondition;
import org.jeecg.modules.xslmes.service.IMesXslMixerConditionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RequestMethod;
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/mesXslMixerCondition")
public class MesXslMixerConditionController
extends JeecgController<MesXslMixerCondition, IMesXslMixerConditionService> {
@Autowired private IMesXslMixerConditionService mesXslMixerConditionService;
@Operation(summary = "密炼机条件维护-分页列表查询")
@GetMapping("/list")
public Result<IPage<MesXslMixerCondition>> queryPageList(
MesXslMixerCondition model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslMixerCondition> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
IPage<MesXslMixerCondition> pageList = mesXslMixerConditionService.page(new Page<>(pageNo, pageSize), queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "密炼机条件维护-添加")
@Operation(summary = "密炼机条件维护-添加")
@RequiresPermissions("xslmes:mes_xsl_mixer_condition:add")
@PostMapping("/add")
public Result<String> add(@RequestBody MesXslMixerCondition model) {
String err = validateForSave(model, null);
if (err != null) {
return Result.error(err);
}
mesXslMixerConditionService.fillEquipmentName(model);
if (StringUtils.isBlank(model.getEquipmentName())) {
return Result.error("请选择有效的设备名称");
}
mesXslMixerConditionService.save(model);
return Result.OK("添加成功!");
}
@AutoLog(value = "密炼机条件维护-编辑")
@Operation(summary = "密炼机条件维护-编辑")
@RequiresPermissions("xslmes:mes_xsl_mixer_condition:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody MesXslMixerCondition model) {
String err = validateForSave(model, model.getId());
if (err != null) {
return Result.error(err);
}
mesXslMixerConditionService.fillEquipmentName(model);
if (StringUtils.isBlank(model.getEquipmentName())) {
return Result.error("请选择有效的设备名称");
}
mesXslMixerConditionService.updateById(model);
return Result.OK("编辑成功!");
}
@AutoLog(value = "密炼机条件维护-通过id删除")
@Operation(summary = "密炼机条件维护-通过id删除")
@RequiresPermissions("xslmes:mes_xsl_mixer_condition:delete")
@DeleteMapping("/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
mesXslMixerConditionService.removeById(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "密炼机条件维护-批量删除")
@Operation(summary = "密炼机条件维护-批量删除")
@RequiresPermissions("xslmes:mes_xsl_mixer_condition:deleteBatch")
@DeleteMapping("/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
mesXslMixerConditionService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@Operation(summary = "密炼机条件维护-通过id查询")
@GetMapping("/queryById")
public Result<MesXslMixerCondition> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslMixerCondition entity = mesXslMixerConditionService.getById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@Operation(summary = "校验条件名称是否重复")
@GetMapping("/checkConditionName")
public Result<String> checkConditionName(
@RequestParam(name = "conditionName", required = true) String conditionName,
@RequestParam(name = "dataId", required = false) String dataId) {
if (oConvertUtils.isEmpty(conditionName) || conditionName.trim().isEmpty()) {
return Result.OK("该值可用!");
}
if (mesXslMixerConditionService.isConditionNameDuplicated(conditionName, dataId)) {
return Result.error("条件名称不能重复");
}
return Result.OK("该值可用!");
}
@Operation(summary = "校验条件代码是否重复")
@GetMapping("/checkConditionCode")
public Result<String> checkConditionCode(
@RequestParam(name = "conditionCode", required = true) String conditionCode,
@RequestParam(name = "dataId", required = false) String dataId) {
if (oConvertUtils.isEmpty(conditionCode) || conditionCode.trim().isEmpty()) {
return Result.OK("该值可用!");
}
if (mesXslMixerConditionService.isConditionCodeDuplicated(conditionCode, dataId)) {
return Result.error("条件代码不能重复");
}
return Result.OK("该值可用!");
}
@RequiresPermissions("xslmes:mes_xsl_mixer_condition:exportXls")
@RequestMapping("/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslMixerCondition model) {
return super.exportXls(request, model, MesXslMixerCondition.class, "密炼机条件维护");
}
private String validateForSave(MesXslMixerCondition model, String excludeId) {
if (oConvertUtils.isEmpty(model.getEquipmentId()) || StringUtils.isBlank(model.getEquipmentId())) {
return "设备名称不能为空";
}
model.setEquipmentId(model.getEquipmentId().trim());
if (oConvertUtils.isEmpty(model.getConditionName()) || StringUtils.isBlank(model.getConditionName())) {
return "条件名称不能为空";
}
model.setConditionName(model.getConditionName().trim());
if (mesXslMixerConditionService.isConditionNameDuplicated(model.getConditionName(), excludeId)) {
return "条件名称不能重复";
}
if (oConvertUtils.isEmpty(model.getConditionCode()) || StringUtils.isBlank(model.getConditionCode())) {
return "条件代码不能为空";
}
model.setConditionCode(model.getConditionCode().trim());
if (mesXslMixerConditionService.isConditionCodeDuplicated(model.getConditionCode(), excludeId)) {
return "条件代码不能重复";
}
return null;
}
}

View File

@@ -0,0 +1,100 @@
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.Arrays;
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.MesXslProductionOrder;
import org.jeecg.modules.xslmes.service.IMesXslProductionOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RequestMethod;
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/mesXslProductionOrder")
public class MesXslProductionOrderController
extends JeecgController<MesXslProductionOrder, IMesXslProductionOrderService> {
@Autowired private IMesXslProductionOrderService mesXslProductionOrderService;
@Operation(summary = "生产订单-分页列表查询")
@GetMapping("/list")
public Result<IPage<MesXslProductionOrder>> queryPageList(
MesXslProductionOrder model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslProductionOrder> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
IPage<MesXslProductionOrder> pageList = mesXslProductionOrderService.page(new Page<>(pageNo, pageSize), queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "生产订单-添加")
@Operation(summary = "生产订单-添加")
@RequiresPermissions("xslmes:mes_xsl_production_order:add")
@PostMapping("/add")
public Result<String> add(@RequestBody MesXslProductionOrder model) {
mesXslProductionOrderService.save(model);
return Result.OK("添加成功!");
}
@AutoLog(value = "生产订单-编辑")
@Operation(summary = "生产订单-编辑")
@RequiresPermissions("xslmes:mes_xsl_production_order:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody MesXslProductionOrder model) {
mesXslProductionOrderService.updateById(model);
return Result.OK("编辑成功!");
}
@AutoLog(value = "生产订单-通过id删除")
@Operation(summary = "生产订单-通过id删除")
@RequiresPermissions("xslmes:mes_xsl_production_order:delete")
@DeleteMapping("/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
mesXslProductionOrderService.removeById(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "生产订单-批量删除")
@Operation(summary = "生产订单-批量删除")
@RequiresPermissions("xslmes:mes_xsl_production_order:deleteBatch")
@DeleteMapping("/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
mesXslProductionOrderService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@Operation(summary = "生产订单-通过id查询")
@GetMapping("/queryById")
public Result<MesXslProductionOrder> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslProductionOrder entity = mesXslProductionOrderService.getById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@RequiresPermissions("xslmes:mes_xsl_production_order:exportXls")
@RequestMapping("/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslProductionOrder model) {
return super.exportXls(request, model, MesXslProductionOrder.class, "生产订单");
}
}

View File

@@ -0,0 +1,90 @@
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 日罐物料对应信息
*/
@Data
@TableName("mes_xsl_day_tank_material_map")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES日罐物料对应信息")
public class MesXslDayTankMaterialMap implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
@Excel(name = "机台名称", width = 20, dictTable = "mes_xsl_equipment_ledger", dicText = "equipment_name", dicCode = "id")
@Dict(dictTable = "mes_xsl_equipment_ledger", dicText = "equipment_name", dicCode = "id")
@Schema(description = "设备台账ID")
private String equipmentId;
@Excel(name = "机台代码", width = 20)
@Schema(description = "机台代码(设备编号冗余)")
private String machineCode;
@Excel(name = "机台名称", width = 20)
@Schema(description = "机台名称冗余")
private String machineName;
@Excel(name = "料仓分类", width = 20, dictTable = "sys_category", dicText = "name", dicCode = "id")
@Dict(dictTable = "sys_category", dicText = "name", dicCode = "id")
@Schema(description = "料仓分类ID分类字典")
private String siloCategoryId;
@Excel(name = "工位", width = 20)
@Schema(description = "工位")
private String station;
@Excel(name = "料仓号", width = 20)
@Schema(description = "料仓号")
private String siloNo;
@Excel(name = "物料名称", width = 20, dictTable = "mes_material", dicText = "material_name", dicCode = "id")
@Dict(dictTable = "mes_material", dicText = "material_name", dicCode = "id")
@Schema(description = "胶料信息ID")
private String materialId;
@Excel(name = "物料名称", width = 20)
@Schema(description = "物料名称冗余")
private String materialName;
@Excel(name = "使用状态", width = 12, replace = {"使用中_1", "停用_0"})
@Schema(description = "使用状态1使用中 0停用")
private Integer useStatus;
@Excel(name = "是否允许同步", width = 12, replace = {"允许_1", "不允许_0"})
@Schema(description = "是否允许同步1允许 0不允许")
private Integer allowSync;
private Integer tenantId;
private String sysOrgCode;
private String createBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
private String updateBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
private Integer delFlag;
}

View File

@@ -0,0 +1,65 @@
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;
/**
* MES 设备点检配置主表(表 mes_xsl_equip_inspect_config
*/
@Data
@TableName("mes_xsl_equip_inspect_config")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES设备点检配置")
public class MesXslEquipInspectConfig implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
@Schema(description = "设备台账主键 mes_xsl_equipment_ledger.id")
private String equipmentLedgerId;
@Excel(name = "设备名称", width = 22)
@Schema(description = "设备名称冗余")
private String equipmentName;
@Excel(name = "设备编号", width = 18)
@Schema(description = "设备编号冗余")
private String equipmentCode;
@Excel(name = "类型", width = 12, dicCode = "xslmes_im_item_category")
@Dict(dicCode = "xslmes_im_item_category")
@Schema(description = "配置类型字典xslmes_im_item_categoryinspect点检/maintain保养同设备同类型唯一")
private String configType;
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;
@TableField(exist = false)
@Schema(description = "点检项目明细")
private List<MesXslEquipInspectConfigLine> lineList;
}

View File

@@ -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.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.springframework.format.annotation.DateTimeFormat;
/**
* MES 设备点检配置明细(表 mes_xsl_equip_inspect_config_line
*/
@Data
@TableName("mes_xsl_equip_inspect_config_line")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES设备点检配置明细")
public class MesXslEquipInspectConfigLine implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
@Schema(description = "主表主键 mes_xsl_equip_inspect_config.id")
private String configId;
@Schema(description = "点检及保养项目主键 mes_xsl_inspect_maintain_item.id")
private String inspectMaintainItemId;
@Schema(description = "点检项目编号冗余")
private String itemCode;
@Schema(description = "项目名称冗余")
private String itemName;
@Dict(dicCode = "xslmes_im_item_category")
@Schema(description = "项目类别冗余")
private String itemCategory;
@Dict(dicCode = "xslmes_im_item_type")
@Schema(description = "项目类型冗余")
private String itemType;
@Schema(description = "设备部位名称冗余")
private String equipmentPartName;
@Schema(description = "设备小部位名称冗余")
private String equipmentSubPartName;
@Dict(dicCode = "xslmes_im_inspect_method")
@Schema(description = "点检方式冗余")
private String inspectMethod;
@Schema(description = "判断基准冗余")
private String judgmentCriteria;
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;
}

View File

@@ -0,0 +1,126 @@
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;
/**
* MES 点检/保养记录主表(表 mes_xsl_equip_inspect_record
*/
@Data
@TableName("mes_xsl_equip_inspect_record")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES点检保养记录")
public class MesXslEquipInspectRecord implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
@Excel(name = "记录编号", width = 20)
@Schema(description = "记录编号 EC+yyyyMMdd+4位流水")
private String recordNo;
@Excel(name = "计划单号", width = 18)
@Schema(description = "计划单号")
private String planNo;
@Schema(description = "计划主键")
private String planId;
@Schema(description = "设备台账主键")
private String equipmentLedgerId;
@Excel(name = "设备编码", width = 16)
@Schema(description = "设备编码冗余")
private String equipmentCode;
@Excel(name = "设备名称", width = 20)
@Schema(description = "设备名称冗余")
private String equipmentName;
@Schema(description = "设备点检配置主键")
private String equipInspectConfigId;
@Excel(name = "类型", width = 10, dicCode = "xslmes_im_item_category")
@Dict(dicCode = "xslmes_im_item_category")
@Schema(description = "点检/保养类型")
private String recordType;
@Excel(name = "点检日期", width = 12, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Schema(description = "点检日期")
private Date inspectDate;
@Schema(description = "点检人用户ID")
private String inspectorUserId;
@Schema(description = "点检人账号")
private String inspectorUsername;
@Excel(name = "点检人", width = 12)
@Schema(description = "点检人姓名")
private String inspectorRealname;
@Excel(name = "点检结果", width = 10, dicCode = "xslmes_im_inspect_result")
@Dict(dicCode = "xslmes_im_inspect_result")
@Schema(description = "点检结果 pass/fail")
private String inspectResult;
@Excel(name = "状态", width = 10, dicCode = "xslmes_im_record_status")
@Dict(dicCode = "xslmes_im_record_status")
@Schema(description = "记录状态 pending/done")
private String recordStatus;
@Excel(name = "是否已处理", width = 10, dicCode = "yn")
@Dict(dicCode = "yn")
@Schema(description = "是否已处理字典yn1是0否不合格记录使用")
private String handledFlag;
@Schema(description = "处理人用户ID")
private String handlerUserId;
@Schema(description = "处理人账号")
private String handlerUsername;
@Excel(name = "处理人", width = 12)
@Schema(description = "处理人姓名")
private String handlerRealname;
@Excel(name = "处理时间", width = 18, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "处理时间")
private Date handleTime;
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;
@TableField(exist = false)
@Schema(description = "点检明细")
private List<MesXslEquipInspectRecordLine> lineList;
}

View File

@@ -0,0 +1,82 @@
package org.jeecg.modules.xslmes.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.springframework.format.annotation.DateTimeFormat;
/**
* MES 点检/保养记录明细(表 mes_xsl_equip_inspect_record_line
*/
@Data
@TableName("mes_xsl_equip_inspect_record_line")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES点检保养记录明细")
public class MesXslEquipInspectRecordLine implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
@Schema(description = "主表主键")
private String recordId;
@Schema(description = "设备点检配置明细主键")
private String equipInspectConfigLineId;
@Schema(description = "点检及保养项目主键冗余")
private String inspectMaintainItemId;
@Schema(description = "点检项目编号")
private String itemCode;
@Schema(description = "项目名称")
private String itemName;
@Dict(dicCode = "xslmes_im_item_category")
@Schema(description = "项目类别")
private String itemCategory;
@Dict(dicCode = "xslmes_im_item_type")
@Schema(description = "项目类型")
private String itemType;
@Schema(description = "设备部位")
private String equipmentPartName;
@Schema(description = "设备小部位")
private String equipmentSubPartName;
@Dict(dicCode = "xslmes_im_inspect_method")
@Schema(description = "点检方式")
private String inspectMethod;
@Schema(description = "判断基准")
private String judgmentCriteria;
@Schema(description = "明细点检结果文本")
private String lineInspectResult;
@Schema(description = "图片路径,逗号分隔")
private String pictureFiles;
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;
}

View File

@@ -0,0 +1,68 @@
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 密炼机动作维护
*/
@Data
@TableName("mes_xsl_mixer_action")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES密炼机动作维护")
public class MesXslMixerAction implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
@Excel(name = "设备名称", width = 20, dictTable = "mes_xsl_equipment_ledger", dicText = "equipment_name", dicCode = "id")
@Dict(dictTable = "mes_xsl_equipment_ledger", dicText = "equipment_name", dicCode = "id")
@Schema(description = "设备台账ID")
private String equipmentId;
@Excel(name = "设备名称", width = 20)
@Schema(description = "设备名称冗余")
private String equipmentName;
@Excel(name = "动作名称", width = 20)
@Schema(description = "动作名称")
private String actionName;
@Excel(name = "动作代号", width = 20)
@Schema(description = "动作代号")
private String actionCode;
@Excel(name = "备注", width = 30)
@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;
}

View File

@@ -0,0 +1,68 @@
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 密炼机条件维护
*/
@Data
@TableName("mes_xsl_mixer_condition")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES密炼机条件维护")
public class MesXslMixerCondition implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
@Excel(name = "设备名称", width = 20, dictTable = "mes_xsl_equipment_ledger", dicText = "equipment_name", dicCode = "id")
@Dict(dictTable = "mes_xsl_equipment_ledger", dicText = "equipment_name", dicCode = "id")
@Schema(description = "设备台账ID")
private String equipmentId;
@Excel(name = "设备名称", width = 20)
@Schema(description = "设备名称冗余")
private String equipmentName;
@Excel(name = "条件名称", width = 20)
@Schema(description = "条件名称")
private String conditionName;
@Excel(name = "条件代码", width = 20)
@Schema(description = "条件代码")
private String conditionCode;
@Excel(name = "备注", width = 30)
@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;
}

View File

@@ -0,0 +1,82 @@
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.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
/**
* MES 生产订单
*/
@Data
@TableName("mes_xsl_production_order")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES生产订单")
public class MesXslProductionOrder implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
@Excel(name = "销售订单号", width = 20)
private String salesOrderNo;
@Excel(name = "生产订单号", width = 20)
private String productionOrderNo;
@Excel(name = "订单日期", width = 20, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date orderDate;
@Excel(name = "生产车间", width = 20)
private String productionWorkshop;
@Excel(name = "加工段数", width = 12)
private Integer processSegmentCount;
@Excel(name = "物料编号", width = 20)
private String materialCode;
@Excel(name = "MES胶料名称", width = 20)
private String mesMaterialName;
@Excel(name = "金蝶物料名称", width = 20)
private String kingdeeMaterialName;
@Excel(name = "金蝶物料规格", width = 20)
private String kingdeeMaterialSpec;
@Excel(name = "计划数量", width = 15)
private BigDecimal planQty;
@Excel(name = "拆分状态", width = 12, replace = {"已拆分_1", "未拆分_0"})
private Integer splitStatus;
private Integer tenantId;
private String sysOrgCode;
private String createBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
private String updateBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
private Integer delFlag;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
/**
* MES XSL 业务模块Maven 工程名jeecg-module-xslmes
* 包含:客户管理({@link org.jeecg.modules.xslmes.entity.MesXslCustomer})、工序管理({@link org.jeecg.modules.xslmes.entity.MesXslProcessOperation})、设备类别({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentCategory})、设备类型({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentType})、设备台账({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger})、设备部位({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentPart})、设备小部位({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentSubPart})、点检及保养项目({@link org.jeecg.modules.xslmes.entity.MesXslInspectMaintainItem})、备品件类别({@link org.jeecg.modules.xslmes.entity.MesXslSparePartsCategory})、备品件信息({@link org.jeecg.modules.xslmes.entity.MesXslSparePart})、厂家信息({@link org.jeecg.modules.xslmes.entity.MesXslManufacturer})、停机主类型({@link org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType})、停机类型({@link org.jeecg.modules.xslmes.entity.MesXslDowntimeType})等。
* 包含:客户管理({@link org.jeecg.modules.xslmes.entity.MesXslCustomer})、工序管理({@link org.jeecg.modules.xslmes.entity.MesXslProcessOperation})、设备类别({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentCategory})、设备类型({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentType})、设备台账({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger})、设备部位({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentPart})、设备小部位({@link org.jeecg.modules.xslmes.entity.MesXslEquipmentSubPart})、点检及保养项目({@link org.jeecg.modules.xslmes.entity.MesXslInspectMaintainItem})、设备点检配置({@link org.jeecg.modules.xslmes.entity.MesXslEquipInspectConfig})、备品件类别({@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;

View File

@@ -0,0 +1,12 @@
package org.jeecg.modules.xslmes.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.xslmes.entity.MesXslDayTankMaterialMap;
public interface IMesXslDayTankMaterialMapService extends IService<MesXslDayTankMaterialMap> {
/**
* 由选择类字段ID回填冗余展示信息机台代码/机台名称/物料名称)
*/
void fillReferenceFields(MesXslDayTankMaterialMap model);
}

View File

@@ -0,0 +1,23 @@
package org.jeecg.modules.xslmes.service;
import com.baomidou.mybatisplus.extension.service.IService;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import org.jeecg.modules.xslmes.entity.MesXslEquipInspectConfig;
import org.jeecg.modules.xslmes.entity.MesXslEquipInspectConfigLine;
public interface IMesXslEquipInspectConfigService extends IService<MesXslEquipInspectConfig> {
void saveMain(MesXslEquipInspectConfig main, List<MesXslEquipInspectConfigLine> lineList);
void updateMain(MesXslEquipInspectConfig main, List<MesXslEquipInspectConfigLine> lineList);
void delMain(String id);
void delBatchMain(Collection<? extends Serializable> idList);
List<MesXslEquipInspectConfigLine> selectLinesByConfigId(String configId);
boolean isConfigDuplicated(String equipmentLedgerId, String configType, String excludeId, MesXslEquipInspectConfig context);
}

View File

@@ -0,0 +1,34 @@
package org.jeecg.modules.xslmes.service;
import com.baomidou.mybatisplus.extension.service.IService;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import org.jeecg.modules.xslmes.entity.MesXslEquipInspectRecord;
import org.jeecg.modules.xslmes.entity.MesXslEquipInspectRecordLine;
import org.jeecg.modules.xslmes.vo.MesXslEquipInspectRecordBatchCreateResult;
import org.jeecg.modules.xslmes.vo.MesXslEquipInspectRecordHandleDTO;
public interface IMesXslEquipInspectRecordService extends IService<MesXslEquipInspectRecord> {
void saveMain(MesXslEquipInspectRecord main, List<MesXslEquipInspectRecordLine> lineList);
void updateMain(MesXslEquipInspectRecord main, List<MesXslEquipInspectRecordLine> lineList);
void delMain(String id);
void delBatchMain(Collection<? extends Serializable> idList);
List<MesXslEquipInspectRecordLine> selectLinesByRecordId(String recordId);
String generateRecordNo(MesXslEquipInspectRecord context);
List<MesXslEquipInspectRecordLine> buildLinesFromEquipConfig(String equipmentLedgerId, String recordType);
MesXslEquipInspectRecordBatchCreateResult batchCreateFromEquipment(
List<String> equipmentLedgerIds, String recordType, MesXslEquipInspectRecord inspectorContext);
//update-begin---author:jiangxh ---date:20260521 for【MES】不合格点检记录登记处理人及处理时间-----------
void handleFailRecord(MesXslEquipInspectRecordHandleDTO dto);
//update-end---author:jiangxh ---date:20260521 for【MES】不合格点检记录登记处理人及处理时间-----------
}

View File

@@ -0,0 +1,13 @@
package org.jeecg.modules.xslmes.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.xslmes.entity.MesXslMixerAction;
public interface IMesXslMixerActionService extends IService<MesXslMixerAction> {
boolean isActionNameDuplicated(String actionName, String excludeId);
boolean isActionCodeDuplicated(String actionCode, String excludeId);
void fillEquipmentName(MesXslMixerAction model);
}

View File

@@ -0,0 +1,13 @@
package org.jeecg.modules.xslmes.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.xslmes.entity.MesXslMixerCondition;
public interface IMesXslMixerConditionService extends IService<MesXslMixerCondition> {
void fillEquipmentName(MesXslMixerCondition model);
boolean isConditionNameDuplicated(String conditionName, String excludeId);
boolean isConditionCodeDuplicated(String conditionCode, String excludeId);
}

View File

@@ -0,0 +1,6 @@
package org.jeecg.modules.xslmes.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.xslmes.entity.MesXslProductionOrder;
public interface IMesXslProductionOrderService extends IService<MesXslProductionOrder> {}

View File

@@ -0,0 +1,56 @@
package org.jeecg.modules.xslmes.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.modules.mes.material.entity.MesMaterial;
import org.jeecg.modules.mes.material.mapper.MesMaterialMapper;
import org.jeecg.modules.xslmes.entity.MesXslDayTankMaterialMap;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
import org.jeecg.modules.xslmes.mapper.MesXslDayTankMaterialMapMapper;
import org.jeecg.modules.xslmes.mapper.MesXslEquipmentLedgerMapper;
import org.jeecg.modules.xslmes.service.IMesXslDayTankMaterialMapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class MesXslDayTankMaterialMapServiceImpl
extends ServiceImpl<MesXslDayTankMaterialMapMapper, MesXslDayTankMaterialMap>
implements IMesXslDayTankMaterialMapService {
@Autowired private MesXslEquipmentLedgerMapper equipmentLedgerMapper;
@Autowired private MesMaterialMapper mesMaterialMapper;
@Override
public void fillReferenceFields(MesXslDayTankMaterialMap model) {
if (model == null) {
return;
}
fillEquipmentFields(model);
fillMaterialFields(model);
}
private void fillEquipmentFields(MesXslDayTankMaterialMap model) {
if (StringUtils.isBlank(model.getEquipmentId())) {
model.setMachineCode(null);
model.setMachineName(null);
return;
}
MesXslEquipmentLedger equipment = equipmentLedgerMapper.selectById(model.getEquipmentId().trim());
if (equipment == null) {
model.setMachineCode(null);
model.setMachineName(null);
return;
}
model.setMachineCode(equipment.getEquipmentCode());
model.setMachineName(equipment.getEquipmentName());
}
private void fillMaterialFields(MesXslDayTankMaterialMap model) {
if (StringUtils.isBlank(model.getMaterialId())) {
model.setMaterialName(null);
return;
}
MesMaterial material = mesMaterialMapper.selectById(model.getMaterialId().trim());
model.setMaterialName(material == null ? null : material.getMaterialName());
}
}

View File

@@ -0,0 +1,132 @@
package org.jeecg.modules.xslmes.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import org.jeecg.common.config.TenantContext;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.common.util.TokenUtils;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslEquipInspectConfig;
import org.jeecg.modules.xslmes.entity.MesXslEquipInspectConfigLine;
import org.jeecg.modules.xslmes.mapper.MesXslEquipInspectConfigLineMapper;
import org.jeecg.modules.xslmes.mapper.MesXslEquipInspectConfigMapper;
import org.jeecg.modules.xslmes.service.IMesXslEquipInspectConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@Service
public class MesXslEquipInspectConfigServiceImpl
extends ServiceImpl<MesXslEquipInspectConfigMapper, MesXslEquipInspectConfig>
implements IMesXslEquipInspectConfigService {
@Autowired
private MesXslEquipInspectConfigLineMapper mesXslEquipInspectConfigLineMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public void saveMain(MesXslEquipInspectConfig main, List<MesXslEquipInspectConfigLine> lineList) {
this.save(main);
insertLines(main.getId(), lineList);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateMain(MesXslEquipInspectConfig main, List<MesXslEquipInspectConfigLine> lineList) {
this.updateById(main);
mesXslEquipInspectConfigLineMapper.delete(
new LambdaQueryWrapper<MesXslEquipInspectConfigLine>()
.eq(MesXslEquipInspectConfigLine::getConfigId, main.getId()));
insertLines(main.getId(), lineList);
}
private void insertLines(String configId, List<MesXslEquipInspectConfigLine> lineList) {
if (CollectionUtils.isEmpty(lineList)) {
return;
}
int sort = 0;
for (MesXslEquipInspectConfigLine line : lineList) {
line.setId(null);
line.setConfigId(configId);
line.setSortNo(sort++);
mesXslEquipInspectConfigLineMapper.insert(line);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delMain(String id) {
mesXslEquipInspectConfigLineMapper.delete(
new LambdaQueryWrapper<MesXslEquipInspectConfigLine>().eq(MesXslEquipInspectConfigLine::getConfigId, id));
this.removeById(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delBatchMain(Collection<? extends Serializable> idList) {
for (Serializable id : idList) {
delMain(id.toString());
}
}
@Override
public List<MesXslEquipInspectConfigLine> selectLinesByConfigId(String configId) {
return mesXslEquipInspectConfigLineMapper.selectList(
new LambdaQueryWrapper<MesXslEquipInspectConfigLine>()
.eq(MesXslEquipInspectConfigLine::getConfigId, configId)
.orderByAsc(MesXslEquipInspectConfigLine::getSortNo));
}
//update-begin---author:jiangxh ---date:20260519 for【MES】设备点检配置同设备同类型点检/保养)仅允许一条主数据-----------
@Override
public boolean isConfigDuplicated(
String equipmentLedgerId, String configType, String excludeId, MesXslEquipInspectConfig context) {
if (oConvertUtils.isEmpty(equipmentLedgerId) || oConvertUtils.isEmpty(configType)) {
return false;
}
Integer tenantId = resolveTenantId(context);
LambdaQueryWrapper<MesXslEquipInspectConfig> w = new LambdaQueryWrapper<>();
w.eq(MesXslEquipInspectConfig::getEquipmentLedgerId, equipmentLedgerId.trim());
w.eq(MesXslEquipInspectConfig::getConfigType, configType.trim());
w.and(
q ->
q.eq(MesXslEquipInspectConfig::getDelFlag, CommonConstant.DEL_FLAG_0)
.or()
.isNull(MesXslEquipInspectConfig::getDelFlag));
if (oConvertUtils.isNotEmpty(excludeId)) {
w.ne(MesXslEquipInspectConfig::getId, excludeId);
}
if (tenantId != null) {
w.eq(MesXslEquipInspectConfig::getTenantId, tenantId);
}
return this.count(w) > 0;
}
private static Integer resolveTenantId(MesXslEquipInspectConfig 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) {
// ignore
}
}
if (oConvertUtils.isEmpty(ts)) {
return null;
}
try {
return Integer.parseInt(ts);
} catch (NumberFormatException e) {
return null;
}
}
//update-end---author:jiangxh ---date:20260519 for【MES】设备点检配置同设备同类型点检/保养)仅允许一条主数据-----------
}

View File

@@ -0,0 +1,312 @@
package org.jeecg.modules.xslmes.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
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.MesXslEquipInspectConfig;
import org.jeecg.modules.xslmes.entity.MesXslEquipInspectConfigLine;
import org.jeecg.modules.xslmes.entity.MesXslEquipInspectRecord;
import org.jeecg.modules.xslmes.entity.MesXslEquipInspectRecordLine;
import org.jeecg.modules.xslmes.mapper.MesXslEquipInspectRecordLineMapper;
import org.jeecg.modules.xslmes.mapper.MesXslEquipInspectRecordMapper;
import org.jeecg.modules.xslmes.service.IMesXslEquipInspectConfigService;
import org.jeecg.modules.xslmes.service.IMesXslEquipInspectRecordService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentLedgerService;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
import org.jeecg.modules.xslmes.util.MesXslEquipInspectBizMsg;
import org.jeecg.modules.xslmes.vo.MesXslEquipInspectRecordBatchCreateResult;
import org.jeecg.modules.xslmes.vo.MesXslEquipInspectRecordHandleDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@Service
public class MesXslEquipInspectRecordServiceImpl
extends ServiceImpl<MesXslEquipInspectRecordMapper, MesXslEquipInspectRecord>
implements IMesXslEquipInspectRecordService {
@Autowired
private MesXslEquipInspectRecordLineMapper mesXslEquipInspectRecordLineMapper;
@Autowired
private IMesXslEquipInspectConfigService mesXslEquipInspectConfigService;
@Autowired
private IMesXslEquipmentLedgerService mesXslEquipmentLedgerService;
@Override
@Transactional(rollbackFor = Exception.class)
public void saveMain(MesXslEquipInspectRecord main, List<MesXslEquipInspectRecordLine> lineList) {
this.save(main);
insertLines(main.getId(), lineList);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateMain(MesXslEquipInspectRecord main, List<MesXslEquipInspectRecordLine> lineList) {
this.updateById(main);
mesXslEquipInspectRecordLineMapper.delete(
new LambdaQueryWrapper<MesXslEquipInspectRecordLine>()
.eq(MesXslEquipInspectRecordLine::getRecordId, main.getId()));
insertLines(main.getId(), lineList);
}
private void insertLines(String recordId, List<MesXslEquipInspectRecordLine> lineList) {
if (CollectionUtils.isEmpty(lineList)) {
return;
}
int sort = 0;
for (MesXslEquipInspectRecordLine line : lineList) {
line.setId(null);
line.setRecordId(recordId);
line.setSortNo(sort++);
mesXslEquipInspectRecordLineMapper.insert(line);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delMain(String id) {
mesXslEquipInspectRecordLineMapper.delete(
new LambdaQueryWrapper<MesXslEquipInspectRecordLine>().eq(MesXslEquipInspectRecordLine::getRecordId, id));
this.removeById(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delBatchMain(Collection<? extends Serializable> idList) {
for (Serializable id : idList) {
delMain(id.toString());
}
}
@Override
public List<MesXslEquipInspectRecordLine> selectLinesByRecordId(String recordId) {
return mesXslEquipInspectRecordLineMapper.selectList(
new LambdaQueryWrapper<MesXslEquipInspectRecordLine>()
.eq(MesXslEquipInspectRecordLine::getRecordId, recordId)
.orderByAsc(MesXslEquipInspectRecordLine::getSortNo));
}
//update-begin---author:jiangxh ---date:20260520 for【MES】点检保养记录编号 EC+日期+4位流水-----------
@Override
public String generateRecordNo(MesXslEquipInspectRecord context) {
String dateStr = new SimpleDateFormat("yyyyMMdd").format(new Date());
String prefix = "EC" + dateStr;
Integer tenantId = resolveTenantId(context);
LambdaQueryWrapper<MesXslEquipInspectRecord> qw = new LambdaQueryWrapper<>();
qw.likeRight(MesXslEquipInspectRecord::getRecordNo, prefix);
qw.and(
q ->
q.eq(MesXslEquipInspectRecord::getDelFlag, CommonConstant.DEL_FLAG_0)
.or()
.isNull(MesXslEquipInspectRecord::getDelFlag));
if (tenantId != null) {
qw.eq(MesXslEquipInspectRecord::getTenantId, tenantId);
}
qw.select(MesXslEquipInspectRecord::getRecordNo);
qw.orderByDesc(MesXslEquipInspectRecord::getRecordNo);
qw.last("LIMIT 1");
MesXslEquipInspectRecord last = this.getOne(qw, false);
int nextSeq = 1;
if (last != null && oConvertUtils.isNotEmpty(last.getRecordNo()) && last.getRecordNo().length() >= prefix.length() + 4) {
String suffix = last.getRecordNo().substring(prefix.length());
try {
nextSeq = Integer.parseInt(suffix) + 1;
} catch (NumberFormatException ignored) {
nextSeq = (int) this.count(qw) + 1;
}
}
return prefix + String.format("%04d", nextSeq);
}
//update-end---author:jiangxh ---date:20260520 for【MES】点检保养记录编号 EC+日期+4位流水-----------
//update-begin---author:jiangxh ---date:20260520 for【MES】点检保养记录从设备点检配置带出明细-----------
@Override
public List<MesXslEquipInspectRecordLine> buildLinesFromEquipConfig(String equipmentLedgerId, String recordType) {
if (oConvertUtils.isEmpty(equipmentLedgerId) || oConvertUtils.isEmpty(recordType)) {
return List.of();
}
String type = recordType.trim();
MesXslEquipInspectConfig config = findEquipInspectConfig(equipmentLedgerId.trim(), type);
if (config == null) {
return List.of();
}
List<MesXslEquipInspectConfigLine> configLines =
mesXslEquipInspectConfigService.selectLinesByConfigId(config.getId());
if (CollectionUtils.isEmpty(configLines)) {
return List.of();
}
return buildRecordLinesFromConfigLines(configLines);
}
private MesXslEquipInspectConfig findEquipInspectConfig(String equipmentLedgerId, String configType) {
LambdaQueryWrapper<MesXslEquipInspectConfig> cw = new LambdaQueryWrapper<>();
cw.eq(MesXslEquipInspectConfig::getEquipmentLedgerId, equipmentLedgerId);
cw.eq(MesXslEquipInspectConfig::getConfigType, configType);
cw.and(
q ->
q.eq(MesXslEquipInspectConfig::getDelFlag, CommonConstant.DEL_FLAG_0)
.or()
.isNull(MesXslEquipInspectConfig::getDelFlag));
return mesXslEquipInspectConfigService.getOne(cw, false);
}
private List<MesXslEquipInspectRecordLine> buildRecordLinesFromConfigLines(
List<MesXslEquipInspectConfigLine> configLines) {
List<MesXslEquipInspectRecordLine> result = new ArrayList<>(configLines.size());
for (MesXslEquipInspectConfigLine cl : configLines) {
MesXslEquipInspectRecordLine line = new MesXslEquipInspectRecordLine();
line.setEquipInspectConfigLineId(cl.getId());
line.setInspectMaintainItemId(cl.getInspectMaintainItemId());
line.setItemCode(cl.getItemCode());
line.setItemName(cl.getItemName());
line.setItemCategory(cl.getItemCategory());
line.setItemType(cl.getItemType());
line.setEquipmentPartName(cl.getEquipmentPartName());
line.setEquipmentSubPartName(cl.getEquipmentSubPartName());
line.setInspectMethod(cl.getInspectMethod());
line.setJudgmentCriteria(cl.getJudgmentCriteria());
result.add(line);
}
return result;
}
//update-end---author:jiangxh ---date:20260520 for【MES】点检保养记录从设备点检配置带出明细-----------
//update-begin---author:jiangxh ---date:20260520 for【MES】设备台账多选批量生成点检保养记录待点检-----------
@Override
@Transactional(rollbackFor = Exception.class)
public MesXslEquipInspectRecordBatchCreateResult batchCreateFromEquipment(
List<String> equipmentLedgerIds, String recordType, MesXslEquipInspectRecord inspectorContext) {
MesXslEquipInspectRecordBatchCreateResult result = new MesXslEquipInspectRecordBatchCreateResult();
if (CollectionUtils.isEmpty(equipmentLedgerIds) || oConvertUtils.isEmpty(recordType)) {
result.getFailMessages().add("请选择设备并指定点检或保养类型");
return result;
}
String type = recordType.trim();
for (String equipmentLedgerId : equipmentLedgerIds) {
if (oConvertUtils.isEmpty(equipmentLedgerId)) {
continue;
}
String equipId = equipmentLedgerId.trim();
MesXslEquipmentLedger ledger = mesXslEquipmentLedgerService.getById(equipId);
String equipName =
ledger != null
? (oConvertUtils.isNotEmpty(ledger.getEquipmentName())
? ledger.getEquipmentName()
: ledger.getEquipmentCode())
: equipId;
if (ledger == null
|| (ledger.getDelFlag() != null && ledger.getDelFlag().equals(CommonConstant.DEL_FLAG_1))) {
result.getFailMessages().add("设备【" + equipName + "】不存在或已删除");
continue;
}
//update-begin---author:jiangxh ---date:20260520 for【MES】未维护对应类型设备点检配置则不生成记录并提示设备名称-----------
MesXslEquipInspectConfig config = findEquipInspectConfig(equipId, type);
if (config == null) {
result.getFailMessages().add(MesXslEquipInspectBizMsg.noConfigMessage(equipName, type));
continue;
}
List<MesXslEquipInspectConfigLine> configLines =
mesXslEquipInspectConfigService.selectLinesByConfigId(config.getId());
if (CollectionUtils.isEmpty(configLines)) {
result.getFailMessages().add(MesXslEquipInspectBizMsg.noConfigLineMessage(equipName, type));
continue;
}
List<MesXslEquipInspectRecordLine> lines = buildRecordLinesFromConfigLines(configLines);
//update-end---author:jiangxh ---date:20260520 for【MES】未维护对应类型设备点检配置则不生成记录并提示设备名称-----------
MesXslEquipInspectRecord main = new MesXslEquipInspectRecord();
main.setEquipmentLedgerId(equipId);
main.setEquipmentCode(ledger.getEquipmentCode());
main.setEquipmentName(ledger.getEquipmentName());
main.setEquipInspectConfigId(config.getId());
main.setRecordType(type);
main.setRecordNo(generateRecordNo(main));
main.setRecordStatus("pending");
main.setInspectResult("");
main.setInspectDate(new Date());
if (inspectorContext != null) {
main.setInspectorUserId(inspectorContext.getInspectorUserId());
main.setInspectorUsername(inspectorContext.getInspectorUsername());
main.setInspectorRealname(inspectorContext.getInspectorRealname());
}
saveMain(main, lines);
result.setSuccessCount(result.getSuccessCount() + 1);
}
return result;
}
//update-end---author:jiangxh ---date:20260520 for【MES】设备台账多选批量生成点检保养记录待点检-----------
//update-begin---author:jiangxh ---date:20260521 for【MES】不合格点检记录登记处理人及处理时间-----------
@Override
@Transactional(rollbackFor = Exception.class)
public void handleFailRecord(MesXslEquipInspectRecordHandleDTO dto) {
if (dto == null || oConvertUtils.isEmpty(dto.getId())) {
throw new IllegalArgumentException("记录主键不能为空");
}
MesXslEquipInspectRecord existing = this.getById(dto.getId().trim());
if (existing == null) {
throw new IllegalArgumentException("未找到对应数据");
}
if (!"fail".equals(existing.getInspectResult())) {
throw new IllegalArgumentException("仅不合格记录可处理");
}
if (!"done".equals(existing.getRecordStatus())) {
throw new IllegalArgumentException("请先完成点检录入");
}
if ("1".equals(existing.getHandledFlag())) {
throw new IllegalArgumentException("该记录已处理");
}
if (oConvertUtils.isEmpty(dto.getHandlerUserId())
&& oConvertUtils.isEmpty(dto.getHandlerUsername())
&& oConvertUtils.isEmpty(dto.getHandlerRealname())) {
throw new IllegalArgumentException("请选择处理人");
}
Date handleTime = dto.getHandleTime() != null ? dto.getHandleTime() : new Date();
MesXslEquipInspectRecord patch = new MesXslEquipInspectRecord();
patch.setId(existing.getId());
patch.setHandledFlag("1");
patch.setHandlerUserId(dto.getHandlerUserId());
patch.setHandlerUsername(dto.getHandlerUsername());
patch.setHandlerRealname(dto.getHandlerRealname());
patch.setHandleTime(handleTime);
this.updateById(patch);
}
//update-end---author:jiangxh ---date:20260521 for【MES】不合格点检记录登记处理人及处理时间-----------
private static Integer resolveTenantId(MesXslEquipInspectRecord 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) {
// ignore
}
}
if (oConvertUtils.isEmpty(ts)) {
return null;
}
try {
return Integer.parseInt(ts);
} catch (NumberFormatException e) {
return null;
}
}
}

View File

@@ -0,0 +1,58 @@
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.apache.commons.lang3.StringUtils;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
import org.jeecg.modules.xslmes.entity.MesXslMixerAction;
import org.jeecg.modules.xslmes.mapper.MesXslEquipmentLedgerMapper;
import org.jeecg.modules.xslmes.mapper.MesXslMixerActionMapper;
import org.jeecg.modules.xslmes.service.IMesXslMixerActionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class MesXslMixerActionServiceImpl extends ServiceImpl<MesXslMixerActionMapper, MesXslMixerAction>
implements IMesXslMixerActionService {
@Autowired private MesXslEquipmentLedgerMapper equipmentLedgerMapper;
@Override
public boolean isActionNameDuplicated(String actionName, String excludeId) {
if (StringUtils.isBlank(actionName)) {
return false;
}
LambdaQueryWrapper<MesXslMixerAction> wrapper =
new LambdaQueryWrapper<MesXslMixerAction>().eq(MesXslMixerAction::getActionName, actionName.trim());
if (StringUtils.isNotBlank(excludeId)) {
wrapper.ne(MesXslMixerAction::getId, excludeId.trim());
}
return this.count(wrapper) > 0;
}
@Override
public boolean isActionCodeDuplicated(String actionCode, String excludeId) {
if (StringUtils.isBlank(actionCode)) {
return false;
}
LambdaQueryWrapper<MesXslMixerAction> wrapper =
new LambdaQueryWrapper<MesXslMixerAction>().eq(MesXslMixerAction::getActionCode, actionCode.trim());
if (StringUtils.isNotBlank(excludeId)) {
wrapper.ne(MesXslMixerAction::getId, excludeId.trim());
}
return this.count(wrapper) > 0;
}
@Override
public void fillEquipmentName(MesXslMixerAction model) {
if (model == null) {
return;
}
if (StringUtils.isBlank(model.getEquipmentId())) {
model.setEquipmentName(null);
return;
}
MesXslEquipmentLedger ledger = equipmentLedgerMapper.selectById(model.getEquipmentId().trim());
model.setEquipmentName(ledger == null ? null : ledger.getEquipmentName());
}
}

View File

@@ -0,0 +1,59 @@
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.apache.commons.lang3.StringUtils;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
import org.jeecg.modules.xslmes.entity.MesXslMixerCondition;
import org.jeecg.modules.xslmes.mapper.MesXslEquipmentLedgerMapper;
import org.jeecg.modules.xslmes.mapper.MesXslMixerConditionMapper;
import org.jeecg.modules.xslmes.service.IMesXslMixerConditionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class MesXslMixerConditionServiceImpl
extends ServiceImpl<MesXslMixerConditionMapper, MesXslMixerCondition>
implements IMesXslMixerConditionService {
@Autowired private MesXslEquipmentLedgerMapper equipmentLedgerMapper;
@Override
public boolean isConditionNameDuplicated(String conditionName, String excludeId) {
if (StringUtils.isBlank(conditionName)) {
return false;
}
LambdaQueryWrapper<MesXslMixerCondition> wrapper =
new LambdaQueryWrapper<MesXslMixerCondition>().eq(MesXslMixerCondition::getConditionName, conditionName.trim());
if (StringUtils.isNotBlank(excludeId)) {
wrapper.ne(MesXslMixerCondition::getId, excludeId.trim());
}
return this.count(wrapper) > 0;
}
@Override
public boolean isConditionCodeDuplicated(String conditionCode, String excludeId) {
if (StringUtils.isBlank(conditionCode)) {
return false;
}
LambdaQueryWrapper<MesXslMixerCondition> wrapper =
new LambdaQueryWrapper<MesXslMixerCondition>().eq(MesXslMixerCondition::getConditionCode, conditionCode.trim());
if (StringUtils.isNotBlank(excludeId)) {
wrapper.ne(MesXslMixerCondition::getId, excludeId.trim());
}
return this.count(wrapper) > 0;
}
@Override
public void fillEquipmentName(MesXslMixerCondition model) {
if (model == null) {
return;
}
if (StringUtils.isBlank(model.getEquipmentId())) {
model.setEquipmentName(null);
return;
}
MesXslEquipmentLedger equipment = equipmentLedgerMapper.selectById(model.getEquipmentId().trim());
model.setEquipmentName(equipment == null ? null : equipment.getEquipmentName());
}
}

View File

@@ -0,0 +1,12 @@
package org.jeecg.modules.xslmes.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.xslmes.entity.MesXslProductionOrder;
import org.jeecg.modules.xslmes.mapper.MesXslProductionOrderMapper;
import org.jeecg.modules.xslmes.service.IMesXslProductionOrderService;
import org.springframework.stereotype.Service;
@Service
public class MesXslProductionOrderServiceImpl
extends ServiceImpl<MesXslProductionOrderMapper, MesXslProductionOrder>
implements IMesXslProductionOrderService {}

View File

@@ -0,0 +1,27 @@
package org.jeecg.modules.xslmes.util;
import org.jeecg.common.util.oConvertUtils;
/**
* 设备点检/保养业务提示文案
*/
public final class MesXslEquipInspectBizMsg {
private MesXslEquipInspectBizMsg() {}
public static String recordTypeLabel(String recordType) {
return "inspect".equals(recordType) ? "点检" : "保养";
}
/** 未维护该类型设备点检配置(不生成记录) */
public static String noConfigMessage(String equipmentName, String recordType) {
String name = oConvertUtils.isNotEmpty(equipmentName) ? equipmentName.trim() : "该设备";
return name + " 未维护" + recordTypeLabel(recordType) + "类型的设备点检配置";
}
/** 已有点检配置主表但无明细行 */
public static String noConfigLineMessage(String equipmentName, String recordType) {
String name = oConvertUtils.isNotEmpty(equipmentName) ? equipmentName.trim() : "该设备";
return name + "" + recordTypeLabel(recordType) + "类型设备点检配置未维护明细项";
}
}

View File

@@ -0,0 +1,12 @@
package org.jeecg.modules.xslmes.vo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.jeecg.modules.xslmes.entity.MesXslEquipInspectConfig;
/**
* 设备点检配置主子保存页 VO继承主表实体含 {@link MesXslEquipInspectConfig#lineList} 明细)。
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class MesXslEquipInspectConfigPage extends MesXslEquipInspectConfig {}

View File

@@ -0,0 +1,19 @@
package org.jeecg.modules.xslmes.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import lombok.Data;
/**
* 从设备台账批量生成点检/保养记录
*/
@Data
@Schema(description = "批量生成点检保养记录请求")
public class MesXslEquipInspectRecordBatchCreateDTO {
@Schema(description = "设备台账主键列表")
private List<String> equipmentLedgerIds;
@Schema(description = "记录类型 inspect点检/maintain保养")
private String recordType;
}

View File

@@ -0,0 +1,20 @@
package org.jeecg.modules.xslmes.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
/**
* 批量生成点检/保养记录结果
*/
@Data
@Schema(description = "批量生成点检保养记录结果")
public class MesXslEquipInspectRecordBatchCreateResult {
@Schema(description = "成功条数")
private int successCount;
@Schema(description = "失败说明(按设备)")
private List<String> failMessages = new ArrayList<>();
}

View File

@@ -0,0 +1,32 @@
package org.jeecg.modules.xslmes.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Date;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
/**
* 不合格点检记录处理入参
*/
@Data
@Schema(description = "点检保养记录-不合格处理")
public class MesXslEquipInspectRecordHandleDTO {
@Schema(description = "记录主键", requiredMode = Schema.RequiredMode.REQUIRED)
private String id;
@Schema(description = "处理人用户ID")
private String handlerUserId;
@Schema(description = "处理人账号")
private String handlerUsername;
@Schema(description = "处理人姓名")
private String handlerRealname;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "处理时间")
private Date handleTime;
}

View File

@@ -0,0 +1,12 @@
package org.jeecg.modules.xslmes.vo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.jeecg.modules.xslmes.entity.MesXslEquipInspectRecord;
/**
* 点检/保养记录主子保存 VO
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class MesXslEquipInspectRecordPage extends MesXslEquipInspectRecord {}

View File

@@ -339,3 +339,82 @@ jeecgboot-vue3/src/views/xslmes/mesXslInspectMaintainItem/MesXslInspectMaintainI
jeecgboot-vue3/src/views/xslmes/mesXslInspectMaintainItem/components/MesXslInspectMaintainItemModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslInspectMaintainItem/components/MesXslEquipmentTypeFilterSelectModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslInspectMaintainItem/components/MesXslEquipmentSubPartFilterSelectModal.vue
-- author:jiangxh---date:20260519--for: 【MES】设备点检配置主子表设备台账+类型唯一、明细从点检保养项目带出)---
jeecg-boot/db/mes-xsl-equip-inspect-config-menu-permission.sql
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_78__mes_xsl_equip_inspect_config.sql
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslEquipInspectConfig.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslEquipInspectConfigLine.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslEquipInspectConfigPage.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslEquipInspectConfigMapper.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslEquipInspectConfigLineMapper.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslEquipInspectConfigService.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslEquipInspectConfigServiceImpl.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipInspectConfigController.java
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfigList.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfig.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfig.api.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/components/MesXslEquipInspectConfigModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/components/MesXslEquipmentLedgerSelectModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/components/MesXslInspectMaintainItemSelectModal.vue
-- author:jiangxh---date:20260519--for: 【MES】修复设备点检配置保存失败Page VO 与主实体重复 lineList 导致编译错误)---
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslEquipInspectConfigPage.java
-- author:jiangxh---date:20260519--for: 【MES】设备点检配置明细改为多选点检保养项目、禁用JVxe新增---
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/components/MesXslEquipInspectConfigModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/components/MesXslInspectMaintainItemSelectModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfig.data.ts
-- author:jiangxh---date:20260520--for: 【MES】点检保养记录主子表EC编号、设备配置带出明细、字典与菜单---
jeecg-boot/db/mes-xsl-equip-inspect-record-menu-permission.sql
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_79__mes_xsl_equip_inspect_record.sql
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslEquipInspectRecord.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslEquipInspectRecordLine.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslEquipInspectRecordPage.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslEquipInspectRecordMapper.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslEquipInspectRecordLineMapper.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslEquipInspectRecordService.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslEquipInspectRecordServiceImpl.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipInspectRecordController.java
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecordList.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecord.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecord.api.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/components/MesXslEquipInspectRecordModal.vue
-- author:jiangxh---date:20260520--for: 【MES】点检记录改由设备台账批量生成去掉记录列表新增与表单选设备---
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslEquipInspectRecordBatchCreateDTO.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslEquipInspectRecordBatchCreateResult.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslEquipInspectRecordService.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslEquipInspectRecordServiceImpl.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipInspectRecordController.java
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecordList.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecord.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecord.api.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/components/MesXslEquipInspectRecordModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedgerList.vue
-- author:jiangxh---date:20260520--for: 【MES】点检记录录入流程去导入、待点检录入、保存变已点检---
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipInspectRecordController.java
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecordList.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecord.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/components/MesXslEquipInspectRecordModal.vue
-- author:jiangxh---date:20260520--for: 【MES】修复点检记录明细图片上传一直转圈uploadUrl 补全 jeecg-boot 上下文)---
jeecgboot-vue3/src/api/common/api.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecord.data.ts
-- author:jiangxh---date:20260520--for: 【MES】修复点检明细图片上传后预览「图片错误」getFileAccessHttpUrl 补全 context-path---
jeecgboot-vue3/src/utils/env/apiBaseUrl.ts
jeecgboot-vue3/src/utils/common/compUtils.ts
jeecgboot-vue3/src/api/common/api.ts
-- author:jiangxh---date:20260520--for: 【MES】设备台账批量点检/保养:未维护对应类型点检配置不生成并提示设备名称---
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/util/MesXslEquipInspectBizMsg.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslEquipInspectRecordServiceImpl.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipInspectRecordController.java
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedgerList.vue
-- author:jiangxh---date:20260521--for: 【MES】点检保养记录不合格处理是否已处理/处理人/处理时间字段与处理按钮---
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_80__mes_xsl_equip_inspect_record_handle.sql
jeecg-boot/db/mes-xsl-equip-inspect-record-menu-permission.sql
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslEquipInspectRecord.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslEquipInspectRecordHandleDTO.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslEquipInspectRecordService.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslEquipInspectRecordServiceImpl.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipInspectRecordController.java
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecord.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecord.api.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecordList.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/components/MesXslEquipInspectRecordModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/components/MesXslEquipInspectRecordHandleModal.vue

View File

@@ -31,6 +31,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import jakarta.servlet.http.HttpServletRequest;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -61,7 +63,7 @@ public class ThirdAppController {
*/
@GetMapping("/getEnabledType")
public Result getEnabledType() {
Map<String, Boolean> enabledMap = new HashMap(5);
Map<String, Boolean> enabledMap = new HashMap<>(5);
int tenantId;
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
@@ -75,6 +77,8 @@ public class ThirdAppController {
boolean dingConfig = false;
//企业微信是否已配置
boolean qywxConfig = false;
//金蝶是否已配置
boolean kingdeeConfig = false;
if(null != list && list.size()>0){
for (SysThirdAppConfig config:list) {
if(MessageTypeEnum.DD.getType().equals(config.getThirdType())){
@@ -85,10 +89,14 @@ public class ThirdAppController {
qywxConfig = true;
continue;
}
if("kingdee".equals(config.getThirdType())){
kingdeeConfig = true;
}
}
}
enabledMap.put("wechatEnterprise", qywxConfig);
enabledMap.put("dingtalk", dingConfig);
enabledMap.put("kingdee", kingdeeConfig);
return Result.OK(enabledMap);
}
@@ -473,6 +481,59 @@ public class ThirdAppController {
return result;
}
/**
* 测试金蝶配置连通性
*/
@GetMapping("/testKingdeeConnect")
public Result<String> testKingdeeConnect(@RequestParam(name = "tenantId", required = false) Integer tenantId) {
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
if (tenantId == null) {
return Result.error("开启多租户模式租户ID参数不允许为空");
}
} else if (tenantId == null) {
tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0);
}
SysThirdAppConfig config = appConfigService.getThirdConfigByThirdType(tenantId, "kingdee");
if (config == null) {
return Result.error("金蝶尚未配置,请先完成配置");
}
String rawUrl = config.getCorpId();
if (oConvertUtils.isEmpty(rawUrl)) {
return Result.error("金蝶服务地址为空,请先维护服务地址");
}
String endpoint = normalizeUrl(rawUrl);
HttpURLConnection conn = null;
try {
URL url = new URL(endpoint);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setConnectTimeout(5000);
conn.setReadTimeout(5000);
conn.setUseCaches(false);
int code = conn.getResponseCode();
if (code >= 200 && code < 400) {
return Result.OK("连接成功HTTP状态码" + code);
}
return Result.error("连接失败HTTP状态码" + code);
} catch (Exception e) {
log.error("金蝶连通性测试失败", e);
return Result.error("连接失败:" + e.getMessage());
} finally {
if (conn != null) {
conn.disconnect();
}
}
}
private String normalizeUrl(String rawUrl) {
String url = rawUrl == null ? "" : rawUrl.trim();
if (!url.startsWith("http://") && !url.startsWith("https://")) {
url = "http://" + url;
}
return url;
}
/**
* 同步【钉钉】[部门和用户]到本地
*

View File

@@ -0,0 +1,20 @@
-- MES 密炼机动作维护
CREATE TABLE IF NOT EXISTS `mes_xsl_mixer_action` (
`id` varchar(32) NOT NULL COMMENT '主键',
`equipment_id` varchar(32) NOT NULL COMMENT '设备台账IDmes_xsl_equipment_ledger.id',
`equipment_name` varchar(500) NOT NULL COMMENT '设备名称冗余',
`action_name` varchar(500) NOT NULL COMMENT '动作名称同租户未删除数据中唯一',
`action_code` varchar(500) NOT NULL COMMENT '动作代号同租户未删除数据中唯一',
`remark` varchar(1000) DEFAULT NULL COMMENT '备注',
`tenant_id` int DEFAULT NULL COMMENT '租户',
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`del_flag` int DEFAULT '0' COMMENT '删除标记0正常1删除',
PRIMARY KEY (`id`),
KEY `idx_mxma_equipment` (`equipment_id`),
KEY `idx_mxma_tenant_action_name` (`tenant_id`, `action_name`, `del_flag`),
KEY `idx_mxma_tenant_action_code` (`tenant_id`, `action_code`, `del_flag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES密炼机动作维护';

View File

@@ -0,0 +1,24 @@
-- MES 日罐物料对应信息
CREATE TABLE IF NOT EXISTS `mes_xsl_day_tank_material_map` (
`id` varchar(32) NOT NULL COMMENT '主键',
`equipment_id` varchar(32) NOT NULL COMMENT '设备台账IDmes_xsl_equipment_ledger.id',
`machine_code` varchar(500) DEFAULT NULL COMMENT '机台代码设备编号冗余',
`machine_name` varchar(500) DEFAULT NULL COMMENT '机台名称冗余',
`silo_category_id` varchar(32) DEFAULT NULL COMMENT '料仓分类IDsys_category.id',
`station` varchar(500) DEFAULT NULL COMMENT '工位',
`silo_no` varchar(500) DEFAULT NULL COMMENT '料仓号',
`material_id` varchar(32) NOT NULL COMMENT '物料IDmes_material.id',
`material_name` varchar(500) DEFAULT NULL COMMENT '物料名称冗余',
`use_status` int DEFAULT 1 COMMENT '使用状态1使用中 0停用',
`allow_sync` int DEFAULT 1 COMMENT '是否允许同步1允许 0不允许',
`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_mxdtm_equipment` (`equipment_id`),
KEY `idx_mxdtm_material` (`material_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES日罐物料对应信息';

View File

@@ -0,0 +1,88 @@
-- MES 设备点检配置主子表 jeecg-boot/db/mes-xsl-equip-inspect-config-menu-permission.sql 一致
SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS `mes_xsl_equip_inspect_config` (
`id` varchar(32) NOT NULL COMMENT '主键',
`equipment_ledger_id` varchar(32) NOT NULL COMMENT '设备台账主键 mes_xsl_equipment_ledger.id',
`equipment_name` varchar(500) DEFAULT NULL COMMENT '设备名称冗余',
`equipment_code` varchar(500) DEFAULT NULL COMMENT '设备编号冗余',
`config_type` varchar(500) NOT NULL COMMENT '配置类型字典xslmes_im_item_categoryinspect点检/maintain保养同设备同类型唯一',
`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_meic_tenant_equip_type` (`tenant_id`, `equipment_ledger_id`, `config_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES设备点检配置';
CREATE TABLE IF NOT EXISTS `mes_xsl_equip_inspect_config_line` (
`id` varchar(32) NOT NULL COMMENT '主键',
`config_id` varchar(32) NOT NULL COMMENT '主表主键 mes_xsl_equip_inspect_config.id',
`inspect_maintain_item_id` varchar(32) NOT NULL COMMENT '点检及保养项目主键 mes_xsl_inspect_maintain_item.id',
`item_code` varchar(500) DEFAULT NULL COMMENT '点检项目编号冗余',
`item_name` varchar(500) DEFAULT NULL COMMENT '项目名称冗余',
`item_category` varchar(500) DEFAULT NULL COMMENT '项目类别冗余',
`item_type` varchar(500) DEFAULT NULL COMMENT '项目类型冗余',
`equipment_part_name` varchar(500) DEFAULT NULL COMMENT '设备部位名称冗余',
`equipment_sub_part_name` varchar(500) DEFAULT NULL COMMENT '设备小部位名称冗余',
`inspect_method` varchar(500) DEFAULT NULL COMMENT '点检方式冗余',
`judgment_criteria` varchar(500) DEFAULT NULL COMMENT '判断基准冗余',
`sort_no` int DEFAULT '0' 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 '更新时间',
PRIMARY KEY (`id`),
KEY `idx_meicl_config` (`config_id`),
KEY `idx_meicl_item` (`inspect_maintain_item_id`),
UNIQUE KEY `uk_meicl_config_item` (`config_id`, `inspect_maintain_item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES设备点检配置明细';
SET @mes_tenant_id = 1002;
SET @mes_equip_pid = (
SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
);
SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
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 ('1860000000000000148', @mes_equip_pid, '设备点检配置', '/xslmes/mesXslEquipInspectConfig', 'xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfigList', 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`), `icon` = 'ant-design:control-outlined';
UPDATE `sys_permission` SET `icon` = 'ant-design:control-outlined' WHERE `id` = '1860000000000000148' AND `del_flag` = 0;
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
('1860000000000000149', '1860000000000000148', '新增', 2, 'mes:mes_xsl_equip_inspect_config:add', '1', '1', 0, 'admin', NOW()),
('1860000000000000150', '1860000000000000148', '编辑', 2, 'mes:mes_xsl_equip_inspect_config:edit', '1', '1', 0, 'admin', NOW()),
('1860000000000000151', '1860000000000000148', '删除', 2, 'mes:mes_xsl_equip_inspect_config:delete', '1', '1', 0, 'admin', NOW()),
('1860000000000000152', '1860000000000000148', '批量删除', 2, 'mes:mes_xsl_equip_inspect_config:deleteBatch', '1', '1', 0, 'admin', NOW()),
('1860000000000000153', '1860000000000000148', '导出', 2, 'mes:mes_xsl_equip_inspect_config:exportXls', '1', '1', 0, 'admin', NOW()),
('1860000000000000154', '1860000000000000148', '导入', 2, 'mes:mes_xsl_equip_inspect_config: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 (
'1860000000000000148',
'1860000000000000149', '1860000000000000150', '1860000000000000151', '1860000000000000152',
'1860000000000000153', '1860000000000000154'
)
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
);

View File

@@ -0,0 +1,133 @@
-- MES 点检/保养记录主子表建表 + 字典 + 菜单 + 按钮 + 租户 admin 授权
-- 权限前缀mes:mes_xsl_equip_inspect_record:*
-- 父菜单设备管理依赖设备点检配置设备台账
-- FlywayV3.9.2_79__mes_xsl_equip_inspect_record.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_im_inspect_result', '合格/不合格', 0, 'admin', NOW(), 0, 0
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_im_inspect_result' 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`, '合格', 'pass', '', 1, 1, 'admin', NOW()
FROM `sys_dict` d
WHERE d.`dict_code` = 'xslmes_im_inspect_result' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.`id` AND i.`item_value` = 'pass');
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`, '不合格', 'fail', '', 2, 1, 'admin', NOW()
FROM `sys_dict` d
WHERE d.`dict_code` = 'xslmes_im_inspect_result' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.`id` AND i.`item_value` = 'fail');
INSERT INTO `sys_dict`(`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
SELECT REPLACE(UUID(), '-', ''), 'MES点检记录状态', 'xslmes_im_record_status', '待点检/已点检', 0, 'admin', NOW(), 0, 0
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_im_record_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`, '待点检', 'pending', '', 1, 1, 'admin', NOW()
FROM `sys_dict` d
WHERE d.`dict_code` = 'xslmes_im_record_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.`id` AND i.`item_value` = 'pending');
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`, '已点检', 'done', '', 2, 1, 'admin', NOW()
FROM `sys_dict` d
WHERE d.`dict_code` = 'xslmes_im_record_status' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.`id` AND i.`item_value` = 'done');
CREATE TABLE IF NOT EXISTS `mes_xsl_equip_inspect_record` (
`id` varchar(32) NOT NULL COMMENT '主键',
`record_no` varchar(32) NOT NULL COMMENT '记录编号EC+yyyyMMdd+4位流水租户内按日递增',
`plan_no` varchar(500) DEFAULT NULL COMMENT '计划单号',
`plan_id` varchar(32) DEFAULT NULL COMMENT '计划主键隐藏',
`equipment_ledger_id` varchar(32) NOT NULL COMMENT '设备台账主键 mes_xsl_equipment_ledger.id',
`equipment_code` varchar(500) DEFAULT NULL COMMENT '设备编码冗余',
`equipment_name` varchar(500) DEFAULT NULL COMMENT '设备名称冗余',
`equip_inspect_config_id` varchar(32) DEFAULT NULL COMMENT '设备点检配置主键 mes_xsl_equip_inspect_config.id',
`record_type` varchar(500) NOT NULL COMMENT '类型字典xslmes_im_item_categoryinspect点检/maintain保养',
`inspect_date` date DEFAULT NULL COMMENT '点检日期',
`inspector_user_id` varchar(32) DEFAULT NULL COMMENT '点检人用户ID',
`inspector_username` varchar(500) DEFAULT NULL COMMENT '点检人账号',
`inspector_realname` varchar(500) DEFAULT NULL COMMENT '点检人姓名',
`inspect_result` varchar(500) NOT NULL COMMENT '点检结果字典xslmes_im_inspect_resultpass合格/fail不合格',
`record_status` varchar(500) NOT NULL COMMENT '状态字典xslmes_im_record_statuspending待点检/done已点检',
`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`),
UNIQUE KEY `uk_meir_tenant_record_no` (`tenant_id`, `record_no`),
KEY `idx_meir_equip_type` (`equipment_ledger_id`, `record_type`),
KEY `idx_meir_inspect_date` (`inspect_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES点检保养记录';
CREATE TABLE IF NOT EXISTS `mes_xsl_equip_inspect_record_line` (
`id` varchar(32) NOT NULL COMMENT '主键',
`record_id` varchar(32) NOT NULL COMMENT '主表主键 mes_xsl_equip_inspect_record.id',
`equip_inspect_config_line_id` varchar(32) NOT NULL COMMENT '设备点检配置明细主键 mes_xsl_equip_inspect_config_line.id',
`inspect_maintain_item_id` varchar(32) DEFAULT NULL COMMENT '点检及保养项目主键冗余',
`item_code` varchar(500) DEFAULT NULL COMMENT '点检项目编号冗余',
`item_name` varchar(500) DEFAULT NULL COMMENT '项目名称冗余',
`item_category` varchar(500) DEFAULT NULL COMMENT '项目类别冗余',
`item_type` varchar(500) DEFAULT NULL COMMENT '项目类型冗余',
`equipment_part_name` varchar(500) DEFAULT NULL COMMENT '设备部位冗余',
`equipment_sub_part_name` varchar(500) DEFAULT NULL COMMENT '设备小部位冗余',
`inspect_method` varchar(500) DEFAULT NULL COMMENT '点检方式冗余',
`judgment_criteria` varchar(500) DEFAULT NULL COMMENT '判断基准冗余',
`line_inspect_result` varchar(500) DEFAULT NULL COMMENT '明细点检结果文本',
`picture_files` varchar(2000) DEFAULT NULL COMMENT '图片上传路径逗号分隔',
`sort_no` int DEFAULT '0' 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 '更新时间',
PRIMARY KEY (`id`),
KEY `idx_meirl_record` (`record_id`),
KEY `idx_meirl_config_line` (`equip_inspect_config_line_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES点检保养记录明细';
SET @mes_tenant_id = 1002;
SET @mes_equip_pid = (
SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
);
SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
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 ('1860000000000000155', @mes_equip_pid, '点检保养记录', '/xslmes/mesXslEquipInspectRecord', 'xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecordList', 'MesXslEquipInspectRecordList', 1, NULL, '1', 13, 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`), `icon` = 'ant-design:file-done-outlined';
UPDATE `sys_permission` SET `icon` = 'ant-design:file-done-outlined' WHERE `id` = '1860000000000000155' AND `del_flag` = 0;
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
('1860000000000000156', '1860000000000000155', '新增', 2, 'mes:mes_xsl_equip_inspect_record:add', '1', '1', 0, 'admin', NOW()),
('1860000000000000157', '1860000000000000155', '编辑', 2, 'mes:mes_xsl_equip_inspect_record:edit', '1', '1', 0, 'admin', NOW()),
('1860000000000000158', '1860000000000000155', '删除', 2, 'mes:mes_xsl_equip_inspect_record:delete', '1', '1', 0, 'admin', NOW()),
('1860000000000000159', '1860000000000000155', '批量删除', 2, 'mes:mes_xsl_equip_inspect_record:deleteBatch', '1', '1', 0, 'admin', NOW()),
('1860000000000000160', '1860000000000000155', '导出', 2, 'mes:mes_xsl_equip_inspect_record:exportXls', '1', '1', 0, 'admin', NOW()),
('1860000000000000161', '1860000000000000155', '导入', 2, 'mes:mes_xsl_equip_inspect_record: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 (
'1860000000000000155',
'1860000000000000156', '1860000000000000157', '1860000000000000158', '1860000000000000159',
'1860000000000000160', '1860000000000000161'
)
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
);

View File

@@ -0,0 +1,18 @@
-- MES 密炼机条件维护
CREATE TABLE IF NOT EXISTS `mes_xsl_mixer_condition` (
`id` varchar(32) NOT NULL COMMENT '主键',
`equipment_id` varchar(32) NOT NULL COMMENT '设备台账IDmes_xsl_equipment_ledger.id',
`equipment_name` varchar(500) NOT NULL COMMENT '设备名称冗余',
`condition_name` varchar(500) NOT NULL COMMENT '条件名称',
`condition_code` varchar(500) NOT NULL COMMENT '条件代码',
`remark` varchar(1000) DEFAULT NULL COMMENT '备注',
`tenant_id` int DEFAULT NULL COMMENT '租户',
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`del_flag` int DEFAULT '0' COMMENT '删除标记0正常1删除',
PRIMARY KEY (`id`),
KEY `idx_mxmc_equipment` (`equipment_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES密炼机条件维护';

View File

@@ -0,0 +1,9 @@
-- MES 点检保养记录不合格处理字段是否已处理/处理人/处理时间
SET NAMES utf8mb4;
ALTER TABLE `mes_xsl_equip_inspect_record`
ADD COLUMN `handled_flag` varchar(1) DEFAULT NULL COMMENT '是否已处理字典yn1是0否仅不合格记录使用' AFTER `record_status`,
ADD COLUMN `handler_user_id` varchar(32) DEFAULT NULL COMMENT '处理人用户ID' AFTER `handled_flag`,
ADD COLUMN `handler_username` varchar(500) DEFAULT NULL COMMENT '处理人账号' AFTER `handler_user_id`,
ADD COLUMN `handler_realname` varchar(500) DEFAULT NULL COMMENT '处理人姓名' AFTER `handler_username`,
ADD COLUMN `handle_time` datetime DEFAULT NULL COMMENT '处理时间' AFTER `handler_realname`;

View File

@@ -0,0 +1,24 @@
-- MES 生产订单
CREATE TABLE IF NOT EXISTS `mes_xsl_production_order` (
`id` varchar(32) NOT NULL COMMENT '主键',
`sales_order_no` varchar(500) DEFAULT NULL COMMENT '销售订单号',
`production_order_no` varchar(500) DEFAULT NULL COMMENT '生产订单号',
`order_date` date DEFAULT NULL COMMENT '订单日期',
`production_workshop` varchar(500) DEFAULT NULL COMMENT '生产车间',
`process_segment_count` int DEFAULT NULL COMMENT '加工段数',
`material_code` varchar(500) DEFAULT NULL COMMENT '物料编号',
`mes_material_name` varchar(500) DEFAULT NULL COMMENT 'MES胶料名称',
`kingdee_material_name` varchar(500) DEFAULT NULL COMMENT '金蝶物料名称',
`kingdee_material_spec` varchar(500) DEFAULT NULL COMMENT '金蝶物料规格',
`plan_qty` decimal(18,4) DEFAULT NULL COMMENT '计划数量',
`split_status` int DEFAULT 0 COMMENT '拆分状态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_mxpo_production_order_no` (`production_order_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES生产订单';

View File

@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!-- 与 application-*.yml 中 logging.charset 对齐Windows 集成终端默认 GBK -->
<springProperty scope="context" name="CONSOLE_LOG_CHARSET" source="logging.charset.console" defaultValue="GBK"/>
<springProperty scope="context" name="FILE_LOG_CHARSET" source="logging.charset.file" defaultValue="UTF-8"/>
<!--定义日志文件的存储地址 -->
<property name="LOG_HOME" value="../logs" />
@@ -10,6 +14,7 @@
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}:%L) - %msg%n</pattern>
<charset>${CONSOLE_LOG_CHARSET}</charset>
</encoder>
</appender>
@@ -25,6 +30,7 @@
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符 -->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>
<charset>${FILE_LOG_CHARSET}</charset>
</encoder>
</appender>

View File

@@ -1,8 +1,7 @@
import { defHttp } from '/@/utils/http/axios';
import { message } from 'ant-design-vue';
import { useGlobSetting } from '/@/hooks/setting';
const globSetting = useGlobSetting();
const baseUploadUrl = globSetting.uploadUrl;
import { resolveApiBaseUrl } from '/@/utils/env/apiBaseUrl';
enum Api {
positionList = '/sys/position/list',
userList = '/sys/user/list',
@@ -25,9 +24,9 @@ enum Api {
}
/**
* 上传父路径
* 上传地址(须含 context-path开发环境 domain 仅为 host 时需拼 apiUrl
*/
export const uploadUrl = `${baseUploadUrl}/sys/common/upload`;
export const uploadUrl = `${resolveApiBaseUrl()}/sys/common/upload`;
/**
* 职务列表

View File

@@ -1,4 +1,3 @@
import { useGlobSetting } from '/@/hooks/setting';
import { merge, random } from 'lodash-es';
import { isArray } from '/@/utils/is';
import { FormSchema } from '/@/components/Form';
@@ -14,11 +13,10 @@ import { useI18n } from "@/hooks/web/useI18n";
import {$electron} from "@/electron";
import {router} from "@/router";
import {encryptByBase64} from "@/utils/cipher";
import { resolveApiBaseUrl } from '/@/utils/env/apiBaseUrl';
//存放部门路径的数组
const departNamePath = ref<Record<string, string>>({});
const globSetting = useGlobSetting();
const baseApiUrl = globSetting.domainUrl;
/**
* 获取文件服务访问路径
* @param fileUrl 文件路径
@@ -31,10 +29,10 @@ export const getFileAccessHttpUrl = (fileUrl, prefix = 'http') => {
//判断是否是数组格式
let isArray = fileUrl.indexOf('[') != -1;
if (!isArray) {
let prefix = `${baseApiUrl}/sys/common/static/`;
const staticPrefix = `${resolveApiBaseUrl()}/sys/common/static/`;
// 判断是否已包含前缀
if (!fileUrl.startsWith(prefix)) {
result = `${prefix}${fileUrl}`;
if (!fileUrl.startsWith(staticPrefix)) {
result = `${staticPrefix}${fileUrl}`;
}
}
}

View File

@@ -0,0 +1,18 @@
import { useGlobSetting } from '/@/hooks/setting';
/**
* 后端 API 根地址(含 servlet.context-path如 /jeecg-boot
* 开发环境 VITE_GLOB_DOMAIN_URL 常为 http://host:port需与 VITE_GLOB_API_URL 拼接
*/
export function resolveApiBaseUrl(): string {
const { domainUrl, apiUrl } = useGlobSetting();
const domain = (domainUrl || '').replace(/\/$/, '');
const api = apiUrl || '';
if (!domain) {
return api;
}
if (!api || domain.endsWith(api) || domain.includes(`${api}/`)) {
return domain;
}
return `${domain}${api}`;
}

View File

@@ -0,0 +1,7 @@
<template>
<MesXslDayTankMaterialMapList />
</template>
<script lang="ts" setup>
import MesXslDayTankMaterialMapList from '../../xslmes/mesXslDayTankMaterialMap/MesXslDayTankMaterialMapList.vue';
</script>

View File

@@ -0,0 +1,7 @@
<template>
<MesXslMixerActionList />
</template>
<script lang="ts" setup>
import MesXslMixerActionList from '../../xslmes/mesXslMixerAction/MesXslMixerActionList.vue';
</script>

View File

@@ -0,0 +1,7 @@
<template>
<MesXslMixerConditionList />
</template>
<script lang="ts" setup>
import MesXslMixerConditionList from '../../xslmes/mesXslMixerCondition/MesXslMixerConditionList.vue';
</script>

View File

@@ -0,0 +1,7 @@
<template>
<MesXslProductionOrderList />
</template>
<script lang="ts" setup>
import MesXslProductionOrderList from '../../xslmes/mesXslProductionOrder/MesXslProductionOrderList.vue';
</script>

View File

@@ -11,6 +11,7 @@ enum Api {
getThirdUserBindByWechat = '/sys/thirdApp/getThirdUserBindByWechat',
deleteThirdAccount = '/sys/thirdApp/deleteThirdAccount',
deleteThirdAppConfig = '/sys/thirdApp/deleteThirdAppConfig',
testKingdeeConnect = '/sys/thirdApp/testKingdeeConnect',
}
/**
@@ -79,3 +80,10 @@ export const deleteThirdAppConfig = (params, handleSuccess) => {
handleSuccess();
});
};
/**
* 测试金蝶连接
*/
export const testKingdeeConnect = (params) => {
return defHttp.get({ url: Api.testKingdeeConnect, params }, { isTransformResponse: false });
};

View File

@@ -16,31 +16,43 @@ export const thirdAppFormSchema: FormSchema[] = [
show: false,
},
{
label: 'CorpId',
label: 'CorpId/服务地址',
field: 'corpId',
component: 'Input',
ifShow: ({ values }) => {
return values.thirdType === 'dingtalk';
return values.thirdType === 'dingtalk' || values.thirdType === 'kingdee';
},
required: true,
componentProps: ({ formModel }) => ({
placeholder: formModel?.thirdType === 'kingdee' ? '请输入金蝶服务地址,例如 https://xxx.xxx.com' : '请输入CorpId',
}),
},
{
label: 'Agentld',
label: 'AgentId/账套ID',
field: 'agentId',
component: 'Input',
required: true,
componentProps: ({ formModel }) => ({
placeholder: formModel?.thirdType === 'kingdee' ? '请输入账套ID可选业务标识' : '请输入AgentId',
}),
},
{
label: 'AppKey',
label: 'AppKey/AppId',
field: 'clientId',
component: 'Input',
required: true,
componentProps: ({ formModel }) => ({
placeholder: formModel?.thirdType === 'kingdee' ? '请输入金蝶AppId' : '请输入AppKey',
}),
},
{
label: 'AppSecret',
field: 'clientSecret',
component: 'Input',
required: true,
componentProps: ({ formModel }) => ({
placeholder: formModel?.thirdType === 'kingdee' ? '请输入金蝶AppSecret' : '请输入AppSecret',
}),
},{
label: '启用',
field: 'status',

View File

@@ -4,6 +4,7 @@
<ul class="ding-menu-tab">
<li :class="activeKey === 'ding' ? 'active' : ''" @click="dingLiClick('ding')"><a>钉钉集成</a></li>
<li :class="activeKey === 'wechat' ? 'active' : ''" @click="dingLiClick('wechat')"><a>企业微信集成</a></li>
<li :class="activeKey === 'kingdee' ? 'active' : ''" @click="dingLiClick('kingdee')"><a>金蝶集成</a></li>
</ul>
</div>
<div v-show="activeKey === 'ding'" class="base-collapse">
@@ -12,6 +13,9 @@
<div v-show="activeKey === 'wechat'" class="base-collapse">
<ThirdAppWeEnterpriseConfigForm />
</div>
<div v-show="activeKey === 'kingdee'" class="base-collapse">
<ThirdAppKingdeeConfigForm />
</div>
</div>
</template>
@@ -19,6 +23,7 @@
import { defineComponent, ref } from 'vue';
import ThirdAppDingTalkConfigForm from './ThirdAppDingTalkConfigForm.vue';
import ThirdAppWeEnterpriseConfigForm from './ThirdAppWeEnterpriseConfigForm.vue';
import ThirdAppKingdeeConfigForm from './ThirdAppKingdeeConfigForm.vue';
import { useDesign } from '/@/hooks/web/useDesign';
export default defineComponent({
@@ -26,6 +31,7 @@
components: {
ThirdAppDingTalkConfigForm,
ThirdAppWeEnterpriseConfigForm,
ThirdAppKingdeeConfigForm,
},
setup() {
const { prefixCls } = useDesign('j-dd-container');

View File

@@ -27,6 +27,8 @@
setModalProps({ confirmLoading: true });
if (data.thirdType == 'dingtalk') {
title.value = '钉钉配置';
} else if (data.thirdType == 'kingdee') {
title.value = '金蝶配置';
} else {
title.value = '企业微信配置';
}

View File

@@ -0,0 +1,182 @@
<template>
<div class="base-collapse">
<div class="header"> 金蝶集成 </div>
<a-collapse expand-icon-position="right" :bordered="false">
<a-collapse-panel key="1">
<template #header>
<div style="font-size: 16px"> 1.配置对接信息</div>
</template>
<div class="base-desc">先配置金蝶服务地址AppIdAppSecret保存后可进行连通性测试</div>
</a-collapse-panel>
</a-collapse>
<div class="sync-padding">
<a-collapse expand-icon-position="right" :bordered="false">
<a-collapse-panel key="2">
<template #header>
<div style="width: 100%; justify-content: space-between; display: flex">
<div style="font-size: 16px"> 2.配置录入及解绑</div>
</div>
</template>
<div class="flex-flow">
<div class="base-title">服务地址</div>
<div class="base-message">
<a-input-password v-model:value="appConfigData.corpId" readonly />
</div>
</div>
<div class="flex-flow">
<div class="base-title">账套ID</div>
<div class="base-message">
<a-input-password v-model:value="appConfigData.agentId" readonly />
</div>
</div>
<div class="flex-flow">
<div class="base-title">AppId</div>
<div class="base-message">
<a-input-password v-model:value="appConfigData.clientId" readonly />
</div>
</div>
<div class="flex-flow">
<div class="base-title">AppSecret</div>
<div class="base-message">
<a-input-password v-model:value="appConfigData.clientSecret" readonly />
</div>
</div>
<div style="margin-top: 20px; width: 100%; text-align: right">
<a-button @click="kingdeeEditClick">编辑</a-button>
<a-button @click="testConnectClick" style="margin-left: 10px">连接测试</a-button>
<a-button v-if="appConfigData.id" @click="cancelBindClick" danger style="margin-left: 10px">取消绑定</a-button>
</div>
</a-collapse-panel>
</a-collapse>
</div>
</div>
<ThirdAppConfigModal @register="registerAppConfigModal" @success="handleSuccess" />
</template>
<script lang="ts">
import { defineComponent, onMounted, ref } from 'vue';
import { deleteThirdAppConfig, getThirdConfigByTenantId, testKingdeeConnect } from './ThirdApp.api';
import { useModal } from '/@/components/Modal';
import ThirdAppConfigModal from './ThirdAppConfigModal.vue';
import { Modal } from 'ant-design-vue';
import { getTenantId } from '/@/utils/auth';
import { useMessage } from '/@/hooks/web/useMessage';
export default defineComponent({
name: 'ThirdAppKingdeeConfigForm',
components: { ThirdAppConfigModal },
setup() {
const { createMessage } = useMessage();
const appConfigData = ref<any>({ corpId: '', agentId: '', clientId: '', clientSecret: '' });
const [registerAppConfigModal, { openModal }] = useModal();
async function kingdeeEditClick() {
const tenantId = getTenantId();
openModal(true, { tenantId, thirdType: 'kingdee' });
}
async function initThirdAppConfigData(params) {
const values = await getThirdConfigByTenantId(params);
appConfigData.value = values || '';
}
function handleSuccess() {
const tenantId = getTenantId();
initThirdAppConfigData({ tenantId, thirdType: 'kingdee' });
}
async function testConnectClick() {
const tenantId = getTenantId();
const res = await testKingdeeConnect({ tenantId });
if (res.success) {
createMessage.success(res.message || '连接成功');
} else {
createMessage.warning(res.message || '连接失败');
}
}
function cancelBindClick() {
if (!appConfigData.value.id) {
createMessage.warning('请先绑定金蝶应用!');
return;
}
Modal.confirm({
title: '取消绑定',
content: '是否要解除当前组织的金蝶配置绑定?',
okText: '确认',
cancelText: '取消',
onOk: () => deleteThirdAppConfig({ id: appConfigData.value.id }, handleSuccess),
});
}
onMounted(() => {
const tenantId = getTenantId();
initThirdAppConfigData({ tenantId, thirdType: 'kingdee' });
});
return {
appConfigData,
registerAppConfigModal,
kingdeeEditClick,
testConnectClick,
cancelBindClick,
handleSuccess,
};
},
});
</script>
<style lang="less" scoped>
.header {
align-items: center;
box-sizing: border-box;
display: flex;
height: 50px;
justify-content: space-between;
font-weight: 700;
font-size: 18px;
color: @text-color;
}
.flex-flow {
display: flex;
min-height: 0;
}
.sync-padding {
padding: 12px 0 16px;
color: @text-color;
}
.base-collapse {
margin-top: 20px;
padding: 0 24px;
font-size: 20px;
.base-desc {
font-size: 14px;
}
.base-title {
width: 100px;
text-align: left;
height: 50px;
line-height: 50px;
}
.base-message {
width: 100%;
height: 50px;
line-height: 50px;
}
:deep(.ant-collapse-header) {
padding: 12px 0 16px;
}
:deep(.ant-collapse-content-box) {
padding-left: 0;
}
}
</style>

View File

@@ -0,0 +1,28 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslDayTankMaterialMap/list',
save = '/xslmes/mesXslDayTankMaterialMap/add',
edit = '/xslmes/mesXslDayTankMaterialMap/edit',
deleteOne = '/xslmes/mesXslDayTankMaterialMap/delete',
deleteBatch = '/xslmes/mesXslDayTankMaterialMap/deleteBatch',
queryById = '/xslmes/mesXslDayTankMaterialMap/queryById',
exportXls = '/xslmes/mesXslDayTankMaterialMap/exportXls',
equipmentQueryById = '/xslmes/mesXslEquipmentLedger/queryById',
}
export const list = (params) => defHttp.get({ url: Api.list, params });
export const deleteOne = (params, handleSuccess) =>
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
export const batchDelete = (params, handleSuccess) =>
defHttp.delete({ url: Api.deleteBatch, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
export const saveOrUpdate = (params, isUpdate) => defHttp.post({ url: isUpdate ? Api.edit : Api.save, params });
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
export const queryEquipmentById = (params: { id: string }) => defHttp.get({ url: Api.equipmentQueryById, params });
export const getExportUrl = Api.exportXls;

View File

@@ -0,0 +1,154 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
import { loadTreeData } from '/@/api/common/api';
import { queryEquipmentById } from './MesXslDayTankMaterialMap.api';
function useStatusText(v: unknown) {
if (v === 1) return '使用中';
if (v === 0) return '停用';
return '-';
}
function allowSyncText(v: unknown) {
if (v === 1) return '允许';
if (v === 0) return '不允许';
return '-';
}
const useStatusOptions = [
{ label: '使用中', value: 1 },
{ label: '停用', value: 0 },
];
const allowSyncOptions = [
{ label: '允许', value: 1 },
{ label: '不允许', value: 0 },
];
export const columns: BasicColumn[] = [
{ title: '机台代码', align: 'center', dataIndex: 'machineCode', width: 140 },
{ title: '机台名称', align: 'center', dataIndex: 'equipmentId_dictText', width: 160 },
{ title: '料仓分类', align: 'center', dataIndex: 'siloCategoryId_dictText', width: 140 },
{ title: '工位', align: 'center', dataIndex: 'station', width: 120 },
{ title: '料仓号', align: 'center', dataIndex: 'siloNo', width: 120 },
{ title: '物料名称', align: 'center', dataIndex: 'materialId_dictText', width: 160 },
{
title: '使用状态',
align: 'center',
dataIndex: 'useStatus',
width: 120,
customRender: ({ text }) => useStatusText(text),
},
{
title: '是否允许同步',
align: 'center',
dataIndex: 'allowSync',
width: 120,
customRender: ({ text }) => allowSyncText(text),
},
];
export const searchFormSchema: FormSchema[] = [
{
label: '机台名称',
field: 'equipmentId',
component: 'JDictSelectTag',
componentProps: { dictCode: 'mes_xsl_equipment_ledger,equipment_name,id' },
colProps: { span: 6 },
},
{
label: '物料名称',
field: 'materialId',
component: 'JDictSelectTag',
componentProps: { dictCode: 'mes_material,material_name,id' },
colProps: { span: 6 },
},
{
label: '料仓分类',
field: 'siloCategoryId',
component: 'ApiSelect',
componentProps: {
api: loadTreeData,
params: { pcode: 'XSLMES_LCTYPE' },
resultField: '',
labelField: 'title',
valueField: 'key',
placeholder: '请选择料仓分类',
},
colProps: { span: 6 },
},
{
label: '使用状态',
field: 'useStatus',
component: 'Select',
componentProps: { options: useStatusOptions },
colProps: { span: 6 },
},
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{
label: '机台名称',
field: 'equipmentId',
component: 'JDictSelectTag',
required: true,
componentProps: ({ formModel }) => ({
dictCode: 'mes_xsl_equipment_ledger,equipment_name,id',
placeholder: '请选择设备台账中的机台名称',
onChange: async (value: string) => {
if (!value) {
formModel.machineCode = '';
return;
}
try {
const equipment = await queryEquipmentById({ id: value });
formModel.machineCode = equipment?.equipmentCode || '';
} catch {
formModel.machineCode = '';
}
},
}),
},
{
label: '机台代码',
field: 'machineCode',
component: 'Input',
componentProps: { disabled: true, placeholder: '选择机台名称后自动带出设备编号' },
},
{
label: '料仓分类',
field: 'siloCategoryId',
component: 'ApiSelect',
componentProps: {
api: loadTreeData,
params: { pcode: 'XSLMES_LCTYPE' },
resultField: '',
labelField: 'title',
valueField: 'key',
placeholder: '请选择料仓分类',
},
},
{ label: '工位', field: 'station', component: 'Input' },
{ label: '料仓号', field: 'siloNo', component: 'Input' },
{
label: '物料名称',
field: 'materialId',
component: 'JDictSelectTag',
required: true,
componentProps: { dictCode: 'mes_material,material_name,id', placeholder: '请选择胶料信息中的物料名称' },
},
{
label: '使用状态',
field: 'useStatus',
component: 'Select',
defaultValue: 1,
componentProps: { options: useStatusOptions },
},
{
label: '是否允许同步',
field: 'allowSync',
component: 'Select',
defaultValue: 1,
componentProps: { options: allowSyncOptions },
},
];

View File

@@ -0,0 +1,84 @@
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button type="primary" v-auth="'xslmes:mes_xsl_day_tank_material_map:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button>
<a-button
type="primary"
v-auth="'xslmes:mes_xsl_day_tank_material_map:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete"><Icon icon="ant-design:delete-outlined" />删除</a-menu-item>
</a-menu>
</template>
<a-button>批量操作<Icon icon="mdi:chevron-down" /></a-button>
</a-dropdown>
</template>
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</template>
</BasicTable>
<MesXslDayTankMaterialMapModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import MesXslDayTankMaterialMapModal from './modules/MesXslDayTankMaterialMapModal.vue';
import { columns, searchFormSchema } from './MesXslDayTankMaterialMap.data';
import { batchDelete, deleteOne, getExportUrl, list } from './MesXslDayTankMaterialMap.api';
const [registerModal, { openModal }] = useModal();
const { tableContext, onExportXls } = useListPage({
tableProps: {
title: '日罐物料对应信息',
api: list,
columns,
canResize: true,
formConfig: { labelWidth: 100, schemas: searchFormSchema, autoSubmitOnEnter: true },
actionColumn: { width: 120, fixed: 'right' },
},
exportConfig: { name: '日罐物料对应信息', url: getExportUrl },
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
function handleAdd() {
openModal(true, { isUpdate: false, showFooter: true });
}
function handleEdit(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: true });
}
function handleDetail(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: false });
}
async function handleDelete(record) {
await deleteOne({ id: record.id }, reload);
}
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value.join(',') }, reload);
}
function handleSuccess() {
reload();
}
function getTableAction(record) {
return [{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'xslmes:mes_xsl_day_tank_material_map:edit' }];
}
function getDropDownAction(record) {
return [
{ label: '详情', onClick: handleDetail.bind(null, record) },
{
label: '删除',
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
auth: 'xslmes:mes_xsl_day_tank_material_map:delete',
},
];
}
</script>

View File

@@ -0,0 +1,67 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="760px" @ok="handleSubmit">
<BasicForm @register="registerForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import { computed, ref, unref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { formSchema } from '../MesXslDayTankMaterialMap.data';
import { queryEquipmentById, saveOrUpdate } from '../MesXslDayTankMaterialMap.api';
const emit = defineEmits(['register', 'success']);
const isUpdate = ref(true);
const isDetail = ref(false);
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = useForm({
labelWidth: 110,
schemas: formSchema,
showActionButtonGroup: false,
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
await resetFields();
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
isUpdate.value = !!data?.isUpdate;
isDetail.value = !data?.showFooter;
if (unref(isUpdate)) {
await setFieldsValue({ ...data.record });
} else {
await setFieldsValue({ useStatus: 1, allowSync: 1 });
}
setProps({ disabled: !data?.showFooter });
});
const title = computed(() =>
!unref(isUpdate) ? '新增日罐物料对应信息' : unref(isDetail) ? '日罐物料对应信息详情' : '编辑日罐物料对应信息',
);
async function fillMachineCodeByEquipment() {
const values = getFieldsValue();
if (!values?.equipmentId) {
await setFieldsValue({ machineCode: '' });
return;
}
try {
const equipment = await queryEquipmentById({ id: values.equipmentId });
await setFieldsValue({ machineCode: equipment?.equipmentCode || '' });
} catch {
await setFieldsValue({ machineCode: '' });
}
}
async function handleSubmit() {
try {
await fillMachineCodeByEquipment();
const values = await validate();
setModalProps({ confirmLoading: true });
await saveOrUpdate(values, isUpdate.value);
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>

View File

@@ -0,0 +1,51 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
const { createConfirm } = useMessage();
enum Api {
list = '/xslmes/mesXslEquipInspectConfig/list',
save = '/xslmes/mesXslEquipInspectConfig/add',
edit = '/xslmes/mesXslEquipInspectConfig/edit',
deleteOne = '/xslmes/mesXslEquipInspectConfig/delete',
deleteBatch = '/xslmes/mesXslEquipInspectConfig/deleteBatch',
importExcel = '/xslmes/mesXslEquipInspectConfig/importExcel',
exportXls = '/xslmes/mesXslEquipInspectConfig/exportXls',
queryById = '/xslmes/mesXslEquipInspectConfig/queryById',
queryLineList = '/xslmes/mesXslEquipInspectConfig/queryLineListByConfigId',
}
export const getExportUrl = Api.exportXls;
export const getImportUrl = Api.importExcel;
export const list = (params) => defHttp.get({ url: Api.list, params });
export const queryById = (params: { id: string }) => defHttp.get({ url: Api.queryById, params });
export const queryLineListByConfigId = (params: { id: string }) => defHttp.get({ url: Api.queryLineList, params });
export const deleteOne = (params, handleSuccess) => {
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
handleSuccess();
});
};
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
handleSuccess();
});
},
});
};
export const saveOrUpdate = (params, isUpdate) => {
const url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url, params });
};

View File

@@ -0,0 +1,86 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
import { JVxeColumn, JVxeTypes } from '/@/components/jeecg/JVxeTable/types';
export const columns: BasicColumn[] = [
{ title: '设备名称', align: 'center', dataIndex: 'equipmentName', width: 160 },
{ title: '设备编号', align: 'center', dataIndex: 'equipmentCode', width: 140 },
{ title: '类型', align: 'center', dataIndex: 'configType_dictText', width: 90 },
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100 },
{
title: '创建时间',
align: 'center',
dataIndex: 'createTime',
width: 165,
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
},
];
export const searchFormSchema: FormSchema[] = [
{ label: '设备名称', field: 'equipmentName', component: 'Input', colProps: { span: 6 } },
{ label: '设备编号', field: 'equipmentCode', component: 'Input', colProps: { span: 6 } },
{
label: '类型',
field: 'configType',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_im_item_category' },
colProps: { span: 6 },
},
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{ label: '', field: 'equipmentLedgerId', component: 'Input', show: false },
{
label: '设备名称',
field: 'equipmentName',
component: 'Input',
slot: 'equipmentLedgerPicker',
dynamicRules: () => [{ required: true, message: '请选择设备台账' }],
},
{
label: '设备编号',
field: 'equipmentCode',
component: 'Input',
componentProps: { readonly: true, placeholder: '选择设备后自动带出' },
},
{
label: '类型',
field: 'configType',
component: 'JDictSelectTag',
required: true,
componentProps: { dictCode: 'xslmes_im_item_category', placeholder: '点检/保养' },
},
];
export const lineJVxeColumns: JVxeColumn[] = [
{ title: '', key: 'inspectMaintainItemId', type: JVxeTypes.hidden },
{ title: '点检项目编号', key: 'itemCode', type: JVxeTypes.normal, width: 130, disabled: true },
{ title: '项目名称', key: 'itemName', type: JVxeTypes.normal, width: 140, disabled: true },
{
title: '项目类别',
key: 'itemCategory',
type: JVxeTypes.select,
width: 100,
disabled: true,
dictCode: 'xslmes_im_item_category',
},
{
title: '项目类型',
key: 'itemType',
type: JVxeTypes.select,
width: 100,
disabled: true,
dictCode: 'xslmes_im_item_type',
},
{ title: '设备部位', key: 'equipmentPartName', type: JVxeTypes.normal, width: 120, disabled: true },
{ title: '设备小部位', key: 'equipmentSubPartName', type: JVxeTypes.normal, width: 120, disabled: true },
{
title: '点检方式',
key: 'inspectMethod',
type: JVxeTypes.select,
width: 100,
disabled: true,
dictCode: 'xslmes_im_inspect_method',
},
{ title: '判断基准', key: 'judgmentCriteria', type: JVxeTypes.normal, width: 180, disabled: true },
];

View File

@@ -0,0 +1,132 @@
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button
type="primary"
v-auth="'mes:mes_xsl_equip_inspect_config:add'"
@click="handleAdd"
preIcon="ant-design:plus-outlined"
>
新增
</a-button>
<a-button
type="primary"
v-auth="'mes:mes_xsl_equip_inspect_config:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
<j-upload-button
type="primary"
v-auth="'mes:mes_xsl_equip_inspect_config:importExcel'"
preIcon="ant-design:import-outlined"
@click="onImportXls"
>
导入
</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined" />
删除
</a-menu-item>
</a-menu>
</template>
<a-button v-auth="'mes:mes_xsl_equip_inspect_config:deleteBatch'">
批量操作
<Icon icon="mdi:chevron-down" />
</a-button>
</a-dropdown>
</template>
<template #action="{ record }">
<TableAction
:actions="[
{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'mes:mes_xsl_equip_inspect_config:edit' },
]"
:dropDownActions="getDropDownAction(record)"
/>
</template>
</BasicTable>
<MesXslEquipInspectConfigModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" name="xslmes-mesXslEquipInspectConfig" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import Icon from '/@/components/Icon';
import MesXslEquipInspectConfigModal from './components/MesXslEquipInspectConfigModal.vue';
import { columns, searchFormSchema } from './MesXslEquipInspectConfig.data';
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipInspectConfig.api';
const [registerModal, { openModal }] = useModal();
const { tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '设备点检配置',
api: list,
columns,
canResize: true,
formConfig: {
schemas: searchFormSchema,
labelWidth: 100,
autoSubmitOnEnter: true,
showAdvancedButton: true,
},
actionColumn: {
width: 200,
fixed: 'right',
},
},
exportConfig: {
name: '设备点检配置',
url: getExportUrl,
},
importConfig: {
url: getImportUrl,
success: handleSuccess,
},
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
function handleAdd() {
openModal(true, { isUpdate: false, showFooter: true });
}
function handleEdit(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: true });
}
function handleDetail(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: false });
}
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
function handleSuccess() {
selectedRowKeys.value = [];
reload();
}
function getDropDownAction(record) {
return [
{ label: '详情', onClick: handleDetail.bind(null, record) },
{
label: '删除',
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
auth: 'mes:mes_xsl_equip_inspect_config:delete',
},
];
}
</script>

View File

@@ -0,0 +1,239 @@
<template>
<BasicModal
v-bind="$attrs"
destroyOnClose
:title="title"
width="1100px"
@register="registerModal"
@ok="handleSubmit"
>
<BasicForm @register="registerForm">
<template #equipmentLedgerPicker="{ model, field }">
<a-input-group compact style="display: flex; width: 100%">
<a-input v-model:value="model[field]" read-only placeholder="请选择设备台账" style="flex: 1" />
<a-button type="primary" :disabled="isDetail" @click="openLedgerSelect">选择</a-button>
<a-button v-if="model.equipmentLedgerId && !isDetail" @click="clearLedger">清除</a-button>
</a-input-group>
</template>
</BasicForm>
<a-divider orientation="left">点检项目明细</a-divider>
<JVxeTable
v-if="tableReady"
ref="lineTableRef"
toolbar
row-number
rowSelection
keep-source
:insert-row="false"
:max-height="380"
:loading="lineLoading"
:columns="lineJVxeColumns"
:dataSource="lineDataSource"
:disabled="!showFooterFlag"
:toolbar-config="{ btn: ['remove'], slots: ['suffix'] }"
:add-btn-cfg="{ enabled: false }"
>
<template #toolbarSuffix>
<a-button
v-if="showFooterFlag"
type="primary"
preIcon="ant-design:plus-outlined"
@click="openBatchItemSelect"
>
选择点检及保养项目
</a-button>
</template>
</JVxeTable>
<MesXslEquipmentLedgerSelectModal @register="registerLedgerModal" @select="onLedgerSelect" />
<MesXslInspectMaintainItemSelectModal @register="registerItemModal" @select="onItemsSelect" />
</BasicModal>
</template>
<script lang="ts" setup>
import { computed, ref, unref } from 'vue';
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import type { JVxeTableInstance } from '/@/components/jeecg/JVxeTable/types';
import { useMessage } from '/@/hooks/web/useMessage';
import { formSchema, lineJVxeColumns } from '../MesXslEquipInspectConfig.data';
import { saveOrUpdate, queryById, queryLineListByConfigId } from '../MesXslEquipInspectConfig.api';
import MesXslEquipmentLedgerSelectModal from './MesXslEquipmentLedgerSelectModal.vue';
import MesXslInspectMaintainItemSelectModal from './MesXslInspectMaintainItemSelectModal.vue';
const emit = defineEmits(['register', 'success']);
const { createMessage } = useMessage();
const isUpdate = ref(false);
const isDetail = ref(false);
const showFooterFlag = ref(true);
const tableReady = ref(false);
const lineLoading = ref(false);
const lineDataSource = ref<Recordable[]>([]);
const lineTableRef = ref<JVxeTableInstance>();
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = useForm({
labelWidth: 110,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: { span: 12 },
});
const [registerLedgerModal, { openModal: openLedgerModal }] = useModal();
const [registerItemModal, { openModal: openItemModal }] = useModal();
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
tableReady.value = false;
lineDataSource.value = [];
await resetFields();
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
isUpdate.value = !!data?.isUpdate;
isDetail.value = !data?.showFooter;
showFooterFlag.value = !!data?.showFooter;
setProps({ disabled: !data?.showFooter });
if (unref(isUpdate) && data?.record?.id) {
lineLoading.value = true;
try {
const mainRaw = await queryById({ id: data.record.id });
const m = (mainRaw as any)?.id != null ? mainRaw : (mainRaw as any)?.result ?? mainRaw;
const linesRaw = await queryLineListByConfigId({ id: data.record.id });
const list = Array.isArray(linesRaw) ? linesRaw : (linesRaw as any)?.result ?? [];
await setFieldsValue({ ...m });
lineDataSource.value = [...(list || [])];
} finally {
lineLoading.value = false;
}
}
tableReady.value = true;
});
const title = computed(() =>
!unref(isUpdate) ? '新增设备点检配置' : unref(isDetail) ? '设备点检配置详情' : '编辑设备点检配置',
);
function itemToLineRow(item: Recordable) {
return {
inspectMaintainItemId: item.id,
itemCode: item.itemCode,
itemName: item.itemName,
itemCategory: item.itemCategory,
itemType: item.itemType,
equipmentPartName: item.equipmentPartName,
equipmentSubPartName: item.equipmentSubPartName,
inspectMethod: item.inspectMethod,
judgmentCriteria: item.judgmentCriteria,
};
}
function getExistingItemIds(): Set<string> {
const lineRef = lineTableRef.value as any;
const tableData = (lineRef?.getTableData?.() || lineDataSource.value || []) as Recordable[];
const ids = new Set<string>();
for (const r of tableData) {
if (r?.inspectMaintainItemId) {
ids.add(String(r.inspectMaintainItemId));
}
}
return ids;
}
function openLedgerSelect() {
const vals = getFieldsValue();
openLedgerModal(true, { equipmentLedgerId: vals.equipmentLedgerId });
}
function clearLedger() {
setFieldsValue({ equipmentLedgerId: '', equipmentName: '', equipmentCode: '' });
}
function onLedgerSelect(payload: { equipmentLedgerId?: string; equipmentName?: string; equipmentCode?: string }) {
setFieldsValue({
equipmentLedgerId: payload.equipmentLedgerId || '',
equipmentName: payload.equipmentName || '',
equipmentCode: payload.equipmentCode || '',
});
}
function openBatchItemSelect() {
const configType = getFieldsValue()?.configType;
if (!configType) {
createMessage.warning('请先选择类型(点检/保养)');
return;
}
openItemModal(true, { itemCategory: configType, multiple: true });
}
function onItemsSelect(payload: Recordable | Recordable[]) {
const items = Array.isArray(payload) ? payload : payload ? [payload] : [];
if (!items.length) {
return;
}
const existing = getExistingItemIds();
const toAdd: Recordable[] = [];
const skipped: string[] = [];
for (const item of items) {
if (!item?.id) {
continue;
}
const id = String(item.id);
if (existing.has(id)) {
skipped.push(item.itemName || item.itemCode || id);
continue;
}
existing.add(id);
toAdd.push(itemToLineRow(item));
}
if (!toAdd.length) {
if (skipped.length) {
createMessage.warning('所选项目均已在明细中,未添加新行');
}
return;
}
const lineRef = lineTableRef.value as any;
if (lineRef?.pushRows) {
lineRef.pushRows(toAdd);
} else {
lineDataSource.value = [...lineDataSource.value, ...toAdd];
}
if (skipped.length) {
createMessage.warning(`已添加 ${toAdd.length} 项,跳过 ${skipped.length} 项重复项目`);
}
}
async function handleSubmit() {
try {
const values = await validate();
const lineRef = lineTableRef.value as any;
const tableData = (lineRef?.getTableData?.() || []) as Recordable[];
const lineList = tableData
.filter((r) => r && r.inspectMaintainItemId)
.map((r) => ({
inspectMaintainItemId: r.inspectMaintainItemId,
itemCode: r.itemCode,
itemName: r.itemName,
itemCategory: r.itemCategory,
itemType: r.itemType,
equipmentPartName: r.equipmentPartName,
equipmentSubPartName: r.equipmentSubPartName,
inspectMethod: r.inspectMethod,
judgmentCriteria: r.judgmentCriteria,
}));
if (!lineList.length) {
createMessage.warning('请通过「选择点检及保养项目」至少添加一条明细');
return;
}
const ids = new Set<string>();
for (const line of lineList) {
if (ids.has(line.inspectMaintainItemId)) {
createMessage.warning('明细中点检项目不能重复');
return;
}
ids.add(line.inspectMaintainItemId);
}
setModalProps({ confirmLoading: true });
await saveOrUpdate({ ...values, lineList }, unref(isUpdate));
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>

View File

@@ -0,0 +1,93 @@
<template>
<BasicModal v-bind="$attrs" title="选择设备台账" :width="1000" @register="registerModal" @ok="handleOk">
<BasicTable @register="registerTable" />
</BasicModal>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicTable, useTable } from '/@/components/Table';
import { list, queryById } from '/@/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.api';
const emit = defineEmits(['register', 'select']);
const selectedRow = ref<Recordable | null>(null);
function handleSelectionChange(_keys: string[], rows: Recordable[]) {
selectedRow.value = rows?.[0] ?? null;
}
const [registerTable, { reload, getSelectRowKeys, getSelectRows, setSelectedRowKeys, clearSelectedRowKeys }] = useTable({
api: list,
columns: [
{ title: '设备名称', dataIndex: 'equipmentName', width: 160 },
{ title: '设备编号', dataIndex: 'equipmentCode', width: 140 },
{ title: '设备类别', dataIndex: 'equipmentCategoryName', width: 120 },
{ title: '设备类型', dataIndex: 'equipmentTypeName', width: 120 },
],
rowKey: 'id',
useSearchForm: true,
formConfig: {
labelWidth: 90,
schemas: [
{ label: '设备名称', field: 'equipmentName', component: 'Input', colProps: { span: 8 } },
{ label: '设备编号', field: 'equipmentCode', component: 'Input', colProps: { span: 8 } },
],
},
pagination: { pageSize: 10 },
canResize: false,
showIndexColumn: false,
immediate: true,
rowSelection: {
type: 'radio',
columnWidth: 48,
onChange: handleSelectionChange,
},
clickToRowSelect: true,
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
selectedRow.value = null;
clearSelectedRowKeys?.();
setModalProps({ confirmLoading: false });
const lid = data?.equipmentLedgerId as string | undefined;
if (lid) {
setSelectedRowKeys?.([lid]);
try {
const raw = await queryById({ id: lid });
const row = (raw as any)?.id != null ? raw : (raw as any)?.result;
if (row) {
selectedRow.value = row;
}
} catch {
// 忽略
}
}
reload();
});
async function handleOk() {
const keys = (getSelectRowKeys?.() || []) as string[];
let row = selectedRow.value || ((getSelectRows?.() || []) as Recordable[])[0];
if (!row && keys.length) {
try {
const raw = await queryById({ id: keys[0] });
row = (raw as any)?.id != null ? raw : (raw as any)?.result;
} catch {
// 忽略
}
}
if (!row?.id) {
emit('select', { equipmentLedgerId: '', equipmentName: '', equipmentCode: '' });
closeModal();
return;
}
emit('select', {
equipmentLedgerId: row.id,
equipmentName: row.equipmentName || '',
equipmentCode: row.equipmentCode || '',
});
closeModal();
}
</script>

View File

@@ -0,0 +1,89 @@
<template>
<BasicModal v-bind="$attrs" :title="modalTitle" :width="1100" @register="registerModal" @ok="handleOk">
<BasicTable @register="registerTable" />
</BasicModal>
</template>
<script lang="ts" setup>
import { computed, ref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicTable, useTable } from '/@/components/Table';
import { list } from '/@/views/xslmes/mesXslInspectMaintainItem/MesXslInspectMaintainItem.api';
const emit = defineEmits(['register', 'select']);
const multipleMode = ref(true);
const filterItemCategory = ref('');
const selectedRows = ref<Recordable[]>([]);
const modalTitle = computed(() => (multipleMode.value ? '选择点检及保养项目(可多选)' : '选择点检及保养项目'));
function handleSelectionChange(_keys: string[], rows: Recordable[]) {
selectedRows.value = rows || [];
}
function fetchItemPage(params: Recordable) {
const p = { ...params };
if (filterItemCategory.value) {
p.itemCategory = filterItemCategory.value;
}
return list(p);
}
const [registerTable, { reload, getSelectRows, clearSelectedRowKeys }] = useTable({
api: fetchItemPage,
columns: [
{ title: '项目编号', dataIndex: 'itemCode', width: 120 },
{ title: '项目名称', dataIndex: 'itemName', width: 140 },
{ title: '项目类别', dataIndex: 'itemCategory_dictText', width: 90 },
{ title: '项目类型', dataIndex: 'itemType_dictText', width: 90 },
{ title: '设备部位', dataIndex: 'equipmentPartName', width: 110 },
{ title: '设备小部位', dataIndex: 'equipmentSubPartName', width: 110 },
{ title: '点检方式', dataIndex: 'inspectMethod_dictText', width: 90 },
{ title: '判断基准', dataIndex: 'judgmentCriteria', width: 160, ellipsis: true },
],
rowKey: 'id',
useSearchForm: true,
formConfig: {
labelWidth: 90,
schemas: [
{ label: '项目编号', field: 'itemCode', component: 'Input', colProps: { span: 8 } },
{ label: '项目名称', field: 'itemName', component: 'Input', colProps: { span: 8 } },
],
},
pagination: { pageSize: 10 },
canResize: false,
showIndexColumn: false,
immediate: true,
rowSelection: {
type: 'checkbox',
columnWidth: 48,
onChange: handleSelectionChange,
},
clickToRowSelect: true,
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
multipleMode.value = data?.multiple !== false;
filterItemCategory.value = data?.itemCategory ? String(data.itemCategory) : '';
selectedRows.value = [];
clearSelectedRowKeys?.();
setModalProps({ confirmLoading: false });
reload();
});
async function handleOk() {
let rows = selectedRows.value?.length ? [...selectedRows.value] : ((getSelectRows?.() || []) as Recordable[]);
const valid = rows.filter((r) => r?.id && (r.itemCode != null || r.itemName != null));
if (!valid.length) {
closeModal();
return;
}
if (multipleMode.value) {
emit('select', valid);
} else {
emit('select', valid[0]);
}
closeModal();
}
</script>

View File

@@ -0,0 +1,65 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
const { createConfirm } = useMessage();
enum Api {
list = '/xslmes/mesXslEquipInspectRecord/list',
save = '/xslmes/mesXslEquipInspectRecord/add',
edit = '/xslmes/mesXslEquipInspectRecord/edit',
deleteOne = '/xslmes/mesXslEquipInspectRecord/delete',
deleteBatch = '/xslmes/mesXslEquipInspectRecord/deleteBatch',
importExcel = '/xslmes/mesXslEquipInspectRecord/importExcel',
exportXls = '/xslmes/mesXslEquipInspectRecord/exportXls',
queryById = '/xslmes/mesXslEquipInspectRecord/queryById',
queryLineList = '/xslmes/mesXslEquipInspectRecord/queryLineListByRecordId',
generateRecordNo = '/xslmes/mesXslEquipInspectRecord/generateRecordNo',
loadLinesByEquipment = '/xslmes/mesXslEquipInspectRecord/loadLinesByEquipment',
batchCreateFromEquipment = '/xslmes/mesXslEquipInspectRecord/batchCreateFromEquipment',
handleFail = '/xslmes/mesXslEquipInspectRecord/handleFail',
}
export const getExportUrl = Api.exportXls;
export const getImportUrl = Api.importExcel;
export const list = (params) => defHttp.get({ url: Api.list, params });
export const queryById = (params: { id: string }) => defHttp.get({ url: Api.queryById, params });
export const queryLineListByRecordId = (params: { id: string }) => defHttp.get({ url: Api.queryLineList, params });
export const generateRecordNo = () => defHttp.get({ url: Api.generateRecordNo });
export const loadLinesByEquipment = (params: { equipmentLedgerId: string; recordType: string }) =>
defHttp.get({ url: Api.loadLinesByEquipment, params });
export const batchCreateFromEquipment = (params: { equipmentLedgerIds: string[]; recordType: string }) =>
defHttp.post({ url: Api.batchCreateFromEquipment, params });
export const deleteOne = (params, handleSuccess) => {
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
handleSuccess();
});
};
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
handleSuccess();
});
},
});
};
export const saveOrUpdate = (params, isUpdate) => {
const url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url, params });
};
export const handleFailRecord = (params: Recordable) => defHttp.post({ url: Api.handleFail, params });

View File

@@ -0,0 +1,222 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
import { JVxeColumn, JVxeTypes } from '/@/components/jeecg/JVxeTable/types';
import { uploadUrl } from '/@/api/common/api';
export const columns: BasicColumn[] = [
{ title: '记录编号', align: 'center', dataIndex: 'recordNo', width: 150 },
{ title: '计划单号', align: 'center', dataIndex: 'planNo', width: 130 },
{ title: '设备名称', align: 'center', dataIndex: 'equipmentName', width: 150 },
{ title: '设备编码', align: 'center', dataIndex: 'equipmentCode', width: 130 },
{ title: '类型', align: 'center', dataIndex: 'recordType_dictText', width: 80 },
{ title: '点检日期', align: 'center', dataIndex: 'inspectDate', width: 110 },
{ title: '点检人', align: 'center', dataIndex: 'inspectorRealname', width: 100 },
{ title: '点检结果', align: 'center', dataIndex: 'inspectResult_dictText', width: 90 },
{ title: '是否已处理', align: 'center', dataIndex: 'handledFlag_dictText', width: 90 },
{ title: '状态', align: 'center', dataIndex: 'recordStatus_dictText', width: 90 },
{
title: '创建时间',
align: 'center',
dataIndex: 'createTime',
width: 165,
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
},
];
export const searchFormSchema: FormSchema[] = [
{ label: '记录编号', field: 'recordNo', component: 'Input', colProps: { span: 6 } },
{ label: '计划单号', field: 'planNo', component: 'Input', colProps: { span: 6 } },
{ label: '设备名称', field: 'equipmentName', component: 'Input', colProps: { span: 6 } },
{
label: '类型',
field: 'recordType',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_im_item_category' },
colProps: { span: 6 },
},
{
label: '状态',
field: 'recordStatus',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_im_record_status' },
colProps: { span: 6 },
},
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{ label: '', field: 'equipmentLedgerId', component: 'Input', show: false },
{ label: '', field: 'planId', component: 'Input', show: false },
{ label: '', field: 'equipInspectConfigId', component: 'Input', show: false },
{ label: '', field: 'inspectorUserId', component: 'Input', show: false },
{ label: '', field: 'inspectorUsername', component: 'Input', show: false },
{
label: '记录编号',
field: 'recordNo',
component: 'Input',
componentProps: { readonly: true, placeholder: '保存时自动生成' },
dynamicRules: () => [{ required: true, message: '记录编号不能为空' }],
},
{ label: '计划单号', field: 'planNo', component: 'Input' },
{
label: '设备名称',
field: 'equipmentName',
component: 'Input',
componentProps: { readonly: true },
},
{
label: '设备编码',
field: 'equipmentCode',
component: 'Input',
componentProps: { readonly: true },
},
{
label: '类型',
field: 'recordType',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_im_item_category', disabled: true },
},
{
label: '点检日期',
field: 'inspectDate',
component: 'DatePicker',
required: true,
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } },
},
{
label: '点检人',
field: 'inspectorRealname',
component: 'Input',
componentProps: { readonly: true, placeholder: '当前登录用户' },
dynamicRules: () => [{ required: true, message: '点检人不能为空' }],
},
{
label: '点检结果',
field: 'inspectResult',
component: 'JDictSelectTag',
required: true,
componentProps: { dictCode: 'xslmes_im_inspect_result', placeholder: '合格/不合格' },
},
{
label: '状态',
field: 'recordStatus',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_im_record_status', disabled: true },
},
];
/** 详情页:仅不合格记录展示的处理信息(只读) */
export const processDisplayFormSchema: FormSchema[] = [
{
label: '是否已处理',
field: 'handledFlag',
component: 'JDictSelectTag',
componentProps: { dictCode: 'yn', disabled: true },
},
{
label: '处理人',
field: 'handlerRealname',
component: 'Input',
componentProps: { readonly: true },
},
{
label: '处理时间',
field: 'handleTime',
component: 'DatePicker',
componentProps: {
showTime: true,
valueFormat: 'YYYY-MM-DD HH:mm:ss',
style: { width: '100%' },
disabled: true,
},
},
];
/** 不合格记录处理弹窗 */
export const handleFormSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{ label: '', field: 'handlerUsername', component: 'Input', show: false },
{ label: '', field: 'handlerRealname', component: 'Input', show: false },
{
label: '处理人',
field: 'handlerUserId',
component: 'JSelectUser',
required: true,
componentProps: ({ formActionType }) => ({
rowKey: 'id',
labelKey: 'realname',
isRadioSelection: true,
maxSelectCount: 1,
onOptionsChange: (options) => {
const row = options?.[0];
if (row && formActionType) {
formActionType.setFieldsValue({
handlerUsername: row.username,
handlerRealname: row.realname,
});
}
},
}),
},
{
label: '处理时间',
field: 'handleTime',
component: 'DatePicker',
required: true,
componentProps: {
showTime: true,
valueFormat: 'YYYY-MM-DD HH:mm:ss',
style: { width: '100%' },
},
},
];
export const lineJVxeColumns: JVxeColumn[] = [
{ title: '', key: 'equipInspectConfigLineId', type: JVxeTypes.hidden },
{ title: '', key: 'inspectMaintainItemId', type: JVxeTypes.hidden },
{ title: '点检项目编号', key: 'itemCode', type: JVxeTypes.normal, width: 120, disabled: true },
{ title: '点检项目', key: 'itemName', type: JVxeTypes.normal, width: 130, disabled: true },
{
title: '项目类别',
key: 'itemCategory',
type: JVxeTypes.select,
width: 90,
disabled: true,
dictCode: 'xslmes_im_item_category',
filters: false,
sortable: false,
},
{
title: '项目类型',
key: 'itemType',
type: JVxeTypes.select,
width: 90,
disabled: true,
dictCode: 'xslmes_im_item_type',
filters: false,
sortable: false,
},
{ title: '设备部位', key: 'equipmentPartName', type: JVxeTypes.normal, width: 100, disabled: true },
{ title: '设备小部位', key: 'equipmentSubPartName', type: JVxeTypes.normal, width: 100, disabled: true },
{
title: '点检方式',
key: 'inspectMethod',
type: JVxeTypes.select,
width: 90,
disabled: true,
dictCode: 'xslmes_im_inspect_method',
filters: false,
sortable: false,
},
{ title: '判断基准', key: 'judgmentCriteria', type: JVxeTypes.normal, width: 150, disabled: true },
{ title: '点检描述', key: 'lineInspectResult', type: JVxeTypes.input, width: 140 },
{
title: '图片',
key: 'pictureFiles',
type: JVxeTypes.image,
width: 160,
maxCount: 3,
token: true,
action: uploadUrl,
responseName: 'message',
},
];

View File

@@ -0,0 +1,153 @@
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button
type="primary"
v-auth="'mes:mes_xsl_equip_inspect_record:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined" />
删除
</a-menu-item>
</a-menu>
</template>
<a-button v-auth="'mes:mes_xsl_equip_inspect_record:deleteBatch'">
批量操作
<Icon icon="mdi:chevron-down" />
</a-button>
</a-dropdown>
</template>
<template #action="{ record }">
<TableAction :actions="getTableActions(record)" :dropDownActions="getDropDownAction(record)" />
</template>
</BasicTable>
<MesXslEquipInspectRecordModal @register="registerModal" @success="handleSuccess" />
<MesXslEquipInspectRecordHandleModal @register="registerHandleModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" name="xslmes-mesXslEquipInspectRecord" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import { useMessage } from '/@/hooks/web/useMessage';
import Icon from '/@/components/Icon';
import MesXslEquipInspectRecordModal from './components/MesXslEquipInspectRecordModal.vue';
import MesXslEquipInspectRecordHandleModal from './components/MesXslEquipInspectRecordHandleModal.vue';
import { columns, searchFormSchema } from './MesXslEquipInspectRecord.data';
import { list, deleteOne, batchDelete, getExportUrl } from './MesXslEquipInspectRecord.api';
const { createMessage } = useMessage();
const [registerModal, { openModal }] = useModal();
const [registerHandleModal, { openModal: openHandleModal }] = useModal();
const { tableContext, onExportXls } = useListPage({
tableProps: {
title: '点检保养记录',
api: list,
columns,
canResize: true,
formConfig: {
schemas: searchFormSchema,
labelWidth: 100,
autoSubmitOnEnter: true,
showAdvancedButton: true,
},
actionColumn: {
width: 240,
fixed: 'right',
},
},
exportConfig: {
name: '点检保养记录',
url: getExportUrl,
},
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
function handleEnterResult(record: Recordable) {
if (record.recordStatus !== 'pending') {
createMessage.warning('仅待点检记录可录入点检结果');
return;
}
openModal(true, { record, showFooter: true });
}
function handleDetail(record: Recordable) {
openModal(true, { record, showFooter: false });
}
function canHandleFail(record: Recordable) {
return (
record.inspectResult === 'fail' &&
record.recordStatus === 'done' &&
record.handledFlag !== '1'
);
}
function handleProcess(record: Recordable) {
if (!canHandleFail(record)) {
createMessage.warning('仅未处理的不合格记录可登记处理');
return;
}
openHandleModal(true, { record });
}
function getTableActions(record: Recordable) {
if (record.recordStatus === 'pending') {
return [
{
label: '录入点检结果',
onClick: handleEnterResult.bind(null, record),
auth: 'mes:mes_xsl_equip_inspect_record:edit',
},
];
}
const actions: Recordable[] = [{ label: '详情', onClick: handleDetail.bind(null, record) }];
if (canHandleFail(record)) {
actions.push({
label: '处理',
onClick: handleProcess.bind(null, record),
auth: 'mes:mes_xsl_equip_inspect_record:edit',
});
}
return actions;
}
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
function handleSuccess() {
selectedRowKeys.value = [];
reload();
}
function getDropDownAction(record: Recordable) {
if (record.recordStatus === 'pending') {
return [
{ label: '详情', onClick: handleDetail.bind(null, record) },
{
label: '删除',
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
auth: 'mes:mes_xsl_equip_inspect_record:delete',
},
];
}
return [];
}
</script>

View File

@@ -0,0 +1,63 @@
<template>
<BasicModal v-bind="$attrs" destroyOnClose title="不合格记录处理" width="520px" @register="registerModal" @ok="handleSubmit">
<BasicForm @register="registerForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import dayjs from 'dayjs';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { useMessage } from '/@/hooks/web/useMessage';
import { useUserStore } from '/@/store/modules/user';
import { handleFormSchema } from '../MesXslEquipInspectRecord.data';
import { handleFailRecord } from '../MesXslEquipInspectRecord.api';
const emit = defineEmits(['register', 'success']);
const { createMessage } = useMessage();
const userStore = useUserStore();
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
labelWidth: 100,
schemas: handleFormSchema,
showActionButtonGroup: false,
baseColProps: { span: 24 },
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
await resetFields();
setModalProps({ confirmLoading: false });
const record = data?.record;
if (!record?.id) {
return;
}
const user = userStore.getUserInfo || {};
await setFieldsValue({
id: record.id,
handlerUserId: user.id,
handlerUsername: user.username,
handlerRealname: user.realname,
handleTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
});
});
async function handleSubmit() {
try {
const values = await validate();
if (!values.handlerUserId) {
createMessage.warning('请选择处理人');
return;
}
if (!values.handleTime) {
createMessage.warning('请选择处理时间');
return;
}
setModalProps({ confirmLoading: true });
await handleFailRecord(values);
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>

View File

@@ -0,0 +1,173 @@
<template>
<BasicModal
v-bind="$attrs"
destroyOnClose
:title="title"
width="1150px"
@register="registerModal"
@ok="handleSubmit"
>
<BasicForm @register="registerForm" />
<a-divider orientation="left">点检项目明细来自设备点检配置只读</a-divider>
<JVxeTable
v-if="tableReady"
ref="lineTableRef"
row-number
keep-source
:insert-row="false"
:toolbar="false"
:row-selection="false"
:max-height="400"
:loading="lineLoading"
:columns="lineColumns"
:dataSource="lineDataSource"
/>
</BasicModal>
</template>
<script lang="ts" setup>
import { computed, ref, unref } from 'vue';
import dayjs from 'dayjs';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import type { JVxeColumn, JVxeTableInstance } from '/@/components/jeecg/JVxeTable/types';
import { useMessage } from '/@/hooks/web/useMessage';
import { useUserStore } from '/@/store/modules/user';
import { formSchema, lineJVxeColumns, processDisplayFormSchema } from '../MesXslEquipInspectRecord.data';
import { saveOrUpdate, queryById, queryLineListByRecordId } from '../MesXslEquipInspectRecord.api';
const emit = defineEmits(['register', 'success']);
const { createMessage } = useMessage();
const userStore = useUserStore();
const isDetail = ref(false);
const showFooterFlag = ref(true);
const tableReady = ref(false);
const lineLoading = ref(false);
const lineDataSource = ref<Recordable[]>([]);
const lineTableRef = ref<JVxeTableInstance>();
const lineColumns = computed<JVxeColumn[]>(() =>
lineJVxeColumns.map((col) => {
const editable = col.key === 'lineInspectResult' || col.key === 'pictureFiles';
if (editable) {
return { ...col, disabled: !showFooterFlag.value };
}
return { ...col, disabled: true };
}),
);
const showProcessFields = ref(false);
const [registerForm, { resetFields, setFieldsValue, validate, setProps, resetSchema }] = useForm({
labelWidth: 110,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: { span: 12 },
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
tableReady.value = false;
lineDataSource.value = [];
await resetFields();
const editable = !!data?.showFooter;
setModalProps({ confirmLoading: false, showCancelBtn: editable, showOkBtn: editable });
isDetail.value = !editable;
showFooterFlag.value = editable;
setProps({ disabled: !editable });
showProcessFields.value = false;
await resetSchema(formSchema);
if (data?.record?.id) {
lineLoading.value = true;
try {
const mainRaw = await queryById({ id: data.record.id });
const m = (mainRaw as any)?.id != null ? mainRaw : (mainRaw as any)?.result ?? mainRaw;
if (editable && m.recordStatus !== 'pending') {
createMessage.warning('仅待点检记录可录入点检结果');
setModalProps({ showOkBtn: false, showCancelBtn: true });
isDetail.value = true;
showFooterFlag.value = false;
setProps({ disabled: true });
}
const linesRaw = await queryLineListByRecordId({ id: data.record.id });
const list = Array.isArray(linesRaw) ? linesRaw : (linesRaw as any)?.result ?? [];
const user = userStore.getUserInfo || {};
const patch: Recordable = { ...m };
if (editable && showFooterFlag.value) {
if (!patch.inspectDate) {
patch.inspectDate = dayjs().format('YYYY-MM-DD');
}
if (!patch.inspectorRealname) {
patch.inspectorUserId = user.id;
patch.inspectorUsername = user.username;
patch.inspectorRealname = user.realname;
}
}
await setFieldsValue(patch);
if (!editable && m.inspectResult === 'fail') {
showProcessFields.value = true;
await resetSchema([...formSchema, ...processDisplayFormSchema]);
await setFieldsValue(patch);
}
lineDataSource.value = [...(list || [])];
} finally {
lineLoading.value = false;
}
}
tableReady.value = true;
});
const title = computed(() =>
unref(isDetail) ? '点检保养记录详情' : '录入点检结果',
);
async function handleSubmit() {
if (!showFooterFlag.value) {
return;
}
try {
const values = await validate();
const lineRef = lineTableRef.value as any;
const tableData = (lineRef?.getTableData?.() || lineDataSource.value || []) as Recordable[];
const lineList = tableData
.filter((r) => r && r.equipInspectConfigLineId)
.map((r) => ({
id: r.id,
equipInspectConfigLineId: r.equipInspectConfigLineId,
inspectMaintainItemId: r.inspectMaintainItemId,
itemCode: r.itemCode,
itemName: r.itemName,
itemCategory: r.itemCategory,
itemType: r.itemType,
equipmentPartName: r.equipmentPartName,
equipmentSubPartName: r.equipmentSubPartName,
inspectMethod: r.inspectMethod,
judgmentCriteria: r.judgmentCriteria,
lineInspectResult: r.lineInspectResult,
pictureFiles: r.pictureFiles,
}));
if (!lineList.length) {
createMessage.warning('点检明细不能为空');
return;
}
if (!values.inspectResult) {
createMessage.warning('请选择点检结果');
return;
}
if (!values.inspectDate) {
createMessage.warning('请选择点检日期');
return;
}
if (!values.inspectorRealname) {
createMessage.warning('点检人不能为空');
return;
}
setModalProps({ confirmLoading: true });
await saveOrUpdate({ ...values, recordStatus: 'done', lineList }, true);
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>

View File

@@ -5,6 +5,24 @@
<a-button type="primary" v-auth="'mes:mes_xsl_equipment_ledger:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
新增
</a-button>
<a-button
type="primary"
v-auth="'mes:mes_xsl_equip_inspect_record:add'"
:disabled="selectedRowKeys.length === 0"
preIcon="ant-design:audit-outlined"
@click="handleBatchCreateRecord('inspect')"
>
点检
</a-button>
<a-button
type="primary"
v-auth="'mes:mes_xsl_equip_inspect_record:add'"
:disabled="selectedRowKeys.length === 0"
preIcon="ant-design:tool-outlined"
@click="handleBatchCreateRecord('maintain')"
>
保养
</a-button>
<a-button
type="primary"
v-auth="'mes:mes_xsl_equipment_ledger:exportXls'"
@@ -53,10 +71,14 @@
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import { useMessage } from '/@/hooks/web/useMessage';
import Icon from '/@/components/Icon';
import MesXslEquipmentLedgerModal from './components/MesXslEquipmentLedgerModal.vue';
import { columns, searchFormSchema } from './MesXslEquipmentLedger.data';
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipmentLedger.api';
import { batchCreateFromEquipment } from '../mesXslEquipInspectRecord/MesXslEquipInspectRecord.api';
const { createMessage, createConfirm } = useMessage();
const [registerModal, { openModal }] = useModal();
@@ -87,7 +109,7 @@
},
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
const [registerTable, { reload, getSelectRows }, { rowSelection, selectedRowKeys }] = tableContext;
function handleAdd() {
openModal(true, { isUpdate: false, showFooter: true });
@@ -114,6 +136,46 @@
selectedRowKeys.value = [];
}
function handleBatchCreateRecord(recordType: 'inspect' | 'maintain') {
const rows = (getSelectRows?.() || []) as Recordable[];
if (!rows.length) {
createMessage.warning('请先勾选设备');
return;
}
const ids = rows.map((r) => r.id).filter(Boolean);
const typeLabel = recordType === 'inspect' ? '点检' : '保养';
createConfirm({
iconType: 'info',
title: `生成${typeLabel}记录`,
content: `确定为选中的 ${ids.length} 台设备各生成一条${typeLabel}记录?`,
okText: '确定',
cancelText: '取消',
onOk: async () => {
try {
const res = await batchCreateFromEquipment({ equipmentLedgerIds: ids, recordType });
const data = (res as any)?.result ?? res;
const failList: string[] = data?.failMessages || [];
const successCount = data?.successCount ?? 0;
if (successCount > 0 && !failList.length) {
createMessage.success(`成功生成 ${successCount}${typeLabel}记录`);
handleSuccess();
} else if (successCount > 0 && failList.length) {
createMessage.warning(`成功生成 ${successCount} 条;未生成:${failList.join('')}`);
handleSuccess();
} else if (failList.length) {
createMessage.warning(failList.join(''));
} else {
createMessage.warning((res as any)?.message || `未生成任何${typeLabel}记录`);
}
} catch (e: any) {
const errMsg =
e?.response?.data?.message || e?.message || `生成${typeLabel}记录失败`;
createMessage.warning(errMsg);
}
},
});
}
function getDropDownAction(record: Recordable) {
return [
{ label: '详情', onClick: handleDetail.bind(null, record) },

View File

@@ -0,0 +1,33 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslMixerAction/list',
checkActionName = '/xslmes/mesXslMixerAction/checkActionName',
checkActionCode = '/xslmes/mesXslMixerAction/checkActionCode',
save = '/xslmes/mesXslMixerAction/add',
edit = '/xslmes/mesXslMixerAction/edit',
deleteOne = '/xslmes/mesXslMixerAction/delete',
deleteBatch = '/xslmes/mesXslMixerAction/deleteBatch',
queryById = '/xslmes/mesXslMixerAction/queryById',
exportXls = '/xslmes/mesXslMixerAction/exportXls',
}
export const list = (params) => defHttp.get({ url: Api.list, params });
export const checkActionName = (params: { actionName: string; dataId?: string }) =>
defHttp.get({ url: Api.checkActionName, params }, { successMessageMode: 'none', errorMessageMode: 'none' });
export const checkActionCode = (params: { actionCode: string; dataId?: string }) =>
defHttp.get({ url: Api.checkActionCode, params }, { successMessageMode: 'none', errorMessageMode: 'none' });
export const deleteOne = (params, handleSuccess) =>
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
export const batchDelete = (params, handleSuccess) =>
defHttp.delete({ url: Api.deleteBatch, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
export const saveOrUpdate = (params, isUpdate) => defHttp.post({ url: isUpdate ? Api.edit : Api.save, params });
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
export const getExportUrl = Api.exportXls;

View File

@@ -0,0 +1,76 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
import { checkActionCode, checkActionName } from './MesXslMixerAction.api';
export const columns: BasicColumn[] = [
{ title: '设备名称', align: 'center', dataIndex: 'equipmentId_dictText', width: 180 },
{ title: '动作名称', align: 'center', dataIndex: 'actionName', width: 180 },
{ title: '动作代号', align: 'center', dataIndex: 'actionCode', width: 160 },
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 170 },
];
export const searchFormSchema: FormSchema[] = [
{
label: '设备名称',
field: 'equipmentId',
component: 'JDictSelectTag',
componentProps: { dictCode: 'mes_xsl_equipment_ledger,equipment_name,id' },
colProps: { span: 6 },
},
{ label: '动作名称', field: 'actionName', component: 'Input', colProps: { span: 6 } },
{ label: '动作代号', field: 'actionCode', component: 'Input', colProps: { span: 6 } },
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{
label: '设备名称',
field: 'equipmentId',
component: 'JDictSelectTag',
required: true,
componentProps: { dictCode: 'mes_xsl_equipment_ledger,equipment_name,id', placeholder: '请选择设备台账中的设备' },
},
{
label: '动作名称',
field: 'actionName',
component: 'Input',
required: true,
dynamicRules: ({ model }) => [
{ required: true, message: '请输入动作名称' },
{
validator: async (_rule, value) => {
const v = value == null ? '' : String(value).trim();
if (!v) return Promise.resolve();
try {
await checkActionName({ actionName: v, dataId: model?.id });
return Promise.resolve();
} catch (e: any) {
return Promise.reject(e?.response?.data?.message || e?.message || '动作名称不能重复');
}
},
trigger: 'blur',
},
],
},
{
label: '动作代号',
field: 'actionCode',
component: 'Input',
required: true,
dynamicRules: ({ model }) => [
{ required: true, message: '请输入动作代号' },
{
validator: async (_rule, value) => {
const v = value == null ? '' : String(value).trim();
if (!v) return Promise.resolve();
try {
await checkActionCode({ actionCode: v, dataId: model?.id });
return Promise.resolve();
} catch (e: any) {
return Promise.reject(e?.response?.data?.message || e?.message || '动作代号不能重复');
}
},
trigger: 'blur',
},
],
},
];

View File

@@ -0,0 +1,84 @@
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button type="primary" v-auth="'xslmes:mes_xsl_mixer_action:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button>
<a-button
type="primary"
v-auth="'xslmes:mes_xsl_mixer_action:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete"><Icon icon="ant-design:delete-outlined" />删除</a-menu-item>
</a-menu>
</template>
<a-button>批量操作<Icon icon="mdi:chevron-down" /></a-button>
</a-dropdown>
</template>
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</template>
</BasicTable>
<MesXslMixerActionModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import MesXslMixerActionModal from './modules/MesXslMixerActionModal.vue';
import { columns, searchFormSchema } from './MesXslMixerAction.data';
import { batchDelete, deleteOne, getExportUrl, list } from './MesXslMixerAction.api';
const [registerModal, { openModal }] = useModal();
const { tableContext, onExportXls } = useListPage({
tableProps: {
title: '密炼机动作维护',
api: list,
columns,
canResize: true,
formConfig: { labelWidth: 100, schemas: searchFormSchema, autoSubmitOnEnter: true },
actionColumn: { width: 120, fixed: 'right' },
},
exportConfig: { name: '密炼机动作维护', url: getExportUrl },
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
function handleAdd() {
openModal(true, { isUpdate: false, showFooter: true });
}
function handleEdit(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: true });
}
function handleDetail(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: false });
}
async function handleDelete(record) {
await deleteOne({ id: record.id }, reload);
}
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value.join(',') }, reload);
}
function handleSuccess() {
reload();
}
function getTableAction(record) {
return [{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'xslmes:mes_xsl_mixer_action:edit' }];
}
function getDropDownAction(record) {
return [
{ label: '详情', onClick: handleDetail.bind(null, record) },
{
label: '删除',
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
auth: 'xslmes:mes_xsl_mixer_action:delete',
},
];
}
</script>

View File

@@ -0,0 +1,48 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="680px" @ok="handleSubmit">
<BasicForm @register="registerForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import { computed, ref, unref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { formSchema } from '../MesXslMixerAction.data';
import { saveOrUpdate } from '../MesXslMixerAction.api';
const emit = defineEmits(['register', 'success']);
const isUpdate = ref(true);
const isDetail = ref(false);
const [registerForm, { resetFields, setFieldsValue, validate, setProps }] = useForm({
labelWidth: 110,
schemas: formSchema,
showActionButtonGroup: false,
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
await resetFields();
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
isUpdate.value = !!data?.isUpdate;
isDetail.value = !data?.showFooter;
if (unref(isUpdate)) {
await setFieldsValue({ ...data.record });
}
setProps({ disabled: !data?.showFooter });
});
const title = computed(() => (!unref(isUpdate) ? '新增密炼机动作' : unref(isDetail) ? '密炼机动作详情' : '编辑密炼机动作'));
async function handleSubmit() {
try {
const values = await validate();
setModalProps({ confirmLoading: true });
await saveOrUpdate(values, isUpdate.value);
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>

View File

@@ -0,0 +1,33 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslMixerCondition/list',
checkConditionName = '/xslmes/mesXslMixerCondition/checkConditionName',
checkConditionCode = '/xslmes/mesXslMixerCondition/checkConditionCode',
save = '/xslmes/mesXslMixerCondition/add',
edit = '/xslmes/mesXslMixerCondition/edit',
deleteOne = '/xslmes/mesXslMixerCondition/delete',
deleteBatch = '/xslmes/mesXslMixerCondition/deleteBatch',
queryById = '/xslmes/mesXslMixerCondition/queryById',
exportXls = '/xslmes/mesXslMixerCondition/exportXls',
}
export const list = (params) => defHttp.get({ url: Api.list, params });
export const checkConditionName = (params: { conditionName: string; dataId?: string }) =>
defHttp.get({ url: Api.checkConditionName, params }, { successMessageMode: 'none', errorMessageMode: 'none' });
export const checkConditionCode = (params: { conditionCode: string; dataId?: string }) =>
defHttp.get({ url: Api.checkConditionCode, params }, { successMessageMode: 'none', errorMessageMode: 'none' });
export const deleteOne = (params, handleSuccess) =>
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
export const batchDelete = (params, handleSuccess) =>
defHttp.delete({ url: Api.deleteBatch, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
export const saveOrUpdate = (params, isUpdate) => defHttp.post({ url: isUpdate ? Api.edit : Api.save, params });
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
export const getExportUrl = Api.exportXls;

View File

@@ -0,0 +1,78 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
import { checkConditionCode, checkConditionName } from './MesXslMixerCondition.api';
export const columns: BasicColumn[] = [
{ title: '设备名称', align: 'center', dataIndex: 'equipmentId_dictText', width: 180 },
{ title: '条件名称', align: 'center', dataIndex: 'conditionName', width: 180 },
{ title: '条件代码', align: 'center', dataIndex: 'conditionCode', width: 160 },
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 170 },
{ title: '创建用户', align: 'center', dataIndex: 'createBy', width: 120 },
{ title: '修改时间', align: 'center', dataIndex: 'updateTime', width: 170 },
];
export const searchFormSchema: FormSchema[] = [
{
label: '设备名称',
field: 'equipmentId',
component: 'JDictSelectTag',
componentProps: { dictCode: 'mes_xsl_equipment_ledger,equipment_name,id' },
colProps: { span: 6 },
},
{ label: '条件名称', field: 'conditionName', component: 'Input', colProps: { span: 6 } },
{ label: '条件代码', field: 'conditionCode', component: 'Input', colProps: { span: 6 } },
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{
label: '设备名称',
field: 'equipmentId',
component: 'JDictSelectTag',
required: true,
componentProps: { dictCode: 'mes_xsl_equipment_ledger,equipment_name,id', placeholder: '请选择设备名称' },
},
{
label: '条件名称',
field: 'conditionName',
component: 'Input',
required: true,
dynamicRules: ({ model }) => [
{ required: true, message: '请输入条件名称' },
{
validator: async (_rule, value) => {
const v = value == null ? '' : String(value).trim();
if (!v) return Promise.resolve();
try {
await checkConditionName({ conditionName: v, dataId: model?.id });
return Promise.resolve();
} catch (e: any) {
return Promise.reject(e?.response?.data?.message || e?.message || '条件名称不能重复');
}
},
trigger: 'blur',
},
],
},
{
label: '条件代码',
field: 'conditionCode',
component: 'Input',
required: true,
dynamicRules: ({ model }) => [
{ required: true, message: '请输入条件代码' },
{
validator: async (_rule, value) => {
const v = value == null ? '' : String(value).trim();
if (!v) return Promise.resolve();
try {
await checkConditionCode({ conditionCode: v, dataId: model?.id });
return Promise.resolve();
} catch (e: any) {
return Promise.reject(e?.response?.data?.message || e?.message || '条件代码不能重复');
}
},
trigger: 'blur',
},
],
},
];

View File

@@ -0,0 +1,84 @@
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button type="primary" v-auth="'xslmes:mes_xsl_mixer_condition:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button>
<a-button
type="primary"
v-auth="'xslmes:mes_xsl_mixer_condition:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete"><Icon icon="ant-design:delete-outlined" />删除</a-menu-item>
</a-menu>
</template>
<a-button>批量操作<Icon icon="mdi:chevron-down" /></a-button>
</a-dropdown>
</template>
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</template>
</BasicTable>
<MesXslMixerConditionModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import MesXslMixerConditionModal from './modules/MesXslMixerConditionModal.vue';
import { columns, searchFormSchema } from './MesXslMixerCondition.data';
import { batchDelete, deleteOne, getExportUrl, list } from './MesXslMixerCondition.api';
const [registerModal, { openModal }] = useModal();
const { tableContext, onExportXls } = useListPage({
tableProps: {
title: '密炼机条件维护',
api: list,
columns,
canResize: true,
formConfig: { labelWidth: 100, schemas: searchFormSchema, autoSubmitOnEnter: true },
actionColumn: { width: 120, fixed: 'right' },
},
exportConfig: { name: '密炼机条件维护', url: getExportUrl },
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
function handleAdd() {
openModal(true, { isUpdate: false, showFooter: true });
}
function handleEdit(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: true });
}
function handleDetail(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: false });
}
async function handleDelete(record) {
await deleteOne({ id: record.id }, reload);
}
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value.join(',') }, reload);
}
function handleSuccess() {
reload();
}
function getTableAction(record) {
return [{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'xslmes:mes_xsl_mixer_condition:edit' }];
}
function getDropDownAction(record) {
return [
{ label: '详情', onClick: handleDetail.bind(null, record) },
{
label: '删除',
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
auth: 'xslmes:mes_xsl_mixer_condition:delete',
},
];
}
</script>

View File

@@ -0,0 +1,50 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="680px" @ok="handleSubmit">
<BasicForm @register="registerForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import { computed, ref, unref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { formSchema } from '../MesXslMixerCondition.data';
import { saveOrUpdate } from '../MesXslMixerCondition.api';
const emit = defineEmits(['register', 'success']);
const isUpdate = ref(true);
const isDetail = ref(false);
const [registerForm, { resetFields, setFieldsValue, validate, setProps }] = useForm({
labelWidth: 110,
schemas: formSchema,
showActionButtonGroup: false,
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
await resetFields();
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
isUpdate.value = !!data?.isUpdate;
isDetail.value = !data?.showFooter;
if (unref(isUpdate)) {
await setFieldsValue({ ...data.record });
}
setProps({ disabled: !data?.showFooter });
});
const title = computed(() =>
!unref(isUpdate) ? '新增密炼机条件' : unref(isDetail) ? '密炼机条件详情' : '编辑密炼机条件',
);
async function handleSubmit() {
try {
const values = await validate();
setModalProps({ confirmLoading: true });
await saveOrUpdate(values, isUpdate.value);
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>

View File

@@ -0,0 +1,25 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslProductionOrder/list',
save = '/xslmes/mesXslProductionOrder/add',
edit = '/xslmes/mesXslProductionOrder/edit',
deleteOne = '/xslmes/mesXslProductionOrder/delete',
deleteBatch = '/xslmes/mesXslProductionOrder/deleteBatch',
queryById = '/xslmes/mesXslProductionOrder/queryById',
exportXls = '/xslmes/mesXslProductionOrder/exportXls',
}
export const list = (params) => defHttp.get({ url: Api.list, params });
export const deleteOne = (params, handleSuccess) =>
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
export const batchDelete = (params, handleSuccess) =>
defHttp.delete({ url: Api.deleteBatch, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
export const saveOrUpdate = (params, isUpdate) => defHttp.post({ url: isUpdate ? Api.edit : Api.save, params });
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
export const getExportUrl = Api.exportXls;

View File

@@ -0,0 +1,66 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
function splitStatusText(v: unknown) {
if (v === 1) return '已拆分';
if (v === 0) return '未拆分';
return '-';
}
const splitStatusOptions = [
{ label: '未拆分', value: 0 },
{ label: '已拆分', value: 1 },
];
export const columns: BasicColumn[] = [
{ title: '销售订单号', align: 'center', dataIndex: 'salesOrderNo', width: 150 },
{ title: '生产订单号', align: 'center', dataIndex: 'productionOrderNo', width: 150 },
{ title: '订单日期', align: 'center', dataIndex: 'orderDate', width: 130 },
{ title: '生产车间', align: 'center', dataIndex: 'productionWorkshop', width: 130 },
{ title: '加工段数', align: 'center', dataIndex: 'processSegmentCount', width: 100 },
{ title: '物料编号', align: 'center', dataIndex: 'materialCode', width: 130 },
{ title: 'MES胶料名称', align: 'center', dataIndex: 'mesMaterialName', width: 150 },
{ title: '金蝶物料名称', align: 'center', dataIndex: 'kingdeeMaterialName', width: 150 },
{ title: '金蝶物料规格', align: 'center', dataIndex: 'kingdeeMaterialSpec', width: 150 },
{ title: '计划数量', align: 'center', dataIndex: 'planQty', width: 110 },
{ title: '拆分状态', align: 'center', dataIndex: 'splitStatus', width: 100, customRender: ({ text }) => splitStatusText(text) },
];
export const searchFormSchema: FormSchema[] = [
{ label: '销售订单号', field: 'salesOrderNo', component: 'Input', colProps: { span: 6 } },
{ label: '生产订单号', field: 'productionOrderNo', component: 'Input', colProps: { span: 6 } },
{ label: '物料编号', field: 'materialCode', component: 'Input', colProps: { span: 6 } },
{ label: 'MES胶料名称', field: 'mesMaterialName', component: 'Input', colProps: { span: 6 } },
{
label: '拆分状态',
field: 'splitStatus',
component: 'Select',
componentProps: { options: splitStatusOptions },
colProps: { span: 6 },
},
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{ label: '销售订单号', field: 'salesOrderNo', component: 'Input' },
{ label: '生产订单号', field: 'productionOrderNo', component: 'Input' },
{
label: '订单日期',
field: 'orderDate',
component: 'DatePicker',
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } },
},
{ label: '生产车间', field: 'productionWorkshop', component: 'Input' },
{ label: '加工段数', field: 'processSegmentCount', component: 'InputNumber', componentProps: { min: 0, precision: 0 } },
{ label: '物料编号', field: 'materialCode', component: 'Input' },
{ label: 'MES胶料名称', field: 'mesMaterialName', component: 'Input' },
{ label: '金蝶物料名称', field: 'kingdeeMaterialName', component: 'Input' },
{ label: '金蝶物料规格', field: 'kingdeeMaterialSpec', component: 'Input' },
{ label: '计划数量', field: 'planQty', component: 'InputNumber', componentProps: { min: 0 } },
{
label: '拆分状态',
field: 'splitStatus',
component: 'Select',
defaultValue: 0,
componentProps: { options: splitStatusOptions },
},
];

View File

@@ -0,0 +1,84 @@
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button type="primary" v-auth="'xslmes:mes_xsl_production_order:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button>
<a-button
type="primary"
v-auth="'xslmes:mes_xsl_production_order:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete"><Icon icon="ant-design:delete-outlined" />删除</a-menu-item>
</a-menu>
</template>
<a-button>批量操作<Icon icon="mdi:chevron-down" /></a-button>
</a-dropdown>
</template>
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</template>
</BasicTable>
<MesXslProductionOrderModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import MesXslProductionOrderModal from './modules/MesXslProductionOrderModal.vue';
import { columns, searchFormSchema } from './MesXslProductionOrder.data';
import { batchDelete, deleteOne, getExportUrl, list } from './MesXslProductionOrder.api';
const [registerModal, { openModal }] = useModal();
const { tableContext, onExportXls } = useListPage({
tableProps: {
title: '生产订单',
api: list,
columns,
canResize: true,
formConfig: { labelWidth: 100, schemas: searchFormSchema, autoSubmitOnEnter: true, showAdvancedButton: true },
actionColumn: { width: 120, fixed: 'right' },
},
exportConfig: { name: '生产订单', url: getExportUrl },
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
function handleAdd() {
openModal(true, { isUpdate: false, showFooter: true });
}
function handleEdit(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: true });
}
function handleDetail(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: false });
}
async function handleDelete(record) {
await deleteOne({ id: record.id }, reload);
}
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value.join(',') }, reload);
}
function handleSuccess() {
reload();
}
function getTableAction(record) {
return [{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'xslmes:mes_xsl_production_order:edit' }];
}
function getDropDownAction(record) {
return [
{ label: '详情', onClick: handleDetail.bind(null, record) },
{
label: '删除',
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
auth: 'xslmes:mes_xsl_production_order:delete',
},
];
}
</script>

View File

@@ -0,0 +1,53 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="860px" @ok="handleSubmit">
<BasicForm @register="registerForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import { computed, ref, unref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { formSchema } from '../MesXslProductionOrder.data';
import { saveOrUpdate } from '../MesXslProductionOrder.api';
const emit = defineEmits(['register', 'success']);
const isUpdate = ref(true);
const isDetail = ref(false);
const [registerForm, { resetFields, setFieldsValue, validate, setProps }] = useForm({
labelWidth: 110,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: { span: 12 },
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
await resetFields();
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
isUpdate.value = !!data?.isUpdate;
isDetail.value = !data?.showFooter;
if (unref(isUpdate)) {
await setFieldsValue({ ...data.record });
} else {
await setFieldsValue({ splitStatus: 0 });
}
setProps({ disabled: !data?.showFooter });
});
const title = computed(() =>
!unref(isUpdate) ? '新增生产订单' : unref(isDetail) ? '生产订单详情' : '编辑生产订单',
);
async function handleSubmit() {
try {
const values = await validate();
setModalProps({ confirmLoading: true });
await saveOrUpdate(values, isUpdate.value);
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>