6 Commits

71 changed files with 2483 additions and 130 deletions

View File

@@ -0,0 +1,64 @@
-- 修复胶料分类字典XSLMES_RUBBER数据库有数据但页面不展示
-- 场景开启多租户后sys_category tenant_id 与当前登录租户不一致/为空
SET NAMES utf8mb4;
-- 1) 目标租户默认取 admin 用户租户若为空则回退到 0
SET @target_tenant_id = (
SELECT COALESCE(tenant_id, 0)
FROM sys_user
WHERE username = 'admin'
ORDER BY create_time ASC
LIMIT 1
);
SET @target_tenant_id = IFNULL(@target_tenant_id, 0);
-- 2) 定位根分类编码
SET @rubber_code = 'XSLMES_RUBBER';
-- 若根节点不存在则补一个最小根节点避免前端 pcode 查询直接失败
INSERT INTO sys_category (id, pid, name, code, has_child, tenant_id, create_by, create_time, update_by, update_time)
SELECT '1994000000000000001', '0', 'MES胶料分类', @rubber_code, '1', @target_tenant_id, 'admin', NOW(), 'admin', NOW()
FROM dual
WHERE NOT EXISTS (
SELECT 1 FROM sys_category WHERE code = @rubber_code
);
SET @rubber_root_id = (
SELECT id
FROM sys_category
WHERE code = @rubber_code
ORDER BY create_time ASC
LIMIT 1
);
-- 3) 若根节点存在统一修复租户与父子标记
UPDATE sys_category
SET tenant_id = @target_tenant_id
WHERE id = @rubber_root_id;
UPDATE sys_category
SET tenant_id = @target_tenant_id
WHERE pid = @rubber_root_id;
-- 根节点是否有子节点按真实数据回写
UPDATE sys_category
SET has_child = CASE
WHEN EXISTS (SELECT 1 FROM (SELECT id FROM sys_category WHERE pid = @rubber_root_id LIMIT 1) t) THEN '1'
ELSE '0'
END
WHERE id = @rubber_root_id;
-- 子节点统一标记为无子当前这批分类通常为叶子
UPDATE sys_category
SET has_child = '0'
WHERE pid = @rubber_root_id;
-- 4) 结果检查执行后看返回
SELECT 'ROOT' AS level_tag, id, pid, code, name, tenant_id, has_child
FROM sys_category
WHERE id = @rubber_root_id
UNION ALL
SELECT 'CHILD' AS level_tag, id, pid, code, name, tenant_id, has_child
FROM sys_category
WHERE pid = @rubber_root_id
ORDER BY level_tag, code;

View File

@@ -0,0 +1,60 @@
-- MES 设备报警记录设备停机记录菜单 + 导出按钮 + 租户 admin 授权 MySQL 业务表
-- 权限前缀mes:mes_xsl_equip_alarm_record:* / mes:mes_xsl_equip_downtime_record:*
-- 父菜单设备管理FlywayV3.9.2_124__mes_xsl_equip_mcs_alarm_downtime_menu.sql
SET NAMES utf8mb4;
SET @mes_tenant_id = 1002;
SET @mes_equip_pid = (
SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
);
SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
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 ('1860000000000000222', @mes_equip_pid, '设备报警记录', '/xslmes/mesXslEquipAlarmRecord', 'xslmes/mesXslEquipAlarmRecord/MesXslEquipAlarmRecordList', 'MesXslEquipAlarmRecordList', 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`);
UPDATE `sys_permission` SET `icon` = 'ant-design:alert-outlined' WHERE `id` = '1860000000000000222' 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
('1860000000000000223', '1860000000000000222', '导出', 2, 'mes:mes_xsl_equip_alarm_record:exportXls', '1', '1', 0, 'admin', NOW())
ON DUPLICATE KEY UPDATE
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
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 ('1860000000000000224', @mes_equip_pid, '设备停机记录', '/xslmes/mesXslEquipDowntimeRecord', 'xslmes/mesXslEquipDowntimeRecord/MesXslEquipDowntimeRecordList', 'MesXslEquipDowntimeRecordList', 1, NULL, '1', 15, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
ON DUPLICATE KEY UPDATE
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
UPDATE `sys_permission` SET `icon` = 'ant-design:pause-circle-outlined' WHERE `id` = '1860000000000000224' 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
('1860000000000000225', '1860000000000000224', '导出', 2, 'mes:mes_xsl_equip_downtime_record:exportXls', '1', '1', 0, 'admin', NOW())
ON DUPLICATE KEY UPDATE
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
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 (
'1860000000000000222', '1860000000000000223',
'1860000000000000224', '1860000000000000225'
)
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,65 @@
-- MES 设备对应部位建表 + 菜单 + 按钮 + 租户 admin 授权可整文件一次执行
-- 权限前缀mes:mes_xsl_equip_part_mapping:*
-- 数据由设备点检配置保存后自动生成列表无手工新增
-- FlywayV3.9.2_123__mes_xsl_equip_part_mapping.sql
SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS `mes_xsl_equip_part_mapping` (
`id` varchar(32) NOT NULL COMMENT '主键',
`equipment_ledger_id` varchar(32) NOT NULL COMMENT '设备台账主键 mes_xsl_equipment_ledger.id',
`equipment_name` varchar(500) NOT NULL COMMENT '设备名称',
`machine_code` varchar(500) DEFAULT NULL COMMENT '机台代号设备编号冗余',
`equipment_part_id` varchar(32) NOT NULL COMMENT '设备大部位主键 mes_xsl_equipment_part.id',
`equipment_part_name` varchar(500) DEFAULT NULL COMMENT '设备大部位名称',
`part_code` varchar(500) DEFAULT NULL COMMENT '大部位代码',
`equipment_sub_part_id` varchar(32) NOT NULL COMMENT '设备小部位主键 mes_xsl_equipment_sub_part.id',
`equipment_sub_part_name` varchar(500) DEFAULT NULL COMMENT '设备小部位名称',
`sub_part_code` varchar(500) DEFAULT NULL COMMENT '小部位代码',
`tenant_id` int DEFAULT NULL COMMENT '租户',
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`del_flag` int DEFAULT '0' COMMENT '删除标记0正常1删除',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_mepm_ledger_part_sub` (`equipment_ledger_id`, `equipment_part_id`, `equipment_sub_part_id`),
KEY `idx_mepm_tenant_equip_name` (`tenant_id`, `equipment_name`)
) 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 ('1860000000000000215', @mes_equip_pid, '设备对应部位', '/xslmes/mesXslEquipPartMapping', 'xslmes/mesXslEquipPartMapping/MesXslEquipPartMappingList', 'MesXslEquipPartMappingList', 1, NULL, '1', 14, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
ON DUPLICATE KEY UPDATE
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`), `icon` = 'ant-design:apartment-outlined';
UPDATE `sys_permission` SET `icon` = 'ant-design:apartment-outlined' WHERE `id` = '1860000000000000215' 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
('1860000000000000216', '1860000000000000215', '导出', 2, 'mes:mes_xsl_equip_part_mapping: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`);
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 ('1860000000000000215', '1860000000000000216')
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
);

View File

