This commit is contained in:
mashuai 2025-08-19 13:21:06 +08:00
parent cf4ea24379
commit 62bfb600d4
2 changed files with 14 additions and 25 deletions

View File

@ -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;
}

View File

@ -740,7 +740,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<update id="updateDetails">
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}
</update>
<update id="updateCheck">