From 1068673dcf41cdf7a7a06a26aaeb5652d734eb2d Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期四, 27 十一月 2025 09:36:08 +0800
Subject: [PATCH] 添加是否允许超收判断 出库上报明细问题修复

---
 rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOutStockServiceImpl.java |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 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..d8b524c 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
@@ -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寖鍥达紝璇锋牳瀵瑰悗鍐嶆搷浣滐紒锛�");
@@ -338,8 +346,9 @@
                     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)) {

--
Gitblit v1.9.1