From 62bfb600d468e16e645624b4cb1e80c1ffbdd0c6 Mon Sep 17 00:00:00 2001 From: mashuai Date: Tue, 19 Aug 2025 13:21:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/BackApplyInfoServiceImpl.java | 35 ++++++------------- .../material/back/BackApplyInfoMapper.xml | 4 ++- 2 files changed, 14 insertions(+), 25 deletions(-) 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 c44756e1..e247b610 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 @@ -1163,6 +1163,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { } else if (dto != null && dto.getBackApplyInfo() != null && dto.getBackApplyInfo().getId() != null && ((dto.getBackApplyDetails() != null) || CollectionUtils.isNotEmpty(dto.getBackApplyDetailsList()))) { if (dto.getBackApplyDetails() != null) { + //编码退料入库 dto.getBackApplyInfo().setTypeId(String.valueOf(dto.getBackApplyDetails().getTypeId())); result = getResultMaCode(dto, result); } @@ -1335,44 +1336,30 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { } // 设置公共字段 setCommonFields(details, dto.getBackApplyInfo().getId()); - // 插入 CheckDetails //根据id查询back_check_details表,看数据是否存在,存在则对数量进行更新,不存在则插入 for(MaCodeDto maCodeDto : details.getMaVos()){ - BackApplyDetails backInfo = new BackApplyDetails(); - backInfo = details; - backInfo.setMaId(maCodeDto.getMaId()); - backInfo.setMaCode(maCodeDto.getMaCode()); - BackApplyDetails checkDetails = backApplyInfoMapper.selectCheckDetails(details); - if (checkDetails != null) { - checkDetails.setId(checkDetails.getId()); - result += backApplyInfoMapper.updateCheck(checkDetails); + details.setPreNum(BigDecimal.ONE); + details.setMaId(maCodeDto.getMaId()); + // 如果details.getGoodNum()大于0 + if (details.getGoodNum().compareTo(BigDecimal.ZERO) > 0) { + details.setGoodNum(BigDecimal.ONE); + details.setBadNum(BigDecimal.ZERO); } else { - result += backApplyInfoMapper.insertCheckDetails(details); + details.setGoodNum(BigDecimal.ZERO); + details.setBadNum(BigDecimal.ONE); } + result += backApplyInfoMapper.insertCheckDetails(details); if (CollectionUtils.isNotEmpty(details.getBmFileInfos())) { for (BmFileInfo bmFileInfo : details.getBmFileInfos()) { bmFileInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); bmFileInfo.setCreateTime(DateUtils.getNowDate()); bmFileInfo.setTaskId(details.getId()); bmFileInfo.setTaskType(3); - bmFileInfo.setModelId(backInfo.getMaId()); + bmFileInfo.setModelId(maCodeDto.getMaId()); result += bmFileInfoMapper.insertBmFileInfo(bmFileInfo); } } } - //更新ma_machine表状态为3(退料检修) - // result += machineMapper.updateStatus(details.getMaId(), MaMachineStatusEnum.BACK_REPAIR.getStatus()); -// if (CollectionUtils.isNotEmpty(details.getBmFileInfos())) { -// for (BmFileInfo bmFileInfo : details.getBmFileInfos()) { -// bmFileInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); -// bmFileInfo.setCreateTime(DateUtils.getNowDate()); -// bmFileInfo.setTaskId(details.getId()); -// bmFileInfo.setTaskType(3); -// bmFileInfo.setModelId(details.getMaId()); -// result += bmFileInfoMapper.insertBmFileInfo(bmFileInfo); -// } -// } - return result; } 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 75a9fbf6..cf14afc9 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 @@ -740,7 +740,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - update back_apply_details set pre_num = pre_num + COALESCE(#{preNum} ,0) where id = #{id} + update back_apply_details set pre_num = pre_num + COALESCE(#{preNum} ,0) , + audit_num = audit_num + COALESCE(#{preNum} ,0) + where id = #{id}