From 80b2925daf6b53aed54cd6b1de221f8cb5683450 Mon Sep 17 00:00:00 2001 From: erdanergou Date: Tue, 21 Mar 2023 14:43:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=93=E5=82=A8=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E6=8F=90=E4=BA=A4=E5=87=BA=E5=BA=93=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E6=97=B6=E7=94=B1=E8=87=AA=E5=B7=B1=E5=AE=A1=E6=89=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../depository_manage/controller/PageController.java | 8 ++++++-- .../service/impl/StockTakingServiceImpl.java | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java index ba4c2a22..8d851e1a 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java @@ -1965,7 +1965,9 @@ public class PageController { if ("-1".equals(unit)) { // 如果是基础单位 if (inventoryById.getPrice() != null) { - sumPrice += (inventoryById.getPrice() * recordMinP.getQuantity()); + BigDecimal bd = BigDecimal.valueOf(inventoryById.getPrice() * recordMinP.getQuantity()); + double v = bd.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + sumPrice += v; } else { sumPrice += 0.0; } @@ -1982,7 +1984,9 @@ public class PageController { // 获取当前拆单记录与基础单位的进制 int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); if (inventoryById.getPrice() != null) { - sumPrice += (inventoryById.getPrice() / scale * recordMinP.getQuantity()); + BigDecimal bd = BigDecimal.valueOf((inventoryById.getPrice() / scale * recordMinP.getQuantity())); + double v = bd.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + sumPrice += v; } else { sumPrice += 0.0; } diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java index 25ddf541..789ff843 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java @@ -900,7 +900,8 @@ public class StockTakingServiceImpl implements StockTakingService { placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); - } else { + } + else { // 如果是拆单单位 // 用于查找对应的拆单记录 Map paramForSplitInfo = new HashMap<>(); @@ -1021,7 +1022,8 @@ public class StockTakingServiceImpl implements StockTakingService { } - } else { + } + else { // 如果盘点后的库存数非法 placeById.setQuantity(placeById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity());