1.6.0
QMS:完成以下接口的开发: 1、保存质检结果 2、扫描物料条码获取质检结果详情 3、获取质检结果 4、获取质检结果详情列表信息 5、审核质检结果 6、通过详情列表页面点击获取质检结果详情master
parent
9f3b61d379
commit
55baf9523a
@ -1,56 +1,138 @@
|
||||
package com.hw.qms.controller;
|
||||
|
||||
import com.hw.common.core.constant.QmsConstants;
|
||||
import com.hw.common.core.exception.ServiceException;
|
||||
import com.hw.common.core.web.controller.BaseController;
|
||||
import com.hw.common.core.web.domain.AjaxResult;
|
||||
import com.hw.common.core.web.page.TableDataInfo;
|
||||
import com.hw.common.log.annotation.Log;
|
||||
import com.hw.common.log.enums.BusinessType;
|
||||
import com.hw.common.security.annotation.RequiresPermissions;
|
||||
import com.hw.qms.domain.MesBaseBarcodeInfo;
|
||||
import com.hw.qms.domain.QmsCheckRule;
|
||||
import com.hw.qms.domain.QmsCheckRuleProject;
|
||||
import com.hw.qms.domain.*;
|
||||
import com.hw.qms.domain.vo.QmsCheckResultDetailVo;
|
||||
import com.hw.qms.domain.vo.QmsMaterialCheckVo;
|
||||
import com.hw.qms.service.IMesBaseBarcodeInfoService;
|
||||
import com.hw.qms.service.IQmsCheckRuleProjectService;
|
||||
import com.hw.qms.service.IQmsCheckResultDetailService;
|
||||
import com.hw.qms.service.IQmsCheckResultService;
|
||||
import com.hw.qms.service.IQmsCheckRuleService;
|
||||
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.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:PDA接口
|
||||
* @Description:质检PDA接口
|
||||
* @ProjectName:HwMes
|
||||
* @Author:xins
|
||||
* @Date:2024-01-26 10:18
|
||||
* @Version:1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/qms/mobile")
|
||||
public class QmsMobileController {
|
||||
|
||||
@RequestMapping("/mobile")
|
||||
public class QmsMobileController extends BaseController {
|
||||
@Autowired
|
||||
private IQmsCheckRuleService qmsCheckRuleService;
|
||||
@Autowired
|
||||
private IQmsCheckResultService qmsCheckResultService;
|
||||
@Autowired
|
||||
private IQmsCheckRuleProjectService qmsCheckRuleProjectService;
|
||||
private IQmsCheckResultDetailService qmsCheckResultDetailService;
|
||||
@Autowired
|
||||
private IMesBaseBarcodeInfoService mesBaseBarcodeInfoService;
|
||||
|
||||
/**
|
||||
* 获取质检结果
|
||||
* 获取质检结果详情
|
||||
*/
|
||||
// @RequiresPermissions("qms:checkrule:list")
|
||||
@GetMapping("/getCheckResult")
|
||||
public AjaxResult getCheckResult(QmsMaterialCheckVo qmsMaterialCheckVo) {
|
||||
@GetMapping("/getCheckResultDetail")
|
||||
public AjaxResult getCheckResultDetail(QmsMaterialCheckVo qmsMaterialCheckVo) {
|
||||
Long checkResultDetailId = qmsMaterialCheckVo.getCheckResultDetailId();
|
||||
if (checkResultDetailId != null) {//如果是通过列表页点击进来则根据ID获取
|
||||
return success(qmsCheckResultDetailService.selectQmsCheckResultDetailByCheckResultDetailId(checkResultDetailId));
|
||||
}
|
||||
|
||||
//扫描物料条码进入获取
|
||||
String materialBarcode = qmsMaterialCheckVo.getMaterialBarcode();
|
||||
MesBaseBarcodeInfo baseBarcodeInfo = mesBaseBarcodeInfoService.selectMesBaseBarcodeInfoByBarcodeInfo(materialBarcode);
|
||||
if (baseBarcodeInfo == null) {
|
||||
throw new ServiceException("此物料条码系统中不存在");
|
||||
QmsCheckResultDetail qmsCheckResultDetail = qmsCheckResultDetailService.getCheckResultDetail(materialBarcode);
|
||||
if (qmsCheckResultDetail != null) {//如果有质检结果,则返回已经保存的质检结果,否则返回需要质检的项目
|
||||
return success(qmsCheckResultDetail);
|
||||
} else {
|
||||
MesBaseBarcodeInfo baseBarcodeInfo = mesBaseBarcodeInfoService.selectMesBaseBarcodeInfoByBarcodeInfo(materialBarcode);
|
||||
if (baseBarcodeInfo == null) {
|
||||
throw new ServiceException("此物料条码系统中不存在");
|
||||
}
|
||||
Long materialId = baseBarcodeInfo.getMaterialId();
|
||||
QmsCheckRuleDetail queryCheckRuleDetail = new QmsCheckRuleDetail();
|
||||
queryCheckRuleDetail.setTargetId(materialId);
|
||||
queryCheckRuleDetail.setTargetType(QmsConstants.QMS_CHECK_RULE_DETAIL_TARGET_TYPE_MATERIAL);
|
||||
QmsCheckRule qmsCheckRule = qmsCheckRuleService.selectQmsCheckRuleByTarget(queryCheckRuleDetail);
|
||||
Long checkResultId = qmsCheckResultService.insertCheckResult(baseBarcodeInfo, qmsCheckRule);
|
||||
qmsCheckRule.setCheckResultId(checkResultId);
|
||||
return success(qmsCheckRule);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增质检结果详情
|
||||
*/
|
||||
// @RequiresPermissions("qms:checkresultdetail:add")
|
||||
@Log(title = "质检结果详情", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/saveCheckResultDetail")
|
||||
public AjaxResult saveCheckResultDetail(@RequestBody QmsCheckResultDetail qmsCheckResultDetail) {
|
||||
if (qmsCheckResultDetail.getCheckResultDetailId() == null) {
|
||||
return toAjax(qmsCheckResultDetailService.insertQmsCheckResultDetail(qmsCheckResultDetail));
|
||||
} else {
|
||||
return toAjax(qmsCheckResultDetailService.updateQmsCheckResultDetail(qmsCheckResultDetail));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取质检结果
|
||||
*/
|
||||
// @RequiresPermissions("qms:checkrule:list")
|
||||
@GetMapping("/getCheckResults")
|
||||
public TableDataInfo getCheckResults(QmsCheckResult qmsCheckResult) {
|
||||
startPage();
|
||||
List<QmsCheckResult> list = qmsCheckResultService.selectQmsCheckResultJoinList(qmsCheckResult);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取批次质检结果信息
|
||||
*/
|
||||
// @RequiresPermissions("qms:checkrule:list")
|
||||
@GetMapping("/getCheckResult")
|
||||
public AjaxResult getCheckResult(QmsCheckResult qmsCheckResult) {
|
||||
QmsCheckResultDetailVo qmsCheckResultDetailVo = qmsCheckResultDetailService.getCheckResultDetailVo(qmsCheckResult.getCheckResultId());
|
||||
int batchAmount = mesBaseBarcodeInfoService.selectBarcodeInfoCountByBatchcode(qmsCheckResult.getMaterialBatch());
|
||||
qmsCheckResultDetailVo.setBatchAmount(batchAmount);
|
||||
qmsCheckResultDetailVo.setCheckMode(qmsCheckResult.getCheckMode());
|
||||
qmsCheckResultDetailVo.setCheckSample(qmsCheckResult.getCheckSample());
|
||||
return success(qmsCheckResultDetailVo);
|
||||
}
|
||||
|
||||
Long materialId = baseBarcodeInfo.getMaterialId();
|
||||
/**
|
||||
* 获取批次质检结果详情列表
|
||||
*/
|
||||
// @RequiresPermissions("qms:checkrule:list")
|
||||
@GetMapping("/getCheckResultDetails")
|
||||
public TableDataInfo getCheckResultDetails(QmsCheckResultDetail qmsCheckResultDetail) {
|
||||
startPage();
|
||||
List<QmsCheckResultDetail> list = qmsCheckResultDetailService.selectQmsCheckResultDetailList(qmsCheckResultDetail);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
List<QmsCheckRuleProject> checkRuleProjects = qmsCheckRuleProjectService.getCheckRuleProjects(materialId);
|
||||
return null;
|
||||
|
||||
/**
|
||||
* 新增质检结果详情
|
||||
*/
|
||||
// @RequiresPermissions("qms:checkresultdetail:add")
|
||||
@Log(title = "质检结果", businessType = BusinessType.AUDIT)
|
||||
@PostMapping("/auditCheckResult")
|
||||
public AjaxResult auditCheckResult(@RequestBody QmsCheckResult qmsCheckResult) {
|
||||
return toAjax(qmsCheckResultService.auditQmsCheckResult(qmsCheckResult));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,73 @@
|
||||
package com.hw.qms.domain.vo;
|
||||
|
||||
import com.hw.common.core.annotation.Excel;
|
||||
import com.hw.common.core.web.domain.BaseEntity;
|
||||
import com.hw.qms.domain.QmsCheckResultDetailProject;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 质检结果详情对象 QmsCheckResultDetailVo,返回给前端的对象
|
||||
*
|
||||
* @author xins
|
||||
* @date 2024-01-23
|
||||
*/
|
||||
public class QmsCheckResultDetailVo
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 批次数量
|
||||
*/
|
||||
private int batchAmount;
|
||||
private int passAmount;
|
||||
|
||||
private int failAmount;
|
||||
|
||||
private String checkMode;
|
||||
|
||||
private BigDecimal checkSample;
|
||||
|
||||
public int getBatchAmount() {
|
||||
return batchAmount;
|
||||
}
|
||||
|
||||
public void setBatchAmount(int batchAmount) {
|
||||
this.batchAmount = batchAmount;
|
||||
}
|
||||
|
||||
public int getPassAmount() {
|
||||
return passAmount;
|
||||
}
|
||||
|
||||
public void setPassAmount(int passAmount) {
|
||||
this.passAmount = passAmount;
|
||||
}
|
||||
|
||||
public int getFailAmount() {
|
||||
return failAmount;
|
||||
}
|
||||
|
||||
public void setFailAmount(int failAmount) {
|
||||
this.failAmount = failAmount;
|
||||
}
|
||||
|
||||
public String getCheckMode() {
|
||||
return checkMode;
|
||||
}
|
||||
|
||||
public void setCheckMode(String checkMode) {
|
||||
this.checkMode = checkMode;
|
||||
}
|
||||
|
||||
public BigDecimal getCheckSample() {
|
||||
return checkSample;
|
||||
}
|
||||
|
||||
public void setCheckSample(BigDecimal checkSample) {
|
||||
this.checkSample = checkSample;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.hw.qms.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.hw.qms.domain.QmsCheckResultDetailProject;
|
||||
|
||||
/**
|
||||
* 质检结果详情项目信息Mapper接口
|
||||
*
|
||||
* @author xins
|
||||
* @date 2024-02-27
|
||||
*/
|
||||
public interface QmsCheckResultDetailProjectMapper
|
||||
{
|
||||
/**
|
||||
* 查询质检结果详情项目信息
|
||||
*
|
||||
* @param resultDetailProjectId 质检结果详情项目信息主键
|
||||
* @return 质检结果详情项目信息
|
||||
*/
|
||||
public QmsCheckResultDetailProject selectQmsCheckResultDetailProjectByResultDetailProjectId(Long resultDetailProjectId);
|
||||
|
||||
/**
|
||||
* 查询质检结果详情项目信息列表
|
||||
*
|
||||
* @param qmsCheckResultDetailProject 质检结果详情项目信息
|
||||
* @return 质检结果详情项目信息集合
|
||||
*/
|
||||
public List<QmsCheckResultDetailProject> selectQmsCheckResultDetailProjectList(QmsCheckResultDetailProject qmsCheckResultDetailProject);
|
||||
|
||||
/**
|
||||
* 新增质检结果详情项目信息
|
||||
*
|
||||
* @param qmsCheckResultDetailProject 质检结果详情项目信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertQmsCheckResultDetailProject(QmsCheckResultDetailProject qmsCheckResultDetailProject);
|
||||
|
||||
/**
|
||||
* 修改质检结果详情项目信息
|
||||
*
|
||||
* @param qmsCheckResultDetailProject 质检结果详情项目信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateQmsCheckResultDetailProject(QmsCheckResultDetailProject qmsCheckResultDetailProject);
|
||||
|
||||
/**
|
||||
* 删除质检结果详情项目信息
|
||||
*
|
||||
* @param resultDetailProjectId 质检结果详情项目信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteQmsCheckResultDetailProjectByResultDetailProjectId(Long resultDetailProjectId);
|
||||
|
||||
/**
|
||||
* 批量删除质检结果详情项目信息
|
||||
*
|
||||
* @param resultDetailProjectIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteQmsCheckResultDetailProjectByResultDetailProjectIds(Long[] resultDetailProjectIds);
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hw.qms.mapper.QmsCheckResultDetailProjectMapper">
|
||||
|
||||
<resultMap type="QmsCheckResultDetailProject" id="QmsCheckResultDetailProjectResult">
|
||||
<result property="resultDetailProjectId" column="result_detail_project_id" />
|
||||
<result property="checkResultDetailId" column="check_result_detail_id" />
|
||||
<result property="checkProjectId" column="check_project_id" />
|
||||
<result property="checkProjectStatus" column="check_project_status" />
|
||||
<result property="checkProjectResult" column="check_project_result" />
|
||||
<result property="projectStepOrder" column="project_step_order" />
|
||||
<result property="standardValue" column="standard_value" />
|
||||
<result property="checkProjectName" column="check_project_name" />
|
||||
<result property="checkProjectProperty" column="check_project_property" />
|
||||
<result property="upperDiff" column="upper_diff" />
|
||||
<result property="downDiff" column="down_diff" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectQmsCheckResultDetailProjectVo">
|
||||
select result_detail_project_id, check_result_detail_id, check_project_id, check_project_status, check_project_result, project_step_order, standard_value, check_project_name, check_project_property, upper_diff, down_diff, create_by, create_time, update_by, update_time from qms_check_result_detail_project
|
||||
</sql>
|
||||
|
||||
<select id="selectQmsCheckResultDetailProjectList" parameterType="QmsCheckResultDetailProject" resultMap="QmsCheckResultDetailProjectResult">
|
||||
<include refid="selectQmsCheckResultDetailProjectVo"/>
|
||||
<where>
|
||||
<if test="checkResultDetailId != null "> and check_result_detail_id = #{checkResultDetailId}</if>
|
||||
<if test="checkProjectId != null "> and check_project_id = #{checkProjectId}</if>
|
||||
<if test="checkProjectStatus != null and checkProjectStatus != ''"> and check_project_status = #{checkProjectStatus}</if>
|
||||
<if test="checkProjectResult != null "> and check_project_result = #{checkProjectResult}</if>
|
||||
<if test="projectStepOrder != null "> and project_step_order = #{projectStepOrder}</if>
|
||||
<if test="standardValue != null "> and standard_value = #{standardValue}</if>
|
||||
<if test="checkProjectName != null and checkProjectName != ''"> and check_project_name like concat('%', #{checkProjectName}, '%')</if>
|
||||
<if test="checkProjectProperty != null and checkProjectProperty != ''"> and check_project_property = #{checkProjectProperty}</if>
|
||||
<if test="upperDiff != null "> and upper_diff = #{upperDiff}</if>
|
||||
<if test="downDiff != null "> and down_diff = #{downDiff}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectQmsCheckResultDetailProjectByResultDetailProjectId" parameterType="Long" resultMap="QmsCheckResultDetailProjectResult">
|
||||
<include refid="selectQmsCheckResultDetailProjectVo"/>
|
||||
where result_detail_project_id = #{resultDetailProjectId}
|
||||
</select>
|
||||
|
||||
<insert id="insertQmsCheckResultDetailProject" parameterType="QmsCheckResultDetailProject" useGeneratedKeys="true" keyProperty="resultDetailProjectId">
|
||||
insert into qms_check_result_detail_project
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="checkResultDetailId != null">check_result_detail_id,</if>
|
||||
<if test="checkProjectId != null">check_project_id,</if>
|
||||
<if test="checkProjectStatus != null">check_project_status,</if>
|
||||
<if test="checkProjectResult != null">check_project_result,</if>
|
||||
<if test="projectStepOrder != null">project_step_order,</if>
|
||||
<if test="standardValue != null">standard_value,</if>
|
||||
<if test="checkProjectName != null">check_project_name,</if>
|
||||
<if test="checkProjectProperty != null">check_project_property,</if>
|
||||
<if test="upperDiff != null">upper_diff,</if>
|
||||
<if test="downDiff != null">down_diff,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="checkResultDetailId != null">#{checkResultDetailId},</if>
|
||||
<if test="checkProjectId != null">#{checkProjectId},</if>
|
||||
<if test="checkProjectStatus != null">#{checkProjectStatus},</if>
|
||||
<if test="checkProjectResult != null">#{checkProjectResult},</if>
|
||||
<if test="projectStepOrder != null">#{projectStepOrder},</if>
|
||||
<if test="standardValue != null">#{standardValue},</if>
|
||||
<if test="checkProjectName != null">#{checkProjectName},</if>
|
||||
<if test="checkProjectProperty != null">#{checkProjectProperty},</if>
|
||||
<if test="upperDiff != null">#{upperDiff},</if>
|
||||
<if test="downDiff != null">#{downDiff},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateQmsCheckResultDetailProject" parameterType="QmsCheckResultDetailProject">
|
||||
update qms_check_result_detail_project
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="checkResultDetailId != null">check_result_detail_id = #{checkResultDetailId},</if>
|
||||
<if test="checkProjectId != null">check_project_id = #{checkProjectId},</if>
|
||||
<if test="checkProjectStatus != null">check_project_status = #{checkProjectStatus},</if>
|
||||
<if test="checkProjectResult != null">check_project_result = #{checkProjectResult},</if>
|
||||
<if test="projectStepOrder != null">project_step_order = #{projectStepOrder},</if>
|
||||
<if test="standardValue != null">standard_value = #{standardValue},</if>
|
||||
<if test="checkProjectName != null">check_project_name = #{checkProjectName},</if>
|
||||
<if test="checkProjectProperty != null">check_project_property = #{checkProjectProperty},</if>
|
||||
<if test="upperDiff != null">upper_diff = #{upperDiff},</if>
|
||||
<if test="downDiff != null">down_diff = #{downDiff},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where result_detail_project_id = #{resultDetailProjectId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteQmsCheckResultDetailProjectByResultDetailProjectId" parameterType="Long">
|
||||
delete from qms_check_result_detail_project where result_detail_project_id = #{resultDetailProjectId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteQmsCheckResultDetailProjectByResultDetailProjectIds" parameterType="String">
|
||||
delete from qms_check_result_detail_project where result_detail_project_id in
|
||||
<foreach item="resultDetailProjectId" collection="array" open="(" separator="," close=")">
|
||||
#{resultDetailProjectId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue