diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java index 5efc29f1..222fb844 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java @@ -127,11 +127,15 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { } } } - List list = backApplyInfoMapper.selectByCode(details.getParentId()); - if (CollectionUtils.isNotEmpty(list)) { - // 将goodNum和badNum分别相加 - details.setGoodNum(list.stream().map(MaCodeVo::getGoodNum).reduce(BigDecimal.ZERO, BigDecimal::add)); - details.setBadNum(list.stream().map(MaCodeVo::getBadNum).reduce(BigDecimal.ZERO, BigDecimal::add)); + if ("0".equals(details.getManageType())) { + List list = backApplyInfoMapper.selectByCode(details.getParentId()); + if (CollectionUtils.isNotEmpty(list)) { + // 过滤出list中typeId和details.getTypeId相等的MaCodeVo对象 + list = list.stream().filter(type -> type.getTypeId().equals(details.getTypeId().toString())).collect(Collectors.toList()); + // 将goodNum和badNum分别相加 + details.setGoodNum(list.stream().map(MaCodeVo::getGoodNum).reduce(BigDecimal.ZERO, BigDecimal::add)); + details.setBadNum(list.stream().map(MaCodeVo::getBadNum).reduce(BigDecimal.ZERO, BigDecimal::add)); + } } // 为每个退料详情设置附件信息 setBmFileInfosForDetails(details, bmFileInfos); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml index d28a6763..41b20f44 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml @@ -178,7 +178,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ba.remark AS remark, ba.ap_detection AS apDetection, ba.bad_num AS badNum, - ba.good_num AS goodNum + ba.good_num AS goodNum, + mt.manage_type AS manageType FROM back_apply_details ba LEFT JOIN ma_type mt ON mt.type_id = ba.type_id and mt.del_flag = 0 @@ -209,7 +210,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM back_check_details bcd left join ma_machine mm on bcd.ma_id = mm.ma_id - left join ma_type mt ON mt.type_id = mm.type_id and mt.del_flag = 0 + left join ma_type mt ON mt.type_id = bcd.type_id and mt.del_flag = 0 left join ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = 0 left join ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = 0 where bcd.parent_id = #{id}