缺陷记录

This commit is contained in:
JinLu.Yin 2022-05-20 23:42:33 +08:00
parent 99746467f4
commit a012317432
7 changed files with 210 additions and 21 deletions

View File

@ -2,8 +2,13 @@ package com.ktg.mes.qc.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; 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.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; 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.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
@ -80,17 +85,39 @@ public class QcIqcDefectController extends BaseController
return toAjax(qcIqcDefectService.insertQcIqcDefect(qcIqcDefect)); return toAjax(qcIqcDefectService.insertQcIqcDefect(qcIqcDefect));
} }
/** /**
* 修改来料检验单缺陷记录 * 修改来料检验单缺陷记录
*/ */
@PreAuthorize("@ss.hasPermi('mes:qc:iqcdefect:edit')") @PreAuthorize("@ss.hasPermi('mes:qc:iqcdefect:edit')")
@Log(title = "来料检验单缺陷记录", businessType = BusinessType.UPDATE) @Log(title = "来料检验单缺陷记录", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody QcIqcDefect qcIqcDefect) public AjaxResult updateList(@Validated @RequestBody ValidList<QcIqcDefect> defects){
{ if(CollUtil.isNotEmpty(defects)){
return toAjax(qcIqcDefectService.updateQcIqcDefect(qcIqcDefect)); 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();
} }
/** /**
* 删除来料检验单缺陷记录 * 删除来料检验单缺陷记录
*/ */

View File

@ -5,6 +5,9 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel; import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity; import com.ktg.common.core.domain.BaseEntity;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/** /**
* 来料检验单缺陷记录对象 qc_iqc_defect * 来料检验单缺陷记录对象 qc_iqc_defect
* *
@ -27,10 +30,12 @@ public class QcIqcDefect extends BaseEntity
private Long lineId; private Long lineId;
/** 缺陷描述 */ /** 缺陷描述 */
@NotBlank(message = "缺陷描述不能为空")
@Excel(name = "缺陷描述") @Excel(name = "缺陷描述")
private String defectName; private String defectName;
/** 缺陷等级 */ /** 缺陷等级 */
@NotBlank(message = "请选择缺陷等级")
@Excel(name = "缺陷等级") @Excel(name = "缺陷等级")
private String defectLevel; private String defectLevel;
@ -38,6 +43,8 @@ public class QcIqcDefect extends BaseEntity
@Excel(name = "缺陷数量") @Excel(name = "缺陷数量")
private Long defectQuantity; private Long defectQuantity;
private String deleteflag;
/** 预留字段1 */ /** 预留字段1 */
private String attr1; private String attr1;
@ -109,7 +116,15 @@ public class QcIqcDefect extends BaseEntity
this.attr1 = attr1; this.attr1 = attr1;
} }
public String getAttr1() public String getDeleteflag() {
return deleteflag;
}
public void setDeleteflag(String deleteflag) {
this.deleteflag = deleteflag;
}
public String getAttr1()
{ {
return attr1; return attr1;
} }
@ -143,22 +158,18 @@ public class QcIqcDefect extends BaseEntity
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return "QcIqcDefect{" +
.append("recordId", getRecordId()) "recordId=" + recordId +
.append("iqcId", getIqcId()) ", iqcId=" + iqcId +
.append("lineId", getLineId()) ", lineId=" + lineId +
.append("defectName", getDefectName()) ", defectName='" + defectName + '\'' +
.append("defectLevel", getDefectLevel()) ", defectLevel='" + defectLevel + '\'' +
.append("defectQuantity", getDefectQuantity()) ", defectQuantity=" + defectQuantity +
.append("remark", getRemark()) ", deleteflag='" + deleteflag + '\'' +
.append("attr1", getAttr1()) ", attr1='" + attr1 + '\'' +
.append("attr2", getAttr2()) ", attr2='" + attr2 + '\'' +
.append("attr3", getAttr3()) ", attr3=" + attr3 +
.append("attr4", getAttr4()) ", attr4=" + attr4 +
.append("createBy", getCreateBy()) '}';
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
} }
} }

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

View File

@ -51,6 +51,7 @@ public interface QcIqcDefectMapper
*/ */
public int deleteQcIqcDefectByRecordId(Long recordId); public int deleteQcIqcDefectByRecordId(Long recordId);
public int deleteByIqcIdLineId(QcIqcDefect qcIqcDefect);
public int deleteByIqcId(Long iqcId); public int deleteByIqcId(Long iqcId);

View File

@ -58,6 +58,13 @@ public interface IQcIqcDefectService
*/ */
public int deleteByIqcId(Long iqcID); public int deleteByIqcId(Long iqcID);
/**
* 删除行下所有缺陷记录
* @param qcIqcDefect
* @return
*/
public int deleteByIqcIdLineId(QcIqcDefect qcIqcDefect);
/** /**
* 删除来料检验单缺陷记录信息 * 删除来料检验单缺陷记录信息
* *

View File

@ -87,6 +87,11 @@ public class QcIqcDefectServiceImpl implements IQcIqcDefectService
return qcIqcDefectMapper.deleteByIqcId(iqcID); return qcIqcDefectMapper.deleteByIqcId(iqcID);
} }
@Override
public int deleteByIqcIdLineId(QcIqcDefect qcIqcDefect) {
return qcIqcDefectMapper.deleteByIqcIdLineId(qcIqcDefect);
}
/** /**
* 删除来料检验单缺陷记录信息 * 删除来料检验单缺陷记录信息
* *

View File

@ -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="defectLevel != null and defectLevel != ''"> and defect_level = #{defectLevel}</if>
<if test="defectQuantity != null "> and defect_quantity = #{defectQuantity}</if> <if test="defectQuantity != null "> and defect_quantity = #{defectQuantity}</if>
</where> </where>
order by create_time desc
</select> </select>
<select id="selectQcIqcDefectByRecordId" parameterType="Long" resultMap="QcIqcDefectResult"> <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 from qc_iqc_defect where iqc_id = #{iqcId}
</delete> </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 id="deleteQcIqcDefectByRecordIds" parameterType="String">
delete from qc_iqc_defect where record_id in delete from qc_iqc_defect where record_id in
<foreach item="recordId" collection="array" open="(" separator="," close=")"> <foreach item="recordId" collection="array" open="(" separator="," close=")">