停机记录新增,设备管理查询条件完善

This commit is contained in:
2026-06-02 14:11:35 +08:00
parent 3586f86ea6
commit 3f2c486f04
41 changed files with 2782 additions and 213 deletions

View File

@@ -521,3 +521,63 @@ jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules
-- author:GHT---date:20260529--for: 【QH-MES审批流设计】审批IM消息升级为可跳转业务卡片(biz_record):点击可定位到对应单据,无法定位功能页时退回纯文本 ---
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/approval/controller/MesXslApprovalLaunchController.java
-- author:jiangxh---date:20250602--for: 【MES】停机记录建表+菜单+CRUD+列表录入维修结果弹窗 ---
jeecg-boot/db/mes-xsl-downtime-record-menu-permission.sql
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_117__mes_xsl_downtime_record.sql
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslDowntimeRecord.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslDowntimeRecordMaintenanceDTO.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslDowntimeRecordMapper.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslDowntimeRecordService.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslDowntimeRecordServiceImpl.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeRecordController.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslInspectMaintainItemController.java
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.api.ts
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecordList.vue
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordMaintenanceModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeTypeSelectModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslInspectMaintainItemSelectModal.vue
-- author:jiangxh---date:20250602--for: 【MES】停机记录弹窗日期时间选择器下拉被裁剪导致点击无反应 ---
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.data.ts
-- author:jiangxh---date:20250602--for: 【MES】停机记录维修项目按设备部位筛选点检保养项目均含小部位 ---
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslInspectMaintainItemSelectModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordMaintenanceModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.data.ts
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslDowntimeRecordServiceImpl.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslInspectMaintainItemController.java
-- author:jiangxh---date:20250602--for: 【MES】设备台账列表所属工序查询改为工序选择器 ---
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedgerList.vue
-- author:jiangxh---date:20250602--for: 【MES】设备管理各功能列表查询与表单一致改为选择器 ---
jeecgboot-vue3/src/views/xslmes/components/MesSearchPickerInput.vue
jeecgboot-vue3/src/views/xslmes/utils/mesSearchPickerUtil.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentCategory/MesXslEquipmentCategory.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentCategory/MesXslEquipmentCategoryList.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentType/MesXslEquipmentType.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentType/MesXslEquipmentTypeList.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentPart/MesXslEquipmentPart.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentPart/MesXslEquipmentPartList.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentSubPart/MesXslEquipmentSubPart.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentSubPart/MesXslEquipmentSubPartList.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedgerList.vue
jeecgboot-vue3/src/views/xslmes/mesXslSparePart/MesXslSparePart.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslSparePart/MesXslSparePartList.vue
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainType.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainTypeList.vue
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeType.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeTypeList.vue
jeecgboot-vue3/src/views/xslmes/mesXslInspectMaintainItem/MesXslInspectMaintainItem.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslInspectMaintainItem/MesXslInspectMaintainItemList.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfig.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfigList.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecord.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecordList.vue
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecordList.vue

View File

