From dfb97801e895fee019226f4c4f7a23bf9fac006b Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期五, 28 十一月 2025 15:40:50 +0800
Subject: [PATCH] 快带拣货状态变更

---
 rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOutStockServiceImpl.java |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 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 52a5c8c..9dc2808 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()));
@@ -280,7 +280,7 @@
             if (Objects.isNull(orderItem)) {
                 throw new CoolException("鏁版嵁閿欒锛屾嫞鏂欎笉鍦ㄥ崟鎹渶姹備腑锛侊紒");
             }
-
+            //taskItems涓烘嫞璐ф槑缁嗭紝浣滃弬鏁颁笂鎶�
             Double summed = items.stream().mapToDouble(TaskItem::getAnfme).sum();
             //鍔犱笂鍘嗗彶鎷f枡鏁伴噺
             Double pickQty = Math.round((orderItem.getQty() + summed) * 100) / 100.0;
@@ -326,6 +326,14 @@
                 TaskItem item = taskItemService.getById(taskItem.getId());
                 //鍒ゆ柇鏄惁鍏佽瓒呮敹锛屼笉鍏佽瓒呮敹娣诲姞鎷掓敹鍒ゆ柇
                 if (!Objects.isNull(config)) {
+                    LocItemWorking serviceOne = locItemWorkingService.getOne(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getFieldsIndex, item.getFieldsIndex()));
+                    if (Objects.isNull(serviceOne)) {
+                        throw new CoolException("缂撳瓨鏁版嵁涓㈠け锛侊紒");
+                    }
+                    //涓嶇鏄惁鍏佽瓒呮敹锛岄兘闇�鍒ゆ柇鏄惁瓒呭嚭搴撳瓨鑼冨洿
+                    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) {
                             throw new CoolException("鍓嶅綋鐗╂枡宸茶秴鍑哄彲鎷h寖鍥达紝璇锋牳瀵瑰悗鍐嶆搷浣滐紒锛�");
@@ -333,13 +341,15 @@
                     }
                 }
 
-                item.setQty(item.getQty() + taskItem.getAnfme()).setOrderId(order.getId()).setOrderItemId(orderItem.getId());
+                Double picQty = Math.round((item.getQty() + taskItem.getAnfme()) * 100) / 100.0;
+                item.setQty(picQty).setOrderId(order.getId()).setOrderItemId(orderItem.getId());
                 if (!taskItemService.updateById(item)) {
                     throw new CoolException("鐘舵�佸畬鎴愬け璐ワ紒锛�");
                 }
                 StockItem stockItem = new StockItem();
-                BeanUtils.copyProperties(taskItem, stockItem);
-                stockItem.setStockId(stock.getId()).setStockCode(stock.getCode()).setSourceItemId(orderItem.getId());
+                BeanUtils.copyProperties(item, stockItem);
+                //taskItem涓轰笂鎶ユ暟鎹�
+                stockItem.setStockId(stock.getId()).setAnfme(taskItem.getAnfme()).setStockCode(stock.getCode()).setSourceItemId(orderItem.getId());
                 stockItems.add(stockItem);
             });
             if (!stockItemService.saveBatch(stockItems)) {
@@ -348,9 +358,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) * 100) / 100.0;
+        order.setQty(total).setWorkQty(v);
         if (!asnOrderService.updateById(order)) {
             throw new CoolException("璁㈠崟鏁伴噺鏇存柊澶辫触锛侊紒");
         }

--
Gitblit v1.9.1