From 5ea5d085cc7c9a1aea3d4ee7e3a9c93ea05a2eb1 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期四, 17 七月 2025 16:35:16 +0800
Subject: [PATCH] 盘点功能优化

---
 rsf-admin/src/page/orders/check/CheckOrderPub.jsx                                               |    3 +--
 rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/CheckOrderServiceImpl.java |   38 ++++++++++++++++++++++++++++++++++++++
 rsf-admin/src/i18n/zh.js                                                                        |    4 ++--
 3 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/rsf-admin/src/i18n/zh.js b/rsf-admin/src/i18n/zh.js
index b1cefa6..b98d8cf 100644
--- a/rsf-admin/src/i18n/zh.js
+++ b/rsf-admin/src/i18n/zh.js
@@ -662,8 +662,8 @@
                 anfme: "璁″垝鐩樼偣鏁�",
                 stockUnit: "鍗曚綅",
                 unit: '鍗曚綅',
-                workQty: '宸茬洏鐐规暟',
-                qty: "宸茬洏鐐规暟",
+                workQty: '宸蹭笅鍙�',
+                qty: "宸茬洏鐐�",
                 splrBatch: "鎵规",
                 splrCode: "渚涘簲鍟嗙紪鐮�",
                 splrName: "渚涘簲鍟�",
diff --git a/rsf-admin/src/page/orders/check/CheckOrderPub.jsx b/rsf-admin/src/page/orders/check/CheckOrderPub.jsx
index 242a1e7..54babf4 100644
--- a/rsf-admin/src/page/orders/check/CheckOrderPub.jsx
+++ b/rsf-admin/src/page/orders/check/CheckOrderPub.jsx
@@ -89,9 +89,8 @@
             setSelectedMatnr(mas);
             // onUnselectItems()
         }
-
         return (
-            <Button label="toolbar.confirm" size="medium" onClick={handleRowClick} />
+            record.exceStatus != 3 ? <><Button label="toolbar.confirm" size="medium" onClick={handleRowClick} /></> : <></>
         )
     };
 
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/CheckOrderServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/CheckOrderServiceImpl.java
index e94be30..e2893b3 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/CheckOrderServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/CheckOrderServiceImpl.java
@@ -48,6 +48,8 @@
     private LocServiceImpl locService;
     @Autowired
     private TaskItemServiceImpl taskItemService;
+    @Autowired
+    private CheckOrderService checkOrderService;
 
     /**
      * @author Ryan
@@ -319,10 +321,46 @@
                             .setCreateTime(new Date())
                             .setPlatItemId(checkParam.getPlatItemId());
                     items.add(taskItem);
+
+                    if (!checkOrderItemService.update(new LambdaUpdateWrapper<WkOrderItem>()
+                            .eq(WkOrderItem::getId, checkParam.getId())
+                            .setSql("work_qty = work_qty + " + item.getAnfme())
+                            .set(WkOrderItem::getWorkQty, checkItem.getAnfme()))) {
+                        throw new CoolException("鐩樼偣鏄庣粏淇敼澶辫触锛侊紒");
+                    }
                 });
                 if (!taskItemService.saveBatch(items)) {
                     throw new CoolException("浠诲姟鏄庣粏淇濆瓨澶辫触锛侊紒");
                 }
+
+                loc.setUseStatus(LocStsType.LOC_STS_TYPE_R.type);
+                if (!locService.updateById(loc)) {
+                    throw new CoolException("搴撲綅棰勭害鍑哄簱澶辫触锛侊紒");
+                }
+
+            });
+
+            Set<Long> checkItemIds = checkParams.stream().map(CheckOrderParams::getOrderId).collect(Collectors.toSet());
+            checkItemIds.forEach(orderId -> {
+                WkOrder order = this.getById(orderId);
+                if (Objects.isNull(order)) {
+                    throw new CoolException("鏁版嵁閿欒锛氬崟鎹笉瀛樺湪锛侊紒");
+                }
+                List<WkOrderItem> orderItems = checkOrderItemService.list(new LambdaQueryWrapper<WkOrderItem>().eq(WkOrderItem::getOrderId, orderId));
+                if (orderItems.isEmpty()) {
+                    throw new CoolException("鏁版嵁閿欒锛氬崟鎹槑缁嗕笉瀛樺湪锛侊紒");
+                }
+                Double sum = orderItems.stream().mapToDouble(WkOrderItem::getWorkQty).sum();
+
+                if (order.getAnfme().compareTo(sum) <= 0) {
+                    order.setWorkQty(sum).setExceStatus(CheckExceStatus.CHECK_ORDER_STATUS_EXCE_DONE.val);
+                } else {
+                    order.setWorkQty(sum).setExceStatus(CheckExceStatus.CHECK_ORDER_STATUS_EXCE_ING.val);
+                }
+
+                if (!this.updateById(order)) {
+                    throw new CoolException("鐩樼偣鍗曚俊鎭慨鏀瑰け璐ワ紒锛�");
+                }
             });
         }
         return R.ok();

--
Gitblit v1.9.1