设备对应部位功能新增

This commit is contained in:
2026-06-03 16:28:57 +08:00
parent 1c5cede957
commit 457089e271
24 changed files with 747 additions and 7 deletions

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,46 @@ 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

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

@@ -69,6 +69,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("添加成功!");
}
@@ -131,6 +134,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 +235,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 +276,7 @@ public class MesXslEquipmentLedgerController extends JeecgController<MesXslEquip
return "文件导入失败:第 " + rowNo + " 条设备编号不能为空";
}
row.setEquipmentCode(code);
row.setLedgerNo(null);
if (!codesInFile.add(code)) {
return "文件导入失败:设备编号【" + code + "】在导入文件中重复";
}
@@ -279,6 +298,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

@@ -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

@@ -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,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

@@ -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

@@ -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,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 });
});