退料接收时,检查结算表拿到待退料数量,防止多退

This commit is contained in:
sxu 2024-08-28 13:11:14 +08:00
parent 3aaa1188b0
commit 4c81a2d9dc
2 changed files with 12 additions and 1 deletions

View File

@ -196,7 +196,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
if (maxBackNum < passNum + maintenanceNum + scrapNum) {
throw new RuntimeException("提交退料数量大于最大退料数,可能您的退料已被别人退掉了");
}
boolean allZeros = list.stream().allMatch(n -> Double.valueOf(n.getMaxBackNum()).intValue() == 0);
boolean allZeros = list.stream().allMatch(n -> Double.valueOf(n.getNum()).intValue() == 0);
if (allZeros) {
res = updateTaskStatus(taskId, 40);
if (res == 0) {

View File

@ -730,6 +730,7 @@
bad.pre_num as preNum,
bad.audit_num as auditNum,
bad.status as status,
CASE WHEN (IFNULL(sai.num, 0)-IFNULL(aa.back_num,0)) &lt; 0 THEN 0 ELSE (IFNULL(sai.num, 0)-IFNULL(aa.back_num,0)) END as num,
IFNULL(sai.num, 0) as max_back_num,
mt.manage_type as manageType,
mtk.user_id,
@ -743,6 +744,16 @@
LEFT JOIN ma_type mt on mt.type_id=bad.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id=mt.parent_id
LEFT JOIN ma_type_keeper mtk on mt.type_id=mtk.type_id
LEFT JOIN (
SELECT
type_id as typeId,
SUM(IFNULL(back_num,0)) as back_num
FROM
back_check_details
WHERE
parent_id=#{parentId} and is_finished is null
GROUP BY type_id
) aa on aa.typeId=bad.type_id
WHERE
bai.id=#{parentId}
<if test="typeId != null and typeId != ''">