From a8cbf88595ee02897272de2525510c4dc3545568 Mon Sep 17 00:00:00 2001
From: 南骏 池 <chiffly@163.com>
Date: 星期三, 28 五月 2025 13:25:44 +0800
Subject: [PATCH] 1.PDA生产确认领料新增工单查询。

---
 service/Wom/WomdaaManager.cs |   98 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 96 insertions(+), 2 deletions(-)

diff --git a/service/Wom/WomdaaManager.cs b/service/Wom/WomdaaManager.cs
index b105469..30351a7 100644
--- a/service/Wom/WomdaaManager.cs
+++ b/service/Wom/WomdaaManager.cs
@@ -1,5 +1,6 @@
 锘縰sing System.Data;
 using System.Data.SqlClient;
+using System.Text;
 using Masuit.Tools;
 using Microsoft.SqlServer.Server;
 using NewPdaSqlServer.DB;
@@ -407,7 +408,7 @@
     public dynamic getKbBarMxInfo(dynamic query)
     {
 
-        var sql = string.Format(@"SELECT ITEM_BARCODE, QUANTITY,item_no,item_name,item_model
+        var sql = string.Format(@"SELECT ITEM_BARCODE, QUANTITY,item_no,item_name,item_model,weight
 FROM MES_INV_ITEM_BARCODES_TBMX A
          LEFT JOIN WOMDAA B ON B.daa001 = A.DAA_001
         LEFT JOIN MES_ITEMS C ON C.item_id = B.daa002
@@ -607,7 +608,7 @@
     public dynamic SubmitKbInspection(dynamic query)
     {
         if (query == null) throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓� null");
-    
+
         // 鍙傛暟鏍¢獙
         if (string.IsNullOrEmpty(query.userAccount?.ToString()))
             throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(query.userAccount));
@@ -824,4 +825,97 @@
             }
         }
     }
+
+
+    public dynamic GetWeightByXt(dynamic query)
+    {
+        if (query == null) throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓簄ull");
+
+        // 鍙傛暟鏍¢獙
+        if (string.IsNullOrEmpty(query.userName?.ToString()))
+            throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(query.userName));
+
+        if (string.IsNullOrEmpty(query.LsBar?.ToString()))
+            throw new ArgumentException("鍗℃澘鏉$爜涓嶅厑璁镐负绌�", nameof(query.LsBar));
+
+        var _strMsg = "";
+        var _status = -1;
+        var _weight = "0";
+        
+        using (var conn = new SqlConnection(DbHelperSQL.strConn))
+        {
+            using (var cmd = new SqlCommand("prc_pda_Xbar_chenzhong", conn))
+            {
+                try
+                {
+                    conn.Open();
+                    cmd.CommandType = CommandType.StoredProcedure;
+
+                    SqlParameter[] parameters = 
+                    {
+                        new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userName },
+                        new("@pi_ls_barcode", SqlDbType.NVarChar, 100) { Value = query.LsBar },
+                        new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output },
+                        new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output },
+                        new("@po_outWeight", SqlDbType.NVarChar, 100) { Direction = ParameterDirection.Output }
+                    };
+
+                    cmd.Parameters.AddRange(parameters);
+                    cmd.ExecuteNonQuery();
+
+                    _strMsg = parameters[2].Value?.ToString() ?? "";
+                    _status = Convert.ToInt32(parameters[3].Value ?? -1);
+                    _weight = parameters[4].Value?.ToString() ?? "0";
+
+                    if (_status <= 0) throw new Exception(_strMsg);
+
+                    return new 
+                    {
+                        message = _strMsg,
+                        status = _status,
+                        weight = _weight,
+                        barCode = query.Bar
+                    };
+                }
+                catch (Exception ex)
+                {
+                    throw new Exception($"浜у搧绉伴噸澶辫触锛歿ex.Message}");
+                }
+                finally
+                {
+                    conn.Close();
+                }
+            }
+        }
+    }
+
+    public dynamic GetXcslDaa(dynamic unity)
+    {
+
+        var sqlParams = new List<SugarParameter> { };
+
+        var sql2 = new StringBuilder(@"
+        SELECT '['+DAA001+']['+DAA021+']' AS daaInfo,DAA001,DAA021
+        FROM WOMDAA
+        WHERE daa018 NOT IN ('W:瀹屽伐', 'D:寰呭紑宸�')");
+
+        if (!string.IsNullOrWhiteSpace(unity.selectKey?.ToString()))
+        {
+            sqlParams.Add(new("@selectKey", unity.selectKey));
+            sql2.Append(@"
+            AND (DAA001 LIKE '%' + @selectKey + '%' 
+            OR DAA021 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