From 8f2b8bd09ce1d7bbf7764129d0f1eac6c977c3a9 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期四, 09 十月 2025 15:11:38 +0800
Subject: [PATCH] 刀具查询分页

---
 Services/MesCutterLedgerManager.cs |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/Services/MesCutterLedgerManager.cs b/Services/MesCutterLedgerManager.cs
index 4fb4a59..fa78b2f 100644
--- a/Services/MesCutterLedgerManager.cs
+++ b/Services/MesCutterLedgerManager.cs
@@ -21,12 +21,26 @@
     /// 鍒�鍏锋煡璇紙鏀寔缂栧彿鎴栧悕绉版ā绯婃煡璇級
     /// </summary>
     /// <param name="searchKey">鏌ヨ鍏抽敭瀛�</param>
-    /// <returns>鍒�鍏峰垪琛�</returns>
-    public List<MesCutterLedger> QueryTools(string searchKey)
+    /// <param name="pageIndex">椤电爜</param>
+    /// <param name="pageSize">姣忛〉澶у皬</param>
+    /// <returns>鍒�鍏锋煡璇㈢粨鏋�</returns>
+    public MesCutterLedger QueryTools(string searchKey, int pageIndex, int pageSize)
     {
-        return Db.Queryable<MesCutterLedger>()
+        var query = Db.Queryable<MesCutterLedger>()
             .WhereIF(!string.IsNullOrEmpty(searchKey),
-                t => t.CutterId.Contains(searchKey) || t.CutterName.Contains(searchKey))
+                t => t.CutterId.Contains(searchKey) || t.CutterName.Contains(searchKey));
+
+        var total = query.Count();
+        var tbBillList = query
+            .OrderBy(t => t.CutterId)
+            .Skip((pageIndex - 1) * pageSize)
+            .Take(pageSize)
             .ToList();
+
+        return new MesCutterLedger
+        {
+            tbBillList = tbBillList,
+            total = total
+        };
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3