From 4c81a2d9dce7f76acae80b45ea5aed22f811bd12 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Wed, 28 Aug 2024 13:11:14 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E6=96=99=E6=8E=A5=E6=94=B6=E6=97=B6,?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E7=BB=93=E7=AE=97=E8=A1=A8=E6=8B=BF=E5=88=B0?= =?UTF-8?q?=E5=BE=85=E9=80=80=E6=96=99=E6=95=B0=E9=87=8F,=E9=98=B2?= =?UTF-8?q?=E6=AD=A2=E5=A4=9A=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sgzb/app/service/impl/BackReceiveServiceImpl.java | 2 +- .../main/resources/mapper/app/BackReceiveMapper.xml | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java index 2c8bf27..24213cc 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java @@ -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) { diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/app/BackReceiveMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/app/BackReceiveMapper.xml index b1e3960..996f080 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/app/BackReceiveMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/app/BackReceiveMapper.xml @@ -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)) < 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}