设备对应部位功能新增
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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设备对应部位");
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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> {}
|
||||
@@ -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】设备台账租户内最大三位系统编号-----------
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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】设备点检配置保存后同步设备对应部位-----------
|
||||
}
|
||||
|
||||
@@ -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】设备点检配置保存后按大部位+小部位去重生成设备对应部位-----------
|
||||
}
|
||||
@@ -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递增、编辑不可改-----------
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user