QMS:完成以下接口的开发:
1、保存质检结果
2、扫描物料条码获取质检结果详情
3、获取质检结果
4、获取质检结果详情列表信息
5、审核质检结果
6、通过详情列表页面点击获取质检结果详情
master
xins 9 months ago
parent 9f3b61d379
commit 55baf9523a

@ -93,6 +93,10 @@ public class MesBaseBarcodeInfo extends BaseEntity
@Excel(name = "生产计划明细编号关联mes_product_plan_detail的plan_detail_code;适合生产出入库等")
private String planDetailCode;
/** 销售订单编号;适合生产出入库等 */
@Excel(name = "销售订单ID;适合生产出入库等")
private String saleOrderId;
/** 销售订单编号;适合生产出入库等 */
@Excel(name = "销售订单编号;适合生产出入库等")
private String saleorderCode;
@ -280,6 +284,15 @@ public class MesBaseBarcodeInfo extends BaseEntity
{
return planDetailCode;
}
public String getSaleOrderId() {
return saleOrderId;
}
public void setSaleOrderId(String saleOrderId) {
this.saleOrderId = saleOrderId;
}
public void setSaleorderCode(String saleorderCode)
{
this.saleorderCode = saleorderCode;

@ -20,7 +20,7 @@ public class HwQmsApplication
public static void main(String[] args)
{
SpringApplication.run(HwQmsApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 能源模块启动成功 ლ(´ڡ`ლ)゙ \n" +
System.out.println("(♥◠‿◠)ノ゙ 质检模块启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +

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

@ -94,6 +94,9 @@ public class MesBaseBarcodeInfo extends BaseEntity
@Excel(name = "生产计划明细编号关联mes_product_plan_detail的plan_detail_code;适合生产出入库等")
private String planDetailCode;
/** 销售订单ID;适合生产出入库等 */
private String saleOrderId;
/** 销售订单编号;适合生产出入库等 */
@Excel(name = "销售订单编号;适合生产出入库等")
private String saleorderCode;
@ -119,6 +122,10 @@ public class MesBaseBarcodeInfo extends BaseEntity
@Excel(name = "绑定托盘时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date bindTime;
private String materialCode;
private String materialName;
public void setBarcodeId(Long barcodeId)
{
this.barcodeId = barcodeId;
@ -281,6 +288,15 @@ public class MesBaseBarcodeInfo extends BaseEntity
{
return planDetailCode;
}
public String getSaleOrderId() {
return saleOrderId;
}
public void setSaleOrderId(String saleOrderId) {
this.saleOrderId = saleOrderId;
}
public void setSaleorderCode(String saleorderCode)
{
this.saleorderCode = saleorderCode;
@ -336,6 +352,22 @@ public class MesBaseBarcodeInfo extends BaseEntity
return bindTime;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -9,7 +9,7 @@ import com.hw.common.core.web.domain.BaseEntity;
/**
* qms_check_result
*
*
* @author xins
* @date 2024-01-23
*/
@ -20,6 +20,9 @@ public class QmsCheckResult extends BaseEntity
/** 质检结果ID */
private Long checkResultId;
/** 质检规则ID */
private Long checkRuleId;
/** 物料类型(1:原材料,2:半成品,3:成品) */
@Excel(name = "物料类型(1:原材料,2:半成品,3:成品)")
private String materialType;
@ -48,6 +51,10 @@ public class QmsCheckResult extends BaseEntity
@Excel(name = "生产计划明细编号")
private String planDetailCode;
/** 销售订单ID */
@Excel(name = "销售订单ID")
private String saleOrderId;
/** 销售订单编号 */
@Excel(name = "销售订单编号")
private String saleorderCode;
@ -69,137 +76,158 @@ public class QmsCheckResult extends BaseEntity
private String checkStatus;
/** 预留字段1 */
@Excel(name = "预留字段1")
private String attr1;
@Excel(name = "检验规则名称")
private String checkRuleName;
private String materialCode;
private String materialName;
/** 质检结果详情信息 */
private List<QmsCheckResultDetail> qmsCheckResultDetailList;
public void setCheckResultId(Long checkResultId)
public void setCheckResultId(Long checkResultId)
{
this.checkResultId = checkResultId;
}
public Long getCheckResultId()
public Long getCheckResultId()
{
return checkResultId;
}
public void setMaterialType(String materialType)
public Long getCheckRuleId() {
return checkRuleId;
}
public void setCheckRuleId(Long checkRuleId) {
this.checkRuleId = checkRuleId;
}
public void setMaterialType(String materialType)
{
this.materialType = materialType;
}
public String getMaterialType()
public String getMaterialType()
{
return materialType;
}
public void setMaterialId(Long materialId)
public void setMaterialId(Long materialId)
{
this.materialId = materialId;
}
public Long getMaterialId()
public Long getMaterialId()
{
return materialId;
}
public void setMaterialBatch(String materialBatch)
public void setMaterialBatch(String materialBatch)
{
this.materialBatch = materialBatch;
}
public String getMaterialBatch()
public String getMaterialBatch()
{
return materialBatch;
}
public void setCheckMode(String checkMode)
public void setCheckMode(String checkMode)
{
this.checkMode = checkMode;
}
public String getCheckMode()
public String getCheckMode()
{
return checkMode;
}
public void setCheckSample(BigDecimal checkSample)
public void setCheckSample(BigDecimal checkSample)
{
this.checkSample = checkSample;
}
public BigDecimal getCheckSample()
public BigDecimal getCheckSample()
{
return checkSample;
}
public void setPlanCode(String planCode)
public void setPlanCode(String planCode)
{
this.planCode = planCode;
}
public String getPlanCode()
public String getPlanCode()
{
return planCode;
}
public void setPlanDetailCode(String planDetailCode)
public void setPlanDetailCode(String planDetailCode)
{
this.planDetailCode = planDetailCode;
}
public String getPlanDetailCode()
public String getPlanDetailCode()
{
return planDetailCode;
}
public void setSaleorderCode(String saleorderCode)
public String getSaleOrderId() {
return saleOrderId;
}
public void setSaleOrderId(String saleOrderId) {
this.saleOrderId = saleOrderId;
}
public void setSaleorderCode(String saleorderCode)
{
this.saleorderCode = saleorderCode;
}
public String getSaleorderCode()
public String getSaleorderCode()
{
return saleorderCode;
}
public void setPoNo(String poNo)
public void setPoNo(String poNo)
{
this.poNo = poNo;
}
public String getPoNo()
public String getPoNo()
{
return poNo;
}
public void setPoLine(String poLine)
public void setPoLine(String poLine)
{
this.poLine = poLine;
}
public String getPoLine()
public String getPoLine()
{
return poLine;
}
public void setProjectNo(String projectNo)
public void setProjectNo(String projectNo)
{
this.projectNo = projectNo;
}
public String getProjectNo()
public String getProjectNo()
{
return projectNo;
}
public void setCheckStatus(String checkStatus)
public void setCheckStatus(String checkStatus)
{
this.checkStatus = checkStatus;
}
public String getCheckStatus()
public String getCheckStatus()
{
return checkStatus;
}
public void setAttr1(String attr1)
{
this.attr1 = attr1;
public String getCheckRuleName() {
return checkRuleName;
}
public String getAttr1()
{
return attr1;
public void setCheckRuleName(String checkRuleName) {
this.checkRuleName = checkRuleName;
}
public List<QmsCheckResultDetail> getQmsCheckResultDetailList()
@ -212,6 +240,22 @@ public class QmsCheckResult extends BaseEntity
this.qmsCheckResultDetailList = qmsCheckResultDetailList;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -233,7 +277,7 @@ public class QmsCheckResult extends BaseEntity
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("attr1", getAttr1())
.append("checkRuleName", getCheckRuleName())
.append("qmsCheckResultDetailList", getQmsCheckResultDetailList())
.toString();
}

@ -1,5 +1,6 @@
package com.hw.qms.domain;
import java.math.BigDecimal;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -27,6 +28,30 @@ public class QmsCheckResultDetail extends BaseEntity
@Excel(name = "物料条码")
private String materialBarcode;
/** 物料ID关联物料主键 */
@Excel(name = "物料ID关联物料主键")
private Long materialId;
/** 检验规则ID(冗余,与质检结果中值相同),关联检验规则主键 */
@Excel(name = "检验规则ID(冗余,与质检结果中值相同),关联检验规则主键")
private Long checkRuleId;
/** 冗余,检验规则类型(1来料检验,2,半成品检验3成品检验,4工序检验) */
@Excel(name = "冗余,检验规则类型(1来料检验,2,半成品检验3成品检验,4工序检验)")
private String checkRuleType;
/** 冗余,检验规则名称 */
@Excel(name = "冗余,检验规则名称")
private String checkRuleName;
/** 冗余,检验方式(1,全检2,抽检) */
@Excel(name = "冗余,检验方式(1,全检2,抽检)")
private String checkMode;
/** 冗余,抽检比例 */
@Excel(name = "冗余,抽检比例")
private BigDecimal checkSample;
/** 检验状态(0待检验,1检验中,2质检通过,3质检不通过) */
@Excel(name = "检验状态(0待检验,1检验中,2质检通过,3质检不通过)")
private String checkStatus;
@ -70,6 +95,55 @@ public class QmsCheckResultDetail extends BaseEntity
{
return materialBarcode;
}
public Long getMaterialId() {
return materialId;
}
public void setMaterialId(Long materialId) {
this.materialId = materialId;
}
public Long getCheckRuleId() {
return checkRuleId;
}
public void setCheckRuleId(Long checkRuleId) {
this.checkRuleId = checkRuleId;
}
public String getCheckRuleType() {
return checkRuleType;
}
public void setCheckRuleType(String checkRuleType) {
this.checkRuleType = checkRuleType;
}
public String getCheckRuleName() {
return checkRuleName;
}
public void setCheckRuleName(String checkRuleName) {
this.checkRuleName = checkRuleName;
}
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;
}
public void setCheckStatus(String checkStatus)
{
this.checkStatus = checkStatus;
@ -125,16 +199,22 @@ public class QmsCheckResultDetail extends BaseEntity
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("checkResultDetailId", getCheckResultDetailId())
.append("checkResultId", getCheckResultId())
.append("materialBarcode", getMaterialBarcode())
.append("checkStatus", getCheckStatus())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("qmsCheckResultDetailProjectList", getQmsCheckResultDetailProjectList())
.append("checkResultDetailId", getCheckResultDetailId())
.append("checkResultId", getCheckResultId())
.append("materialBarcode", getMaterialBarcode())
.append("materialId", getMaterialId())
.append("checkRuleId", getCheckRuleId())
.append("checkRuleType", getCheckRuleType())
.append("checkRuleName", getCheckRuleName())
.append("checkMode", getCheckMode())
.append("checkSample", getCheckSample())
.append("checkStatus", getCheckStatus())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("qmsCheckResultDetailProjectList", getQmsCheckResultDetailProjectList())
.toString();
}
}

@ -7,10 +7,10 @@ import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* qms_check_result_detail_project
*
* ; qms_check_result_detail_project
*
* @author xins
* @date 2024-01-23
* @date 2024-02-26
*/
public class QmsCheckResultDetailProject extends BaseEntity
{
@ -35,87 +35,125 @@ public class QmsCheckResultDetailProject extends BaseEntity
@Excel(name = "检验结果,具体值")
private BigDecimal checkProjectResult;
/**检验项目顺序*/
private Long projectStepOrder;
/** 标准值 */
@Excel(name = "标准值")
private BigDecimal standardValue;
/** 上差值 */
@Excel(name = "上差值")
/** 检验项目名称(冗余字段) */
@Excel(name = "检验项目名称", readConverterExp = "冗=余字段")
private String checkProjectName;
/** 检验项目属性(1定性,2定量),冗余字段 */
@Excel(name = "检验项目属性(1定性,2定量),冗余字段")
private String checkProjectProperty;
/** 上差值,检验时从检验项目复制过来的值 */
@Excel(name = "上差值,检验时从检验项目复制过来的值")
private BigDecimal upperDiff;
/** 下差值 */
@Excel(name = "下差值")
/** 下差值,检验时从检验项目复制过来的值 */
@Excel(name = "下差值,检验时从检验项目复制过来的值")
private BigDecimal downDiff;
public void setResultDetailProjectId(Long resultDetailProjectId)
public void setResultDetailProjectId(Long resultDetailProjectId)
{
this.resultDetailProjectId = resultDetailProjectId;
}
public Long getResultDetailProjectId()
public Long getResultDetailProjectId()
{
return resultDetailProjectId;
}
public void setCheckResultDetailId(Long checkResultDetailId)
public void setCheckResultDetailId(Long checkResultDetailId)
{
this.checkResultDetailId = checkResultDetailId;
}
public Long getCheckResultDetailId()
public Long getCheckResultDetailId()
{
return checkResultDetailId;
}
public void setCheckProjectId(Long checkProjectId)
public void setCheckProjectId(Long checkProjectId)
{
this.checkProjectId = checkProjectId;
}
public Long getCheckProjectId()
public Long getCheckProjectId()
{
return checkProjectId;
}
public void setCheckProjectStatus(String checkProjectStatus)
public void setCheckProjectStatus(String checkProjectStatus)
{
this.checkProjectStatus = checkProjectStatus;
}
public String getCheckProjectStatus()
public String getCheckProjectStatus()
{
return checkProjectStatus;
}
public void setCheckProjectResult(BigDecimal checkProjectResult)
public void setCheckProjectResult(BigDecimal checkProjectResult)
{
this.checkProjectResult = checkProjectResult;
}
public BigDecimal getCheckProjectResult()
public BigDecimal getCheckProjectResult()
{
return checkProjectResult;
}
public void setStandardValue(BigDecimal standardValue)
public Long getProjectStepOrder() {
return projectStepOrder;
}
public void setProjectStepOrder(Long projectStepOrder) {
this.projectStepOrder = projectStepOrder;
}
public void setStandardValue(BigDecimal standardValue)
{
this.standardValue = standardValue;
}
public BigDecimal getStandardValue()
public BigDecimal getStandardValue()
{
return standardValue;
}
public void setUpperDiff(BigDecimal upperDiff)
public void setCheckProjectName(String checkProjectName)
{
this.checkProjectName = checkProjectName;
}
public String getCheckProjectName()
{
return checkProjectName;
}
public void setCheckProjectProperty(String checkProjectProperty)
{
this.checkProjectProperty = checkProjectProperty;
}
public String getCheckProjectProperty()
{
return checkProjectProperty;
}
public void setUpperDiff(BigDecimal upperDiff)
{
this.upperDiff = upperDiff;
}
public BigDecimal getUpperDiff()
public BigDecimal getUpperDiff()
{
return upperDiff;
}
public void setDownDiff(BigDecimal downDiff)
public void setDownDiff(BigDecimal downDiff)
{
this.downDiff = downDiff;
}
public BigDecimal getDownDiff()
public BigDecimal getDownDiff()
{
return downDiff;
}
@ -129,6 +167,8 @@ public class QmsCheckResultDetailProject extends BaseEntity
.append("checkProjectStatus", getCheckProjectStatus())
.append("checkProjectResult", getCheckProjectResult())
.append("standardValue", getStandardValue())
.append("checkProjectName", getCheckProjectName())
.append("checkProjectProperty", getCheckProjectProperty())
.append("upperDiff", getUpperDiff())
.append("downDiff", getDownDiff())
.append("createBy", getCreateBy())

@ -47,6 +47,11 @@ public class QmsCheckRule extends BaseEntity
/** 检验规则项目信息 */
private List<QmsCheckRuleProject> qmsCheckRuleProjectList;
/** 质检结果id */
private Long checkResultId;
public void setCheckRuleId(Long checkRuleId)
{
this.checkRuleId = checkRuleId;
@ -121,6 +126,14 @@ public class QmsCheckRule extends BaseEntity
this.qmsCheckRuleProjectList = qmsCheckRuleProjectList;
}
public Long getCheckResultId() {
return checkResultId;
}
public void setCheckResultId(Long checkResultId) {
this.checkResultId = checkResultId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
import java.math.BigDecimal;
/**
* qms_check_rule_project
*
@ -31,6 +33,27 @@ public class QmsCheckRuleProject extends BaseEntity
private Long targetId;
/**检验项目名称*/
private String checkProjectName;
/**检验项目属性*/
private String checkProjectProperty;
/**检验项目标准值*/
private BigDecimal standardValue;
/**检验项目上差值*/
private BigDecimal upperDiff;
/**检验项目下差值*/
private BigDecimal downDiff;
/**检验项目检验结果状态*/
private String checkProjectStatus;
/**检验项目检验结果值*/
private String checkProjectResult;
public void setCheckRuleId(Long checkRuleId)
{
this.checkRuleId = checkRuleId;
@ -83,6 +106,62 @@ public class QmsCheckRuleProject extends BaseEntity
this.targetId = targetId;
}
public String getCheckProjectName() {
return checkProjectName;
}
public void setCheckProjectName(String checkProjectName) {
this.checkProjectName = checkProjectName;
}
public String getCheckProjectProperty() {
return checkProjectProperty;
}
public void setCheckProjectProperty(String checkProjectProperty) {
this.checkProjectProperty = checkProjectProperty;
}
public BigDecimal getStandardValue() {
return standardValue;
}
public void setStandardValue(BigDecimal standardValue) {
this.standardValue = standardValue;
}
public BigDecimal getUpperDiff() {
return upperDiff;
}
public void setUpperDiff(BigDecimal upperDiff) {
this.upperDiff = upperDiff;
}
public BigDecimal getDownDiff() {
return downDiff;
}
public void setDownDiff(BigDecimal downDiff) {
this.downDiff = downDiff;
}
public String getCheckProjectStatus() {
return checkProjectStatus;
}
public void setCheckProjectStatus(String checkProjectStatus) {
this.checkProjectStatus = checkProjectStatus;
}
public String getCheckProjectResult() {
return checkProjectResult;
}
public void setCheckProjectResult(String checkProjectResult) {
this.checkProjectResult = checkProjectResult;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -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;
}
}

@ -16,8 +16,7 @@ import java.math.BigDecimal;
@Data
public class QmsMaterialCheckVo {
//物料条码
@NotBlank(message="物料条码必须输入")
private String materialBarcode;
private Long checkResultDetailId;
}

@ -69,4 +69,13 @@ public interface MesBaseBarcodeInfoMapper
* @return
*/
public int deleteMesBaseBarcodeInfoByBarcodeIds(Long[] barcodeIds);
/**
*
*
* @param batchCode
* @return
*/
public int selectBarcodeInfoCountByBatchcode(String batchCode);
}

@ -96,4 +96,12 @@ public interface QmsCheckResultDetailMapper
*/
public QmsCheckResultDetail selectQmsCheckResultDetailByMaterialBarcode(String materialBarcode);
/**
*
*
* @param qmsCheckResultDetail
* @return
*/
public int selectResultDetailQualityCountByResultDetailId(QmsCheckResultDetail qmsCheckResultDetail);
}

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

@ -6,15 +6,15 @@ import com.hw.qms.domain.QmsCheckResultDetail;
/**
* Mapper
*
*
* @author xins
* @date 2024-01-23
*/
public interface QmsCheckResultMapper
public interface QmsCheckResultMapper
{
/**
*
*
*
* @param checkResultId
* @return
*/
@ -22,7 +22,7 @@ public interface QmsCheckResultMapper
/**
*
*
*
* @param qmsCheckResult
* @return
*/
@ -30,7 +30,7 @@ public interface QmsCheckResultMapper
/**
*
*
*
* @param qmsCheckResult
* @return
*/
@ -38,7 +38,7 @@ public interface QmsCheckResultMapper
/**
*
*
*
* @param qmsCheckResult
* @return
*/
@ -46,7 +46,7 @@ public interface QmsCheckResultMapper
/**
*
*
*
* @param checkResultId
* @return
*/
@ -54,7 +54,7 @@ public interface QmsCheckResultMapper
/**
*
*
*
* @param checkResultIds
* @return
*/
@ -62,26 +62,47 @@ public interface QmsCheckResultMapper
/**
*
*
*
* @param checkResultIds
* @return
*/
public int deleteQmsCheckResultDetailByCheckResultIds(Long[] checkResultIds);
/**
*
*
*
* @param qmsCheckResultDetailList
* @return
*/
public int batchQmsCheckResultDetail(List<QmsCheckResultDetail> qmsCheckResultDetailList);
/**
*
*
*
* @param checkResultId ID
* @return
*/
public int deleteQmsCheckResultDetailByCheckResultId(Long checkResultId);
/**
*
*
* @param materialBatch
* @return
*/
public QmsCheckResult selectQmsCheckResultByMaterialBatch(String materialBatch);
/**
* ,Join material
*
* @param qmsCheckResult
* @return
*/
public List<QmsCheckResult> selectQmsCheckResultJoinList(QmsCheckResult qmsCheckResult);
}

@ -95,4 +95,16 @@ public interface QmsCheckRuleMapper
*/
public int batchQmsCheckRuleProject(List<QmsCheckRuleProject> qmsCheckRuleProjectList);
/**
*
*
* @param qmsCheckRuleDetail targetIdtargetType
* @return
*/
public QmsCheckRule selectQmsCheckRuleByTarget(QmsCheckRuleDetail qmsCheckRuleDetail);
}

@ -68,4 +68,13 @@ public interface IMesBaseBarcodeInfoService
* @return
*/
public int deleteMesBaseBarcodeInfoByBarcodeId(Long barcodeId);
/**
*
*
* @param batchCode
* @return
*/
public int selectBarcodeInfoCountByBatchcode(String batchCode);
}

@ -2,6 +2,7 @@ package com.hw.qms.service;
import java.util.List;
import com.hw.qms.domain.QmsCheckResultDetail;
import com.hw.qms.domain.vo.QmsCheckResultDetailVo;
/**
* Service
@ -65,4 +66,12 @@ public interface IQmsCheckResultDetailService
* @return
*/
public QmsCheckResultDetail getCheckResultDetail(String materialBarcode);
/**
*
*
* @param checkResultDetailId
* @return
*/
public QmsCheckResultDetailVo getCheckResultDetailVo(Long checkResultDetailId);
}

@ -1,19 +1,22 @@
package com.hw.qms.service;
import java.util.List;
import com.hw.qms.domain.MesBaseBarcodeInfo;
import com.hw.qms.domain.QmsCheckResult;
import com.hw.qms.domain.QmsCheckRule;
/**
* Service
*
*
* @author xins
* @date 2024-01-23
*/
public interface IQmsCheckResultService
public interface IQmsCheckResultService
{
/**
*
*
*
* @param checkResultId
* @return
*/
@ -21,7 +24,7 @@ public interface IQmsCheckResultService
/**
*
*
*
* @param qmsCheckResult
* @return
*/
@ -29,7 +32,7 @@ public interface IQmsCheckResultService
/**
*
*
*
* @param qmsCheckResult
* @return
*/
@ -37,7 +40,7 @@ public interface IQmsCheckResultService
/**
*
*
*
* @param qmsCheckResult
* @return
*/
@ -45,7 +48,7 @@ public interface IQmsCheckResultService
/**
*
*
*
* @param checkResultIds
* @return
*/
@ -53,9 +56,35 @@ public interface IQmsCheckResultService
/**
*
*
*
* @param checkResultId
* @return
*/
public int deleteQmsCheckResultByCheckResultId(Long checkResultId);
/**
*
*
* @param mesBaseBarcodeInfo
* @param qmsCheckRule
* @return checkResultId
*/
public Long insertCheckResult(MesBaseBarcodeInfo mesBaseBarcodeInfo, QmsCheckRule qmsCheckRule);
/**
* ,Join material
*
* @param qmsCheckResult
* @return
*/
public List<QmsCheckResult> selectQmsCheckResultJoinList(QmsCheckResult qmsCheckResult);
/**
*
*
* @param qmsCheckResult
* @return
*/
public int auditQmsCheckResult(QmsCheckResult qmsCheckResult);
}

@ -73,4 +73,12 @@ public interface IQmsCheckRuleService
* @param checkRuleProjectList
*/
public int batchInsertCheckRuleProject(List<QmsCheckRuleProject> checkRuleProjectList);
/**
* check_rule_project
*
* @param qmsCheckRuleDetail
* @return
*/
public QmsCheckRule selectQmsCheckRuleByTarget(QmsCheckRuleDetail qmsCheckRuleDetail);
}

@ -107,4 +107,20 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
{
return mesBaseBarcodeInfoMapper.deleteMesBaseBarcodeInfoByBarcodeId(barcodeId);
}
/**
*
*
* @param batchCode
* @return
*/
@Override
public int selectBarcodeInfoCountByBatchcode(String batchCode)
{
return mesBaseBarcodeInfoMapper.selectBarcodeInfoCountByBatchcode(batchCode);
}
}

@ -1,12 +1,17 @@
package com.hw.qms.service.impl;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.hw.common.core.constant.QmsConstants;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.qms.domain.MesBaseBarcodeInfo;
import com.hw.qms.domain.QmsCheckRuleProject;
import com.hw.qms.domain.vo.QmsCheckResultDetailVo;
import com.hw.qms.domain.vo.QmsMaterialCheckVo;
import com.hw.qms.mapper.QmsCheckResultDetailProjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -30,6 +35,9 @@ public class QmsCheckResultDetailServiceImpl implements IQmsCheckResultDetailSer
@Autowired
private QmsCheckResultDetailMapper qmsCheckResultDetailMapper;
@Autowired
private QmsCheckResultDetailProjectMapper qmsCheckResultDetailProjectMapper;
/**
*
*
@ -61,10 +69,19 @@ public class QmsCheckResultDetailServiceImpl implements IQmsCheckResultDetailSer
@Transactional
@Override
public int insertQmsCheckResultDetail(QmsCheckResultDetail qmsCheckResultDetail) {
qmsCheckResultDetail.setCreateTime(DateUtils.getNowDate());
int rows = qmsCheckResultDetailMapper.insertQmsCheckResultDetail(qmsCheckResultDetail);
insertQmsCheckResultDetailProject(qmsCheckResultDetail);
return rows;
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
qmsCheckResultDetail.setCreateTime(currentDate);
qmsCheckResultDetail.setCreateBy(userName);
QmsCheckResultDetail returnCheckResultDetail = handleQmsCheckResultDetailProject(qmsCheckResultDetail);
if (returnCheckResultDetail != null) {
qmsCheckResultDetail.setCheckStatus(returnCheckResultDetail.getCheckStatus());
int rows = qmsCheckResultDetailMapper.insertQmsCheckResultDetail(qmsCheckResultDetail);
qmsCheckResultDetail.setQmsCheckResultDetailProjectList(returnCheckResultDetail.getQmsCheckResultDetailProjectList());
batchQmsCheckResultDetailProject(qmsCheckResultDetail);
return rows;
}
return 0;
}
/**
@ -76,9 +93,18 @@ public class QmsCheckResultDetailServiceImpl implements IQmsCheckResultDetailSer
@Transactional
@Override
public int updateQmsCheckResultDetail(QmsCheckResultDetail qmsCheckResultDetail) {
qmsCheckResultDetail.setUpdateTime(DateUtils.getNowDate());
qmsCheckResultDetailMapper.deleteQmsCheckResultDetailProjectByCheckResultDetailId(qmsCheckResultDetail.getCheckResultDetailId());
insertQmsCheckResultDetailProject(qmsCheckResultDetail);
String userName = SecurityUtils.getUsername();
Date currentDate = new Date();
qmsCheckResultDetail.setUpdateTime(currentDate);
qmsCheckResultDetail.setUpdateBy(userName);
QmsCheckResultDetail returnCheckResultDetail = handleQmsCheckResultDetailProject(qmsCheckResultDetail);
if (returnCheckResultDetail != null) {
qmsCheckResultDetail.setCheckStatus(returnCheckResultDetail.getCheckStatus());
qmsCheckResultDetail.setQmsCheckResultDetailProjectList(returnCheckResultDetail.getQmsCheckResultDetailProjectList());
batchUpdateQmsCheckResultDetailProject(qmsCheckResultDetail);
}
return qmsCheckResultDetailMapper.updateQmsCheckResultDetail(qmsCheckResultDetail);
}
@ -113,10 +139,80 @@ public class QmsCheckResultDetailServiceImpl implements IQmsCheckResultDetailSer
*
* @param qmsCheckResultDetail
*/
public void insertQmsCheckResultDetailProject(QmsCheckResultDetail qmsCheckResultDetail) {
public QmsCheckResultDetail handleQmsCheckResultDetailProject(QmsCheckResultDetail qmsCheckResultDetail) {
String checkStatus = QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_PASS;//质检结果检验状态
List<QmsCheckResultDetailProject> qmsCheckResultDetailProjectList = qmsCheckResultDetail.getQmsCheckResultDetailProjectList();
Long checkResultDetailId = qmsCheckResultDetail.getCheckResultDetailId();
if (StringUtils.isNotNull(qmsCheckResultDetailProjectList)) {
QmsCheckResultDetail returnCheckResultDetail = new QmsCheckResultDetail();
List<QmsCheckResultDetailProject> list = new ArrayList<QmsCheckResultDetailProject>();
for (QmsCheckResultDetailProject qmsCheckResultDetailProject : qmsCheckResultDetailProjectList) {
String checkProjectProperty = qmsCheckResultDetailProject.getCheckProjectProperty();
if (checkProjectProperty.equals(QmsConstants.QMS_CHECK_PROJECT_PROPERTY_QUALITATIVE)) {//如果是定性
String checkProjectStatus = qmsCheckResultDetailProject.getCheckProjectStatus();
if (checkProjectStatus != null) {
if (checkProjectStatus.equals(QmsConstants.QMS_CHECK_PROJECT_STATUS_FAIL)) {
checkStatus = QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_FAIL;
}
} else {
if (checkStatus.equals(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_PASS)) {
checkStatus = QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_CHECKED;
}
}
} else {//如果是定量
BigDecimal checkProjectResult = qmsCheckResultDetailProject.getCheckProjectResult();
if (checkProjectResult != null) {
BigDecimal standardValue = qmsCheckResultDetailProject.getStandardValue();
BigDecimal upperDiff = qmsCheckResultDetailProject.getUpperDiff();
BigDecimal downDiff = qmsCheckResultDetailProject.getDownDiff();
if (upperDiff == null && downDiff == null) {
if (checkProjectResult.compareTo(standardValue) == 0) {
qmsCheckResultDetailProject.setCheckProjectStatus(QmsConstants.QMS_CHECK_PROJECT_STATUS_PASS);
} else {
qmsCheckResultDetailProject.setCheckProjectStatus(QmsConstants.QMS_CHECK_PROJECT_STATUS_FAIL);
checkStatus = QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_FAIL;
}
} else {
if (upperDiff == null) {//如果没设置上差值,则标准值为上差值
upperDiff = standardValue;
} else if (downDiff == null) {//如果没设置下差值,则标准值为下差值
downDiff = standardValue;
}
if (checkProjectResult.compareTo(downDiff) >= 0 && checkProjectResult.compareTo(upperDiff) <= 0) {
qmsCheckResultDetailProject.setCheckProjectStatus(QmsConstants.QMS_CHECK_PROJECT_STATUS_PASS);
} else {
qmsCheckResultDetailProject.setCheckProjectStatus(QmsConstants.QMS_CHECK_PROJECT_STATUS_FAIL);
checkStatus = QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_FAIL;
}
}
} else {
if (checkStatus.equals(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_PASS)) {
checkStatus = QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_CHECKED;
}
}
}
list.add(qmsCheckResultDetailProject);
}
returnCheckResultDetail.setCheckStatus(checkStatus);
returnCheckResultDetail.setQmsCheckResultDetailProjectList(list);
return returnCheckResultDetail;
}
return null;
}
/**
* (publicprivate)
*/
public void batchQmsCheckResultDetailProject(QmsCheckResultDetail qmsCheckResultDetail) {
List<QmsCheckResultDetailProject> qmsCheckResultDetailProjectList = qmsCheckResultDetail.getQmsCheckResultDetailProjectList();
Long checkResultDetailId = qmsCheckResultDetail.getCheckResultDetailId();
if (StringUtils.isNotNull(checkResultDetailId)) {
List<QmsCheckResultDetailProject> list = new ArrayList<QmsCheckResultDetailProject>();
for (QmsCheckResultDetailProject qmsCheckResultDetailProject : qmsCheckResultDetailProjectList) {
qmsCheckResultDetailProject.setCheckResultDetailId(checkResultDetailId);
@ -128,9 +224,21 @@ public class QmsCheckResultDetailServiceImpl implements IQmsCheckResultDetailSer
}
}
/**
* (publicprivate)
*/
public void batchUpdateQmsCheckResultDetailProject(QmsCheckResultDetail qmsCheckResultDetail) {
List<QmsCheckResultDetailProject> qmsCheckResultDetailProjectList = qmsCheckResultDetail.getQmsCheckResultDetailProjectList();
for (QmsCheckResultDetailProject qmsCheckResultDetailProject : qmsCheckResultDetailProjectList) {
qmsCheckResultDetailProjectMapper.updateQmsCheckResultDetailProject(qmsCheckResultDetailProject);
}
}
/**
*
*
* @param materialBarcode
* @return
*/
@ -141,4 +249,29 @@ public class QmsCheckResultDetailServiceImpl implements IQmsCheckResultDetailSer
return checkResultDetail;
}
/**
*
*
* @param checkResultId
* @return
*/
@Override
public QmsCheckResultDetailVo getCheckResultDetailVo(Long checkResultId) {
QmsCheckResultDetail passResultDetail = new QmsCheckResultDetail();
passResultDetail.setCheckResultId(checkResultId);
passResultDetail.setCheckStatus(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_PASS);
int passAmount = qmsCheckResultDetailMapper.selectResultDetailQualityCountByResultDetailId(passResultDetail);
QmsCheckResultDetail failResultDetail = new QmsCheckResultDetail();
failResultDetail.setCheckResultId(checkResultId);
failResultDetail.setCheckStatus(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_FAIL);
int failAmount = qmsCheckResultDetailMapper.selectResultDetailQualityCountByResultDetailId(failResultDetail);
QmsCheckResultDetailVo checkResultDetailVo = new QmsCheckResultDetailVo();
checkResultDetailVo.setPassAmount(passAmount);
checkResultDetailVo.setFailAmount(failAmount);
return checkResultDetailVo;
}
}

@ -1,20 +1,21 @@
package com.hw.qms.service.impl;
import java.util.Date;
import java.util.List;
import com.hw.common.core.constant.QmsConstants;
import com.hw.common.core.utils.DateUtils;
import com.hw.qms.domain.MesBaseBarcodeInfo;
import com.hw.qms.domain.QmsCheckRuleProject;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.qms.domain.*;
import com.hw.qms.domain.vo.QmsMaterialCheckVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.hw.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.hw.qms.domain.QmsCheckResultDetail;
import com.hw.qms.mapper.QmsCheckResultMapper;
import com.hw.qms.domain.QmsCheckResult;
import com.hw.qms.service.IQmsCheckResultService;
/**
@ -24,8 +25,7 @@ import com.hw.qms.service.IQmsCheckResultService;
* @date 2024-01-23
*/
@Service
public class QmsCheckResultServiceImpl implements IQmsCheckResultService
{
public class QmsCheckResultServiceImpl implements IQmsCheckResultService {
@Autowired
private QmsCheckResultMapper qmsCheckResultMapper;
@ -36,8 +36,7 @@ public class QmsCheckResultServiceImpl implements IQmsCheckResultService
* @return
*/
@Override
public QmsCheckResult selectQmsCheckResultByCheckResultId(Long checkResultId)
{
public QmsCheckResult selectQmsCheckResultByCheckResultId(Long checkResultId) {
return qmsCheckResultMapper.selectQmsCheckResultByCheckResultId(checkResultId);
}
@ -48,8 +47,7 @@ public class QmsCheckResultServiceImpl implements IQmsCheckResultService
* @return
*/
@Override
public List<QmsCheckResult> selectQmsCheckResultList(QmsCheckResult qmsCheckResult)
{
public List<QmsCheckResult> selectQmsCheckResultList(QmsCheckResult qmsCheckResult) {
return qmsCheckResultMapper.selectQmsCheckResultList(qmsCheckResult);
}
@ -61,8 +59,7 @@ public class QmsCheckResultServiceImpl implements IQmsCheckResultService
*/
@Transactional
@Override
public int insertQmsCheckResult(QmsCheckResult qmsCheckResult)
{
public int insertQmsCheckResult(QmsCheckResult qmsCheckResult) {
qmsCheckResult.setCreateTime(DateUtils.getNowDate());
int rows = qmsCheckResultMapper.insertQmsCheckResult(qmsCheckResult);
insertQmsCheckResultDetail(qmsCheckResult);
@ -77,8 +74,7 @@ public class QmsCheckResultServiceImpl implements IQmsCheckResultService
*/
@Transactional
@Override
public int updateQmsCheckResult(QmsCheckResult qmsCheckResult)
{
public int updateQmsCheckResult(QmsCheckResult qmsCheckResult) {
qmsCheckResult.setUpdateTime(DateUtils.getNowDate());
qmsCheckResultMapper.deleteQmsCheckResultDetailByCheckResultId(qmsCheckResult.getCheckResultId());
insertQmsCheckResultDetail(qmsCheckResult);
@ -93,8 +89,7 @@ public class QmsCheckResultServiceImpl implements IQmsCheckResultService
*/
@Transactional
@Override
public int deleteQmsCheckResultByCheckResultIds(Long[] checkResultIds)
{
public int deleteQmsCheckResultByCheckResultIds(Long[] checkResultIds) {
qmsCheckResultMapper.deleteQmsCheckResultDetailByCheckResultIds(checkResultIds);
return qmsCheckResultMapper.deleteQmsCheckResultByCheckResultIds(checkResultIds);
}
@ -107,8 +102,7 @@ public class QmsCheckResultServiceImpl implements IQmsCheckResultService
*/
@Transactional
@Override
public int deleteQmsCheckResultByCheckResultId(Long checkResultId)
{
public int deleteQmsCheckResultByCheckResultId(Long checkResultId) {
qmsCheckResultMapper.deleteQmsCheckResultDetailByCheckResultId(checkResultId);
return qmsCheckResultMapper.deleteQmsCheckResultByCheckResultId(checkResultId);
}
@ -118,20 +112,16 @@ public class QmsCheckResultServiceImpl implements IQmsCheckResultService
*
* @param qmsCheckResult
*/
public void insertQmsCheckResultDetail(QmsCheckResult qmsCheckResult)
{
public void insertQmsCheckResultDetail(QmsCheckResult qmsCheckResult) {
List<QmsCheckResultDetail> qmsCheckResultDetailList = qmsCheckResult.getQmsCheckResultDetailList();
Long checkResultId = qmsCheckResult.getCheckResultId();
if (StringUtils.isNotNull(qmsCheckResultDetailList))
{
if (StringUtils.isNotNull(qmsCheckResultDetailList)) {
List<QmsCheckResultDetail> list = new ArrayList<QmsCheckResultDetail>();
for (QmsCheckResultDetail qmsCheckResultDetail : qmsCheckResultDetailList)
{
for (QmsCheckResultDetail qmsCheckResultDetail : qmsCheckResultDetailList) {
qmsCheckResultDetail.setCheckResultId(checkResultId);
list.add(qmsCheckResultDetail);
}
if (list.size() > 0)
{
if (list.size() > 0) {
qmsCheckResultMapper.batchQmsCheckResultDetail(list);
}
}
@ -141,4 +131,70 @@ public class QmsCheckResultServiceImpl implements IQmsCheckResultService
/**
*
*
* @param mesBaseBarcodeInfo
* @param qmsCheckRule
* @return checkResultId
*/
@Override
public Long insertCheckResult(MesBaseBarcodeInfo mesBaseBarcodeInfo, QmsCheckRule qmsCheckRule) {
String batchCode = mesBaseBarcodeInfo.getBatchCode();
QmsCheckResult qmsCheckResult = qmsCheckResultMapper.selectQmsCheckResultByMaterialBatch(batchCode);
if (qmsCheckResult == null) {
qmsCheckResult = new QmsCheckResult();
String barcodeType = mesBaseBarcodeInfo.getBarcodeType();//条码类型1原材料,2半成品,3成品,4背板
qmsCheckResult.setCheckRuleId(qmsCheckRule.getCheckRuleId());
qmsCheckResult.setMaterialType(barcodeType);
qmsCheckResult.setMaterialId(mesBaseBarcodeInfo.getMaterialId());
qmsCheckResult.setMaterialBatch(mesBaseBarcodeInfo.getBatchCode());
qmsCheckResult.setCheckMode(qmsCheckResult.getCheckMode());
qmsCheckResult.setCheckSample(qmsCheckRule.getCheckSample());
qmsCheckResult.setPlanCode(mesBaseBarcodeInfo.getPlanCode());
qmsCheckResult.setPlanDetailCode(mesBaseBarcodeInfo.getPlanDetailCode());
qmsCheckResult.setSaleOrderId(mesBaseBarcodeInfo.getSaleOrderId());
qmsCheckResult.setSaleorderCode(mesBaseBarcodeInfo.getSaleorderCode());
qmsCheckResult.setPoNo(mesBaseBarcodeInfo.getPoNo());
qmsCheckResult.setCheckStatus(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_CHECKED);
qmsCheckResult.setCreateBy(SecurityUtils.getUsername());
qmsCheckResult.setCreateTime(new Date());
qmsCheckResultMapper.insertQmsCheckResult(qmsCheckResult);
}
return qmsCheckResult.getCheckResultId();
}
/**
* ,Join material
*
* @param qmsCheckResult
* @return
*/
@Override
public List<QmsCheckResult> selectQmsCheckResultJoinList(QmsCheckResult qmsCheckResult) {
return qmsCheckResultMapper.selectQmsCheckResultJoinList(qmsCheckResult);
}
/**
*
*
* @param qmsCheckResult
* @return
*/
@Override
public int auditQmsCheckResult(QmsCheckResult qmsCheckResult) {
qmsCheckResult.setUpdateTime(DateUtils.getNowDate());
qmsCheckResult.setUpdateBy(SecurityUtils.getUsername());
return qmsCheckResultMapper.updateQmsCheckResult(qmsCheckResult);
}
}

@ -167,5 +167,16 @@ public class QmsCheckRuleServiceImpl implements IQmsCheckRuleService {
}
/**
* check_rule_project
*
* @param qmsCheckRuleDetail
* @return
*/
@Override
public QmsCheckRule selectQmsCheckRuleByTarget(QmsCheckRuleDetail qmsCheckRuleDetail) {
return qmsCheckRuleMapper.selectQmsCheckRuleByTarget(qmsCheckRuleDetail);
}
}

@ -23,6 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="lastOutstockDate" column="last_outstock_date" />
<result property="planCode" column="plan_code" />
<result property="planDetailCode" column="plan_detail_code" />
<result property="saleOrderId" column="sale_order_id" />
<result property="saleorderCode" column="saleorder_code" />
<result property="projectNo" column="project_no" />
<result property="serialNumber" column="serial_number" />
@ -32,10 +33,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="bindTime" column="bind_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
</resultMap>
<sql id="selectMesBaseBarcodeInfoVo">
select barcode_id, print_time, print_person, batch_flag, barcode_type, barcode_info, batch_code, pallet_info_code, material_id, manufacturer_id, amount, machine_name, po_no, production_date, accepted_date, last_outstock_date, plan_code, plan_detail_code, saleorder_code, project_no, serial_number, remark, bind_status, bind_by, bind_time, update_by, update_time from mes_base_barcode_info
select barcode_id, print_time, print_person, batch_flag, barcode_type, barcode_info, batch_code, pallet_info_code, material_id, manufacturer_id, amount, machine_name, po_no, production_date, accepted_date, last_outstock_date, plan_code, plan_detail_code, sale_order_id, saleorder_code, project_no, serial_number, remark, bind_status, bind_by, bind_time, update_by, update_time from mes_base_barcode_info
</sql>
<select id="selectMesBaseBarcodeInfoList" parameterType="MesBaseBarcodeInfo" resultMap="MesBaseBarcodeInfoResult">
@ -179,9 +182,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMesBaseBarcodeInfoByBarcodeInfo" parameterType="String" resultMap="MesBaseBarcodeInfoResult">
<include refid="selectMesBaseBarcodeInfoVo"/>
select mbbi.barcode_id, mbbi.batch_flag, mbbi.barcode_type, mbbi.barcode_info, mbbi.batch_code,
mbbi.material_id, mbbi.amount, mbbi.po_no,mbbi.plan_code, mbbi.plan_detail_code, mbbi.sale_order_id, mbbi.saleorder_code,
mbmi.material_code,mbmi.material_name
from mes_base_barcode_info mbbi left join mes_base_material_info mbmi on mbbi.material_id = mbmi.material_id
where barcode_info = #{barcodeInfo} limit 1
</select>
<select id="selectBarcodeInfoCountByBatchcode" parameterType="String">
select count(1) from mes_base_barcode_info mbbi where batch_code = #{batchCode}
</select>
</mapper>

@ -8,6 +8,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="checkResultDetailId" column="check_result_detail_id" />
<result property="checkResultId" column="check_result_id" />
<result property="materialBarcode" column="material_barcode" />
<result property="materialId" column="material_id" />
<result property="checkRuleId" column="check_rule_id" />
<result property="checkRuleType" column="check_rule_type" />
<result property="checkRuleName" column="check_rule_name" />
<result property="checkMode" column="check_mode" />
<result property="checkSample" column="check_sample" />
<result property="checkStatus" column="check_status" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
@ -26,7 +32,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="checkProjectId" column="sub_check_project_id" />
<result property="checkProjectStatus" column="sub_check_project_status" />
<result property="checkProjectResult" column="sub_check_project_result" />
<result property="projectStepOrder" column="sub_project_step_order" />
<result property="standardValue" column="sub_standard_value" />
<result property="checkProjectName" column="sub_check_project_name" />
<result property="checkProjectProperty" column="sub_check_project_property" />
<result property="upperDiff" column="sub_upper_diff" />
<result property="downDiff" column="sub_down_diff" />
<result property="createBy" column="sub_create_by" />
@ -35,24 +44,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="sub_update_time" />
</resultMap>
<resultMap type="QmsCheckResultDetailVo" id="QmsCheckResultDetailVoResult">
<result property="passAmount" column="update_by" />
<result property="failAmount" column="update_time" />
</resultMap>
<sql id="selectQmsCheckResultDetailVo">
select check_result_detail_id, check_result_id, material_barcode, check_status, remark, create_by, create_time, update_by, update_time from qms_check_result_detail
select check_result_detail_id, check_result_id, material_barcode, material_id, check_rule_id, check_rule_type, check_rule_name, check_mode, check_sample, check_status, remark, create_by, create_time, update_by, update_time from qms_check_result_detail
</sql>
<sql id="selectQmsCheckResultDetailJoinVo">
select a.check_result_detail_id, a.check_result_id, a.material_barcode, a.material_id, a.check_rule_id, a.check_rule_type, a.check_rule_name, a.check_mode, a.check_sample, a.check_status, a.remark, a.create_by, a.create_time, a.update_by, a.update_time,
b.result_detail_project_id as sub_result_detail_project_id, b.check_result_detail_id as sub_check_result_detail_id,
b.check_project_id as sub_check_project_id, b.check_project_status as sub_check_project_status,
b.check_project_result as sub_check_project_result, b.project_step_order as sub_project_step_order,b.standard_value as sub_standard_value,
b.check_project_name as sub_check_project_name, b.check_project_property as sub_check_project_property,
b.upper_diff as sub_upper_diff, b.down_diff as sub_down_diff
from qms_check_result_detail a
left join qms_check_result_detail_project b on b.check_result_detail_id = a.check_result_detail_id
</sql>
<select id="selectQmsCheckResultDetailList" parameterType="QmsCheckResultDetail" resultMap="QmsCheckResultDetailResult">
<include refid="selectQmsCheckResultDetailVo"/>
<where>
<if test="checkResultId != null "> and check_result_id = #{checkResultId}</if>
<if test="materialBarcode != null and materialBarcode != ''"> and material_barcode = #{materialBarcode}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="checkRuleId != null "> and check_rule_id = #{checkRuleId}</if>
<if test="checkRuleType != null and checkRuleType != ''"> and check_rule_type = #{checkRuleType}</if>
<if test="checkRuleName != null and checkRuleName != ''"> and check_rule_name like concat('%', #{checkRuleName}, '%')</if>
<if test="checkMode != null and checkMode != ''"> and check_mode = #{checkMode}</if>
<if test="checkSample != null "> and check_sample = #{checkSample}</if>
<if test="checkStatus != null and checkStatus != ''"> and check_status = #{checkStatus}</if>
</where>
</select>
<select id="selectQmsCheckResultDetailByCheckResultDetailId" parameterType="Long" resultMap="QmsCheckResultDetailQmsCheckResultDetailProjectResult">
select a.check_result_detail_id, a.check_result_id, a.material_barcode, a.check_status, a.remark, a.create_by, a.create_time, a.update_by, a.update_time,
b.result_detail_project_id as sub_result_detail_project_id, b.check_result_detail_id as sub_check_result_detail_id, b.check_project_id as sub_check_project_id, b.check_project_status as sub_check_project_status, b.check_project_result as sub_check_project_result, b.standard_value as sub_standard_value, b.upper_diff as sub_upper_diff, b.down_diff as sub_down_diff, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time
from qms_check_result_detail a
left join qms_check_result_detail_project b on b.check_result_detail_id = a.check_result_detail_id
<include refid="selectQmsCheckResultDetailJoinVo"/>
where a.check_result_detail_id = #{checkResultDetailId}
</select>
@ -61,23 +92,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="checkResultId != null">check_result_id,</if>
<if test="materialBarcode != null and materialBarcode != ''">material_barcode,</if>
<if test="materialId != null">material_id,</if>
<if test="checkRuleId != null">check_rule_id,</if>
<if test="checkRuleType != null and checkRuleType != ''">check_rule_type,</if>
<if test="checkRuleName != null and checkRuleName != ''">check_rule_name,</if>
<if test="checkMode != null and checkMode != ''">check_mode,</if>
<if test="checkSample != null">check_sample,</if>
<if test="checkStatus != null and checkStatus != ''">check_status,</if>
<if test="remark != null">remark,</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>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="checkResultId != null">#{checkResultId},</if>
<if test="materialBarcode != null and materialBarcode != ''">#{materialBarcode},</if>
<if test="materialId != null">#{materialId},</if>
<if test="checkRuleId != null">#{checkRuleId},</if>
<if test="checkRuleType != null and checkRuleType != ''">#{checkRuleType},</if>
<if test="checkRuleName != null and checkRuleName != ''">#{checkRuleName},</if>
<if test="checkMode != null and checkMode != ''">#{checkMode},</if>
<if test="checkSample != null">#{checkSample},</if>
<if test="checkStatus != null and checkStatus != ''">#{checkStatus},</if>
<if test="remark != null">#{remark},</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>
</trim>
</insert>
<update id="updateQmsCheckResultDetail" parameterType="QmsCheckResultDetail">
@ -85,6 +128,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="checkResultId != null">check_result_id = #{checkResultId},</if>
<if test="materialBarcode != null and materialBarcode != ''">material_barcode = #{materialBarcode},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="checkRuleId != null">check_rule_id = #{checkRuleId},</if>
<if test="checkRuleType != null and checkRuleType != ''">check_rule_type = #{checkRuleType},</if>
<if test="checkRuleName != null and checkRuleName != ''">check_rule_name = #{checkRuleName},</if>
<if test="checkMode != null and checkMode != ''">check_mode = #{checkMode},</if>
<if test="checkSample != null">check_sample = #{checkSample},</if>
<if test="checkStatus != null and checkStatus != ''">check_status = #{checkStatus},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
@ -118,22 +167,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<insert id="batchQmsCheckResultDetailProject">
insert into qms_check_result_detail_project( result_detail_project_id, check_result_detail_id, check_project_id, check_project_status, check_project_result, standard_value, upper_diff, down_diff, create_by, create_time, update_by, update_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.resultDetailProjectId}, #{item.checkResultDetailId}, #{item.checkProjectId}, #{item.checkProjectStatus}, #{item.checkProjectResult}, #{item.standardValue}, #{item.upperDiff}, #{item.downDiff}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
insert into qms_check_result_detail_project( 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) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.resultDetailProjectId}, #{item.checkResultDetailId}, #{item.checkProjectId}, #{item.checkProjectStatus}, #{item.checkProjectResult}, #{item.projectStepOrder},#{item.standardValue}, #{item.checkProjectName}, #{item.checkProjectProperty}, #{item.upperDiff}, #{item.downDiff}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
</foreach>
</insert>
<select id="selectQmsCheckResultDetailByMaterialBarcode" parameterType="String" resultMap="QmsCheckResultDetailQmsCheckResultDetailProjectResult">
select a.check_result_detail_id, a.check_result_id, a.material_barcode, a.check_status, a.remark, a.create_by, a.create_time, a.update_by, a.update_time,
b.result_detail_project_id as sub_result_detail_project_id, b.check_result_detail_id as sub_check_result_detail_id, b.check_project_id as sub_check_project_id, b.check_project_status as sub_check_project_status, b.check_project_result as sub_check_project_result, b.standard_value as sub_standard_value, b.upper_diff as sub_upper_diff, b.down_diff as sub_down_diff, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time
from qms_check_result_detail a
left join qms_check_result_detail_project b on b.check_result_detail_id = a.check_result_detail_id
where a.material_barcode = #{materialBarcode} limit 1
<include refid="selectQmsCheckResultDetailJoinVo"/>
where a.material_barcode = #{materialBarcode}
</select>
<select id="selectResultDetailQualityCountByResultDetailId" parameterType="QmsCheckResultDetail">
SELECT count(1) as pass_amount FROM `qms_check_result_detail` where check_status=#{checkStatus} and check_result_id = #{checkResultId}
</select>
</mapper>

@ -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>

@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="QmsCheckResult" id="QmsCheckResultResult">
<result property="checkResultId" column="check_result_id" />
<result property="checkRuleId" column="check_rule_id" />
<result property="materialType" column="material_type" />
<result property="materialId" column="material_id" />
<result property="materialBatch" column="material_batch" />
@ -13,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="checkSample" column="check_sample" />
<result property="planCode" column="plan_code" />
<result property="planDetailCode" column="plan_detail_code" />
<result property="saleOrderId" column="sale_order_id" />
<result property="saleorderCode" column="saleorder_code" />
<result property="poNo" column="po_no" />
<result property="poLine" column="po_line" />
@ -23,7 +25,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="attr1" column="attr1" />
<result property="checkRuleName" column="check_rule_name" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
</resultMap>
<resultMap id="QmsCheckResultQmsCheckResultDetailResult" type="QmsCheckResult" extends="QmsCheckResultResult">
@ -43,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectQmsCheckResultVo">
select check_result_id, material_type, material_id, material_batch, check_mode, check_sample, plan_code, plan_detail_code, saleorder_code, po_no, po_line, project_no, check_status, remark, create_by, create_time, update_by, update_time, attr1 from qms_check_result
select check_result_id, material_type, material_id, material_batch, check_mode, check_sample, plan_code, plan_detail_code, saleorder_code, po_no, po_line, project_no, check_status, remark, create_by, create_time, update_by, update_time, check_rule_name from qms_check_result
</sql>
<select id="selectQmsCheckResultList" parameterType="QmsCheckResult" resultMap="QmsCheckResultResult">
@ -61,12 +65,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="poLine != null and poLine != ''"> and po_line = #{poLine}</if>
<if test="projectNo != null and projectNo != ''"> and project_no = #{projectNo}</if>
<if test="checkStatus != null and checkStatus != ''"> and check_status = #{checkStatus}</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
</where>
</select>
<select id="selectQmsCheckResultByCheckResultId" parameterType="Long" resultMap="QmsCheckResultQmsCheckResultDetailResult">
select a.check_result_id, a.material_type, a.material_id, a.material_batch, a.check_mode, a.check_sample, a.plan_code, a.plan_detail_code, a.saleorder_code, a.po_no, a.po_line, a.project_no, a.check_status, a.remark, a.create_by, a.create_time, a.update_by, a.update_time, a.attr1,
select a.check_result_id, a.material_type, a.material_id, a.material_batch, a.check_mode, a.check_sample, a.plan_code, a.plan_detail_code, a.saleorder_code, a.po_no, a.po_line, a.project_no, a.check_status, a.remark, a.create_by, a.create_time, a.update_by, a.update_time, a.check_rule_name,
b.check_result_detail_id as sub_check_result_detail_id, b.check_result_id as sub_check_result_id, b.material_barcode as sub_material_barcode, b.check_status as sub_check_status, b.remark as sub_remark, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time
from qms_check_result a
left join qms_check_result_detail b on b.check_result_id = a.check_result_id
@ -76,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertQmsCheckResult" parameterType="QmsCheckResult" useGeneratedKeys="true" keyProperty="checkResultId">
insert into qms_check_result
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="checkRuleId != null">check_rule_id,</if>
<if test="materialType != null">material_type,</if>
<if test="materialId != null">material_id,</if>
<if test="materialBatch != null and materialBatch != ''">material_batch,</if>
@ -83,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="checkSample != null">check_sample,</if>
<if test="planCode != null">plan_code,</if>
<if test="planDetailCode != null">plan_detail_code,</if>
<if test="saleOrderId != null">sale_order_id,</if>
<if test="saleorderCode != null">saleorder_code,</if>
<if test="poNo != null">po_no,</if>
<if test="poLine != null">po_line,</if>
@ -93,9 +98,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="attr1 != null">attr1,</if>
<if test="checkRuleName != null">check_rule_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="checkRuleId != null">#{checkRuleId},</if>
<if test="materialType != null">#{materialType},</if>
<if test="materialId != null">#{materialId},</if>
<if test="materialBatch != null and materialBatch != ''">#{materialBatch},</if>
@ -103,6 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="checkSample != null">#{checkSample},</if>
<if test="planCode != null">#{planCode},</if>
<if test="planDetailCode != null">#{planDetailCode},</if>
<if test="saleOrderId != null">#{saleOrderId},</if>
<if test="saleorderCode != null">#{saleorderCode},</if>
<if test="poNo != null">#{poNo},</if>
<if test="poLine != null">#{poLine},</if>
@ -113,7 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="checkRuleName != null">#{checkRuleName},</if>
</trim>
</insert>
@ -137,7 +144,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="checkRuleName != null">check_rule_name = #{checkRuleName},</if>
</trim>
where check_result_id = #{checkResultId}
</update>
@ -170,4 +177,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
( #{item.checkResultDetailId}, #{item.checkResultId}, #{item.materialBarcode}, #{item.checkStatus}, #{item.remark}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
</foreach>
</insert>
<select id="selectQmsCheckResultByMaterialBatch" parameterType="String" resultMap="QmsCheckResultResult">
select a.check_result_id, a.material_type, a.material_id, a.material_batch, a.check_mode, a.check_sample, a.plan_code, a.plan_detail_code, a.saleorder_code, a.po_no, a.po_line, a.project_no, a.check_status, a.remark, a.create_by, a.create_time, a.update_by, a.update_time
from qms_check_result a
where a.material_batch = #{materialBatch}
</select>
<select id="selectQmsCheckResultJoinList" parameterType="QmsCheckResult" resultMap="QmsCheckResultResult">
select qcr.check_result_id, qcr.material_type, qcr.material_id, qcr.material_batch, qcr.check_mode, qcr.check_sample, qcr.plan_code, qcr.plan_detail_code, qcr.saleorder_code,
qcr.po_no, qcr.check_status, qcr.check_rule_name,mbmi.material_code,mbmi.material_name
from qms_check_result qcr left join mes_base_material_info mbmi on qcr.material_id=mbmi.material_id
<where>
<if test="materialType != null and materialType != ''"> and material_type = #{materialType}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="materialBatch != null and materialBatch != ''"> and material_batch = #{materialBatch}</if>
<if test="checkMode != null and checkMode != ''"> and check_mode = #{checkMode}</if>
<if test="checkSample != null "> and check_sample = #{checkSample}</if>
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</if>
<if test="planDetailCode != null and planDetailCode != ''"> and plan_detail_code = #{planDetailCode}</if>
<if test="saleorderCode != null and saleorderCode != ''"> and saleorder_code = #{saleorderCode}</if>
<if test="poNo != null and poNo != ''"> and po_no = #{poNo}</if>
<if test="poLine != null and poLine != ''"> and po_line = #{poLine}</if>
<if test="projectNo != null and projectNo != ''"> and project_no = #{projectNo}</if>
<if test="checkStatus != null and checkStatus != ''"> and check_status = #{checkStatus}</if>
</where>
</select>
</mapper>

@ -26,10 +26,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="checkRuleId" column="sub_check_rule_id" />
<result property="checkProjectId" column="sub_check_project_id" />
<result property="projectStepOrder" column="sub_project_step_order" />
<result property="checkProjectName" column="sub_check_project_name" />
<result property="checkProjectProperty" column="sub_check_project_property" />
<result property="standardValue" column="sub_standard_value" />
<result property="upperDiff" column="sub_upper_diff" />
<result property="downDiff" column="sub_down_diff" />
</resultMap>
<sql id="selectQmsCheckRuleVo">
select check_rule_id, check_rule_name, check_rule_type, check_mode, check_sample, check_rule_status, remark, create_by, create_time, update_by, update_time from qms_check_rule
</sql>
@ -129,7 +133,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="batchQmsCheckRuleProject">
insert into qms_check_rule_project( check_rule_id, check_project_id, project_step_order) values
<foreach item="item" index="index" collection="list" separator=",">
@ -137,4 +140,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</insert>
<select id="selectQmsCheckRuleByTarget" resultMap="QmsCheckRuleQmsCheckRuleProjectResult">
select a.check_rule_id, a.check_rule_name, a.check_rule_type, a.check_mode, a.check_sample, a.check_rule_status,
b.check_rule_id as sub_check_rule_id, b.check_project_id as sub_check_project_id, b.project_step_order as sub_project_step_order,
qcp.check_project_name as sub_check_project_name, qcp.check_project_property as sub_check_project_property,
qcp.standard_value as sub_standard_value,qcp.upper_diff as sub_upper_diff,qcp.down_diff as sub_down_diff
from qms_check_rule a
left join qms_check_rule_project b on b.check_rule_id = a.check_rule_id
left join qms_check_project qcp on qcp.check_project_id = b.check_project_id
<where>
<if test="targetId != null and targetType!=null and targetType!=''"> and exists (select 1 from qms_check_rule_detail qcrd where
qcrd.check_rule_id=a.check_rule_id and qcrd.target_type=#{targetType} and qcrd.target_id=#{targetId})</if>
</where>
order by b.project_step_order
</select>
</mapper>

@ -8,7 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="checkRuleId" column="check_rule_id" />
<result property="checkProjectId" column="check_project_id" />
<result property="projectStepOrder" column="project_step_order" />
<association property="CheckProject" javaType="QmsCheckProject" resultMap="CheckProjectResult" />
<association property="checkProject" javaType="QmsCheckProject" resultMap="CheckProjectResult" />
</resultMap>
<resultMap id="CheckProjectResult" type="QmsCheckProject">
@ -83,13 +83,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectQmsCheckRuleProjectListByTarget" parameterType="QmsCheckRuleProject" resultMap="QmsCheckRuleProjectResult">
select qcrp.check_rule_id, qcrp.check_project_id, qcrp.project_step_order,
select qcrp.check_rule_id, qcrp.check_project_id, qcrp.project_step_order,qcrp.check_mode,qcrp.check_sample
qcp.check_project_name,qcp.check_project_property,qcp.standard_value,qcp.upper_diff,qcp.down_diff
from qms_check_rule_project qcrp left join qms_check_project qcp on qcrp.check_project_id = qcp.check_project_id
<where>
<if test="projectStepOrder != null "> and project_step_order = #{projectStepOrder}</if>
<if test="targetId != null and targetType!=null and targetType!=''"> and exists (select 1 from qms_check_rule_detail qcrd where
qcrd.check_rule_id=qcrd.check_rule_id and qcrd.target_type=#{targetType} and qcrd.target_id=#{targetId})</if>
qcrd.check_rule_id=qcrp.check_rule_id and qcrd.target_type=#{targetType} and qcrd.target_id=#{targetId})</if>
</where>
</select>

Loading…
Cancel
Save