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 |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 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 d8b524c..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
@@ -98,7 +98,7 @@
         if (null == task) {
             throw new CoolException("鏈壘鍒板鍣ㄥ彿瀵瑰簲浠诲姟");
         }
-        if (!task.getTaskStatus().equals(TaskStsType.AWAIT.id)) {
+        if (!task.getTaskStatus().equals(TaskStsType.WAVE_SEED.id)) {
             return R.error("浠诲姟鐘舵�佷笉鏄瓑寰呯‘璁�");
         }
         List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId()));
@@ -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,18 @@
                     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寖鍥达紝璇锋牳瀵瑰悗鍐嶆搷浣滐紒锛�");
                         }
                     }
                 }
 
-                item.setQty(item.getQty() + taskItem.getAnfme()).setOrderId(order.getId()).setOrderItemId(orderItem.getId());
+                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("鐘舵�佸畬鎴愬け璐ワ紒锛�");
                 }
@@ -357,9 +361,10 @@
         });
 
         List<WkOrderItem> orderItems = asnOrderItemService.list(new LambdaQueryWrapper<WkOrderItem>().eq(WkOrderItem::getOrderId, params.getOrderId()));
-        double total = orderItems.stream().mapToDouble(WkOrderItem::getQty).sum();
+        Double total = orderItems.stream().mapToDouble(WkOrderItem::getQty).sum();
         Double wkQty = orderItems.stream().mapToDouble(WkOrderItem::getWorkQty).sum();
-        order.setQty(total).setWorkQty(order.getWorkQty().compareTo(wkQty) < 0 ? 0.0 : (total - wkQty));
+        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