缺陷记录
This commit is contained in:
parent
99746467f4
commit
a012317432
@ -2,8 +2,13 @@ package com.ktg.mes.qc.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import com.ktg.mes.qc.domain.ValidList;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
@ -80,17 +85,39 @@ public class QcIqcDefectController extends BaseController
|
||||
return toAjax(qcIqcDefectService.insertQcIqcDefect(qcIqcDefect));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改来料检验单缺陷记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes:qc:iqcdefect:edit')")
|
||||
@Log(title = "来料检验单缺陷记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody QcIqcDefect qcIqcDefect)
|
||||
{
|
||||
return toAjax(qcIqcDefectService.updateQcIqcDefect(qcIqcDefect));
|
||||
public AjaxResult updateList(@Validated @RequestBody ValidList<QcIqcDefect> defects){
|
||||
if(CollUtil.isNotEmpty(defects)){
|
||||
for (QcIqcDefect defect: defects
|
||||
) {
|
||||
if(StringUtils.isNotNull(defect.getRecordId())){
|
||||
if("Y".equals(defect.getDeleteflag())){
|
||||
qcIqcDefectService.deleteQcIqcDefectByRecordId(defect.getRecordId());
|
||||
}else {
|
||||
qcIqcDefectService.updateQcIqcDefect(defect);
|
||||
}
|
||||
}else {
|
||||
if("Y".equals(defect.getDeleteflag())){
|
||||
//doNothing
|
||||
}else {
|
||||
qcIqcDefectService.insertQcIqcDefect(defect);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除来料检验单缺陷记录
|
||||
*/
|
||||
|
@ -5,6 +5,9 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ktg.common.annotation.Excel;
|
||||
import com.ktg.common.core.domain.BaseEntity;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 来料检验单缺陷记录对象 qc_iqc_defect
|
||||
*
|
||||
@ -27,10 +30,12 @@ public class QcIqcDefect extends BaseEntity
|
||||
private Long lineId;
|
||||
|
||||
/** 缺陷描述 */
|
||||
@NotBlank(message = "缺陷描述不能为空")
|
||||
@Excel(name = "缺陷描述")
|
||||
private String defectName;
|
||||
|
||||
/** 缺陷等级 */
|
||||
@NotBlank(message = "请选择缺陷等级")
|
||||
@Excel(name = "缺陷等级")
|
||||
private String defectLevel;
|
||||
|
||||
@ -38,6 +43,8 @@ public class QcIqcDefect extends BaseEntity
|
||||
@Excel(name = "缺陷数量")
|
||||
private Long defectQuantity;
|
||||
|
||||
private String deleteflag;
|
||||
|
||||
/** 预留字段1 */
|
||||
private String attr1;
|
||||
|
||||
@ -109,7 +116,15 @@ public class QcIqcDefect extends BaseEntity
|
||||
this.attr1 = attr1;
|
||||
}
|
||||
|
||||
public String getAttr1()
|
||||
public String getDeleteflag() {
|
||||
return deleteflag;
|
||||
}
|
||||
|
||||
public void setDeleteflag(String deleteflag) {
|
||||
this.deleteflag = deleteflag;
|
||||
}
|
||||
|
||||
public String getAttr1()
|
||||
{
|
||||
return attr1;
|
||||
}
|
||||
@ -143,22 +158,18 @@ public class QcIqcDefect extends BaseEntity
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("recordId", getRecordId())
|
||||
.append("iqcId", getIqcId())
|
||||
.append("lineId", getLineId())
|
||||
.append("defectName", getDefectName())
|
||||
.append("defectLevel", getDefectLevel())
|
||||
.append("defectQuantity", getDefectQuantity())
|
||||
.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 "QcIqcDefect{" +
|
||||
"recordId=" + recordId +
|
||||
", iqcId=" + iqcId +
|
||||
", lineId=" + lineId +
|
||||
", defectName='" + defectName + '\'' +
|
||||
", defectLevel='" + defectLevel + '\'' +
|
||||
", defectQuantity=" + defectQuantity +
|
||||
", deleteflag='" + deleteflag + '\'' +
|
||||
", attr1='" + attr1 + '\'' +
|
||||
", attr2='" + attr2 + '\'' +
|
||||
", attr3=" + attr3 +
|
||||
", attr4=" + attr4 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
133
ktg-mes/src/main/java/com/ktg/mes/qc/domain/ValidList.java
Normal file
133
ktg-mes/src/main/java/com/ktg/mes/qc/domain/ValidList.java
Normal file
@ -0,0 +1,133 @@
|
||||
package com.ktg.mes.qc.domain;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.*;
|
||||
public class ValidList<E> implements List<E> {
|
||||
|
||||
@Valid
|
||||
private List<E> list = new LinkedList<>();
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return list.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return list.contains(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<E> iterator() {
|
||||
return list.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return list.toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T[] toArray(T[] a) {
|
||||
return list.toArray(a);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(E e) {
|
||||
return list.add(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return list.remove(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(Collection<?> c) {
|
||||
return list.containsAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(Collection<? extends E> c) {
|
||||
return list.addAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(int index, Collection<? extends E> c) {
|
||||
return list.addAll(index, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(Collection<?> c) {
|
||||
return list.removeAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(Collection<?> c) {
|
||||
return list.retainAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public E get(int index) {
|
||||
return list.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public E set(int index, E element) {
|
||||
return list.set(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int index, E element) {
|
||||
list.add(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public E remove(int index) {
|
||||
return list.remove(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int indexOf(Object o) {
|
||||
return list.indexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lastIndexOf(Object o) {
|
||||
return list.lastIndexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListIterator<E> listIterator() {
|
||||
return list.listIterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListIterator<E> listIterator(int index) {
|
||||
return list.listIterator(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
return list.subList(fromIndex, toIndex);
|
||||
}
|
||||
|
||||
public List<E> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<E> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
}
|
@ -51,6 +51,7 @@ public interface QcIqcDefectMapper
|
||||
*/
|
||||
public int deleteQcIqcDefectByRecordId(Long recordId);
|
||||
|
||||
public int deleteByIqcIdLineId(QcIqcDefect qcIqcDefect);
|
||||
|
||||
public int deleteByIqcId(Long iqcId);
|
||||
|
||||
|
@ -58,6 +58,13 @@ public interface IQcIqcDefectService
|
||||
*/
|
||||
public int deleteByIqcId(Long iqcID);
|
||||
|
||||
/**
|
||||
* 删除行下所有缺陷记录
|
||||
* @param qcIqcDefect
|
||||
* @return
|
||||
*/
|
||||
public int deleteByIqcIdLineId(QcIqcDefect qcIqcDefect);
|
||||
|
||||
/**
|
||||
* 删除来料检验单缺陷记录信息
|
||||
*
|
||||
|
@ -87,6 +87,11 @@ public class QcIqcDefectServiceImpl implements IQcIqcDefectService
|
||||
return qcIqcDefectMapper.deleteByIqcId(iqcID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByIqcIdLineId(QcIqcDefect qcIqcDefect) {
|
||||
return qcIqcDefectMapper.deleteByIqcIdLineId(qcIqcDefect);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除来料检验单缺陷记录信息
|
||||
*
|
||||
|
@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="defectLevel != null and defectLevel != ''"> and defect_level = #{defectLevel}</if>
|
||||
<if test="defectQuantity != null "> and defect_quantity = #{defectQuantity}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectQcIqcDefectByRecordId" parameterType="Long" resultMap="QcIqcDefectResult">
|
||||
@ -107,6 +108,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
delete from qc_iqc_defect where iqc_id = #{iqcId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByIqcIdLineId" parameterType="QcIqcDefect">
|
||||
delete from qc_iqc_defect where iqc_id = #{iqcId} and line_id =#{lineId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteQcIqcDefectByRecordIds" parameterType="String">
|
||||
delete from qc_iqc_defect where record_id in
|
||||
<foreach item="recordId" collection="array" open="(" separator="," close=")">
|
||||
|
Loading…
Reference in New Issue
Block a user