@@ -23,6 +23,7 @@ CREATE TABLE IF NOT EXISTS `mes_xsl_equipment_ledger` (
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序 mes_xsl_process_operation.id',
`process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
`equipment_name` varchar(500) NOT NULL COMMENT '设备名称同租户未删除唯一',
`ledger_no` varchar(16) DEFAULT NULL COMMENT '编号租户内从001递增自动生成只读',
`equipment_code` varchar(128) NOT NULL COMMENT '设备编号同租户未删除唯一',
`manufacturer_id` varchar(32) DEFAULT NULL COMMENT '所属设备厂家 mes_xsl_manufacturer.id',
`manufacturer_name` varchar(500) DEFAULT NULL COMMENT '设备厂家名称冗余',
@@ -59,6 +60,7 @@ CREATE TABLE IF NOT EXISTS `mes_xsl_equipment_ledger` (
`del_flag` int DEFAULT '0' COMMENT '删除标记0正常1删除',
PRIMARY KEY (`id`),
KEY `idx_mel_tenant_code` (`tenant_id`, `equipment_code`),
KEY `idx_mel_tenant_ledger_no` (`tenant_id`, `ledger_no`),
KEY `idx_mel_tenant_name` (`tenant_id`, `equipment_name`),
KEY `idx_mel_process` (`process_operation_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES设备台账';

View File

@@ -6,7 +6,8 @@ CREATE TABLE IF NOT EXISTS `mes_xsl_equipment_ledger` (
`process_operation_id` varchar(32) NOT NULL COMMENT '所属工序',
`process_operation_name` varchar(500) DEFAULT NULL COMMENT '工序名称冗余',
`equipment_name` varchar(500) NOT NULL COMMENT '设备名称',
`equipment_code` varchar(128) NOT NULL COMMENT '设备编号',
`ledger_no` varchar(16) DEFAULT NULL COMMENT '编号租户内从001递增自动生成只读',
`equipment_code` varchar(128) NOT NULL COMMENT '设备编号同租户不可重复',
`manufacturer_id` varchar(32) DEFAULT NULL COMMENT '所属设备厂家',
`manufacturer_name` varchar(500) DEFAULT NULL COMMENT '设备厂家名称冗余',
`equipment_category_id` varchar(32) DEFAULT NULL COMMENT '设备类别',
@@ -42,5 +43,6 @@ CREATE TABLE IF NOT EXISTS `mes_xsl_equipment_ledger` (
`del_flag` int DEFAULT '0' COMMENT '删除标记',
PRIMARY KEY (`id`),
KEY `idx_mel_tenant_code` (`tenant_id`, `equipment_code`),
KEY `idx_mel_tenant_ledger_no` (`tenant_id`, `ledger_no`),
KEY `idx_mel_tenant_name` (`tenant_id`, `equipment_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES设备台账';

View File

@@ -678,3 +678,88 @@ jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockLog/MesXslRubberSmallLockLo
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockLog/MesXslRubberSmallLockLog.api.ts
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockLog/MesXslRubberSmallLockLogList.vue
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockLog/components/MesXslRubberSmallLockLogModal.vue
-- author:jiangxh---date:20250602--for: 【MES】设备台账原设备编号改为自定义编号、新增001自增只读系统编号 ---
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_122__mes_xsl_equipment_ledger_ledger_no.sql
jeecg-boot/db/mes-xsl-equipment-ledger.sql
jeecg-boot/db/mes-xsl-equipment-ledger-menu-permission.sql
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslEquipmentLedger.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslEquipmentLedgerMapper.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslEquipmentLedgerService.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslEquipmentLedgerServiceImpl.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipmentLedgerController.java
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.api.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/components/MesXslEquipmentLedgerModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/components/MesXslEquipmentLedgerSelectModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/components/MesXslEquipmentLedgerMultiSelectModal.vue
-- author:jiangxh---date:20250602--for: 【MES】设备台账设备类别、设备类型必填 ---
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.data.ts
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipmentLedgerController.java
-- author:jiangxh---date:20250602--for: 【MES】设备台账 ledgerNo 显示名改为设备编号 ---
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.data.ts
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslEquipmentLedger.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipmentLedgerController.java
-- author:jiangxh---date:20250602--for: 【MES】设备台账 ledgerNo 显示名改为系统编号、equipmentCode 改为设备编号 ---
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.data.ts
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslEquipmentLedger.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipmentLedgerController.java
-- author:jiangxh---date:20250603--for: 【MES】设备对应部位点检配置保存后按大部位+小部位去重生成,列表只读无新增 ---
jeecg-boot/db/mes-xsl-equip-part-mapping-menu-permission.sql
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_123__mes_xsl_equip_part_mapping.sql
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslEquipPartMapping.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslEquipPartMappingMapper.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslEquipPartMappingService.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslEquipPartMappingServiceImpl.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipPartMappingController.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/package-info.java
jeecgboot-vue3/src/views/xslmes/mesXslEquipPartMapping/MesXslEquipPartMappingList.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipPartMapping/MesXslEquipPartMapping.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipPartMapping/MesXslEquipPartMapping.api.ts
-- author:jiangxh---date:20250603--for: 【MES】设备/质量管理主数据删除前引用校验(统一点检配置等下游阻断) ---
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslDeleteReferenceService.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslDeleteReferenceServiceImpl.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslInspectMaintainItemController.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipmentCategoryController.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipmentTypeController.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipmentPartController.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipmentSubPartController.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipmentLedgerController.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslManufacturerController.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslSparePartsCategoryController.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeMainTypeController.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeTypeController.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipInspectConfigController.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestTypeController.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestDataPointController.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestMethodController.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestStdController.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberSmallLockReasonController.java
-- author:jiangxh---date:20250604--for: 【MES】设备报警记录与设备停机记录SQL Server MCSToMES_MixAlarm 只读、列表回写 ReadTime/MES_Flag ---
jeecg-boot/db/mes-xsl-equip-mcs-alarm-downtime-menu-permission.sql
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_124__mes_xsl_equip_mcs_alarm_downtime_menu.sql
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mcs/vo/MesXslEquipAlarmRecordVO.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mcs/vo/MesXslEquipDowntimeRecordVO.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mcs/util/MesXslMcsMixAlarmConvertUtil.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mcs/service/IMesXslEquipAlarmRecordService.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mcs/service/IMesXslEquipDowntimeRecordService.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mcs/service/impl/MesXslMcsMixAlarmReadMarker.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mcs/service/impl/MesXslEquipAlarmRecordServiceImpl.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mcs/service/impl/MesXslEquipDowntimeRecordServiceImpl.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipAlarmRecordController.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslEquipDowntimeRecordController.java
jeecgboot-vue3/src/views/xslmes/mesXslEquipAlarmRecord/MesXslEquipAlarmRecord.api.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipAlarmRecord/MesXslEquipAlarmRecord.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipAlarmRecord/MesXslEquipAlarmRecordList.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipAlarmRecord/components/MesXslEquipAlarmRecordModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipDowntimeRecord/MesXslEquipDowntimeRecord.api.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipDowntimeRecord/MesXslEquipDowntimeRecord.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipDowntimeRecord/MesXslEquipDowntimeRecordList.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipDowntimeRecord/components/MesXslEquipDowntimeRecordModal.vue

View File

@@ -25,6 +25,7 @@ import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType;
import org.jeecg.modules.xslmes.entity.MesXslProcessOperation;
import org.jeecg.modules.xslmes.service.IMesXslDeleteReferenceService;
import org.jeecg.modules.xslmes.service.IMesXslDowntimeMainTypeService;
import org.jeecg.modules.xslmes.service.IMesXslProcessOperationService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
@@ -53,6 +54,9 @@ public class MesXslDowntimeMainTypeController extends JeecgController<MesXslDown
@Autowired
private IMesXslProcessOperationService mesXslProcessOperationService;
@Autowired
private IMesXslDeleteReferenceService mesXslDeleteReferenceService;
@Operation(summary = "MES停机主类型-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslDowntimeMainType>> queryPageList(
@@ -104,6 +108,10 @@ public class MesXslDowntimeMainTypeController extends JeecgController<MesXslDown
@RequiresPermissions("mes:mes_xsl_downtime_main_type:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
String refErr = mesXslDeleteReferenceService.validateDowntimeMainTypeDelete(List.of(id));
if (refErr != null) {
return Result.error(refErr);
}
mesXslDowntimeMainTypeService.removeById(id);
return Result.OK("删除成功!");
}
@@ -113,6 +121,10 @@ public class MesXslDowntimeMainTypeController extends JeecgController<MesXslDown
@RequiresPermissions("mes:mes_xsl_downtime_main_type:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
String refErr = mesXslDeleteReferenceService.validateDowntimeMainTypeDelete(Arrays.asList(ids.split(",")));
if (refErr != null) {
return Result.error(refErr);
}
mesXslDowntimeMainTypeService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}

View File

@@ -26,6 +26,7 @@ import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslDowntimeMainType;
import org.jeecg.modules.xslmes.entity.MesXslDowntimeType;
import org.jeecg.modules.xslmes.entity.MesXslProcessOperation;
import org.jeecg.modules.xslmes.service.IMesXslDeleteReferenceService;
import org.jeecg.modules.xslmes.service.IMesXslDowntimeMainTypeService;
import org.jeecg.modules.xslmes.service.IMesXslDowntimeTypeService;
import org.jeecg.modules.xslmes.service.IMesXslProcessOperationService;
@@ -59,6 +60,9 @@ public class MesXslDowntimeTypeController extends JeecgController<MesXslDowntime
@Autowired
private IMesXslDowntimeMainTypeService mesXslDowntimeMainTypeService;
@Autowired
private IMesXslDeleteReferenceService mesXslDeleteReferenceService;
@Operation(summary = "MES停机类型-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslDowntimeType>> queryPageList(
@@ -110,6 +114,10 @@ public class MesXslDowntimeTypeController extends JeecgController<MesXslDowntime
@RequiresPermissions("mes:mes_xsl_downtime_type:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
String refErr = mesXslDeleteReferenceService.validateDowntimeTypeDelete(List.of(id));
if (refErr != null) {
return Result.error(refErr);
}
mesXslDowntimeTypeService.removeById(id);
return Result.OK("删除成功!");
}
@@ -119,6 +127,10 @@ public class MesXslDowntimeTypeController extends JeecgController<MesXslDowntime
@RequiresPermissions("mes:mes_xsl_downtime_type:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
String refErr = mesXslDeleteReferenceService.validateDowntimeTypeDelete(Arrays.asList(ids.split(",")));
if (refErr != null) {
return Result.error(refErr);
}
mesXslDowntimeTypeService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}

View File

@@ -0,0 +1,86 @@
package org.jeecg.modules.xslmes.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.subject.Subject;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.mcs.entity.McsToMesMixAlarm;
import org.jeecg.modules.xslmes.mcs.service.IMesXslEquipAlarmRecordService;
import org.jeecg.modules.xslmes.mcs.vo.MesXslEquipAlarmRecordVO;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
/**
* 设备报警记录(只读,数据来自 SQL Server MCSToMES_MixAlarm
*/
@Tag(name = "MES设备报警记录")
@RestController
@RequestMapping("/xslmes/mesXslEquipAlarmRecord")
@Slf4j
public class MesXslEquipAlarmRecordController {
@Autowired
private IMesXslEquipAlarmRecordService mesXslEquipAlarmRecordService;
@Operation(summary = "MES设备报警记录-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslEquipAlarmRecordVO>> queryPageList(
McsToMesMixAlarm query,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
IPage<MesXslEquipAlarmRecordVO> pageList =
mesXslEquipAlarmRecordService.queryPage(query, req.getParameterMap(), pageNo, pageSize);
return Result.OK(pageList);
}
@Operation(summary = "MES设备报警记录-通过id查询")
@GetMapping(value = "/queryById")
public Result<MesXslEquipAlarmRecordVO> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslEquipAlarmRecordVO entity = mesXslEquipAlarmRecordService.queryById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@RequiresPermissions("mes:mes_xsl_equip_alarm_record:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, McsToMesMixAlarm query) {
List<MesXslEquipAlarmRecordVO> exportList =
mesXslEquipAlarmRecordService.listForExport(query, request.getParameterMap());
Subject subject = SecurityUtils.getSubject();
LoginUser sysUser = subject != null && subject.getPrincipal() instanceof LoginUser
? (LoginUser) subject.getPrincipal()
: null;
String exporter = sysUser == null || oConvertUtils.isEmpty(sysUser.getRealname()) ? "admin" : sysUser.getRealname();
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "设备报警记录");
mv.addObject(NormalExcelConstants.CLASS, MesXslEquipAlarmRecordVO.class);
mv.addObject(
NormalExcelConstants.PARAMS,
new ExportParams("设备报警记录", "导出人:" + exporter, "设备报警记录", ExcelType.XSSF));
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
String exportFields = request.getParameter(NormalExcelConstants.EXPORT_FIELDS);
if (oConvertUtils.isNotEmpty(exportFields)) {
mv.addObject(NormalExcelConstants.EXPORT_FIELDS, exportFields);
}
return mv;
}
}

View File

@@ -0,0 +1,86 @@
package org.jeecg.modules.xslmes.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.subject.Subject;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.mcs.entity.McsToMesMixAlarm;
import org.jeecg.modules.xslmes.mcs.service.IMesXslEquipDowntimeRecordService;
import org.jeecg.modules.xslmes.mcs.vo.MesXslEquipDowntimeRecordVO;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
/**
* 设备停机记录(只读,数据来自 SQL Server MCSToMES_MixAlarm
*/
@Tag(name = "MES设备停机记录")
@RestController
@RequestMapping("/xslmes/mesXslEquipDowntimeRecord")
@Slf4j
public class MesXslEquipDowntimeRecordController {
@Autowired
private IMesXslEquipDowntimeRecordService mesXslEquipDowntimeRecordService;
@Operation(summary = "MES设备停机记录-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslEquipDowntimeRecordVO>> queryPageList(
McsToMesMixAlarm query,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
IPage<MesXslEquipDowntimeRecordVO> pageList =
mesXslEquipDowntimeRecordService.queryPage(query, req.getParameterMap(), pageNo, pageSize);
return Result.OK(pageList);
}
@Operation(summary = "MES设备停机记录-通过id查询")
@GetMapping(value = "/queryById")
public Result<MesXslEquipDowntimeRecordVO> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslEquipDowntimeRecordVO entity = mesXslEquipDowntimeRecordService.queryById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@RequiresPermissions("mes:mes_xsl_equip_downtime_record:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, McsToMesMixAlarm query) {
List<MesXslEquipDowntimeRecordVO> exportList =
mesXslEquipDowntimeRecordService.listForExport(query, request.getParameterMap());
Subject subject = SecurityUtils.getSubject();
LoginUser sysUser = subject != null && subject.getPrincipal() instanceof LoginUser
? (LoginUser) subject.getPrincipal()
: null;
String exporter = sysUser == null || oConvertUtils.isEmpty(sysUser.getRealname()) ? "admin" : sysUser.getRealname();
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "设备停机记录");
mv.addObject(NormalExcelConstants.CLASS, MesXslEquipDowntimeRecordVO.class);
mv.addObject(
NormalExcelConstants.PARAMS,
new ExportParams("设备停机记录", "导出人:" + exporter, "设备停机记录", ExcelType.XSSF));
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
String exportFields = request.getParameter(NormalExcelConstants.EXPORT_FIELDS);
if (oConvertUtils.isNotEmpty(exportFields)) {
mv.addObject(NormalExcelConstants.EXPORT_FIELDS, exportFields);
}
return mv;
}
}

View File

@@ -23,6 +23,7 @@ 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.IMesXslDeleteReferenceService;
import org.jeecg.modules.xslmes.service.IMesXslEquipInspectConfigService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentLedgerService;
import org.jeecg.modules.xslmes.service.IMesXslInspectMaintainItemService;
@@ -53,6 +54,9 @@ public class MesXslEquipInspectConfigController
@Autowired
private IMesXslInspectMaintainItemService mesXslInspectMaintainItemService;
@Autowired
private IMesXslDeleteReferenceService mesXslDeleteReferenceService;
@Operation(summary = "MES设备点检配置-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslEquipInspectConfig>> queryPageList(
@@ -106,6 +110,10 @@ public class MesXslEquipInspectConfigController
@RequiresPermissions("mes:mes_xsl_equip_inspect_config:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
String refErr = mesXslDeleteReferenceService.validateEquipInspectConfigDelete(List.of(id));
if (refErr != null) {
return Result.error(refErr);
}
mesXslEquipInspectConfigService.delMain(id);
return Result.OK("删除成功!");
}
@@ -115,6 +123,10 @@ public class MesXslEquipInspectConfigController
@RequiresPermissions("mes:mes_xsl_equip_inspect_config:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
String refErr = mesXslDeleteReferenceService.validateEquipInspectConfigDelete(Arrays.asList(ids.split(",")));
if (refErr != null) {
return Result.error(refErr);
}
mesXslEquipInspectConfigService.delBatchMain(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}

View File

@@ -0,0 +1,57 @@
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 lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.xslmes.entity.MesXslEquipPartMapping;
import org.jeecg.modules.xslmes.service.IMesXslEquipPartMappingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
/**
* MES 设备对应部位(只读列表,数据由设备点检配置保存后自动生成)
*/
@Tag(name = "MES设备对应部位")
@RestController
@RequestMapping("/xslmes/mesXslEquipPartMapping")
@Slf4j
public class MesXslEquipPartMappingController
extends JeecgController<MesXslEquipPartMapping, IMesXslEquipPartMappingService> {
@Autowired
private IMesXslEquipPartMappingService mesXslEquipPartMappingService;
@Operation(summary = "MES设备对应部位-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslEquipPartMapping>> queryPageList(
MesXslEquipPartMapping model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslEquipPartMapping> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
//update-begin---author:jiangxh ---date:20250603 for【MES】设备对应部位列表按设备名称、机台代号、大部位代码排序-----------
queryWrapper.orderByAsc("equipment_name", "machine_code", "part_code", "sub_part_code");
//update-end---author:jiangxh ---date:20250603 for【MES】设备对应部位列表按设备名称、机台代号、大部位代码排序-----------
Page<MesXslEquipPartMapping> page = new Page<>(pageNo, pageSize);
IPage<MesXslEquipPartMapping> pageList = mesXslEquipPartMappingService.page(page, queryWrapper);
return Result.OK(pageList);
}
@RequiresPermissions("mes:mes_xsl_equip_part_mapping:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslEquipPartMapping model) {
return super.exportXls(request, model, MesXslEquipPartMapping.class, "MES设备对应部位");
}
}

View File

@@ -24,6 +24,7 @@ import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentCategory;
import org.jeecg.modules.xslmes.entity.MesXslProcessOperation;
import org.jeecg.modules.xslmes.service.IMesXslDeleteReferenceService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentCategoryService;
import org.jeecg.modules.xslmes.service.IMesXslProcessOperationService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
@@ -52,6 +53,9 @@ public class MesXslEquipmentCategoryController extends JeecgController<MesXslEqu
@Autowired
private IMesXslProcessOperationService mesXslProcessOperationService;
@Autowired
private IMesXslDeleteReferenceService mesXslDeleteReferenceService;
@Operation(summary = "MES设备类别-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslEquipmentCategory>> queryPageList(
@@ -100,6 +104,10 @@ public class MesXslEquipmentCategoryController extends JeecgController<MesXslEqu
@RequiresPermissions("mes:mes_xsl_equipment_category:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
String refErr = mesXslDeleteReferenceService.validateEquipmentCategoryDelete(List.of(id));
if (refErr != null) {
return Result.error(refErr);
}
mesXslEquipmentCategoryService.removeById(id);
return Result.OK("删除成功!");
}
@@ -109,6 +117,10 @@ public class MesXslEquipmentCategoryController extends JeecgController<MesXslEqu
@RequiresPermissions("mes:mes_xsl_equipment_category:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
String refErr = mesXslDeleteReferenceService.validateEquipmentCategoryDelete(Arrays.asList(ids.split(",")));
if (refErr != null) {
return Result.error(refErr);
}
mesXslEquipmentCategoryService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}

View File

@@ -21,6 +21,7 @@ import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
import org.jeecg.modules.xslmes.service.IMesXslDeleteReferenceService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentLedgerService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams;
@@ -45,6 +46,9 @@ public class MesXslEquipmentLedgerController extends JeecgController<MesXslEquip
@Autowired
private IMesXslEquipmentLedgerService mesXslEquipmentLedgerService;
@Autowired
private IMesXslDeleteReferenceService mesXslDeleteReferenceService;
@Operation(summary = "MES设备台账-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslEquipmentLedger>> queryPageList(
@@ -69,6 +73,9 @@ public class MesXslEquipmentLedgerController extends JeecgController<MesXslEquip
return Result.error(err);
}
//update-end---author:jiangxh ---date:20260518 for【MES】设备台账保存前校验-----------
//update-begin---author:jiangxh ---date:20250602 for【MES】设备台账新增时系统编号由服务端生成-----------
model.setLedgerNo(null);
//update-end---author:jiangxh ---date:20250602 for【MES】设备台账新增时系统编号由服务端生成-----------
mesXslEquipmentLedgerService.save(model);
return Result.OK("添加成功!");
}
@@ -93,6 +100,10 @@ public class MesXslEquipmentLedgerController extends JeecgController<MesXslEquip
@RequiresPermissions("mes:mes_xsl_equipment_ledger:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
String refErr = mesXslDeleteReferenceService.validateEquipmentLedgerDelete(List.of(id));
if (refErr != null) {
return Result.error(refErr);
}
mesXslEquipmentLedgerService.removeById(id);
return Result.OK("删除成功!");
}
@@ -102,6 +113,10 @@ public class MesXslEquipmentLedgerController extends JeecgController<MesXslEquip
@RequiresPermissions("mes:mes_xsl_equipment_ledger:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
String refErr = mesXslDeleteReferenceService.validateEquipmentLedgerDelete(Arrays.asList(ids.split(",")));
if (refErr != null) {
return Result.error(refErr);
}
mesXslEquipmentLedgerService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@@ -131,6 +146,13 @@ public class MesXslEquipmentLedgerController extends JeecgController<MesXslEquip
return Result.OK("该值可用!");
}
@Operation(summary = "预览下一系统编号001起")
@GetMapping(value = "/nextLedgerNo")
public Result<String> nextLedgerNo() {
MesXslEquipmentLedger ctx = new MesXslEquipmentLedger();
return Result.OK(mesXslEquipmentLedgerService.generateNextLedgerNo(ctx));
}
@Operation(summary = "校验设备名称是否重复")
@GetMapping(value = "/checkEquipmentName")
public Result<String> checkEquipmentName(
@@ -225,6 +247,14 @@ public class MesXslEquipmentLedgerController extends JeecgController<MesXslEquip
if (mesXslEquipmentLedgerService.isEquipmentCodeDuplicated(code, excludeId, model)) {
return "设备编号不能重复";
}
//update-begin---author:jiangxh ---date:20250602 for【MES】设备台账设备类别、设备类型必填-----------
if (oConvertUtils.isEmpty(model.getEquipmentCategoryId())) {
return "请选择设备类别";
}
if (oConvertUtils.isEmpty(model.getEquipmentTypeId())) {
return "请选择设备类型";
}
//update-end---author:jiangxh ---date:20250602 for【MES】设备台账设备类别、设备类型必填-----------
trimRelationNames(model);
String status = model.getEquipmentStatus();
if (oConvertUtils.isEmpty(status)) {
@@ -258,6 +288,7 @@ public class MesXslEquipmentLedgerController extends JeecgController<MesXslEquip
return "文件导入失败:第 " + rowNo + " 条设备编号不能为空";
}
row.setEquipmentCode(code);
row.setLedgerNo(null);
if (!codesInFile.add(code)) {
return "文件导入失败:设备编号【" + code + "】在导入文件中重复";
}
@@ -279,6 +310,14 @@ public class MesXslEquipmentLedgerController extends JeecgController<MesXslEquip
return "文件导入失败:第 " + rowNo + " 条设备名称【" + name + "】不能重复";
}
trimRelationNames(row);
//update-begin---author:jiangxh ---date:20250602 for【MES】设备台账导入设备类别、设备类型必填-----------
if (oConvertUtils.isEmpty(row.getEquipmentCategoryId()) && oConvertUtils.isEmpty(row.getEquipmentCategoryName())) {
return "文件导入失败:第 " + rowNo + " 条设备类别不能为空";
}
if (oConvertUtils.isEmpty(row.getEquipmentTypeId()) && oConvertUtils.isEmpty(row.getEquipmentTypeName())) {
return "文件导入失败:第 " + rowNo + " 条设备类型不能为空";
}
//update-end---author:jiangxh ---date:20250602 for【MES】设备台账导入设备类别、设备类型必填-----------
String status = row.getEquipmentStatus();
if (oConvertUtils.isEmpty(status)) {
row.setEquipmentStatus("0");

View File

@@ -22,6 +22,7 @@ import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentCategory;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentPart;
import org.jeecg.modules.xslmes.service.IMesXslDeleteReferenceService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentCategoryService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentPartService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
@@ -49,6 +50,9 @@ public class MesXslEquipmentPartController extends JeecgController<MesXslEquipme
@Autowired
private IMesXslEquipmentCategoryService mesXslEquipmentCategoryService;
@Autowired
private IMesXslDeleteReferenceService mesXslDeleteReferenceService;
@Operation(summary = "MES设备部位-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslEquipmentPart>> queryPageList(
@@ -97,6 +101,10 @@ public class MesXslEquipmentPartController extends JeecgController<MesXslEquipme
@RequiresPermissions("mes:mes_xsl_equipment_part:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
String refErr = mesXslDeleteReferenceService.validateEquipmentPartDelete(List.of(id));
if (refErr != null) {
return Result.error(refErr);
}
mesXslEquipmentPartService.removeById(id);
return Result.OK("删除成功!");
}
@@ -106,6 +114,10 @@ public class MesXslEquipmentPartController extends JeecgController<MesXslEquipme
@RequiresPermissions("mes:mes_xsl_equipment_part:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
String refErr = mesXslDeleteReferenceService.validateEquipmentPartDelete(Arrays.asList(ids.split(",")));
if (refErr != null) {
return Result.error(refErr);
}
mesXslEquipmentPartService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}

View File

@@ -23,6 +23,7 @@ import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentCategory;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentPart;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentSubPart;
import org.jeecg.modules.xslmes.service.IMesXslDeleteReferenceService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentCategoryService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentPartService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentSubPartService;
@@ -54,6 +55,9 @@ public class MesXslEquipmentSubPartController extends JeecgController<MesXslEqui
@Autowired
private IMesXslEquipmentPartService mesXslEquipmentPartService;
@Autowired
private IMesXslDeleteReferenceService mesXslDeleteReferenceService;
@Operation(summary = "MES设备小部位-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslEquipmentSubPart>> queryPageList(
@@ -102,6 +106,10 @@ public class MesXslEquipmentSubPartController extends JeecgController<MesXslEqui
@RequiresPermissions("mes:mes_xsl_equipment_sub_part:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
String refErr = mesXslDeleteReferenceService.validateEquipmentSubPartDelete(List.of(id));
if (refErr != null) {
return Result.error(refErr);
}
mesXslEquipmentSubPartService.removeById(id);
return Result.OK("删除成功!");
}
@@ -111,6 +119,10 @@ public class MesXslEquipmentSubPartController extends JeecgController<MesXslEqui
@RequiresPermissions("mes:mes_xsl_equipment_sub_part:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
String refErr = mesXslDeleteReferenceService.validateEquipmentSubPartDelete(Arrays.asList(ids.split(",")));
if (refErr != null) {
return Result.error(refErr);
}
mesXslEquipmentSubPartService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}

View File

@@ -25,6 +25,7 @@ import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentCategory;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentType;
import org.jeecg.modules.xslmes.entity.MesXslProcessOperation;
import org.jeecg.modules.xslmes.service.IMesXslDeleteReferenceService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentCategoryService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentTypeService;
import org.jeecg.modules.xslmes.service.IMesXslProcessOperationService;
@@ -54,6 +55,9 @@ public class MesXslEquipmentTypeController extends JeecgController<MesXslEquipme
@Autowired
private IMesXslEquipmentCategoryService mesXslEquipmentCategoryService;
@Autowired
private IMesXslDeleteReferenceService mesXslDeleteReferenceService;
@Operation(summary = "MES设备类型-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslEquipmentType>> queryPageList(
@@ -102,6 +106,10 @@ public class MesXslEquipmentTypeController extends JeecgController<MesXslEquipme
@RequiresPermissions("mes:mes_xsl_equipment_type:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
String refErr = mesXslDeleteReferenceService.validateEquipmentTypeDelete(List.of(id));
if (refErr != null) {
return Result.error(refErr);
}
mesXslEquipmentTypeService.removeById(id);
return Result.OK("删除成功!");
}
@@ -111,6 +119,10 @@ public class MesXslEquipmentTypeController extends JeecgController<MesXslEquipme
@RequiresPermissions("mes:mes_xsl_equipment_type:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
String refErr = mesXslDeleteReferenceService.validateEquipmentTypeDelete(Arrays.asList(ids.split(",")));
if (refErr != null) {
return Result.error(refErr);
}
mesXslEquipmentTypeService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}

View File

@@ -8,6 +8,7 @@ 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.List;
import java.util.Set;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -26,6 +27,7 @@ import org.jeecg.modules.xslmes.service.IMesXslEquipmentCategoryService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentPartService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentSubPartService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentTypeService;
import org.jeecg.modules.xslmes.service.IMesXslDeleteReferenceService;
import org.jeecg.modules.xslmes.service.IMesXslInspectMaintainItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -60,6 +62,9 @@ public class MesXslInspectMaintainItemController
@Autowired
private IMesXslEquipmentSubPartService mesXslEquipmentSubPartService;
@Autowired
private IMesXslDeleteReferenceService mesXslDeleteReferenceService;
@Operation(summary = "MES点检及保养项目-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslInspectMaintainItem>> queryPageList(
@@ -109,6 +114,12 @@ public class MesXslInspectMaintainItemController
@RequiresPermissions("mes:mes_xsl_inspect_maintain_item:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
//update-begin---author:jiangxh ---date:20250603 for【MES】点检及保养项目删除前校验设备点检配置等引用-----------
String err = mesXslDeleteReferenceService.validateInspectMaintainItemDelete(List.of(id));
if (err != null) {
return Result.error(err);
}
//update-end---author:jiangxh ---date:20250603 for【MES】点检及保养项目删除前校验设备点检配置等引用-----------
mesXslInspectMaintainItemService.removeById(id);
return Result.OK("删除成功!");
}
@@ -118,6 +129,12 @@ public class MesXslInspectMaintainItemController
@RequiresPermissions("mes:mes_xsl_inspect_maintain_item:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
//update-begin---author:jiangxh ---date:20250603 for【MES】点检及保养项目删除前校验设备点检配置等引用-----------
String err = mesXslDeleteReferenceService.validateInspectMaintainItemDelete(Arrays.asList(ids.split(",")));
if (err != null) {
return Result.error(err);
}
//update-end---author:jiangxh ---date:20250603 for【MES】点检及保养项目删除前校验设备点检配置等引用-----------
mesXslInspectMaintainItemService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}

View File

@@ -21,6 +21,7 @@ import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslManufacturer;
import org.jeecg.modules.xslmes.service.IMesXslDeleteReferenceService;
import org.jeecg.modules.xslmes.service.IMesXslManufacturerService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams;
@@ -45,6 +46,9 @@ public class MesXslManufacturerController extends JeecgController<MesXslManufact
@Autowired
private IMesXslManufacturerService mesXslManufacturerService;
@Autowired
private IMesXslDeleteReferenceService mesXslDeleteReferenceService;
@Operation(summary = "MES厂家信息-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslManufacturer>> queryPageList(
@@ -93,6 +97,10 @@ public class MesXslManufacturerController extends JeecgController<MesXslManufact
@RequiresPermissions("mes:mes_xsl_manufacturer:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
String refErr = mesXslDeleteReferenceService.validateManufacturerDelete(List.of(id));
if (refErr != null) {
return Result.error(refErr);
}
mesXslManufacturerService.removeById(id);
return Result.OK("删除成功!");
}
@@ -102,6 +110,10 @@ public class MesXslManufacturerController extends JeecgController<MesXslManufact
@RequiresPermissions("mes:mes_xsl_manufacturer:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
String refErr = mesXslDeleteReferenceService.validateManufacturerDelete(Arrays.asList(ids.split(",")));
if (refErr != null) {
return Result.error(refErr);
}
mesXslManufacturerService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}

View File

@@ -25,6 +25,7 @@ import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestDataPoint;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestType;
import org.jeecg.modules.xslmes.service.IMesXslDeleteReferenceService;
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestDataPointService;
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestTypeService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
@@ -51,6 +52,9 @@ public class MesXslRubberQuickTestDataPointController
@Autowired
private IMesXslRubberQuickTestTypeService mesXslRubberQuickTestTypeService;
@Autowired
private IMesXslDeleteReferenceService mesXslDeleteReferenceService;
@Operation(summary = "MES胶料快检数据点-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslRubberQuickTestDataPoint>> queryPageList(
@@ -120,6 +124,10 @@ public class MesXslRubberQuickTestDataPointController
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_data_point:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
String refErr = mesXslDeleteReferenceService.validateRubberQuickTestDataPointDelete(List.of(id));
if (refErr != null) {
return Result.error(refErr);
}
mesXslRubberQuickTestDataPointService.removeById(id);
return Result.OK("删除成功!");
}
@@ -129,6 +137,10 @@ public class MesXslRubberQuickTestDataPointController
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_data_point:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
String refErr = mesXslDeleteReferenceService.validateRubberQuickTestDataPointDelete(Arrays.asList(ids.split(",")));
if (refErr != null) {
return Result.error(refErr);
}
mesXslRubberQuickTestDataPointService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}

View File

@@ -50,6 +50,7 @@ import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestType;
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestDataPointService;
import org.jeecg.modules.xslmes.service.IMesXslDeleteReferenceService;
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestMethodService;
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestTypeService;
@@ -102,7 +103,8 @@ public class MesXslRubberQuickTestMethodController
private IMesXslRubberQuickTestDataPointService mesXslRubberQuickTestDataPointService;
@Autowired
private IMesXslDeleteReferenceService mesXslDeleteReferenceService;
@Operation(summary = "MES胶料快检实验方法-分页列表查询")
@@ -231,29 +233,25 @@ public class MesXslRubberQuickTestMethodController
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
String refErr = mesXslDeleteReferenceService.validateRubberQuickTestMethodDelete(List.of(id));
if (refErr != null) {
return Result.error(refErr);
}
mesXslRubberQuickTestMethodService.delMain(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "MES胶料快检实验方法-批量删除")
@Operation(summary = "MES胶料快检实验方法-批量删除")
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_method:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
String refErr = mesXslDeleteReferenceService.validateRubberQuickTestMethodDelete(Arrays.asList(ids.split(",")));
if (refErr != null) {
return Result.error(refErr);
}
mesXslRubberQuickTestMethodService.delBatchMain(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}

View File

@@ -34,6 +34,7 @@ import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStd;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStdLine;
import org.jeecg.modules.xslmes.service.IMesXslMixerPsCompileService;
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestMethodService;
import org.jeecg.modules.xslmes.service.IMesXslDeleteReferenceService;
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestStdService;
import org.jeecg.modules.xslmes.vo.MesXslRubberQuickTestStdPage;
import org.springframework.beans.BeanUtils;
@@ -69,6 +70,9 @@ public class MesXslRubberQuickTestStdController
@Autowired
private ISysDepartService sysDepartService;
@Autowired
private IMesXslDeleteReferenceService mesXslDeleteReferenceService;
@Operation(summary = "MES胶料快检实验标准-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslRubberQuickTestStd>> queryPageList(
@@ -133,6 +137,10 @@ public class MesXslRubberQuickTestStdController
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_std:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
String refErr = mesXslDeleteReferenceService.validateRubberQuickTestStdDelete(List.of(id));
if (refErr != null) {
return Result.error(refErr);
}
mesXslRubberQuickTestStdService.delMain(id);
return Result.OK("删除成功!");
}
@@ -142,6 +150,10 @@ public class MesXslRubberQuickTestStdController
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_std:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
String refErr = mesXslDeleteReferenceService.validateRubberQuickTestStdDelete(Arrays.asList(ids.split(",")));
if (refErr != null) {
return Result.error(refErr);
}
mesXslRubberQuickTestStdService.delBatchMain(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}

View File

@@ -22,6 +22,7 @@ import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestType;
import org.jeecg.modules.xslmes.service.IMesXslDeleteReferenceService;
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestTypeService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams;
@@ -44,6 +45,9 @@ public class MesXslRubberQuickTestTypeController
@Autowired
private IMesXslRubberQuickTestTypeService mesXslRubberQuickTestTypeService;
@Autowired
private IMesXslDeleteReferenceService mesXslDeleteReferenceService;
@Operation(summary = "MES胶料快检实验类型-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslRubberQuickTestType>> queryPageList(
@@ -116,6 +120,10 @@ public class MesXslRubberQuickTestTypeController
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_type:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
String refErr = mesXslDeleteReferenceService.validateRubberQuickTestTypeDelete(List.of(id));
if (refErr != null) {
return Result.error(refErr);
}
mesXslRubberQuickTestTypeService.removeById(id);
return Result.OK("删除成功!");
}
@@ -125,6 +133,10 @@ public class MesXslRubberQuickTestTypeController
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_type:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
String refErr = mesXslDeleteReferenceService.validateRubberQuickTestTypeDelete(Arrays.asList(ids.split(",")));
if (refErr != null) {
return Result.error(refErr);
}
mesXslRubberQuickTestTypeService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}

View File

@@ -22,6 +22,7 @@ import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockReason;
import org.jeecg.modules.xslmes.service.IMesXslDeleteReferenceService;
import org.jeecg.modules.xslmes.service.IMesXslRubberSmallLockReasonService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams;
@@ -44,6 +45,9 @@ public class MesXslRubberSmallLockReasonController
@Autowired
private IMesXslRubberSmallLockReasonService mesXslRubberSmallLockReasonService;
@Autowired
private IMesXslDeleteReferenceService mesXslDeleteReferenceService;
@Operation(summary = "MES胶料小料锁定原因-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslRubberSmallLockReason>> queryPageList(
@@ -122,6 +126,10 @@ public class MesXslRubberSmallLockReasonController
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_reason:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
String refErr = mesXslDeleteReferenceService.validateRubberSmallLockReasonDelete(List.of(id));
if (refErr != null) {
return Result.error(refErr);
}
mesXslRubberSmallLockReasonService.removeById(id);
return Result.OK("删除成功!");
}
@@ -131,6 +139,10 @@ public class MesXslRubberSmallLockReasonController
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_reason:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
String refErr = mesXslDeleteReferenceService.validateRubberSmallLockReasonDelete(Arrays.asList(ids.split(",")));
if (refErr != null) {
return Result.error(refErr);
}
mesXslRubberSmallLockReasonService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}

View File

@@ -21,6 +21,7 @@ import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslSparePartsCategory;
import org.jeecg.modules.xslmes.service.IMesXslDeleteReferenceService;
import org.jeecg.modules.xslmes.service.IMesXslSparePartsCategoryService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams;
@@ -42,6 +43,9 @@ public class MesXslSparePartsCategoryController extends JeecgController<MesXslSp
@Autowired
private IMesXslSparePartsCategoryService mesXslSparePartsCategoryService;
@Autowired
private IMesXslDeleteReferenceService mesXslDeleteReferenceService;
@Operation(summary = "MES备品件类别-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslSparePartsCategory>> queryPageList(
@@ -90,6 +94,10 @@ public class MesXslSparePartsCategoryController extends JeecgController<MesXslSp
@RequiresPermissions("mes:mes_xsl_spare_parts_category:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
String refErr = mesXslDeleteReferenceService.validateSparePartsCategoryDelete(List.of(id));
if (refErr != null) {
return Result.error(refErr);
}
mesXslSparePartsCategoryService.removeById(id);
return Result.OK("删除成功!");
}
@@ -99,6 +107,10 @@ public class MesXslSparePartsCategoryController extends JeecgController<MesXslSp
@RequiresPermissions("mes:mes_xsl_spare_parts_category:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
String refErr = mesXslDeleteReferenceService.validateSparePartsCategoryDelete(Arrays.asList(ids.split(",")));
if (refErr != null) {
return Result.error(refErr);
}
mesXslSparePartsCategoryService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}

View File

@@ -0,0 +1,75 @@
package org.jeecg.modules.xslmes.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
/**
* MES 设备对应部位(表 mes_xsl_equip_part_mapping由设备点检配置保存后自动生成
*/
@Data
@TableName("mes_xsl_equip_part_mapping")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES设备对应部位")
public class MesXslEquipPartMapping 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 machineCode;
@Schema(description = "设备大部位主键 mes_xsl_equipment_part.id")
private String equipmentPartId;
@Excel(name = "设备大部位", width = 20)
@Schema(description = "设备大部位名称")
private String equipmentPartName;
@Excel(name = "大部位代码", width = 16)
@Schema(description = "大部位代码")
private String partCode;
@Schema(description = "设备小部位主键 mes_xsl_equipment_sub_part.id")
private String equipmentSubPartId;
@Excel(name = "设备小部位", width = 20)
@Schema(description = "设备小部位名称")
private String equipmentSubPartName;
@Excel(name = "小部位代码", width = 16)
@Schema(description = "小部位代码")
private String subPartCode;
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

@@ -40,6 +40,10 @@ public class MesXslEquipmentLedger implements Serializable {
@Schema(description = "设备名称(同租户未删除数据中唯一)")
private String equipmentName;
@Excel(name = "系统编号", width = 12)
@Schema(description = "系统编号租户内从001递增自动生成只读")
private String ledgerNo;
@Excel(name = "设备编号", width = 18)
@Schema(description = "设备编号(同租户未删除数据中唯一)")
private String equipmentCode;

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.MesXslEquipPartMapping;
public interface MesXslEquipPartMappingMapper extends BaseMapper<MesXslEquipPartMapping> {}

View File

@@ -1,6 +1,17 @@
package org.jeecg.modules.xslmes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
public interface MesXslEquipmentLedgerMapper extends BaseMapper<MesXslEquipmentLedger> {}
public interface MesXslEquipmentLedgerMapper extends BaseMapper<MesXslEquipmentLedger> {
//update-begin---author:jiangxh ---date:20250602 for【MES】设备台账租户内最大三位系统编号-----------
@Select(
"SELECT IFNULL(MAX(CAST(ledger_no AS UNSIGNED)), 0) FROM mes_xsl_equipment_ledger "
+ "WHERE del_flag = 0 AND ledger_no REGEXP '^[0-9]+$' "
+ "AND (#{tenantId} IS NULL OR tenant_id = #{tenantId})")
Integer selectMaxNumericLedgerNo(@Param("tenantId") Integer tenantId);
//update-end---author:jiangxh ---date:20250602 for【MES】设备台账租户内最大三位系统编号-----------
}

View File

@@ -0,0 +1,19 @@
package org.jeecg.modules.xslmes.mcs.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
import java.util.Map;
import org.jeecg.modules.xslmes.mcs.entity.McsToMesMixAlarm;
import org.jeecg.modules.xslmes.mcs.vo.MesXslEquipAlarmRecordVO;
/**
* 设备报警记录只读SQL Server MCSToMES_MixAlarm
*/
public interface IMesXslEquipAlarmRecordService {
IPage<MesXslEquipAlarmRecordVO> queryPage(McsToMesMixAlarm query, Map<String, String[]> paramMap, int pageNo, int pageSize);
MesXslEquipAlarmRecordVO queryById(String id);
List<MesXslEquipAlarmRecordVO> listForExport(McsToMesMixAlarm query, Map<String, String[]> paramMap);
}

View File

@@ -0,0 +1,19 @@
package org.jeecg.modules.xslmes.mcs.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
import java.util.Map;
import org.jeecg.modules.xslmes.mcs.entity.McsToMesMixAlarm;
import org.jeecg.modules.xslmes.mcs.vo.MesXslEquipDowntimeRecordVO;
/**
* 设备停机记录只读SQL Server MCSToMES_MixAlarm
*/
public interface IMesXslEquipDowntimeRecordService {
IPage<MesXslEquipDowntimeRecordVO> queryPage(McsToMesMixAlarm query, Map<String, String[]> paramMap, int pageNo, int pageSize);
MesXslEquipDowntimeRecordVO queryById(String id);
List<MesXslEquipDowntimeRecordVO> listForExport(McsToMesMixAlarm query, Map<String, String[]> paramMap);
}

View File

@@ -0,0 +1,59 @@
package org.jeecg.modules.xslmes.mcs.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.jeecg.modules.xslmes.mcs.entity.McsToMesMixAlarm;
import org.jeecg.modules.xslmes.mcs.service.IMcsToMesMixAlarmService;
import org.jeecg.modules.xslmes.mcs.service.IMesXslEquipAlarmRecordService;
import org.jeecg.modules.xslmes.mcs.util.McsQueryHelper;
import org.jeecg.modules.xslmes.mcs.util.MesXslMcsMixAlarmConvertUtil;
import org.jeecg.modules.xslmes.mcs.vo.MesXslEquipAlarmRecordVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 设备报警记录
*/
@Service
public class MesXslEquipAlarmRecordServiceImpl implements IMesXslEquipAlarmRecordService {
@Autowired
private IMcsToMesMixAlarmService mcsToMesMixAlarmService;
@Autowired
private MesXslMcsMixAlarmReadMarker mesXslMcsMixAlarmReadMarker;
@Override
public IPage<MesXslEquipAlarmRecordVO> queryPage(McsToMesMixAlarm query, Map<String, String[]> paramMap, int pageNo, int pageSize) {
QueryWrapper<McsToMesMixAlarm> queryWrapper = McsQueryHelper.buildWrapper(query, paramMap);
Page<McsToMesMixAlarm> page = new Page<>(pageNo, pageSize);
IPage<McsToMesMixAlarm> rawPage = mcsToMesMixAlarmService.page(page, queryWrapper);
//update-begin---author:jiangxh ---date:20250604 for【MES】设备报警记录列表查询后回写 MCS 读取时间与标识-----------
mesXslMcsMixAlarmReadMarker.markAsRead(rawPage.getRecords());
//update-end---author:jiangxh ---date:20250604 for【MES】设备报警记录列表查询后回写 MCS 读取时间与标识-----------
Page<MesXslEquipAlarmRecordVO> voPage = new Page<>(pageNo, pageSize, rawPage.getTotal());
voPage.setRecords(rawPage.getRecords().stream().map(MesXslMcsMixAlarmConvertUtil::toAlarmVo).collect(Collectors.toList()));
return voPage;
}
@Override
public MesXslEquipAlarmRecordVO queryById(String id) {
McsToMesMixAlarm row = mcsToMesMixAlarmService.getById(id);
if (row == null) {
return null;
}
return MesXslMcsMixAlarmConvertUtil.toAlarmVo(row);
}
@Override
public List<MesXslEquipAlarmRecordVO> listForExport(McsToMesMixAlarm query, Map<String, String[]> paramMap) {
QueryWrapper<McsToMesMixAlarm> queryWrapper = McsQueryHelper.buildWrapper(query, paramMap);
return mcsToMesMixAlarmService.list(queryWrapper).stream()
.map(MesXslMcsMixAlarmConvertUtil::toAlarmVo)
.collect(Collectors.toList());
}
}

View File

@@ -0,0 +1,59 @@
package org.jeecg.modules.xslmes.mcs.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.jeecg.modules.xslmes.mcs.entity.McsToMesMixAlarm;
import org.jeecg.modules.xslmes.mcs.service.IMcsToMesMixAlarmService;
import org.jeecg.modules.xslmes.mcs.service.IMesXslEquipDowntimeRecordService;
import org.jeecg.modules.xslmes.mcs.util.McsQueryHelper;
import org.jeecg.modules.xslmes.mcs.util.MesXslMcsMixAlarmConvertUtil;
import org.jeecg.modules.xslmes.mcs.vo.MesXslEquipDowntimeRecordVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 设备停机记录
*/
@Service
public class MesXslEquipDowntimeRecordServiceImpl implements IMesXslEquipDowntimeRecordService {
@Autowired
private IMcsToMesMixAlarmService mcsToMesMixAlarmService;
@Autowired
private MesXslMcsMixAlarmReadMarker mesXslMcsMixAlarmReadMarker;
@Override
public IPage<MesXslEquipDowntimeRecordVO> queryPage(McsToMesMixAlarm query, Map<String, String[]> paramMap, int pageNo, int pageSize) {
QueryWrapper<McsToMesMixAlarm> queryWrapper = McsQueryHelper.buildWrapper(query, paramMap);
Page<McsToMesMixAlarm> page = new Page<>(pageNo, pageSize);
IPage<McsToMesMixAlarm> rawPage = mcsToMesMixAlarmService.page(page, queryWrapper);
//update-begin---author:jiangxh ---date:20250604 for【MES】设备停机记录列表查询后回写 MCS 读取时间与标识-----------
mesXslMcsMixAlarmReadMarker.markAsRead(rawPage.getRecords());
//update-end---author:jiangxh ---date:20250604 for【MES】设备停机记录列表查询后回写 MCS 读取时间与标识-----------
Page<MesXslEquipDowntimeRecordVO> voPage = new Page<>(pageNo, pageSize, rawPage.getTotal());
voPage.setRecords(rawPage.getRecords().stream().map(MesXslMcsMixAlarmConvertUtil::toDowntimeVo).collect(Collectors.toList()));
return voPage;
}
@Override
public MesXslEquipDowntimeRecordVO queryById(String id) {
McsToMesMixAlarm row = mcsToMesMixAlarmService.getById(id);
if (row == null) {
return null;
}
return MesXslMcsMixAlarmConvertUtil.toDowntimeVo(row);
}
@Override
public List<MesXslEquipDowntimeRecordVO> listForExport(McsToMesMixAlarm query, Map<String, String[]> paramMap) {
QueryWrapper<McsToMesMixAlarm> queryWrapper = McsQueryHelper.buildWrapper(query, paramMap);
return mcsToMesMixAlarmService.list(queryWrapper).stream()
.map(MesXslMcsMixAlarmConvertUtil::toDowntimeVo)
.collect(Collectors.toList());
}
}

View File

@@ -0,0 +1,36 @@
package org.jeecg.modules.xslmes.mcs.service.impl;
import java.util.Date;
import java.util.List;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.mcs.entity.McsToMesMixAlarm;
import org.jeecg.modules.xslmes.mcs.service.IMcsToMesMixAlarmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 列表查询后将 MCSToMES_MixAlarm 标记为已读ReadTime、MES_Flag=1
*/
@Component
public class MesXslMcsMixAlarmReadMarker {
@Autowired
private IMcsToMesMixAlarmService mcsToMesMixAlarmService;
public void markAsRead(List<McsToMesMixAlarm> records) {
if (records == null || records.isEmpty()) {
return;
}
Date now = new Date();
for (McsToMesMixAlarm row : records) {
if (oConvertUtils.isEmpty(row.getGuid())) {
continue;
}
McsToMesMixAlarm upd = new McsToMesMixAlarm();
upd.setGuid(row.getGuid());
upd.setReadTime(now);
upd.setMesFlag(1);
mcsToMesMixAlarmService.updateById(upd);
}
}
}

View File

@@ -0,0 +1,90 @@
package org.jeecg.modules.xslmes.mcs.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.mcs.entity.McsToMesMixAlarm;
import org.jeecg.modules.xslmes.mcs.vo.MesXslEquipAlarmRecordVO;
import org.jeecg.modules.xslmes.mcs.vo.MesXslEquipDowntimeRecordVO;
/**
* MCSToMES_MixAlarm 与 MES 设备报警/停机展示 VO 转换
*/
public final class MesXslMcsMixAlarmConvertUtil {
public static final String RECORD_TYPE_AUTO = "自动";
private static final String[] DATE_PATTERNS = {
"yyyy-MM-dd HH:mm:ss",
"yyyy/MM/dd HH:mm:ss",
"yyyy-MM-dd HH:mm",
"yyyy/MM/dd HH:mm"
};
private MesXslMcsMixAlarmConvertUtil() {}
public static MesXslEquipAlarmRecordVO toAlarmVo(McsToMesMixAlarm row) {
MesXslEquipAlarmRecordVO vo = new MesXslEquipAlarmRecordVO();
vo.setId(row.getGuid());
vo.setEquipId(row.getEquipId());
vo.setEquipName(row.getEquipName());
vo.setEquipType(row.getEquipType());
vo.setShiftClass(null);
vo.setAlarmContent(row.getAlarmInf());
vo.setAlarmTime(row.getWriteTime());
vo.setRecordType(RECORD_TYPE_AUTO);
return vo;
}
public static MesXslEquipDowntimeRecordVO toDowntimeVo(McsToMesMixAlarm row) {
MesXslEquipDowntimeRecordVO vo = new MesXslEquipDowntimeRecordVO();
vo.setId(row.getGuid());
vo.setEquipId(row.getEquipId());
vo.setEquipName(row.getEquipName());
vo.setEquipType(row.getEquipType());
vo.setShiftClass(null);
vo.setDowntimeContent(row.getAlarmInf());
vo.setDowntimeStartTime(row.getWriteTime());
vo.setDowntimeEndTime(row.getEndTime());
vo.setDowntimeDuration(formatDowntimeDuration(row.getWriteTime(), row.getEndTime()));
vo.setRecordType(RECORD_TYPE_AUTO);
return vo;
}
public static String formatDowntimeDuration(Date start, String endStr) {
if (start == null || oConvertUtils.isEmpty(endStr)) {
return null;
}
Date end = parseDateTime(endStr);
if (end == null) {
return null;
}
long diffMs = end.getTime() - start.getTime();
if (diffMs < 0) {
return null;
}
long totalMinutes = diffMs / 60000;
long hours = totalMinutes / 60;
long minutes = totalMinutes % 60;
if (hours > 0) {
return minutes > 0 ? hours + "小时" + minutes + "分钟" : hours + "小时";
}
return minutes + "分钟";
}
public static Date parseDateTime(String text) {
if (oConvertUtils.isEmpty(text)) {
return null;
}
String trimmed = text.trim();
for (String pattern : DATE_PATTERNS) {
try {
return new SimpleDateFormat(pattern).parse(trimmed);
} catch (ParseException ignored) {
// try next pattern
}
}
return null;
}
}

View File

@@ -0,0 +1,51 @@
package org.jeecg.modules.xslmes.mcs.vo;
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 org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
/**
* 设备报警记录(展示 VO数据来自 SQL Server MCSToMES_MixAlarm
*/
@Data
@Schema(description = "设备报警记录")
public class MesXslEquipAlarmRecordVO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "主键")
private String id;
@Excel(name = "机台编号", width = 15)
@Schema(description = "机台编号")
private String equipId;
@Excel(name = "机台名称", width = 15)
@Schema(description = "机台名称")
private String equipName;
@Excel(name = "机台类型", width = 15)
@Schema(description = "机台类型")
private String equipType;
@Excel(name = "班次", width = 12)
@Schema(description = "班次")
private String shiftClass;
@Excel(name = "报警内容", width = 40)
@Schema(description = "报警内容")
private String alarmContent;
@Excel(name = "报警时间", width = 20, 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 alarmTime;
@Excel(name = "类型", width = 12)
@Schema(description = "类型(自动/人工)")
private String recordType;
}

View File

@@ -0,0 +1,59 @@
package org.jeecg.modules.xslmes.mcs.vo;
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 org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
/**
* 设备停机记录(展示 VO数据来自 SQL Server MCSToMES_MixAlarm
*/
@Data
@Schema(description = "设备停机记录")
public class MesXslEquipDowntimeRecordVO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "主键")
private String id;
@Excel(name = "机台编号", width = 15)
@Schema(description = "机台编号")
private String equipId;
@Excel(name = "机台名称", width = 15)
@Schema(description = "机台名称")
private String equipName;
@Excel(name = "机台类型", width = 15)
@Schema(description = "机台类型")
private String equipType;
@Excel(name = "班次", width = 12)
@Schema(description = "班次")
private String shiftClass;
@Excel(name = "停机内容", width = 40)
@Schema(description = "停机内容")
private String downtimeContent;
@Excel(name = "停机开始时间", width = 20, 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 downtimeStartTime;
@Excel(name = "停机结束时间", width = 20)
@Schema(description = "停机结束时间")
private String downtimeEndTime;
@Excel(name = "停机时长", width = 15)
@Schema(description = "停机时长")
private String downtimeDuration;
@Excel(name = "类型", width = 12)
@Schema(description = "类型(自动/人工)")
private String recordType;
}

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.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})等。
* 包含:客户管理({@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.MesXslEquipPartMapping})、备品件类别({@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,41 @@
package org.jeecg.modules.xslmes.service;
import java.util.Collection;
/**
* MES 设备管理 / 质量管理主数据删除前引用校验。
*/
public interface IMesXslDeleteReferenceService {
String validateEquipmentCategoryDelete(Collection<String> ids);
String validateEquipmentTypeDelete(Collection<String> ids);
String validateEquipmentPartDelete(Collection<String> ids);
String validateEquipmentSubPartDelete(Collection<String> ids);
String validateInspectMaintainItemDelete(Collection<String> ids);
String validateEquipmentLedgerDelete(Collection<String> ids);
String validateManufacturerDelete(Collection<String> ids);
String validateSparePartsCategoryDelete(Collection<String> ids);
String validateDowntimeMainTypeDelete(Collection<String> ids);
String validateDowntimeTypeDelete(Collection<String> ids);
String validateEquipInspectConfigDelete(Collection<String> ids);
String validateRubberQuickTestTypeDelete(Collection<String> ids);
String validateRubberQuickTestDataPointDelete(Collection<String> ids);
String validateRubberQuickTestMethodDelete(Collection<String> ids);
String validateRubberQuickTestStdDelete(Collection<String> ids);
String validateRubberSmallLockReasonDelete(Collection<String> ids);
}

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.MesXslEquipPartMapping;
public interface IMesXslEquipPartMappingService extends IService<MesXslEquipPartMapping> {
/**
* 根据设备台账下全部点检/保养配置明细,按大部位+小部位去重后重建对应部位记录。
*/
void syncByEquipmentLedgerId(String equipmentLedgerId);
}

View File

@@ -5,6 +5,9 @@ import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
public interface IMesXslEquipmentLedgerService extends IService<MesXslEquipmentLedger> {
/** 生成下一系统编号001 起,三位数字,租户维度) */
String generateNextLedgerNo(MesXslEquipmentLedger context);
boolean isEquipmentCodeDuplicated(String equipmentCode, String excludeId, MesXslEquipmentLedger context);
boolean isEquipmentNameDuplicated(String equipmentName, String excludeId, MesXslEquipmentLedger context);

View File

@@ -0,0 +1,267 @@
package org.jeecg.modules.xslmes.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import java.util.Collection;
import java.util.List;
import java.util.function.Function;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslDayTankMaterialMap;
import org.jeecg.modules.xslmes.entity.MesXslDowntimeRecord;
import org.jeecg.modules.xslmes.entity.MesXslDowntimeType;
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.entity.MesXslEquipPartMapping;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentPart;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentSubPart;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentType;
import org.jeecg.modules.xslmes.entity.MesXslInspectMaintainItem;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestDataPoint;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestRecord;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStd;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStdLine;
import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockLog;
import org.jeecg.modules.xslmes.entity.MesXslSparePart;
import org.jeecg.modules.xslmes.mapper.MesXslDayTankMaterialMapMapper;
import org.jeecg.modules.xslmes.mapper.MesXslDowntimeRecordMapper;
import org.jeecg.modules.xslmes.mapper.MesXslDowntimeTypeMapper;
import org.jeecg.modules.xslmes.mapper.MesXslEquipInspectConfigLineMapper;
import org.jeecg.modules.xslmes.mapper.MesXslEquipInspectConfigMapper;
import org.jeecg.modules.xslmes.mapper.MesXslEquipInspectRecordLineMapper;
import org.jeecg.modules.xslmes.mapper.MesXslEquipInspectRecordMapper;
import org.jeecg.modules.xslmes.mapper.MesXslEquipPartMappingMapper;
import org.jeecg.modules.xslmes.mapper.MesXslEquipmentLedgerMapper;
import org.jeecg.modules.xslmes.mapper.MesXslEquipmentPartMapper;
import org.jeecg.modules.xslmes.mapper.MesXslEquipmentSubPartMapper;
import org.jeecg.modules.xslmes.mapper.MesXslEquipmentTypeMapper;
import org.jeecg.modules.xslmes.mapper.MesXslInspectMaintainItemMapper;
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestDataPointMapper;
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestMethodLineMapper;
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestMethodMapper;
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestRecordMapper;
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestStdLineMapper;
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestStdMapper;
import org.jeecg.modules.xslmes.mapper.MesXslRubberSmallLockLogMapper;
import org.jeecg.modules.xslmes.mapper.MesXslSparePartMapper;
import org.jeecg.modules.xslmes.service.IMesXslDeleteReferenceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@Service
public class MesXslDeleteReferenceServiceImpl implements IMesXslDeleteReferenceService {
@Autowired
private MesXslEquipInspectConfigLineMapper mesXslEquipInspectConfigLineMapper;
@Autowired
private MesXslEquipInspectRecordMapper mesXslEquipInspectRecordMapper;
@Autowired
private MesXslEquipInspectRecordLineMapper mesXslEquipInspectRecordLineMapper;
@Autowired
private MesXslDowntimeRecordMapper mesXslDowntimeRecordMapper;
@Autowired
private MesXslEquipmentTypeMapper mesXslEquipmentTypeMapper;
@Autowired
private MesXslEquipmentPartMapper mesXslEquipmentPartMapper;
@Autowired
private MesXslEquipmentSubPartMapper mesXslEquipmentSubPartMapper;
@Autowired
private MesXslInspectMaintainItemMapper mesXslInspectMaintainItemMapper;
@Autowired
private MesXslEquipmentLedgerMapper mesXslEquipmentLedgerMapper;
@Autowired
private MesXslEquipInspectConfigMapper mesXslEquipInspectConfigMapper;
@Autowired
private MesXslEquipPartMappingMapper mesXslEquipPartMappingMapper;
@Autowired
private MesXslDayTankMaterialMapMapper mesXslDayTankMaterialMapMapper;
@Autowired
private MesXslSparePartMapper mesXslSparePartMapper;
@Autowired
private MesXslDowntimeTypeMapper mesXslDowntimeTypeMapper;
@Autowired
private MesXslRubberQuickTestMethodMapper mesXslRubberQuickTestMethodMapper;
@Autowired
private MesXslRubberQuickTestDataPointMapper mesXslRubberQuickTestDataPointMapper;
@Autowired
private MesXslRubberQuickTestRecordMapper mesXslRubberQuickTestRecordMapper;
@Autowired
private MesXslRubberQuickTestStdMapper mesXslRubberQuickTestStdMapper;
@Autowired
private MesXslRubberQuickTestMethodLineMapper mesXslRubberQuickTestMethodLineMapper;
@Autowired
private MesXslRubberQuickTestStdLineMapper mesXslRubberQuickTestStdLineMapper;
@Autowired
private MesXslRubberSmallLockLogMapper mesXslRubberSmallLockLogMapper;
//update-begin---author:jiangxh ---date:20250603 for【MES】设备/质量管理主数据删除前引用校验-----------
@Override
public String validateEquipmentCategoryDelete(Collection<String> ids) {
return firstBlocked(
ids,
ref("设备类型", MesXslEquipmentType::getEquipmentCategoryId, mesXslEquipmentTypeMapper, true),
ref("设备部位", MesXslEquipmentPart::getEquipmentCategoryId, mesXslEquipmentPartMapper, true),
ref("点检及保养项目", MesXslInspectMaintainItem::getEquipmentCategoryId, mesXslInspectMaintainItemMapper, true),
ref("设备台账", MesXslEquipmentLedger::getEquipmentCategoryId, mesXslEquipmentLedgerMapper, true));
}
@Override
public String validateEquipmentTypeDelete(Collection<String> ids) {
return firstBlocked(
ids,
ref("点检及保养项目", MesXslInspectMaintainItem::getEquipmentTypeId, mesXslInspectMaintainItemMapper, true),
ref("设备台账", MesXslEquipmentLedger::getEquipmentTypeId, mesXslEquipmentLedgerMapper, true));
}
@Override
public String validateEquipmentPartDelete(Collection<String> ids) {
return firstBlocked(
ids,
ref("设备小部位", MesXslEquipmentSubPart::getEquipmentPartId, mesXslEquipmentSubPartMapper, true),
ref("点检及保养项目", MesXslInspectMaintainItem::getEquipmentPartId, mesXslInspectMaintainItemMapper, true),
ref("停机记录", MesXslDowntimeRecord::getEquipmentPartId, mesXslDowntimeRecordMapper, true));
}
@Override
public String validateEquipmentSubPartDelete(Collection<String> ids) {
return firstBlocked(
ids,
ref("点检及保养项目", MesXslInspectMaintainItem::getEquipmentSubPartId, mesXslInspectMaintainItemMapper, true));
}
@Override
public String validateInspectMaintainItemDelete(Collection<String> ids) {
return firstBlocked(
ids,
refPlain("设备点检配置", MesXslEquipInspectConfigLine::getInspectMaintainItemId, mesXslEquipInspectConfigLineMapper),
refPlain("点检保养记录", MesXslEquipInspectRecordLine::getInspectMaintainItemId, mesXslEquipInspectRecordLineMapper),
ref("停机记录", MesXslDowntimeRecord::getInspectMaintainItemId, mesXslDowntimeRecordMapper, true));
}
@Override
public String validateEquipmentLedgerDelete(Collection<String> ids) {
return firstBlocked(
ids,
ref("设备点检配置", MesXslEquipInspectConfig::getEquipmentLedgerId, mesXslEquipInspectConfigMapper, true),
ref("点检保养记录", MesXslEquipInspectRecord::getEquipmentLedgerId, mesXslEquipInspectRecordMapper, true),
ref("停机记录", MesXslDowntimeRecord::getEquipmentLedgerId, mesXslDowntimeRecordMapper, true),
ref("设备对应部位", MesXslEquipPartMapping::getEquipmentLedgerId, mesXslEquipPartMappingMapper, true),
refPlain("日罐物料对应", MesXslDayTankMaterialMap::getEquipmentId, mesXslDayTankMaterialMapMapper),
ref("胶料快检记录", MesXslRubberQuickTestRecord::getProdEquipmentLedgerId, mesXslRubberQuickTestRecordMapper, true));
}
@Override
public String validateManufacturerDelete(Collection<String> ids) {
return firstBlocked(ids, ref("设备台账", MesXslEquipmentLedger::getManufacturerId, mesXslEquipmentLedgerMapper, true));
}
@Override
public String validateSparePartsCategoryDelete(Collection<String> ids) {
return firstBlocked(ids, ref("备品件信息", MesXslSparePart::getSparePartsCategoryId, mesXslSparePartMapper, true));
}
@Override
public String validateDowntimeMainTypeDelete(Collection<String> ids) {
return firstBlocked(ids, ref("停机类型", MesXslDowntimeType::getDowntimeMainTypeId, mesXslDowntimeTypeMapper, true));
}
@Override
public String validateDowntimeTypeDelete(Collection<String> ids) {
return firstBlocked(ids, ref("停机记录", MesXslDowntimeRecord::getDowntimeTypeId, mesXslDowntimeRecordMapper, true));
}
@Override
public String validateEquipInspectConfigDelete(Collection<String> ids) {
return firstBlocked(
ids, ref("点检保养记录", MesXslEquipInspectRecord::getEquipInspectConfigId, mesXslEquipInspectRecordMapper, true));
}
@Override
public String validateRubberQuickTestTypeDelete(Collection<String> ids) {
return firstBlocked(
ids,
ref("胶料快检实验方法", MesXslRubberQuickTestMethod::getQuickTestTypeId, mesXslRubberQuickTestMethodMapper, true),
ref("胶料快检数据点", MesXslRubberQuickTestDataPoint::getQuickTestTypeId, mesXslRubberQuickTestDataPointMapper, true),
ref("胶料快检记录", MesXslRubberQuickTestRecord::getQuickTestTypeId, mesXslRubberQuickTestRecordMapper, true));
}
@Override
public String validateRubberQuickTestDataPointDelete(Collection<String> ids) {
return firstBlocked(
ids,
refPlain("胶料快检实验方法", MesXslRubberQuickTestMethodLine::getDataPointId, mesXslRubberQuickTestMethodLineMapper),
refPlain("胶料快检实验标准", MesXslRubberQuickTestStdLine::getDataPointId, mesXslRubberQuickTestStdLineMapper));
}
@Override
public String validateRubberQuickTestMethodDelete(Collection<String> ids) {
return firstBlocked(ids, ref("胶料快检实验标准", MesXslRubberQuickTestStd::getTestMethodId, mesXslRubberQuickTestStdMapper, true));
}
@Override
public String validateRubberQuickTestStdDelete(Collection<String> ids) {
return firstBlocked(ids, ref("胶料快检记录", MesXslRubberQuickTestRecord::getStdId, mesXslRubberQuickTestRecordMapper, true));
}
@Override
public String validateRubberSmallLockReasonDelete(Collection<String> ids) {
return firstBlocked(ids, ref("胶料小料锁定日志", MesXslRubberSmallLockLog::getLockReasonId, mesXslRubberSmallLockLogMapper, true));
}
@SafeVarargs
private final String firstBlocked(Collection<String> ids, Function<List<String>, String>... checks) {
List<String> idList = normalizeIds(ids);
if (idList.isEmpty()) {
return null;
}
for (Function<List<String>, String> check : checks) {
String msg = check.apply(idList);
if (msg != null) {
return msg;
}
}
return null;
}
private <T> Function<List<String>, String> ref(
String moduleName, SFunction<T, String> column, BaseMapper<T> mapper, boolean aliveOnly) {
return idList -> countRef(mapper, column, idList, aliveOnly) > 0 ? blockedMsg(moduleName) : null;
}
private <T> Function<List<String>, String> refPlain(
String moduleName, SFunction<T, String> column, BaseMapper<T> mapper) {
return idList -> countRef(mapper, column, idList, false) > 0 ? blockedMsg(moduleName) : null;
}
private <T> long countRef(
BaseMapper<T> mapper, SFunction<T, String> column, List<String> ids, boolean aliveOnly) {
if (CollectionUtils.isEmpty(ids)) {
return 0;
}
LambdaQueryWrapper<T> w = new LambdaQueryWrapper<>();
w.in(column, ids);
if (aliveOnly) {
w.apply("(del_flag = {0} OR del_flag IS NULL)", CommonConstant.DEL_FLAG_0);
}
return mapper.selectCount(w);
}
private List<String> normalizeIds(Collection<String> ids) {
if (ids == null) {
return List.of();
}
return ids.stream().filter(oConvertUtils::isNotEmpty).map(String::trim).distinct().toList();
}
private static String blockedMsg(String moduleName) {
return "已在【" + moduleName + "】中使用,请先删除" + moduleName + "后再删除";
}
//update-end---author:jiangxh ---date:20250603 for【MES】设备/质量管理主数据删除前引用校验-----------
}

View File

@@ -13,6 +13,7 @@ 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.jeecg.modules.xslmes.service.IMesXslEquipPartMappingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -26,21 +27,40 @@ public class MesXslEquipInspectConfigServiceImpl
@Autowired
private MesXslEquipInspectConfigLineMapper mesXslEquipInspectConfigLineMapper;
@Autowired
private IMesXslEquipPartMappingService mesXslEquipPartMappingService;
@Override
@Transactional(rollbackFor = Exception.class)
public void saveMain(MesXslEquipInspectConfig main, List<MesXslEquipInspectConfigLine> lineList) {
this.save(main);
insertLines(main.getId(), lineList);
//update-begin---author:jiangxh ---date:20250603 for【MES】设备点检配置保存后同步设备对应部位-----------
syncEquipPartMapping(main.getEquipmentLedgerId());
//update-end---author:jiangxh ---date:20250603 for【MES】设备点检配置保存后同步设备对应部位-----------
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateMain(MesXslEquipInspectConfig main, List<MesXslEquipInspectConfigLine> lineList) {
//update-begin---author:jiangxh ---date:20250603 for【MES】设备点检配置变更台账时同步原设备对应部位-----------
MesXslEquipInspectConfig old = this.getById(main.getId());
String oldLedgerId = old != null ? old.getEquipmentLedgerId() : null;
//update-end---author:jiangxh ---date:20250603 for【MES】设备点检配置变更台账时同步原设备对应部位-----------
this.updateById(main);
mesXslEquipInspectConfigLineMapper.delete(
new LambdaQueryWrapper<MesXslEquipInspectConfigLine>()
.eq(MesXslEquipInspectConfigLine::getConfigId, main.getId()));
insertLines(main.getId(), lineList);
//update-begin---author:jiangxh ---date:20250603 for【MES】设备点检配置保存后同步设备对应部位-----------
syncEquipPartMapping(main.getEquipmentLedgerId());
String newLedgerId = main.getEquipmentLedgerId();
if (oConvertUtils.isNotEmpty(oldLedgerId)
&& oConvertUtils.isNotEmpty(newLedgerId)
&& !oldLedgerId.trim().equals(newLedgerId.trim())) {
syncEquipPartMapping(oldLedgerId);
}
//update-end---author:jiangxh ---date:20250603 for【MES】设备点检配置保存后同步设备对应部位-----------
}
private void insertLines(String configId, List<MesXslEquipInspectConfigLine> lineList) {
@@ -59,9 +79,16 @@ public class MesXslEquipInspectConfigServiceImpl
@Override
@Transactional(rollbackFor = Exception.class)
public void delMain(String id) {
//update-begin---author:jiangxh ---date:20250603 for【MES】设备点检配置删除后同步设备对应部位-----------
MesXslEquipInspectConfig main = this.getById(id);
String ledgerId = main != null ? main.getEquipmentLedgerId() : null;
//update-end---author:jiangxh ---date:20250603 for【MES】设备点检配置删除后同步设备对应部位-----------
mesXslEquipInspectConfigLineMapper.delete(
new LambdaQueryWrapper<MesXslEquipInspectConfigLine>().eq(MesXslEquipInspectConfigLine::getConfigId, id));
this.removeById(id);
//update-begin---author:jiangxh ---date:20250603 for【MES】设备点检配置删除后同步设备对应部位-----------
syncEquipPartMapping(ledgerId);
//update-end---author:jiangxh ---date:20250603 for【MES】设备点检配置删除后同步设备对应部位-----------
}
@Override
@@ -106,4 +133,13 @@ public class MesXslEquipInspectConfigServiceImpl
}
//update-end---author:jiangxh ---date:20260519 for【MES】设备点检配置同设备同类型点检/保养)仅允许一条主数据-----------
//update-begin---author:jiangxh ---date:20250603 for【MES】设备点检配置保存后同步设备对应部位-----------
private void syncEquipPartMapping(String equipmentLedgerId) {
if (oConvertUtils.isEmpty(equipmentLedgerId)) {
return;
}
mesXslEquipPartMappingService.syncByEquipmentLedgerId(equipmentLedgerId);
}
//update-end---author:jiangxh ---date:20250603 for【MES】设备点检配置保存后同步设备对应部位-----------
}

View File

@@ -0,0 +1,156 @@
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.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.jeecg.common.constant.CommonConstant;
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.MesXslEquipPartMapping;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentPart;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentSubPart;
import org.jeecg.modules.xslmes.entity.MesXslInspectMaintainItem;
import org.jeecg.modules.xslmes.mapper.MesXslEquipInspectConfigLineMapper;
import org.jeecg.modules.xslmes.mapper.MesXslEquipInspectConfigMapper;
import org.jeecg.modules.xslmes.mapper.MesXslEquipPartMappingMapper;
import org.jeecg.modules.xslmes.service.IMesXslEquipPartMappingService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentLedgerService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentPartService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentSubPartService;
import org.jeecg.modules.xslmes.service.IMesXslInspectMaintainItemService;
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 MesXslEquipPartMappingServiceImpl
extends ServiceImpl<MesXslEquipPartMappingMapper, MesXslEquipPartMapping>
implements IMesXslEquipPartMappingService {
@Autowired
private IMesXslEquipmentLedgerService mesXslEquipmentLedgerService;
@Autowired
private IMesXslInspectMaintainItemService mesXslInspectMaintainItemService;
@Autowired
private IMesXslEquipmentPartService mesXslEquipmentPartService;
@Autowired
private IMesXslEquipmentSubPartService mesXslEquipmentSubPartService;
@Autowired
private MesXslEquipInspectConfigMapper mesXslEquipInspectConfigMapper;
@Autowired
private MesXslEquipInspectConfigLineMapper mesXslEquipInspectConfigLineMapper;
//update-begin---author:jiangxh ---date:20250603 for【MES】设备点检配置保存后按大部位+小部位去重生成设备对应部位-----------
@Override
@Transactional(rollbackFor = Exception.class)
public void syncByEquipmentLedgerId(String equipmentLedgerId) {
if (oConvertUtils.isEmpty(equipmentLedgerId)) {
return;
}
String ledgerId = equipmentLedgerId.trim();
MesXslEquipmentLedger ledger = mesXslEquipmentLedgerService.getById(ledgerId);
if (ledger == null || isDeleted(ledger.getDelFlag())) {
removeByLedgerId(ledgerId);
return;
}
LambdaQueryWrapper<MesXslEquipInspectConfig> configW = new LambdaQueryWrapper<>();
configW.eq(MesXslEquipInspectConfig::getEquipmentLedgerId, ledgerId);
configW.and(
q ->
q.eq(MesXslEquipInspectConfig::getDelFlag, CommonConstant.DEL_FLAG_0)
.or()
.isNull(MesXslEquipInspectConfig::getDelFlag));
List<MesXslEquipInspectConfig> configs = mesXslEquipInspectConfigMapper.selectList(configW);
Map<String, MesXslEquipPartMapping> unique = new LinkedHashMap<>();
if (!CollectionUtils.isEmpty(configs)) {
for (MesXslEquipInspectConfig config : configs) {
List<MesXslEquipInspectConfigLine> lines =
mesXslEquipInspectConfigLineMapper.selectList(
new LambdaQueryWrapper<MesXslEquipInspectConfigLine>()
.eq(MesXslEquipInspectConfigLine::getConfigId, config.getId())
.orderByAsc(MesXslEquipInspectConfigLine::getSortNo));
if (CollectionUtils.isEmpty(lines)) {
continue;
}
for (MesXslEquipInspectConfigLine line : lines) {
if (line == null || oConvertUtils.isEmpty(line.getInspectMaintainItemId())) {
continue;
}
MesXslInspectMaintainItem item =
mesXslInspectMaintainItemService.getById(line.getInspectMaintainItemId().trim());
if (item == null || isDeleted(item.getDelFlag())) {
continue;
}
if (oConvertUtils.isEmpty(item.getEquipmentPartId())
|| oConvertUtils.isEmpty(item.getEquipmentSubPartId())) {
continue;
}
String partKey = item.getEquipmentPartId().trim() + "|" + item.getEquipmentSubPartId().trim();
if (unique.containsKey(partKey)) {
continue;
}
MesXslEquipPartMapping row = buildMappingRow(ledger, item);
if (row != null) {
unique.put(partKey, row);
}
}
}
}
removeByLedgerId(ledgerId);
if (unique.isEmpty()) {
return;
}
saveBatch(new ArrayList<>(unique.values()));
}
private MesXslEquipPartMapping buildMappingRow(MesXslEquipmentLedger ledger, MesXslInspectMaintainItem item) {
MesXslEquipmentPart part = mesXslEquipmentPartService.getById(item.getEquipmentPartId());
MesXslEquipmentSubPart subPart = mesXslEquipmentSubPartService.getById(item.getEquipmentSubPartId());
if (part == null || isDeleted(part.getDelFlag()) || subPart == null || isDeleted(subPart.getDelFlag())) {
return null;
}
MesXslEquipPartMapping row = new MesXslEquipPartMapping();
row.setEquipmentLedgerId(ledger.getId());
row.setEquipmentName(ledger.getEquipmentName());
row.setMachineCode(ledger.getEquipmentCode());
row.setEquipmentPartId(part.getId());
row.setEquipmentPartName(
oConvertUtils.isNotEmpty(part.getPartName()) ? part.getPartName() : item.getEquipmentPartName());
row.setPartCode(part.getPartCode());
row.setEquipmentSubPartId(subPart.getId());
row.setEquipmentSubPartName(
oConvertUtils.isNotEmpty(subPart.getSubPartName())
? subPart.getSubPartName()
: item.getEquipmentSubPartName());
row.setSubPartCode(subPart.getSubPartCode());
row.setTenantId(ledger.getTenantId());
row.setSysOrgCode(ledger.getSysOrgCode());
row.setDelFlag(CommonConstant.DEL_FLAG_0);
return row;
}
private void removeByLedgerId(String equipmentLedgerId) {
this.remove(
new LambdaQueryWrapper<MesXslEquipPartMapping>()
.eq(MesXslEquipPartMapping::getEquipmentLedgerId, equipmentLedgerId));
}
private static boolean isDeleted(Integer delFlag) {
return delFlag != null && delFlag.equals(CommonConstant.DEL_FLAG_1);
}
//update-end---author:jiangxh ---date:20250603 for【MES】设备点检配置保存后按大部位+小部位去重生成设备对应部位-----------
}

View File

@@ -9,6 +9,7 @@ import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
import org.jeecg.modules.xslmes.mapper.MesXslEquipmentLedgerMapper;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentLedgerService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
public class MesXslEquipmentLedgerServiceImpl extends ServiceImpl<MesXslEquipmentLedgerMapper, MesXslEquipmentLedger>
@@ -47,4 +48,51 @@ public class MesXslEquipmentLedgerServiceImpl extends ServiceImpl<MesXslEquipmen
}
//update-end---author:jiangxh ---date:20260518 for【MES】设备台账编号、名称同租户不可重复-----------
//update-begin---author:jiangxh ---date:20250602 for【MES】设备台账系统编号001递增、编辑不可改-----------
@Override
public String generateNextLedgerNo(MesXslEquipmentLedger context) {
Integer tenantId = MesXslTenantUtils.resolveTenantId(context != null ? context.getTenantId() : null);
Integer max = baseMapper.selectMaxNumericLedgerNo(tenantId);
int next = (max == null ? 0 : max) + 1;
if (next > 999) {
throw new IllegalStateException("编号已超过999请联系管理员");
}
return String.format("%03d", next);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean save(MesXslEquipmentLedger entity) {
if (oConvertUtils.isEmpty(entity.getLedgerNo())) {
entity.setLedgerNo(generateNextLedgerNo(entity));
}
return super.save(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean saveBatch(java.util.Collection<MesXslEquipmentLedger> entityList, int batchSize) {
if (entityList != null) {
for (MesXslEquipmentLedger entity : entityList) {
if (oConvertUtils.isEmpty(entity.getLedgerNo())) {
entity.setLedgerNo(generateNextLedgerNo(entity));
}
}
}
return super.saveBatch(entityList, batchSize);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updateById(MesXslEquipmentLedger entity) {
if (oConvertUtils.isNotEmpty(entity.getId())) {
MesXslEquipmentLedger old = getById(entity.getId());
if (old != null) {
entity.setLedgerNo(old.getLedgerNo());
}
}
return super.updateById(entity);
}
//update-end---author:jiangxh ---date:20250602 for【MES】设备台账系统编号001递增、编辑不可改-----------
}

View File

@@ -785,71 +785,65 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
}
String specCode = row.getSpecCode().trim();
boolean isFinalStage = "Q".equalsIgnoreCase(resolveMixingMaterialStep(row));
String materialPhase = resolveGeneratedMaterialPhase(row);
MesMaterial sourceRubber = resolveSourceRubberMaterial(formula);
MesMaterial existing = findRubberMaterialByCodeOrName(specCode);
String categoryId = sourceRubber != null ? sourceRubber.getCategoryId() : null;
String rubberName = resolveRubberName(formula);
String generatedName = buildGeneratedRubberMaterialName(row, rubberName);
MesMaterial existing = findGeneratedRubberMaterialByCodeOrName(specCode, materialPhase);
Date now = new Date();
if (existing != null) {
//update-begin---author:cursor ---date:20260601 for【XSLMES-20260601-A62】更新已生成胶料时按原胶料复制字段-----------
if (sourceRubber != null) {
fillGeneratedRubberFromSource(existing, sourceRubber, specCode, now, true);
} else {
applyGeneratedRubberFallback(existing, formula, specCode, now);
copyGeneratedMaterialFieldsFromSource(existing, sourceRubber);
if (StringUtils.isNotBlank(categoryId)) {
existing.setCategoryId(categoryId);
}
//update-end---author:cursor ---date:20260601 for【XSLMES-20260601-A62】更新已生成胶料时按原胶料复制字段-----------
if (StringUtils.isBlank(existing.getMaterialCode())) {
existing.setMaterialCode(specCode);
}
existing.setMaterialName(generatedName);
if (StringUtils.isBlank(existing.getAliasName()) && StringUtils.isNotBlank(rubberName)) {
existing.setAliasName(rubberName);
}
existing.setMaterialPhase(materialPhase);
existing.setEnableFlag(existing.getEnableFlag() == null ? 1 : existing.getEnableFlag());
existing.setUpdateTime(now);
mesMaterialService.updateById(existing);
log.info(
"[混炼示方生成] 更新胶料信息 id={}, code={}, sourceId={}, isFinal={}",
"[混炼示方生成] 更新胶料信息 id={}, code={}, phase={}, categoryId={}, isFinal={}",
existing.getId(),
specCode,
sourceRubber != null ? sourceRubber.getId() : null,
materialPhase,
categoryId,
isFinalStage);
return;
}
MesMaterial material = new MesMaterial();
//update-begin---author:cursor ---date:20260601 for【XSLMES-20260601-A62】新增B/F段胶料按原胶料复制字段-----------
if (sourceRubber != null) {
fillGeneratedRubberFromSource(material, sourceRubber, specCode, now, false);
} else {
applyGeneratedRubberFallback(material, formula, specCode, now);
}
//update-end---author:cursor ---date:20260601 for【XSLMES-20260601-A62】新增B/F段胶料按原胶料复制字段-----------
copyGeneratedMaterialFieldsFromSource(material, sourceRubber);
material.setMaterialCode(specCode);
material.setMaterialName(generatedName);
material.setAliasName(StringUtils.isNotBlank(rubberName) ? rubberName : null);
material.setCategoryId(categoryId);
material.setMaterialPhase(materialPhase);
material.setEnableFlag(1);
material.setIsSpecialRubber(0);
material.setDelFlag(CommonConstant.DEL_FLAG_0);
material.setCreateTime(now);
material.setUpdateTime(now);
mesMaterialService.save(material);
log.info(
"[混炼示方生成] 新增胶料信息 id={}, code={}, sourceId={}, isFinal={}",
"[混炼示方生成] 新增胶料信息 id={}, code={}, phase={}, categoryId={}, isFinal={}",
material.getId(),
specCode,
sourceRubber != null ? sourceRubber.getId() : null,
materialPhase,
categoryId,
isFinalStage);
}
/** 配合示方所选「胶料代号」对应的原胶料信息 */
private MesMaterial resolveSourceRubberMaterial(MesXslFormulaSpec formula) {
if (formula == null || StringUtils.isBlank(formula.getRubberMaterialId())) {
return null;
}
MesMaterial rubber = mesMaterialService.getById(formula.getRubberMaterialId());
if (rubber == null) {
return null;
}
if (rubber.getDelFlag() != null && rubber.getDelFlag().equals(CommonConstant.DEL_FLAG_1)) {
return null;
}
return rubber;
}
/**
* 将原胶料字段复制到生成的 B/F 段胶料:编码/名称=示方编号ERP 编号留空,不复制主键与审计字段。
*/
private void fillGeneratedRubberFromSource(
MesMaterial target, MesMaterial source, String specCode, Date now, boolean isUpdate) {
if (target == null || source == null || StringUtils.isBlank(specCode)) {
private void copyGeneratedMaterialFieldsFromSource(MesMaterial target, MesMaterial source) {
if (target == null || source == null) {
return;
}
String code = specCode.trim();
target.setMaterialCode(code);
target.setMaterialName(code);
target.setAliasName(source.getAliasName());
target.setShortName(source.getShortName());
target.setCategoryId(source.getCategoryId());
target.setMaterialGrade(source.getMaterialGrade());
@@ -859,7 +853,7 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
target.setBaseUnitId(source.getBaseUnitId());
target.setStatUnitId(source.getStatUnitId());
target.setUnitConvertRate(source.getUnitConvertRate());
target.setErpCode(null);
target.setErpCode(source.getErpCode());
target.setFinalShelfLifeDays(source.getFinalShelfLifeDays());
target.setMasterShelfLifeDays(source.getMasterShelfLifeDays());
target.setMinStandingHours(source.getMinStandingHours());
@@ -867,41 +861,18 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
target.setOriginPlace(source.getOriginPlace());
target.setSupplierId(source.getSupplierId());
target.setCustomerId(source.getCustomerId());
target.setEnableFlag(source.getEnableFlag() != null ? source.getEnableFlag() : 1);
target.setIsSpecialRubber(source.getIsSpecialRubber() != null ? source.getIsSpecialRubber() : 0);
target.setSyncFromErpFlag(0);
target.setLastErpSyncTime(null);
target.setEnableFlag(source.getEnableFlag());
target.setIsSpecialRubber(source.getIsSpecialRubber());
target.setSyncFromErpFlag(source.getSyncFromErpFlag());
target.setLastErpSyncTime(source.getLastErpSyncTime());
target.setRemark(source.getRemark());
target.setTenantId(source.getTenantId());
target.setSysOrgCode(source.getSysOrgCode());
target.setUpdateTime(now);
if (!isUpdate) {
target.setDelFlag(CommonConstant.DEL_FLAG_0);
target.setCreateTime(now);
}
}
/** 未选择原胶料时的最小兜底(仅类别/状态) */
private void applyGeneratedRubberFallback(MesMaterial target, MesXslFormulaSpec formula, String specCode, Date now) {
if (target == null || StringUtils.isBlank(specCode)) {
return;
}
String code = specCode.trim();
target.setMaterialCode(code);
target.setMaterialName(code);
target.setCategoryId(resolveGeneratedRubberCategoryId(formula));
String rubberName = resolveRubberName(formula);
if (StringUtils.isNotBlank(rubberName)) {
target.setAliasName(rubberName);
}
target.setErpCode(null);
target.setEnableFlag(target.getEnableFlag() != null ? target.getEnableFlag() : 1);
target.setIsSpecialRubber(target.getIsSpecialRubber() != null ? target.getIsSpecialRubber() : 0);
target.setDelFlag(target.getDelFlag() != null ? target.getDelFlag() : CommonConstant.DEL_FLAG_0);
target.setUpdateTime(now);
if (target.getCreateTime() == null) {
target.setCreateTime(now);
private MesMaterial resolveSourceRubberMaterial(MesXslFormulaSpec formula) {
if (formula == null || StringUtils.isBlank(formula.getRubberMaterialId())) {
return null;
}
return mesMaterialService.getById(formula.getRubberMaterialId());
}
/** 生成的 B/F 段胶料类别:取配合示方所选「胶料代号」对应胶料(mes_material)的类别 */
@@ -911,22 +882,67 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
}
private MesMaterial findRubberMaterialByCodeOrName(String specCode) {
return findGeneratedRubberMaterialByCodeOrName(specCode, null);
}
private MesMaterial findGeneratedRubberMaterialByCodeOrName(String specCode, String materialPhase) {
if (StringUtils.isBlank(specCode)) {
return null;
}
LambdaQueryWrapper<MesMaterial> byCodeWrapper = new LambdaQueryWrapper<MesMaterial>()
.eq(MesMaterial::getMaterialCode, specCode)
.and(w -> w.eq(MesMaterial::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesMaterial::getDelFlag));
appendPhaseMatch(byCodeWrapper, materialPhase);
MesMaterial byCode = mesMaterialService.getOne(
new LambdaQueryWrapper<MesMaterial>()
.eq(MesMaterial::getMaterialCode, specCode)
.and(w -> w.eq(MesMaterial::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesMaterial::getDelFlag))
.last("limit 1"));
byCodeWrapper.last("limit 1"));
if (byCode != null) {
return byCode;
}
LambdaQueryWrapper<MesMaterial> byNameWrapper = new LambdaQueryWrapper<MesMaterial>()
.eq(MesMaterial::getMaterialName, specCode)
.and(w -> w.eq(MesMaterial::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesMaterial::getDelFlag));
appendPhaseMatch(byNameWrapper, materialPhase);
return mesMaterialService.getOne(
new LambdaQueryWrapper<MesMaterial>()
.eq(MesMaterial::getMaterialName, specCode)
.and(w -> w.eq(MesMaterial::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesMaterial::getDelFlag))
.last("limit 1"));
byNameWrapper.last("limit 1"));
}
private void appendPhaseMatch(LambdaQueryWrapper<MesMaterial> wrapper, String materialPhase) {
if (wrapper == null || StringUtils.isBlank(materialPhase)) {
return;
}
wrapper.and(w -> w.eq(MesMaterial::getMaterialPhase, materialPhase)
.or()
.isNull(MesMaterial::getMaterialPhase)
.or()
.eq(MesMaterial::getMaterialPhase, ""));
}
private String resolveGeneratedMaterialPhase(MesXslFormulaMixingGenerateRowVO row) {
if (row == null) {
return null;
}
if ("Q".equalsIgnoreCase(resolveMixingMaterialStep(row))) {
return "F";
}
if (row.getASegmentIndex() != null && row.getASegmentIndex() > 0) {
return "B" + row.getASegmentIndex();
}
if (row.getStageIndex() != null && row.getStageIndex() > 0) {
return "B" + row.getStageIndex();
}
return "B1";
}
private String buildGeneratedRubberMaterialName(MesXslFormulaMixingGenerateRowVO row, String rubberName) {
String baseName = StringUtils.defaultString(rubberName).trim();
if (StringUtils.isBlank(baseName) && row != null && StringUtils.isNotBlank(row.getSpecCode())) {
baseName = row.getSpecCode().trim();
}
String phase = resolveGeneratedMaterialPhase(row);
if (StringUtils.isBlank(phase)) {
return baseName;
}
return phase + baseName;
}
//update-end---author:cursor ---date:20260601 for【XSLMES-20260601-A62】生成混炼示方改为同步B/F段胶至胶料信息-----------
@@ -1015,9 +1031,9 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
if (row != null && row.getStageIndex() != null && row.getStageIndex() > 0) {
return Math.min(row.getStageIndex(), 7);
}
String specCode = row != null ? row.getSpecCode() : null;
if (StringUtils.isNotBlank(specCode)) {
Matcher matcher = Pattern.compile("(?i)B(\\d+)").matcher(specCode.trim());
String normalizedSpecCode = row == null ? "" : StringUtils.trimToEmpty(row.getSpecCode());
if (StringUtils.isNotEmpty(normalizedSpecCode)) {
Matcher matcher = Pattern.compile("(?i)B(\\d+)").matcher(normalizedSpecCode);
if (matcher.find()) {
return Math.min(Integer.parseInt(matcher.group(1)), 7);
}
@@ -1033,8 +1049,8 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
if (row != null && StringUtils.isNotBlank(row.getStepType())) {
return row.getStepType().trim().toUpperCase();
}
String specCode = row != null ? row.getSpecCode() : null;
if (StringUtils.isNotBlank(specCode) && specCode.trim().toUpperCase().startsWith("F")) {
String normalizedSpecCode = row == null ? "" : StringUtils.trimToEmpty(row.getSpecCode()).toUpperCase();
if (StringUtils.isNotEmpty(normalizedSpecCode) && normalizedSpecCode.startsWith("F")) {
return "Q";
}
return "A";
@@ -1052,7 +1068,6 @@ public class MesXslFormulaSpecServiceImpl extends ServiceImpl<MesXslFormulaSpecM
Map<String, String> categoryIdCache) {
String stepFilter = StringUtils.isNotBlank(materialStep) ? materialStep.trim().toUpperCase() : "A";
List<MesXslMixingSpecMaterial> materials = new ArrayList<>();
int sort = 0;
if ("Q".equals(stepFilter)) {
//update-begin---author:cursor ---date:20260522 for【XSLMES-20260522-A38】F段加入最后一段B炼好胶料一条再加Q配合剂-----------
String rubberName = resolveRubberName(formula);

View File

@@ -148,8 +148,7 @@ public class MesXslRawMaterialInspectRecordServiceImpl
if (lineList == null || lineList.isEmpty()) {
throw new JeecgBootException("请至少录入一条检验结果");
}
boolean allPass = true;
boolean hasAnyDetailUpdated = false;
for (MesXslRawMaterialInspectRecordLine line : lineList) {
if (StringUtils.isBlank(line.getId())) {
throw new JeecgBootException("明细ID不能为空请刷新后重试");
@@ -158,6 +157,15 @@ public class MesXslRawMaterialInspectRecordServiceImpl
if (dbLine == null || !recordId.equals(dbLine.getRecordId())) {
throw new JeecgBootException("明细不存在或不属于当前送检记录");
}
// 已录入(非待检)明细不允许再次录入,防止重复覆盖。
String dbPassFlag = normalize(dbLine.getPassFlag());
if (!STATUS_PENDING.equals(dbPassFlag)) {
throw new JeecgBootException("检验项目【" + dbLine.getInspectItemName() + "】已录入,不能重复录入");
}
// 允许分次录入:本次未填检验值的明细跳过,不改该行状态。
if (line.getInspectValue() == null) {
continue;
}
String passFlag =
evaluatePassFlag(
line.getInspectValue(),
@@ -168,20 +176,37 @@ public class MesXslRawMaterialInspectRecordServiceImpl
dbLine.setInspectValue(line.getInspectValue());
dbLine.setPassFlag(passFlag);
recordLineMapper.updateById(dbLine);
hasAnyDetailUpdated = true;
}
if (!hasAnyDetailUpdated) {
throw new JeecgBootException("请至少录入一条检验值后再保存");
}
List<MesXslRawMaterialInspectRecordLine> allDbLines = selectLinesByRecordId(recordId);
boolean allCompleted = true;
boolean allPass = true;
for (MesXslRawMaterialInspectRecordLine dbLine : allDbLines) {
String passFlag = normalize(dbLine.getPassFlag());
if (STATUS_PENDING.equals(passFlag) || StringUtils.isBlank(passFlag)) {
allCompleted = false;
continue;
}
if (!STATUS_PASS.equals(passFlag)) {
allPass = false;
}
}
record.setInspectStatus(allPass ? STATUS_PASS : STATUS_FAIL);
record.setResultTime(new Date());
this.updateById(record);
// 判定完成后回写原材料卡片检测结果
if (StringUtils.isNotBlank(record.getRawMaterialCardId())) {
MesXslRawMaterialCard card = new MesXslRawMaterialCard();
card.setId(record.getRawMaterialCardId());
card.setTestResult(allPass ? CARD_TEST_RESULT_PASS : CARD_TEST_RESULT_FAIL);
rawMaterialCardService.updateById(card);
// 仅当全部明细已完成录入时,才回写主表/卡片检验状态。
if (allCompleted) {
record.setInspectStatus(allPass ? STATUS_PASS : STATUS_FAIL);
record.setResultTime(new Date());
this.updateById(record);
if (StringUtils.isNotBlank(record.getRawMaterialCardId())) {
MesXslRawMaterialCard card = new MesXslRawMaterialCard();
card.setId(record.getRawMaterialCardId());
card.setTestResult(allPass ? CARD_TEST_RESULT_PASS : CARD_TEST_RESULT_FAIL);
rawMaterialCardService.updateById(card);
}
}
}

View File

@@ -33,8 +33,12 @@ public class MesMaterialController extends JeecgController<MesMaterial, IMesMate
MesMaterial model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "onlySales", required = false) Integer onlySales,
HttpServletRequest req) {
QueryWrapper<MesMaterial> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
if (onlySales != null && onlySales == 1) {
queryWrapper.and(w -> w.isNull("material_phase").or().eq("material_phase", ""));
}
IPage<MesMaterial> pageList = mesMaterialService.page(new Page<>(pageNo, pageSize), queryWrapper);
return Result.OK(pageList);
}

View File

@@ -74,6 +74,8 @@ public class MesMaterial implements Serializable {
@Excel(name = "胶料客户", width = 15, dictTable = "mes_xsl_customer", dicText = "customer_name", dicCode = "id")
@Dict(dictTable = "mes_xsl_customer", dicText = "customer_name", dicCode = "id")
private String customerId;
@Excel(name = "物料阶段", width = 12)
private String materialPhase;
@Excel(name = "使用状态", width = 10, replace = {"使用中_1", "停用_0"})
private Integer enableFlag;
@Excel(name = "是否为特种胶", width = 12, replace = {"是_1", "否_0"})

View File

@@ -0,0 +1,11 @@
-- mes_material 新增物料阶段字段销售物料为空生产自动生成为 Bn/F
SET NAMES utf8mb4;
SET @db = DATABASE();
SET @sql = IF(
(SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'mes_material' AND COLUMN_NAME = 'material_phase') = 0,
'ALTER TABLE `mes_material` ADD COLUMN `material_phase` varchar(16) DEFAULT NULL COMMENT ''物料阶段销售为空生产为B1/B2.../F'' AFTER `customer_id`',
'SELECT 1'
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;

View File

@@ -0,0 +1,49 @@
-- MES 设备台账新增系统编号 ledger_no001自增+ 历史数据回填equipment_code 语义改为自定义编号
SET NAMES utf8mb4;
SET @ledger_no_exists := (
SELECT COUNT(1)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'mes_xsl_equipment_ledger'
AND COLUMN_NAME = 'ledger_no'
);
SET @ddl_ledger_no := IF(
@ledger_no_exists = 0,
'ALTER TABLE `mes_xsl_equipment_ledger` ADD COLUMN `ledger_no` varchar(16) DEFAULT NULL COMMENT ''编号租户内从001递增自动生成只读'' AFTER `equipment_name`',
'SELECT 1'
);
PREPARE stmt_ledger_no FROM @ddl_ledger_no;
EXECUTE stmt_ledger_no;
DEALLOCATE PREPARE stmt_ledger_no;
UPDATE `mes_xsl_equipment_ledger` t
INNER JOIN (
SELECT
id,
LPAD(
ROW_NUMBER() OVER (PARTITION BY IFNULL(tenant_id, 0) ORDER BY IFNULL(create_time, '1970-01-01'), id),
3,
'0'
) AS new_no
FROM `mes_xsl_equipment_ledger`
WHERE del_flag = 0
) s ON t.id = s.id
SET t.ledger_no = s.new_no
WHERE t.del_flag = 0 AND (t.ledger_no IS NULL OR TRIM(t.ledger_no) = '');
SET @idx_ledger_no_exists := (
SELECT COUNT(1)
FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'mes_xsl_equipment_ledger'
AND INDEX_NAME = 'idx_mel_tenant_ledger_no'
);
SET @ddl_idx_ledger_no := IF(
@idx_ledger_no_exists = 0,
'ALTER TABLE `mes_xsl_equipment_ledger` ADD KEY `idx_mel_tenant_ledger_no` (`tenant_id`, `ledger_no`)',
'SELECT 1'
);
PREPARE stmt_idx_ledger_no FROM @ddl_idx_ledger_no;
EXECUTE stmt_idx_ledger_no;
DEALLOCATE PREPARE stmt_idx_ledger_no;

View File

@@ -0,0 +1,48 @@
-- MES 设备对应部位由设备点检配置保存后自动生成
SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS `mes_xsl_equip_part_mapping` (
`id` varchar(32) NOT NULL COMMENT '主键',
`equipment_ledger_id` varchar(32) NOT NULL COMMENT '设备台账主键 mes_xsl_equipment_ledger.id',
`equipment_name` varchar(500) NOT NULL COMMENT '设备名称',
`machine_code` varchar(500) DEFAULT NULL COMMENT '机台代号设备编号冗余',
`equipment_part_id` varchar(32) NOT NULL COMMENT '设备大部位主键 mes_xsl_equipment_part.id',
`equipment_part_name` varchar(500) DEFAULT NULL COMMENT '设备大部位名称',
`part_code` varchar(500) DEFAULT NULL COMMENT '大部位代码',
`equipment_sub_part_id` varchar(32) NOT NULL COMMENT '设备小部位主键 mes_xsl_equipment_sub_part.id',
`equipment_sub_part_name` varchar(500) DEFAULT NULL COMMENT '设备小部位名称',
`sub_part_code` varchar(500) DEFAULT NULL COMMENT '小部位代码',
`tenant_id` int DEFAULT NULL COMMENT '租户',
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`del_flag` int DEFAULT '0' COMMENT '删除标记0正常1删除',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_mepm_ledger_part_sub` (`equipment_ledger_id`, `equipment_part_id`, `equipment_sub_part_id`),
KEY `idx_mepm_tenant_equip_name` (`tenant_id`, `equipment_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES设备对应部位';
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`)
SELECT '1860000000000000215', @mes_equip_pid, '设备对应部位', '/xslmes/mesXslEquipPartMapping', 'xslmes/mesXslEquipPartMapping/MesXslEquipPartMappingList', 'MesXslEquipPartMappingList', 1, NULL, '1', 14, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW()
FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '1860000000000000215');
UPDATE `sys_permission` SET
`parent_id` = @mes_equip_pid, `name` = '设备对应部位', `url` = '/xslmes/mesXslEquipPartMapping',
`component` = 'xslmes/mesXslEquipPartMapping/MesXslEquipPartMappingList', `component_name` = 'MesXslEquipPartMappingList',
`menu_type` = 1, `sort_no` = 14, `is_route` = 1, `is_leaf` = 0, `icon` = 'ant-design:apartment-outlined', `del_flag` = 0
WHERE `id` = '1860000000000000215';
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`)
SELECT '1860000000000000216', '1860000000000000215', '导出', 2, 'mes:mes_xsl_equip_part_mapping:exportXls', '1', '1', 0, 'admin', NOW()
FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '1860000000000000216');

View File

@@ -0,0 +1,60 @@
-- MES 设备报警记录设备停机记录只读数据来自 SQL Server MCSToMES_MixAlarm MySQL 业务表
-- 权限前缀mes:mes_xsl_equip_alarm_record:* / mes:mes_xsl_equip_downtime_record:*
-- 父菜单设备管理
SET NAMES utf8mb4;
SET @mes_tenant_id = 1002;
SET @mes_equip_pid = (
SELECT `id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
LIMIT 1
);
SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
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 ('1860000000000000222', @mes_equip_pid, '设备报警记录', '/xslmes/mesXslEquipAlarmRecord', 'xslmes/mesXslEquipAlarmRecord/MesXslEquipAlarmRecordList', 'MesXslEquipAlarmRecordList', 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`);
UPDATE `sys_permission` SET `icon` = 'ant-design:alert-outlined' WHERE `id` = '1860000000000000222' 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
('1860000000000000223', '1860000000000000222', '导出', 2, 'mes:mes_xsl_equip_alarm_record:exportXls', '1', '1', 0, 'admin', NOW())
ON DUPLICATE KEY UPDATE
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
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 ('1860000000000000224', @mes_equip_pid, '设备停机记录', '/xslmes/mesXslEquipDowntimeRecord', 'xslmes/mesXslEquipDowntimeRecord/MesXslEquipDowntimeRecordList', 'MesXslEquipDowntimeRecordList', 1, NULL, '1', 15, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
ON DUPLICATE KEY UPDATE
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
UPDATE `sys_permission` SET `icon` = 'ant-design:pause-circle-outlined' WHERE `id` = '1860000000000000224' 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
('1860000000000000225', '1860000000000000224', '导出', 2, 'mes:mes_xsl_equip_downtime_record:exportXls', '1', '1', 0, 'admin', NOW())
ON DUPLICATE KEY UPDATE
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
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 (
'1860000000000000222', '1860000000000000223',
'1860000000000000224', '1860000000000000225'
)
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
);

View File

@@ -16,6 +16,7 @@
const { createMessage } = useMessage();
const selectedRow = ref<Recordable | null>(null);
const onlySales = ref(false);
const [registerTable, { reload, getSelectRowKeys, getSelectRows, setSelectedRowKeys, clearSelectedRowKeys }] = useTable({
api: materialList,
@@ -33,6 +34,7 @@
beforeFetch: (params) => ({
...params,
enableFlag: params.enableFlag ?? 1,
onlySales: onlySales.value ? 1 : undefined,
}),
rowSelection: {
type: 'radio',
@@ -46,6 +48,7 @@
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
selectedRow.value = null;
onlySales.value = !!data?.onlySales;
clearSelectedRowKeys?.();
setModalProps({ confirmLoading: false });
const materialId = data?.materialId as string | undefined;

View File

@@ -0,0 +1,11 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslEquipAlarmRecord/list',
queryById = '/xslmes/mesXslEquipAlarmRecord/queryById',
exportXls = '/xslmes/mesXslEquipAlarmRecord/exportXls',
}
export const list = (params) => defHttp.get({ url: Api.list, params });
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
export const getExportUrl = Api.exportXls;

View File

@@ -0,0 +1,35 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
export const columns: BasicColumn[] = [
{ title: '机台编号', align: 'center', dataIndex: 'equipId', width: 120 },
{ title: '机台名称', align: 'center', dataIndex: 'equipName', width: 140 },
{ title: '机台类型', align: 'center', dataIndex: 'equipType', width: 100 },
{ title: '班次', align: 'center', dataIndex: 'shiftClass', width: 80 },
{ title: '报警内容', align: 'left', dataIndex: 'alarmContent', width: 260 },
{ title: '报警时间', align: 'center', dataIndex: 'alarmTime', width: 170 },
{ title: '类型', align: 'center', dataIndex: 'recordType', width: 80 },
];
export const searchFormSchema: FormSchema[] = [
{ label: '机台编号', field: 'equipId', component: 'JInput', colProps: { span: 6 } },
{ label: '机台名称', field: 'equipName', component: 'JInput', colProps: { span: 6 } },
{ label: '报警内容', field: 'alarmInf', component: 'JInput', colProps: { span: 6 } },
{
label: '报警时间',
field: 'writeTime',
component: 'RangePicker',
componentProps: { valueType: 'Date', showTime: true, placeholder: ['开始时间', '结束时间'] },
colProps: { span: 8 },
},
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{ label: '机台编号', field: 'equipId', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '机台名称', field: 'equipName', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '机台类型', field: 'equipType', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '班次', field: 'shiftClass', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '报警内容', field: 'alarmContent', component: 'InputTextArea', componentProps: { disabled: true, rows: 3 }, colProps: { span: 24 } },
{ label: '报警时间', field: 'alarmTime', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '类型', field: 'recordType', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
];

View File

@@ -0,0 +1,63 @@
<template>
<div>
<BasicTable @register="registerTable">
<template #tableTitle>
<a-button
type="primary"
v-auth="'mes:mes_xsl_equip_alarm_record:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
</template>
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
</BasicTable>
<MesXslEquipAlarmRecordModal @register="registerModal" />
</div>
</template>
<script lang="ts" name="xslmes-mesXslEquipAlarmRecord" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import MesXslEquipAlarmRecordModal from './components/MesXslEquipAlarmRecordModal.vue';
import { columns, searchFormSchema } from './MesXslEquipAlarmRecord.data';
import { list, getExportUrl } from './MesXslEquipAlarmRecord.api';
const [registerModal, { openModal }] = useModal();
const { tableContext, onExportXls } = useListPage({
tableProps: {
title: '设备报警记录',
api: list,
columns,
canResize: true,
showActionColumn: true,
actionColumn: { width: 80, fixed: 'right' },
formConfig: {
schemas: searchFormSchema,
labelWidth: 100,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToTime: [['writeTime', ['writeTime_begin', 'writeTime_end'], 'YYYY-MM-DD HH:mm:ss']],
},
},
exportConfig: {
name: '设备报警记录',
url: getExportUrl,
},
});
const [registerTable] = tableContext;
function handleDetail(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: false });
}
function getTableAction(record) {
return [{ label: '详情', onClick: handleDetail.bind(null, record) }];
}
</script>

View File

@@ -0,0 +1,23 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" title="设备报警记录详情" :width="800" :showOkBtn="false" cancelText="关闭">
<BasicForm @register="registerForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form';
import { formSchema } from '../MesXslEquipAlarmRecord.data';
const [registerForm, { resetFields, setFieldsValue }] = useForm({
labelWidth: 120,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: { span: 24 },
});
const [registerModal] = useModalInner(async (data) => {
await resetFields();
await setFieldsValue({ ...data.record });
});
</script>

View File

@@ -0,0 +1,11 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslEquipDowntimeRecord/list',
queryById = '/xslmes/mesXslEquipDowntimeRecord/queryById',
exportXls = '/xslmes/mesXslEquipDowntimeRecord/exportXls',
}
export const list = (params) => defHttp.get({ url: Api.list, params });
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
export const getExportUrl = Api.exportXls;

View File

@@ -0,0 +1,39 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
export const columns: BasicColumn[] = [
{ title: '机台编号', align: 'center', dataIndex: 'equipId', width: 120 },
{ title: '机台名称', align: 'center', dataIndex: 'equipName', width: 140 },
{ title: '机台类型', align: 'center', dataIndex: 'equipType', width: 100 },
{ title: '班次', align: 'center', dataIndex: 'shiftClass', width: 80 },
{ title: '停机内容', align: 'left', dataIndex: 'downtimeContent', width: 260 },
{ title: '停机开始时间', align: 'center', dataIndex: 'downtimeStartTime', width: 170 },
{ title: '停机结束时间', align: 'center', dataIndex: 'downtimeEndTime', width: 170 },
{ title: '停机时长', align: 'center', dataIndex: 'downtimeDuration', width: 120 },
{ title: '类型', align: 'center', dataIndex: 'recordType', width: 80 },
];
export const searchFormSchema: FormSchema[] = [
{ label: '机台编号', field: 'equipId', component: 'JInput', colProps: { span: 6 } },
{ label: '机台名称', field: 'equipName', component: 'JInput', colProps: { span: 6 } },
{ label: '停机内容', field: 'alarmInf', component: 'JInput', colProps: { span: 6 } },
{
label: '停机开始时间',
field: 'writeTime',
component: 'RangePicker',
componentProps: { valueType: 'Date', showTime: true, placeholder: ['开始时间', '结束时间'] },
colProps: { span: 8 },
},
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{ label: '机台编号', field: 'equipId', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '机台名称', field: 'equipName', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '机台类型', field: 'equipType', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '班次', field: 'shiftClass', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '停机内容', field: 'downtimeContent', component: 'InputTextArea', componentProps: { disabled: true, rows: 3 }, colProps: { span: 24 } },
{ label: '停机开始时间', field: 'downtimeStartTime', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '停机结束时间', field: 'downtimeEndTime', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '停机时长', field: 'downtimeDuration', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
{ label: '类型', field: 'recordType', component: 'Input', componentProps: { disabled: true }, colProps: { span: 12 } },
];

View File

@@ -0,0 +1,63 @@
<template>
<div>
<BasicTable @register="registerTable">
<template #tableTitle>
<a-button
type="primary"
v-auth="'mes:mes_xsl_equip_downtime_record:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
</template>
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
</BasicTable>
<MesXslEquipDowntimeRecordModal @register="registerModal" />
</div>
</template>
<script lang="ts" name="xslmes-mesXslEquipDowntimeRecord" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import MesXslEquipDowntimeRecordModal from './components/MesXslEquipDowntimeRecordModal.vue';
import { columns, searchFormSchema } from './MesXslEquipDowntimeRecord.data';
import { list, getExportUrl } from './MesXslEquipDowntimeRecord.api';
const [registerModal, { openModal }] = useModal();
const { tableContext, onExportXls } = useListPage({
tableProps: {
title: '设备停机记录',
api: list,
columns,
canResize: true,
showActionColumn: true,
actionColumn: { width: 80, fixed: 'right' },
formConfig: {
schemas: searchFormSchema,
labelWidth: 110,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToTime: [['writeTime', ['writeTime_begin', 'writeTime_end'], 'YYYY-MM-DD HH:mm:ss']],
},
},
exportConfig: {
name: '设备停机记录',
url: getExportUrl,
},
});
const [registerTable] = tableContext;
function handleDetail(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: false });
}
function getTableAction(record) {
return [{ label: '详情', onClick: handleDetail.bind(null, record) }];
}
</script>

View File

@@ -0,0 +1,23 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" title="设备停机记录详情" :width="800" :showOkBtn="false" cancelText="关闭">
<BasicForm @register="registerForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form';
import { formSchema } from '../MesXslEquipDowntimeRecord.data';
const [registerForm, { resetFields, setFieldsValue }] = useForm({
labelWidth: 120,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: { span: 24 },
});
const [registerModal] = useModalInner(async (data) => {
await resetFields();
await setFieldsValue({ ...data.record });
});
</script>

View File

@@ -0,0 +1,10 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslEquipPartMapping/list',
exportXls = '/xslmes/mesXslEquipPartMapping/exportXls',
}
export const list = (params) => defHttp.get({ url: Api.list, params });
export const getExportUrl = Api.exportXls;

View File

@@ -0,0 +1,20 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
export const columns: BasicColumn[] = [
{ title: '设备名称', align: 'center', dataIndex: 'equipmentName', width: 180 },
{ title: '机台代号', align: 'center', dataIndex: 'machineCode', width: 140 },
{ title: '设备大部位', align: 'center', dataIndex: 'equipmentPartName', width: 160 },
{ title: '大部位代码', align: 'center', dataIndex: 'partCode', width: 120 },
{ title: '设备小部位', align: 'center', dataIndex: 'equipmentSubPartName', width: 160 },
{ title: '小部位代码', align: 'center', dataIndex: 'subPartCode', width: 120 },
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 165 },
];
export const searchFormSchema: FormSchema[] = [
{ label: '设备名称', field: 'equipmentName', component: 'Input', colProps: { span: 6 } },
{ label: '机台代号', field: 'machineCode', component: 'Input', colProps: { span: 6 } },
{ label: '设备大部位', field: 'equipmentPartName', component: 'Input', colProps: { span: 6 } },
{ label: '设备小部位', field: 'equipmentSubPartName', component: 'Input', colProps: { span: 6 } },
{ label: '大部位代码', field: 'partCode', component: 'Input', colProps: { span: 6 } },
{ label: '小部位代码', field: 'subPartCode', component: 'Input', colProps: { span: 6 } },
];

View File

@@ -0,0 +1,45 @@
<template>
<div>
<BasicTable @register="registerTable">
<template #tableTitle>
<a-button
type="primary"
v-auth="'mes:mes_xsl_equip_part_mapping:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
</template>
</BasicTable>
</div>
</template>
<script lang="ts" name="xslmes-mesXslEquipPartMapping" setup>
import { BasicTable } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns, searchFormSchema } from './MesXslEquipPartMapping.data';
import { list, getExportUrl } from './MesXslEquipPartMapping.api';
const { tableContext, onExportXls } = useListPage({
tableProps: {
title: '设备对应部位',
api: list,
columns,
canResize: true,
showActionColumn: false,
formConfig: {
schemas: searchFormSchema,
labelWidth: 120,
autoSubmitOnEnter: true,
showAdvancedButton: true,
},
},
exportConfig: {
name: '设备对应部位',
url: getExportUrl,
},
});
const [registerTable] = tableContext;
</script>

View File

@@ -3,6 +3,7 @@ import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslEquipmentLedger/list',
checkEquipmentCode = '/xslmes/mesXslEquipmentLedger/checkEquipmentCode',
nextLedgerNo = '/xslmes/mesXslEquipmentLedger/nextLedgerNo',
checkEquipmentName = '/xslmes/mesXslEquipmentLedger/checkEquipmentName',
save = '/xslmes/mesXslEquipmentLedger/add',
edit = '/xslmes/mesXslEquipmentLedger/edit',
@@ -20,6 +21,8 @@ export const checkEquipmentCode = (params: { equipmentCode: string; dataId?: str
export const checkEquipmentName = (params: { equipmentName: string; dataId?: string }) =>
defHttp.get({ url: Api.checkEquipmentName, params }, { successMessageMode: 'none', errorMessageMode: 'none' });
export const fetchNextLedgerNo = () => defHttp.get({ url: Api.nextLedgerNo }, { successMessageMode: '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) => {

View File

@@ -4,6 +4,7 @@ import { checkEquipmentCode, checkEquipmentName } from './MesXslEquipmentLedger.
const colHalf = { span: 12 };
export const columns: BasicColumn[] = [
{ title: '系统编号', align: 'center', dataIndex: 'ledgerNo', width: 100 },
{ title: '设备编号', align: 'center', dataIndex: 'equipmentCode', width: 130 },
{ title: '设备名称', align: 'center', dataIndex: 'equipmentName', width: 160 },
{ title: '工序', align: 'center', dataIndex: 'processOperationName', width: 120 },
@@ -18,6 +19,7 @@ export const columns: BasicColumn[] = [
];
export const searchFormSchema: FormSchema[] = [
{ label: '系统编号', field: 'ledgerNo', component: 'Input', colProps: { span: 6 } },
{ label: '设备编号', field: 'equipmentCode', component: 'Input', colProps: { span: 6 } },
{ label: '设备名称', field: 'equipmentName', component: 'Input', colProps: { span: 6 } },
{ label: '', field: 'processOperationId', component: 'Input', show: false },
@@ -80,8 +82,8 @@ export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{ label: '', field: 'processOperationId', component: 'Input', show: false },
{ label: '', field: 'manufacturerId', component: 'Input', show: false },
{ label: '', field: 'equipmentCategoryId', component: 'Input', show: false },
{ label: '', field: 'equipmentTypeId', component: 'Input', show: false },
{ label: '', field: 'equipmentCategoryId', component: 'Input', show: false, dynamicRules: () => [{ required: true, message: '请选择设备类别' }] },
{ label: '', field: 'equipmentTypeId', component: 'Input', show: false, dynamicRules: () => [{ required: true, message: '请选择设备类型' }] },
{ label: '', field: 'factoryId', component: 'Input', show: false },
{
label: '所属工序',
@@ -91,6 +93,13 @@ export const formSchema: FormSchema[] = [
colProps: colHalf,
dynamicRules: () => [{ required: true, message: '请选择所属工序' }],
},
{
label: '系统编号',
field: 'ledgerNo',
component: 'Input',
colProps: colHalf,
componentProps: { readonly: true, placeholder: '保存时从001起自动生成' },
},
{
label: '设备编号',
field: 'equipmentCode',
@@ -150,6 +159,7 @@ export const formSchema: FormSchema[] = [
component: 'Input',
slot: 'equipmentCategoryPicker',
colProps: colHalf,
dynamicRules: () => [{ required: true, message: '请选择设备类别' }],
},
{
label: '设备类型',
@@ -157,6 +167,7 @@ export const formSchema: FormSchema[] = [
component: 'Input',
slot: 'equipmentTypePicker',
colProps: colHalf,
dynamicRules: () => [{ required: true, message: '请选择设备类型' }],
},
{
label: '所属工厂',

View File

@@ -62,7 +62,7 @@
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { formSchema } from '../MesXslEquipmentLedger.data';
import { saveOrUpdate } from '../MesXslEquipmentLedger.api';
import { fetchNextLedgerNo, saveOrUpdate } from '../MesXslEquipmentLedger.api';
import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue';
import MesXslManufacturerSelectModal from './MesXslManufacturerSelectModal.vue';
import MesXslEquipmentCategorySelectModal from '/@/views/xslmes/mesXslEquipmentType/components/MesXslEquipmentCategorySelectModal.vue';
@@ -112,7 +112,14 @@
isUpdate.value = !!data?.isUpdate;
isDetail.value = !data?.showFooter;
if (unref(isUpdate)) await setFieldsValue({ ...data.record });
else await setFieldsValue({ equipmentStatus: '0', enabledFlag: '1' });
else {
try {
const nextNo = await fetchNextLedgerNo();
await setFieldsValue({ equipmentStatus: '0', enabledFlag: '1', ledgerNo: nextNo });
} catch {
await setFieldsValue({ equipmentStatus: '0', enabledFlag: '1', ledgerNo: '' });
}
}
setProps({ disabled: !data?.showFooter });
});

View File

@@ -831,7 +831,7 @@
if (!showFooterFlag.value) {
return;
}
openRubberMaterialModalInner(true, { materialId: rubberMaterialPickerId.value || '' });
openRubberMaterialModalInner(true, { materialId: rubberMaterialPickerId.value || '', onlySales: true });
}
function openIssueNumberPicker() {

View File

@@ -68,7 +68,12 @@ export const lineJVxeColumns: JVxeColumn[] = [
key: 'inspectValue',
type: JVxeTypes.inputNumber,
width: 120,
validateRules: [{ required: true, message: '${title}必填' }],
props: {
isDisabledCell: ({ row }) => {
const passFlag = String(row?.passFlag ?? '');
return passFlag !== '' && passFlag !== '0';
},
},
},
{
title: '判定',

View File

@@ -114,15 +114,14 @@
}
try {
const lineRef = lineTableRef.value as any;
if (lineRef?.validateTable) {
const err = await lineRef.validateTable();
if (err) {
createMessage.warning('请完善检验值');
return;
}
}
const tableData = (lineRef?.getTableData?.() || []) as Recordable[];
const lineList = tableData.map((item) => ({
const editableRows = tableData.filter((item) => String(item?.passFlag ?? '0') === '0');
const hasInput = editableRows.some((item) => item.inspectValue !== null && item.inspectValue !== undefined && item.inspectValue !== '');
if (!hasInput) {
createMessage.warning('请至少录入一条检验值');
return;
}
const lineList = editableRows.map((item) => ({
id: item.id,
inspectValue: item.inspectValue,
}));