| | |
| | | if (null == diffItem) { |
| | | return R.error("数据错误,未找到差异单明细"); |
| | | } |
| | | diffItem.setCheckQty(ckDiffItem.getCheckQty()).setReason(ckDiffItem.getReason()).setMemo(ckDiffItem.getMemo()); |
| | | } |
| | | |
| | | diffItem.setExceStatus(CheckDiffExceStatus.CHECK_DIFF_EXCE_STATUS_HOLD.val); |
| | | if (!checkDiffItemService.updateById(diffItem)) { |
| | | throw new CoolException("更新差异单明细失败"); |
| | | } |
| | | Double checkQty = Math.round((checkDiff.getCheckQty() + diffItem.getCheckQty()) * 10000) / 10000.0; |
| | | checkDiff.setCheckQty(checkQty); |
| | | // Double checkQty = Math.round((checkDiff.getCheckQty() + diffItem.getCheckQty()) * 10000) / 10000.0; |
| | | // checkDiff.setCheckQty(checkQty); |
| | | } |
| | | checkDiff.setExceStatus(CheckDiffExceStatus.CHECK_DIFF_EXCE_STATUS_HOLD.val); |
| | | |
| | | List<CheckDiffItem> diffItems = checkDiffItemService.list(new LambdaQueryWrapper<CheckDiffItem>() |
| | | .eq(CheckDiffItem::getCheckId, checkDiff.getId())); |
| | | if (diffItems.isEmpty()) { |
| | | throw new CoolException("盘点差异单明细不存在!!"); |
| | | } |
| | | Double sum = diffItems.stream().mapToDouble(CheckDiffItem::getCheckQty).sum(); |
| | | checkDiff.setExceStatus(CheckDiffExceStatus.CHECK_DIFF_EXCE_STATUS_HOLD.val).setCheckQty(sum); |
| | | if (!checkDiffService.updateById(checkDiff)) { |
| | | throw new CoolException("更新差异单失败"); |
| | | } |