Browse Source

[feat]品质管理:

制程工序
新增接口判断制程工序编号是否唯一
dev
liuxiaoxu 7 months ago
parent
commit
981839be19
  1. 14
      ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityManufacturingProcessController.java
  2. 13
      ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityManufacturingProcessMapper.java
  3. 9
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityManufacturingProcessService.java
  4. 24
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityManufacturingProcessServiceImpl.java
  5. 8
      ruoyi-admin/src/main/resources/mapper/quality/QualityManufacturingProcessMapper.xml
  6. 2
      ruoyi-admin/src/main/resources/templates/quality/manufacturingProcess/detail.html

14
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));
}
/**
* 删除品质管理制程工序
*/

13
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);
}

9
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);
/**
* 批量删除品质管理制程工序
*

24
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);
}
/**
* 删除品质管理制程工序对象
*

8
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}, '%')
</select>
<select id="existsByManufacturingProcessCode" resultType="boolean" parameterType="QualityManufacturingProcess">
SELECT COUNT(*) > 0
FROM quality_manufacturing_process
WHERE manufacturing_process_code = #{manufacturingProcessCode}
<if test="manufacturingProcessAutoid != null and manufacturingProcessAutoid != ''">
and manufacturing_process_autoid != #{manufacturingProcessAutoid}
</if>
</select>
</mapper>

2
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());
}
}
</script>

Loading…
Cancel
Save