From 4a912ddfed47ffc057c1885993034bbcc77acc5c Mon Sep 17 00:00:00 2001 From: 野心家 <1051256694@qq.com> Date: 星期二, 11 七月 2023 17:22:50 +0800 Subject: [PATCH] 订单出库,对小数之间的减法误差进行修复 --- src/main/java/com/zy/asrs/controller/OutController.java | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/OutController.java b/src/main/java/com/zy/asrs/controller/OutController.java index b2dce00..1a824df 100644 --- a/src/main/java/com/zy/asrs/controller/OutController.java +++ b/src/main/java/com/zy/asrs/controller/OutController.java @@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; @@ -62,7 +63,7 @@ List<OrderDetl> orderDetls = orderDetlService.selectBatchIds(ids); List<LocDto> locDtos = new ArrayList<>(); for (OrderDetl o: orderDetls) { - if (o.getAnfme() == o.getWorkQty()){ + if (o.getAnfme().equals(o.getWorkQty())){ return R.error("鍑哄簱鐨勬槑缁嗕腑鏈夊凡鍑哄簱鐗╂枡"); } } @@ -86,8 +87,10 @@ locDto.setManu(locDetl.getManu()); locDtos.add(locDto); exist.add(locDetl.getLocNo()); + BigDecimal iss=new BigDecimal(Double.toString(issued)); + BigDecimal an=new BigDecimal(Double.toString(locDetl.getAnfme())); // 鍓╀綑寰呭嚭鏁伴噺閫掑噺 - issued = issued - locDetl.getAnfme(); + issued=iss.subtract(an).doubleValue(); } else { break; } -- Gitblit v1.9.1