diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityManufacturingProcessController.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityManufacturingProcessController.java index 9e697491..90415eb6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityManufacturingProcessController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityManufacturingProcessController.java @@ -123,6 +123,20 @@ public class QualityManufacturingProcessController extends BaseController return prefix + "/detail"; } + + /** + * 品质管理制程工序详情 + */ + @RequiresPermissions("quality:manufacturingProcess:detail") + @Log(title = "品质管理制程工序", businessType = BusinessType.UPDATE) + @PostMapping("/detail") + @ResponseBody + public AjaxResult detailSave(QualityManufacturingProcess qualityManufacturingProcess) + { + return toAjax(qualityManufacturingProcessService.qualityManufacturingProcessDetail(qualityManufacturingProcess)); + } + + /** * 删除品质管理制程工序 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityManufacturingProcessMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityManufacturingProcessMapper.java index 4dcedaf6..9401a54e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityManufacturingProcessMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityManufacturingProcessMapper.java @@ -2,7 +2,8 @@ package com.ruoyi.quality.mapper; import java.util.List; import com.ruoyi.quality.domain.QualityManufacturingProcess; -import org.springframework.data.repository.query.Param; +import org.apache.ibatis.annotations.Param; + /** * 品质管理制程工序Mapper接口 @@ -82,4 +83,14 @@ public interface QualityManufacturingProcessMapper * @param prefix 前面的:ZCGX年月日 */ public String findMaxRoundCode(@Param("prefix") String prefix); + + + /** + * 判断制程工序编号是否已经存在 + * + * @param manufacturingProcessCode,manufacturingProcessAutoid 制程工序编号 制程工序自增长id + */ + //boolean existsByManufacturingProcessCode(@Param("manufacturingProcessCode") String manufacturingProcessCode, @Param("manufacturingProcessAutoid") Long manufacturingProcessAutoid); + boolean existsByManufacturingProcessCode(QualityManufacturingProcess qualityManufacturingProcess); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityManufacturingProcessService.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityManufacturingProcessService.java index 79fbaf3c..b1a96f40 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityManufacturingProcessService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityManufacturingProcessService.java @@ -43,6 +43,15 @@ public interface IQualityManufacturingProcessService */ public int updateQualityManufacturingProcess(QualityManufacturingProcess qualityManufacturingProcess); + + /** + * 品质管理制程工序详情 + * + * @param qualityManufacturingProcess 品质管理制程工序 + * @return 结果 + */ + public int qualityManufacturingProcessDetail(QualityManufacturingProcess qualityManufacturingProcess); + /** * 批量删除品质管理制程工序 * diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityManufacturingProcessServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityManufacturingProcessServiceImpl.java index de29a440..c6607d83 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityManufacturingProcessServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityManufacturingProcessServiceImpl.java @@ -75,8 +75,13 @@ public class QualityManufacturingProcessServiceImpl implements IQualityManufactu //查询数据库中最大的编号 String maxCode = qualityManufacturingProcessMapper.findMaxRoundCode(prefix); String newCode = generateNewCode(prefix,maxCode); - qualityManufacturingProcess.setManufacturingProcessId(newCode); + + //查询制程工序编号是否唯一 + if (qualityManufacturingProcessMapper.existsByManufacturingProcessCode(qualityManufacturingProcess)) + { + throw new BusinessException("该制程工序编号当前已存在!"); + } String loginName = ShiroUtils.getLoginName(); qualityManufacturingProcess.setCreateBy(loginName); qualityManufacturingProcess.setCreateTime(DateUtils.getNowDate()); @@ -119,9 +124,26 @@ public class QualityManufacturingProcessServiceImpl implements IQualityManufactu String loginName = ShiroUtils.getLoginName(); qualityManufacturingProcess.setUpdateBy(loginName); qualityManufacturingProcess.setUpdateTime(DateUtils.getNowDate()); + //查询制程工序编号是否唯一 + if (qualityManufacturingProcessMapper.existsByManufacturingProcessCode(qualityManufacturingProcess)) + { + throw new BusinessException("该制程工序编号当前已存在!"); + } return qualityManufacturingProcessMapper.updateQualityManufacturingProcess(qualityManufacturingProcess); } + + /** + * 品质管理制程工序详情 + * + * @param qualityManufacturingProcess 品质管理制程工序 + * @return 结果 + */ + @Override + public int qualityManufacturingProcessDetail(QualityManufacturingProcess qualityManufacturingProcess) + { + return qualityManufacturingProcessMapper.updateQualityManufacturingProcess(qualityManufacturingProcess); + } /** * 删除品质管理制程工序对象 * diff --git a/ruoyi-admin/src/main/resources/mapper/quality/QualityManufacturingProcessMapper.xml b/ruoyi-admin/src/main/resources/mapper/quality/QualityManufacturingProcessMapper.xml index 6f634bfb..3083d994 100644 --- a/ruoyi-admin/src/main/resources/mapper/quality/QualityManufacturingProcessMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/quality/QualityManufacturingProcessMapper.xml @@ -123,4 +123,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select max(substring(manufacturing_process_id,9)) from quality_manufacturing_process WHERE manufacturing_process_id LIKE CONCAT(#{prefix}, '%') + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/quality/manufacturingProcess/detail.html b/ruoyi-admin/src/main/resources/templates/quality/manufacturingProcess/detail.html index 8505dfb7..de317668 100644 --- a/ruoyi-admin/src/main/resources/templates/quality/manufacturingProcess/detail.html +++ b/ruoyi-admin/src/main/resources/templates/quality/manufacturingProcess/detail.html @@ -74,7 +74,7 @@ function submitHandler() { if ($.validate.form()) { - $.operate.save(prefix + "/edit", $('#form-manufacturingProcess-edit').serialize()); + $.operate.save(prefix + "/detail", $('#form-manufacturingProcess-edit').serialize()); } }