@@ -0,0 +1,220 @@
package org.jeecg.modules.xslmes.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.Date;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslDowntimeRecord;
import org.jeecg.modules.xslmes.entity.MesXslDowntimeType;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
import org.jeecg.modules.xslmes.service.IMesXslDowntimeRecordService;
import org.jeecg.modules.xslmes.service.IMesXslDowntimeTypeService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentLedgerService;
import org.jeecg.modules.xslmes.vo.MesXslDowntimeRecordMaintenanceDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
/**
* MES 停机记录
*/
@Tag(name = "MES停机记录")
@RestController
@RequestMapping("/xslmes/mesXslDowntimeRecord")
@Slf4j
public class MesXslDowntimeRecordController extends JeecgController<MesXslDowntimeRecord, IMesXslDowntimeRecordService> {
@Autowired
private IMesXslDowntimeRecordService mesXslDowntimeRecordService;
@Autowired
private IMesXslEquipmentLedgerService mesXslEquipmentLedgerService;
@Autowired
private IMesXslDowntimeTypeService mesXslDowntimeTypeService;
@Operation(summary = "MES停机记录-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslDowntimeRecord>> queryPageList(
MesXslDowntimeRecord model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslDowntimeRecord> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
//update-begin---author:jiangxh ---date:20250602 for【MES】停机记录列表默认按开始时间倒序-----------
queryWrapper.orderByDesc("start_time").orderByDesc("create_time");
//update-end---author:jiangxh ---date:20250602 for【MES】停机记录列表默认按开始时间倒序-----------
Page<MesXslDowntimeRecord> page = new Page<>(pageNo, pageSize);
IPage<MesXslDowntimeRecord> pageList = mesXslDowntimeRecordService.page(page, queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "MES停机记录-添加")
@Operation(summary = "MES停机记录-添加")
@RequiresPermissions("mes:mes_xsl_downtime_record:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody MesXslDowntimeRecord model) {
//update-begin---author:jiangxh ---date:20250602 for【MES】停机记录保存前校验-----------
String err = validateForSave(model);
if (err != null) {
return Result.error(err);
}
clearMaintenanceFieldsForFormSave(model);
//update-end---author:jiangxh ---date:20250602 for【MES】停机记录保存前校验-----------
mesXslDowntimeRecordService.save(model);
return Result.OK("添加成功!");
}
@AutoLog(value = "MES停机记录-编辑")
@Operation(summary = "MES停机记录-编辑")
@RequiresPermissions("mes:mes_xsl_downtime_record:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody MesXslDowntimeRecord model) {
//update-begin---author:jiangxh ---date:20250602 for【MES】停机记录保存前校验-----------
String err = validateForSave(model);
if (err != null) {
return Result.error(err);
}
MesXslDowntimeRecord old = mesXslDowntimeRecordService.getById(model.getId());
if (old == null) {
return Result.error("未找到对应数据");
}
preserveMaintenanceFields(model, old);
//update-end---author:jiangxh ---date:20250602 for【MES】停机记录保存前校验-----------
mesXslDowntimeRecordService.updateById(model);
return Result.OK("编辑成功!");
}
@AutoLog(value = "MES停机记录-录入维修结果")
@Operation(summary = "MES停机记录-录入维修结果")
@RequiresPermissions("mes:mes_xsl_downtime_record:edit")
@PostMapping(value = "/saveMaintenanceResult")
public Result<String> saveMaintenanceResult(@RequestBody MesXslDowntimeRecordMaintenanceDTO dto) {
//update-begin---author:jiangxh ---date:20250602 for【MES】停机记录录入维修结果-----------
mesXslDowntimeRecordService.saveMaintenanceResult(dto);
//update-end---author:jiangxh ---date:20250602 for【MES】停机记录录入维修结果-----------
return Result.OK("录入成功!");
}
@AutoLog(value = "MES停机记录-删除")
@Operation(summary = "MES停机记录-通过id删除")
@RequiresPermissions("mes:mes_xsl_downtime_record:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
mesXslDowntimeRecordService.removeById(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "MES停机记录-批量删除")
@Operation(summary = "MES停机记录-批量删除")
@RequiresPermissions("mes:mes_xsl_downtime_record:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
mesXslDowntimeRecordService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@Operation(summary = "MES停机记录-通过id查询")
@GetMapping(value = "/queryById")
public Result<MesXslDowntimeRecord> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslDowntimeRecord entity = mesXslDowntimeRecordService.getById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@RequiresPermissions("mes:mes_xsl_downtime_record:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslDowntimeRecord model) {
return super.exportXls(request, model, MesXslDowntimeRecord.class, "MES停机记录");
}
@RequiresPermissions("mes:mes_xsl_downtime_record:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, MesXslDowntimeRecord.class);
}
//update-begin---author:jiangxh ---date:20250602 for【MES】停机记录保存前校验、关联设备与停机类型回填-----------
private String validateForSave(MesXslDowntimeRecord model) {
if (model == null) {
return "参数无效";
}
if (oConvertUtils.isEmpty(model.getEquipmentLedgerId())) {
return "请选择机台";
}
MesXslEquipmentLedger ledger = mesXslEquipmentLedgerService.getById(model.getEquipmentLedgerId());
if (ledger == null
|| (ledger.getDelFlag() != null && CommonConstant.DEL_FLAG_1.equals(ledger.getDelFlag()))) {
return "所选设备不存在";
}
model.setEquipmentCode(ledger.getEquipmentCode());
model.setEquipmentName(ledger.getEquipmentName());
if (oConvertUtils.isEmpty(model.getDowntimeTypeId())) {
return "请选择停机原因";
}
MesXslDowntimeType downtimeType = mesXslDowntimeTypeService.getById(model.getDowntimeTypeId());
if (downtimeType == null
|| (downtimeType.getDelFlag() != null && CommonConstant.DEL_FLAG_1.equals(downtimeType.getDelFlag()))) {
return "所选停机类型不存在";
}
if (!"0".equals(downtimeType.getStatus())) {
return "所选停机类型未启用";
}
model.setDowntimeTypeName(downtimeType.getDowntimeType());
if (model.getStartTime() == null) {
return "开始时间不能为空";
}
Date endTime = model.getEndTime();
if (endTime != null && endTime.before(model.getStartTime())) {
return "结束时间不能早于开始时间";
}
if (oConvertUtils.isEmpty(model.getMaintenanceFilledFlag())) {
model.setMaintenanceFilledFlag("0");
}
return null;
}
private void clearMaintenanceFieldsForFormSave(MesXslDowntimeRecord model) {
model.setEquipmentPartId(null);
model.setEquipmentPartName(null);
model.setInspectMaintainItemId(null);
model.setInspectMaintainItemName(null);
model.setMaintenanceResult(null);
model.setMaintainerUserId(null);
model.setMaintainerUsername(null);
model.setMaintainerRealname(null);
model.setMaintenanceFilledFlag("0");
}
private void preserveMaintenanceFields(MesXslDowntimeRecord model, MesXslDowntimeRecord old) {
model.setEquipmentPartId(old.getEquipmentPartId());
model.setEquipmentPartName(old.getEquipmentPartName());
model.setInspectMaintainItemId(old.getInspectMaintainItemId());
model.setInspectMaintainItemName(old.getInspectMaintainItemName());
model.setMaintenanceResult(old.getMaintenanceResult());
model.setMaintainerUserId(old.getMaintainerUserId());
model.setMaintainerUsername(old.getMaintainerUsername());
model.setMaintainerRealname(old.getMaintainerRealname());
model.setMaintenanceFilledFlag(
oConvertUtils.isEmpty(old.getMaintenanceFilledFlag()) ? "0" : old.getMaintenanceFilledFlag());
}
//update-end---author:jiangxh ---date:20250602 for【MES】停机记录保存前校验、关联设备与停机类型回填-----------
}

View File

@@ -0,0 +1,106 @@
package org.jeecg.modules.xslmes.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
/**
* MES 停机记录(表 mes_xsl_downtime_record
*/
@Data
@TableName("mes_xsl_downtime_record")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES停机记录")
public class MesXslDowntimeRecord 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 = 18)
@Schema(description = "设备编号冗余")
private String equipmentCode;
@Excel(name = "机台", width = 22)
@Schema(description = "设备名称冗余")
private String equipmentName;
@Schema(description = "停机类型主键 mes_xsl_downtime_type.id")
private String downtimeTypeId;
@Excel(name = "停机原因", width = 24)
@Schema(description = "停机类型名称冗余")
private String downtimeTypeName;
@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 startTime;
@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 endTime;
@Schema(description = "设备部位主键 mes_xsl_equipment_part.id")
private String equipmentPartId;
@Excel(name = "设备部位", width = 18)
@Schema(description = "设备部位名称冗余")
private String equipmentPartName;
@Schema(description = "点检及保养项目主键 mes_xsl_inspect_maintain_item.id")
private String inspectMaintainItemId;
@Excel(name = "维修项目", width = 22)
@Schema(description = "点检项目名称冗余")
private String inspectMaintainItemName;
@Excel(name = "维修结果", width = 28)
@Schema(description = "维修结果")
private String maintenanceResult;
@Schema(description = "维修人用户ID")
private String maintainerUserId;
@Schema(description = "维修人账号")
private String maintainerUsername;
@Excel(name = "维修人", width = 12)
@Schema(description = "维修人姓名")
private String maintainerRealname;
@Excel(name = "是否已录入维修", width = 14, dicCode = "yn")
@Dict(dicCode = "yn")
@Schema(description = "是否已录入维修结果字典yn1是0否")
private String maintenanceFilledFlag;
private Integer tenantId;
private String sysOrgCode;
private String createBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
private String updateBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
private Integer delFlag;
}

View File

@@ -0,0 +1,9 @@
package org.jeecg.modules.xslmes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.xslmes.entity.MesXslDowntimeRecord;
/**
* MES 停机记录
*/
public interface MesXslDowntimeRecordMapper extends BaseMapper<MesXslDowntimeRecord> {}

View File

@@ -0,0 +1,16 @@
package org.jeecg.modules.xslmes.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.xslmes.entity.MesXslDowntimeRecord;
import org.jeecg.modules.xslmes.vo.MesXslDowntimeRecordMaintenanceDTO;
/**
* MES 停机记录
*/
public interface IMesXslDowntimeRecordService extends IService<MesXslDowntimeRecord> {
/**
* 录入维修结果
*/
void saveMaintenanceResult(MesXslDowntimeRecordMaintenanceDTO dto);
}

View File

@@ -0,0 +1,92 @@
package org.jeecg.modules.xslmes.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslDowntimeRecord;
import org.jeecg.modules.xslmes.entity.MesXslEquipmentPart;
import org.jeecg.modules.xslmes.entity.MesXslInspectMaintainItem;
import org.jeecg.modules.xslmes.mapper.MesXslDowntimeRecordMapper;
import org.jeecg.modules.xslmes.service.IMesXslDowntimeRecordService;
import org.jeecg.modules.xslmes.service.IMesXslEquipmentPartService;
import org.jeecg.modules.xslmes.service.IMesXslInspectMaintainItemService;
import org.jeecg.modules.xslmes.vo.MesXslDowntimeRecordMaintenanceDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* MES 停机记录
*/
@Service
public class MesXslDowntimeRecordServiceImpl extends ServiceImpl<MesXslDowntimeRecordMapper, MesXslDowntimeRecord>
implements IMesXslDowntimeRecordService {
@Autowired
private IMesXslEquipmentPartService mesXslEquipmentPartService;
@Autowired
private IMesXslInspectMaintainItemService mesXslInspectMaintainItemService;
//update-begin---author:jiangxh ---date:20250602 for【MES】停机记录录入维修结果-----------
@Override
@Transactional(rollbackFor = Exception.class)
public void saveMaintenanceResult(MesXslDowntimeRecordMaintenanceDTO dto) {
if (dto == null || oConvertUtils.isEmpty(dto.getId())) {
throw new JeecgBootException("停机记录不存在");
}
MesXslDowntimeRecord record = this.getById(dto.getId());
if (record == null
|| (record.getDelFlag() != null && CommonConstant.DEL_FLAG_1.equals(record.getDelFlag()))) {
throw new JeecgBootException("停机记录不存在");
}
if (oConvertUtils.isEmpty(dto.getEquipmentPartId())) {
throw new JeecgBootException("请选择设备部位");
}
if (oConvertUtils.isEmpty(dto.getInspectMaintainItemId())) {
throw new JeecgBootException("请选择维修项目");
}
if (oConvertUtils.isEmpty(dto.getMaintenanceResult()) || dto.getMaintenanceResult().trim().isEmpty()) {
throw new JeecgBootException("维修结果不能为空");
}
if (oConvertUtils.isEmpty(dto.getMaintainerUserId())) {
throw new JeecgBootException("请选择维修人");
}
MesXslEquipmentPart part = mesXslEquipmentPartService.getById(dto.getEquipmentPartId());
if (part == null
|| (part.getDelFlag() != null && CommonConstant.DEL_FLAG_1.equals(part.getDelFlag()))) {
throw new JeecgBootException("设备部位不存在");
}
MesXslInspectMaintainItem item = mesXslInspectMaintainItemService.getById(dto.getInspectMaintainItemId());
if (item == null
|| (item.getDelFlag() != null && CommonConstant.DEL_FLAG_1.equals(item.getDelFlag()))) {
throw new JeecgBootException("维修项目不存在");
}
if (!dto.getEquipmentPartId().equals(item.getEquipmentPartId())) {
throw new JeecgBootException("维修项目与所选设备部位不匹配");
}
record.setEquipmentPartId(part.getId());
record.setEquipmentPartName(part.getPartName());
record.setInspectMaintainItemId(item.getId());
record.setInspectMaintainItemName(item.getItemName());
record.setMaintenanceResult(dto.getMaintenanceResult().trim());
record.setMaintainerUserId(dto.getMaintainerUserId());
record.setMaintainerUsername(trimToNull(dto.getMaintainerUsername()));
record.setMaintainerRealname(trimToNull(dto.getMaintainerRealname()));
record.setMaintenanceFilledFlag("1");
this.updateById(record);
}
private static String trimToNull(String value) {
if (value == null) {
return null;
}
String v = value.trim();
return v.isEmpty() ? null : v;
}
//update-end---author:jiangxh ---date:20250602 for【MES】停机记录录入维修结果-----------
}

View File

@@ -0,0 +1,33 @@
package org.jeecg.modules.xslmes.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 停机记录-录入维修结果入参
*/
@Data
@Schema(description = "停机记录-录入维修结果")
public class MesXslDowntimeRecordMaintenanceDTO {
@Schema(description = "停机记录主键", requiredMode = Schema.RequiredMode.REQUIRED)
private String id;
@Schema(description = "设备部位主键")
private String equipmentPartId;
@Schema(description = "点检及保养项目主键")
private String inspectMaintainItemId;
@Schema(description = "维修结果")
private String maintenanceResult;
@Schema(description = "维修人用户ID")
private String maintainerUserId;
@Schema(description = "维修人账号")
private String maintainerUsername;
@Schema(description = "维修人姓名")
private String maintainerRealname;
}