From 4ef0acfc95e9e654ae142f8d5b21d68c55ddfc8d Mon Sep 17 00:00:00 2001
From: 南骏 池 <chiffly@163.com>
Date: 星期二, 27 五月 2025 10:37:04 +0800
Subject: [PATCH] 1.巡检新增扫描工单获取检验信息

---
 service/Warehouse/InventoryManager.cs |   62 ++++++++++++++++++++++++++++++-
 1 files changed, 60 insertions(+), 2 deletions(-)

diff --git a/service/Warehouse/InventoryManager.cs b/service/Warehouse/InventoryManager.cs
index 7268bfc..4a876e6 100644
--- a/service/Warehouse/InventoryManager.cs
+++ b/service/Warehouse/InventoryManager.cs
@@ -4,6 +4,7 @@
 using NewPdaSqlServer.service.@base;
 using NewPdaSqlServer.util;
 using SqlSugar;
+using System.Text;
 
 namespace NewPdaSqlServer.service.Warehouse;
 
@@ -90,7 +91,7 @@
         // if (c_mes_inv_item_barcodes == null)
         //     throw new Exception("002[鏉$爜涓嶅瓨鍦紝璇锋牳瀵癸紒");
 
-        if (c_mes_inv_item_barcodes.Memo != "鏈熷垵")
+        if (c_mes_inv_item_barcodes.Memo != "鍒濇湡鐗╂枡")
             throw new Exception("002[鏉$爜涓嶆槸鏈熷垵鏉$爜锛屾棤娉曠敤鏈熷垵鍏ュ簱锛�");
 
         var wmsManager = new WmsBaseMangeer();
@@ -106,7 +107,7 @@
             transactionNo: "601" // 浜嬪姟绫诲瀷涓庡瓨鍌ㄨ繃绋嬪尮閰�
         );
         
-        if (checkResult.result < "1") 
+        if ( Convert.ToInt32(checkResult.result) < 1) 
             throw new Exception($"鍏ュ簱鏍¢獙澶辫触锛歿checkResult.strMsg}");
 
         UseTransaction(db =>
@@ -268,4 +269,61 @@
         // 杩斿洖鎴愬姛淇℃伅
         return query;
     }
+
+
+    public dynamic GetDepoptsInfo(dynamic unity)
+    {
+
+        //// 浣跨敤鍙傛暟鍖栨煡璇㈤槻姝QL娉ㄥ叆
+        var sqlParams = new List<SugarParameter> { new("@sectionCode", unity.sectionCode) };
+
+        var sql2 = @"        SELECT TOP 1  B.depot_code + '('+B.depot_name+')' depotsInfo,
+                     B.FSubsidiary,
+                     C.FNumber + '('+C.NAME+')' orgInfo
+        FROM MES_DEPOT_SECTIONS A
+                 LEFT JOIN
+             MES_DEPOTS B ON A.depot_guid = B.Guid
+            LEFT JOIN SYS_ORGANIZATION C ON C.FID = B.FSubsidiary
+        WHERE a.depot_section_code = @sectionCode;";
+
+        var XcslItem = Db.Ado.SqlQuery<dynamic>(sql2, sqlParams).FirstOrDefault();
+
+        // 妫�鏌ョ粨鏋滄湁鏁堟��
+        if (XcslItem == null)
+        {
+            throw new Exception($"搴撲綅 [{unity.sectionCode}] 涓嶅瓨鍦紝鎴栨墍灞炰粨搴撶姸鎬佸紓甯革紙鍙兘琚鐢ㄦ垨鍒犻櫎锛夈��");
+        }
+
+        return XcslItem; // 杩斿洖绗竴琛屾暟鎹紝濡傛灉娌℃湁鍒欒繑鍥� null
+    }
+
+
+
+    public dynamic GetItemsList(dynamic unity)
+    {
+        var sqlParams = new List<SugarParameter> { new("@orgId", unity.orgId) };
+
+        var sql2 = new StringBuilder(@"
+        SELECT TOP 20 item_id, item_no, item_name, item_model,item_no+'---'+item_name AS wlInfo
+        FROM MES_ITEMS
+        WHERE FSubsidiary = @orgId");
+
+        if (!string.IsNullOrWhiteSpace(unity.selectKey?.ToString()))
+        {
+            sqlParams.Add(new("@selectKey", unity.selectKey));
+            sql2.Append(@"
+            AND (item_no LIKE '%' + @selectKey + '%' 
+            OR item_name LIKE '%' + @selectKey + '%' 
+            OR item_model LIKE '%' + @selectKey + '%')");
+        }
+
+        var XcslItem = Db.Ado.SqlQuery<dynamic>(sql2.ToString(), sqlParams);
+
+        if (XcslItem == null)
+        {
+            throw new Exception("璇ユ潯浠朵笅鏃犲搴旂墿鏂欎俊鎭紝璇烽噸鏂拌緭鍏ワ紒");
+        }
+
+        return XcslItem;
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3