来料检验单根据新的缺陷记录表更新对应的数值
This commit is contained in:
parent
929632ff22
commit
81117ecbd7
@ -45,6 +45,11 @@ public interface QcIqcMapper
|
|||||||
*/
|
*/
|
||||||
public int updateQcIqc(QcIqc qcIqc);
|
public int updateQcIqc(QcIqc qcIqc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据缺陷记录更新头上的缺陷数量和比率
|
||||||
|
* @param iqcId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public int updateCrMajMinQuaAndRate(Long iqcId);
|
public int updateCrMajMinQuaAndRate(Long iqcId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,12 +58,6 @@ public interface IQcIpqcService
|
|||||||
*/
|
*/
|
||||||
public int updateCrMajMinQuaAndRate(Long qcId);
|
public int updateCrMajMinQuaAndRate(Long qcId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据缺陷记录更新头上的缺陷数量和缺陷率
|
|
||||||
* @param qcIpqc
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int updateCrMajMinQuaAndRate(QcIpqc qcIpqc);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除过程检验单
|
* 批量删除过程检验单
|
||||||
|
@ -88,6 +88,7 @@ public class QcIpqcServiceImpl implements IQcIpqcService
|
|||||||
return qcIpqcMapper.updateCrMajMinQuaAndRate(qcId);
|
return qcIpqcMapper.updateCrMajMinQuaAndRate(qcId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除过程检验单
|
* 批量删除过程检验单
|
||||||
*
|
*
|
||||||
|
@ -117,21 +117,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<update id="updateCrMajMinQuantity" parameterType="QcIqcLine">
|
<update id="updateCrMajMinQuantity" parameterType="QcIqcLine">
|
||||||
UPDATE qc_iqc_line a
|
UPDATE qc_iqc_line a
|
||||||
INNER JOIN (
|
INNER JOIN (
|
||||||
SELECT SUM(CASE WHEN defect_level = 'CR' THEN defect_quantity ELSE 0 END ) AS cr_quantity,
|
SELECT SUM(CASE WHEN defect_level = 'CR' THEN defect_quantity ELSE 0 END ) AS cr_quantity,
|
||||||
SUM(CASE WHEN defect_level = 'MAJ' THEN defect_quantity ELSE 0 END) AS maj_quantity,
|
SUM(CASE WHEN defect_level = 'MAJ' THEN defect_quantity ELSE 0 END) AS maj_quantity,
|
||||||
SUM(CASE WHEN defect_level = 'MIN' THEN defect_quantity ELSE 0 END) AS min_quantity,
|
SUM(CASE WHEN defect_level = 'MIN' THEN defect_quantity ELSE 0 END) AS min_quantity,
|
||||||
qid.`iqc_id`,
|
qid.`qc_id` as 'iqc_id',
|
||||||
qid.`line_id`
|
qid.`line_id`
|
||||||
FROM qc_iqc_defect qid
|
FROM qc_defect_record qid
|
||||||
WHERE qid.iqc_id = #{iqcId}
|
WHERE qid.qc_id = #{iqcId}
|
||||||
AND qid.line_id = #{lineId}
|
AND qid.line_id = #{lineId}
|
||||||
GROUP BY qid.iqc_id,qid.line_id
|
AND qid.qc_type = 'IQC'
|
||||||
)b
|
GROUP BY qid.qc_id,qid.line_id
|
||||||
|
)b
|
||||||
ON a.iqc_id = b.iqc_id AND a.line_id = b.line_id
|
ON a.iqc_id = b.iqc_id AND a.line_id = b.line_id
|
||||||
SET a.cr_quantity=b.cr_quantity,a.maj_quantity=b.maj_quantity,a.min_quantity=b.min_quantity
|
SET a.cr_quantity=b.cr_quantity,a.maj_quantity=b.maj_quantity,a.min_quantity=b.min_quantity
|
||||||
WHERE a.iqc_id = #{iqcId}
|
WHERE a.iqc_id = #{iqcId}
|
||||||
AND a.line_id = #{lineId}
|
AND a.line_id = #{lineId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateQcIqcLine" parameterType="QcIqcLine">
|
<update id="updateQcIqcLine" parameterType="QcIqcLine">
|
||||||
|
@ -182,22 +182,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<update id="updateCrMajMinQuaAndRate" parameterType="Long">
|
<update id="updateCrMajMinQuaAndRate" parameterType="Long">
|
||||||
UPDATE qc_iqc a
|
UPDATE qc_iqc a
|
||||||
INNER JOIN (
|
INNER JOIN (
|
||||||
|
|
||||||
SELECT SUM(CASE WHEN defect_level = 'CR' THEN defect_quantity ELSE 0 END ) AS cr_quantity,
|
SELECT SUM(CASE WHEN defect_level = 'CR' THEN defect_quantity ELSE 0 END ) AS cr_quantity,
|
||||||
SUM(CASE WHEN defect_level = 'MAJ' THEN defect_quantity ELSE 0 END) AS maj_quantity,
|
SUM(CASE WHEN defect_level = 'MAJ' THEN defect_quantity ELSE 0 END) AS maj_quantity,
|
||||||
SUM(CASE WHEN defect_level = 'MIN' THEN defect_quantity ELSE 0 END) AS min_quantity,
|
SUM(CASE WHEN defect_level = 'MIN' THEN defect_quantity ELSE 0 END) AS min_quantity,
|
||||||
qid.`iqc_id`
|
qid.`qc_id` as 'iqc_id'
|
||||||
FROM qc_iqc_defect qid
|
FROM qc_defect_record qid
|
||||||
WHERE qid.iqc_id = #{iqc_id}
|
WHERE qid.qc_id = #{iqcId}
|
||||||
GROUP BY qid.iqc_id
|
and qc_type = 'IQC'
|
||||||
) b
|
GROUP BY qid.qc_id
|
||||||
|
) b
|
||||||
ON a.`iqc_id` = b.iqc_id
|
ON a.`iqc_id` = b.iqc_id
|
||||||
SET a.cr_quantity=b.cr_quantity,a.maj_quantity=b.maj_quantity,a.min_quantity=b.min_quantity,
|
SET a.cr_quantity=b.cr_quantity,a.maj_quantity=b.maj_quantity,a.min_quantity=b.min_quantity,
|
||||||
a.`cr_rate`= ROUND(b.cr_quantity/a.`quantity_check`*100,2),
|
a.`cr_rate`= ROUND(b.cr_quantity/a.`quantity_check`*100,2),
|
||||||
a.`maj_rate`= ROUND(b.maj_quantity/a.`quantity_check`*100,2),
|
a.`maj_rate`= ROUND(b.maj_quantity/a.`quantity_check`*100,2),
|
||||||
a.`min_rate`= ROUND(b.min_quantity/a.`quantity_check`*100,2)
|
a.`min_rate`= ROUND(b.min_quantity/a.`quantity_check`*100,2)
|
||||||
WHERE a.iqc_id = #{iqc_id}
|
WHERE a.iqc_id = #{iqcId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user