From f56457b75944ef2def631ad5ed07f302123d3f75 Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期五, 28 十一月 2025 21:05:41 +0800
Subject: [PATCH] 小数精确到6位
---
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOutStockServiceImpl.java | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOutStockServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOutStockServiceImpl.java
index 9dc2808..df9a7dd 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOutStockServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOutStockServiceImpl.java
@@ -283,7 +283,7 @@
//taskItems涓烘嫞璐ф槑缁嗭紝浣滃弬鏁颁笂鎶�
Double summed = items.stream().mapToDouble(TaskItem::getAnfme).sum();
//鍔犱笂鍘嗗彶鎷f枡鏁伴噺
- Double pickQty = Math.round((orderItem.getQty() + summed) * 100) / 100.0;
+ Double pickQty = Math.round((orderItem.getQty() + summed) * 1000000) / 1000000.0;
Config config = configService.getOne(new LambdaQueryWrapper<Config>().eq(Config::getFlag, GlobalConfigCode.ALLOW_OVER_CHANGE));
//鍒ゆ柇鏄惁鍏佽瓒呮敹锛屼笉鍏佽瓒呮敹娣诲姞鎷掓敹鍒ゆ柇
if (!Objects.isNull(config)) {
@@ -334,14 +334,17 @@
if (taskItem.getAnfme().compareTo(serviceOne.getAnfme()) > 0) {
throw new CoolException("鎷h揣鏁伴噺瓒呭嚭褰撳墠绁ㄥ彿搴撳瓨鏁伴噺锛侊紒");
}
+
if (!Boolean.parseBoolean(config.getVal())) {
- if (item.getAnfme().compareTo(item.getQty() + taskItem.getAnfme()) < 0.0) {
+ Double v = Math.round((item.getQty() + taskItem.getAnfme()) * 1000000) / 1000000.0;
+ if (item.getAnfme().compareTo(v) < 0.0) {
+
throw new CoolException("鍓嶅綋鐗╂枡宸茶秴鍑哄彲鎷h寖鍥达紝璇锋牳瀵瑰悗鍐嶆搷浣滐紒锛�");
}
}
}
- Double picQty = Math.round((item.getQty() + taskItem.getAnfme()) * 100) / 100.0;
+ Double picQty = Math.round((item.getQty() + taskItem.getAnfme()) * 1000000) / 1000000.0;
item.setQty(picQty).setOrderId(order.getId()).setOrderItemId(orderItem.getId());
if (!taskItemService.updateById(item)) {
throw new CoolException("鐘舵�佸畬鎴愬け璐ワ紒锛�");
@@ -360,7 +363,7 @@
List<WkOrderItem> orderItems = asnOrderItemService.list(new LambdaQueryWrapper<WkOrderItem>().eq(WkOrderItem::getOrderId, params.getOrderId()));
Double total = orderItems.stream().mapToDouble(WkOrderItem::getQty).sum();
Double wkQty = orderItems.stream().mapToDouble(WkOrderItem::getWorkQty).sum();
- double v = order.getWorkQty().compareTo(wkQty) < 0 ? 0.0 : Math.round((total - wkQty) * 100) / 100.0;
+ double v = order.getWorkQty().compareTo(wkQty) < 0 ? 0.0 : Math.round((total - wkQty) * 1000000) / 1000000.0;
order.setQty(total).setWorkQty(v);
if (!asnOrderService.updateById(order)) {
throw new CoolException("璁㈠崟鏁伴噺鏇存柊澶辫触锛侊紒");
--
Gitblit v1.9.1