IPQC的保存
This commit is contained in:
parent
2d48e5c7ea
commit
1c3347c112
@ -4,6 +4,11 @@ import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import com.ktg.mes.pro.domain.ProWorkorder;
|
||||
import com.ktg.mes.pro.service.IProWorkorderService;
|
||||
import com.ktg.mes.qc.domain.QcTemplate;
|
||||
import com.ktg.mes.qc.service.IQcTemplateService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -36,6 +41,12 @@ public class QcIpqcController extends BaseController
|
||||
@Autowired
|
||||
private IQcIpqcService qcIpqcService;
|
||||
|
||||
@Autowired
|
||||
private IProWorkorderService proWorkorderService;
|
||||
|
||||
@Autowired
|
||||
private IQcTemplateService qcTemplateService;
|
||||
|
||||
/**
|
||||
* 查询过程检验单列表
|
||||
*/
|
||||
@ -83,6 +94,28 @@ public class QcIpqcController extends BaseController
|
||||
return AjaxResult.error("检测单编码已存在!");
|
||||
}
|
||||
|
||||
//根据工单获取产品信息
|
||||
ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(qcIpqc.getWorkorderId());
|
||||
qcIpqc.setWorkorderId(workorder.getWorkorderId());
|
||||
qcIpqc.setWorkorderCode(workorder.getWorkorderCode());
|
||||
qcIpqc.setWorkorderName(workorder.getWorkorderName());
|
||||
qcIpqc.setItemId(workorder.getProductId());
|
||||
qcIpqc.setItemCode(workorder.getProductCode());
|
||||
qcIpqc.setItemName(workorder.getProductName());
|
||||
qcIpqc.setSpecification(workorder.getProductSpc());
|
||||
qcIpqc.setUnitOfMeasure(workorder.getUnitOfMeasure());
|
||||
|
||||
//根据产品和检测类型获取检测模板
|
||||
QcTemplate param = new QcTemplate();
|
||||
param.setQcTypes(qcIpqc.getIpqcType());
|
||||
param.setItemId(workorder.getProductId());
|
||||
QcTemplate template = qcTemplateService.selectQcTemplateByProductAndQcType(param);
|
||||
if(StringUtils.isNotNull(template)){
|
||||
qcIpqc.setTemplateId(template.getTemplateId());
|
||||
}else{
|
||||
return AjaxResult.error("当前工单生产的产品未配置此类型的检验模板!");
|
||||
}
|
||||
|
||||
return toAjax(qcIpqcService.insertQcIpqc(qcIpqc));
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ktg.common.annotation.Excel;
|
||||
import com.ktg.common.core.domain.BaseEntity;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 检测模板对象 qc_template
|
||||
*
|
||||
@ -35,6 +37,11 @@ public class QcTemplate extends BaseEntity
|
||||
*/
|
||||
private String[] qcTypesParam;
|
||||
|
||||
/**
|
||||
* 物料ID
|
||||
*/
|
||||
private Long itemId;
|
||||
|
||||
/** 是否启用 */
|
||||
@Excel(name = "是否启用")
|
||||
private String enableFlag;
|
||||
@ -105,7 +112,16 @@ public class QcTemplate extends BaseEntity
|
||||
{
|
||||
return enableFlag;
|
||||
}
|
||||
public void setAttr1(String attr1)
|
||||
|
||||
public Long getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public void setItemId(Long itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public void setAttr1(String attr1)
|
||||
{
|
||||
this.attr1 = attr1;
|
||||
}
|
||||
@ -144,21 +160,18 @@ public class QcTemplate extends BaseEntity
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("templateId", getTemplateId())
|
||||
.append("templateCode", getTemplateCode())
|
||||
.append("templateName", getTemplateName())
|
||||
.append("qcTypes", getQcTypes())
|
||||
.append("enableFlag", getEnableFlag())
|
||||
.append("remark", getRemark())
|
||||
.append("attr1", getAttr1())
|
||||
.append("attr2", getAttr2())
|
||||
.append("attr3", getAttr3())
|
||||
.append("attr4", getAttr4())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
return "QcTemplate{" +
|
||||
"templateId=" + templateId +
|
||||
", templateCode='" + templateCode + '\'' +
|
||||
", templateName='" + templateName + '\'' +
|
||||
", qcTypes='" + qcTypes + '\'' +
|
||||
", qcTypesParam=" + Arrays.toString(qcTypesParam) +
|
||||
", itemId=" + itemId +
|
||||
", enableFlag='" + enableFlag + '\'' +
|
||||
", attr1='" + attr1 + '\'' +
|
||||
", attr2='" + attr2 + '\'' +
|
||||
", attr3=" + attr3 +
|
||||
", attr4=" + attr4 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,13 @@ public interface QcTemplateMapper
|
||||
public List<QcTemplate> selectQcTemplateList(QcTemplate qcTemplate);
|
||||
|
||||
|
||||
/**
|
||||
* 根据检测类型和产品查找对应的检测模板
|
||||
* @param qcTemplate
|
||||
*/
|
||||
public QcTemplate selectQcTemplateByProductAndQcType(QcTemplate qcTemplate);
|
||||
|
||||
|
||||
public QcTemplate checkTemplateCodeUnique(QcTemplate qcTemplate);
|
||||
|
||||
/**
|
||||
|
@ -27,6 +27,12 @@ public interface IQcTemplateService
|
||||
*/
|
||||
public List<QcTemplate> selectQcTemplateList(QcTemplate qcTemplate);
|
||||
|
||||
/**
|
||||
* 根据检测类型和产品查找对应的检测模板
|
||||
* @param qcTemplate
|
||||
*/
|
||||
public QcTemplate selectQcTemplateByProductAndQcType(QcTemplate qcTemplate);
|
||||
|
||||
/**
|
||||
* 检测模板编号是否唯一
|
||||
* @param qcTemplate
|
||||
|
@ -47,6 +47,11 @@ public class QcTemplateServiceImpl implements IQcTemplateService
|
||||
return qcTemplateMapper.selectQcTemplateList(qcTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QcTemplate selectQcTemplateByProductAndQcType(QcTemplate qcTemplate) {
|
||||
return qcTemplateMapper.selectQcTemplateByProductAndQcType(qcTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String checkTemplateCodeUnique(QcTemplate qcTemplate) {
|
||||
QcTemplate template = qcTemplateMapper.checkTemplateCodeUnique(qcTemplate);
|
||||
|
@ -45,6 +45,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where template_code = #{templateCode}
|
||||
</select>
|
||||
|
||||
<select id="selectQcTemplateByProductAndQcType" parameterType="QcTemplate" resultMap="QcTemplateResult">
|
||||
select template_id, template_code, template_name, qc_types, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time
|
||||
from qc_template t
|
||||
left join qc_template_product tl on t.template_id = tl.template_id
|
||||
where t.qc_type = #{qcType} and tl.item_id = #{itemId}
|
||||
limit 1;
|
||||
</select>
|
||||
|
||||
<insert id="insertQcTemplate" parameterType="QcTemplate" useGeneratedKeys="true" keyProperty="templateId">
|
||||
insert into qc_template
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
Loading…
Reference in New Issue
Block a user