From ba578017ad4f7ed7577b84ebad9427596316cd7b Mon Sep 17 00:00:00 2001
From: 南骏 池 <chiffly@163.com>
Date: 星期四, 27 三月 2025 14:47:38 +0800
Subject: [PATCH] 1.实现了PdaJyMangeer类中的通用入库校验功能,使用存储过程进行校验并返回结果。

---
 .gitignore                   |    3 +
 service/base/PdaJyMangeer.cs |   84 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 87 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index 414a435..55165ae 100644
--- a/.gitignore
+++ b/.gitignore
@@ -456,3 +456,6 @@
 # Ionide (cross platform F# VS Code tools) working folder
 .ionide/
 
+.vscode/launch.json
+.gitignore
+.vscode/tasks.json
diff --git a/service/base/PdaJyMangeer.cs b/service/base/PdaJyMangeer.cs
new file mode 100644
index 0000000..e0f07eb
--- /dev/null
+++ b/service/base/PdaJyMangeer.cs
@@ -0,0 +1,84 @@
+锘縩amespace NewPdaSqlServer.util
+{
+    using NewPdaSqlServer.Dto.service;
+    using NewPdaSqlServer.entity;
+    using SqlSugar;
+    using System;
+    using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
+    using System.Data;
+    using NewPdaSqlServer.DB;
+    using System.Data;
+    using System.Data.SqlClient;
+
+
+    public class PdaJyMangeer
+    {
+
+        /// <summary>
+        /// 閫氱敤鍏ュ簱鏍¢獙
+        /// </summary>
+        /// <param name="db">SqlSugar 鏁版嵁搴撲笂涓嬫枃</param>
+        /// <param name="edtUserNo">鎿嶄綔浜哄伐鍙�</param>
+        /// <param name="barcode">鐗╂枡鏉$爜</param>
+        /// <param name="sectionCode">搴撲綅缂栫爜</param>
+        /// <param name="stockId">浠撳簱ID</param>
+        /// <param name="stockOrgId">搴撳瓨缁勭粐ID</param>
+        /// <param name="billNo">鐢宠鍗曞彿</param>
+        /// <param name="transactionNo">浜嬪姟绫诲瀷</param>
+        /// <returns>鍖呭惈鏍¢獙缁撴灉鐨勬暟鎹紶杈撳璞�</returns>
+        public ProductionPickDto SalesReturnCheck(SqlSugarScope db, string edtUserNo,
+            string barcode, string sectionCode, string stockId, string stockOrgId,
+            string billNo, string transactionNo)
+        {
+            var outputMsg = "";
+            var outputStatus = -1;
+
+            using (var conn = new SqlConnection(DbHelperSQL.strConn))
+            using (var cmd = new SqlCommand("prc_pda_inv_JY", conn))
+            {
+                cmd.CommandType = CommandType.StoredProcedure;
+                // 杈撳叆鍙傛暟閰嶇疆
+                SqlParameter[] parameters =
+                {
+                    new("@pi_user", SqlDbType.NVarChar, 100) { Value = edtUserNo },
+                    new("@pi_barcode", SqlDbType.NVarChar, 100) { Value = barcode },
+                    new("@pi_sectionCode", SqlDbType.NVarChar, 100) { Value = sectionCode },
+                    new("@pi_stockId", SqlDbType.NVarChar, 100) { Value = stockId },
+                    new("@pi_stockOrgId", SqlDbType.NVarChar, 100) { Value = stockOrgId },
+                    new("@pi_billno", SqlDbType.NVarChar, 100) { Value = billNo },
+                    new("@pi_transaction_no", SqlDbType.NVarChar, 10) { Value = transactionNo },
+                    new("@pi_val1", SqlDbType.NVarChar, 100) { Value = DBNull.Value }, // 棰勭暀鎵╁睍瀛楁
+                    new("@pi_val2", SqlDbType.NVarChar, 100) { Value = DBNull.Value }, // 棰勭暀鎵╁睍瀛楁
+                    new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output },
+                    new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output }
+                };
+
+                try
+                {
+                    conn.Open();
+                    cmd.Parameters.AddRange(parameters);
+                    cmd.ExecuteNonQuery();
+
+                    // 鑾峰彇杈撳嚭鍙傛暟
+                    outputMsg = parameters[9].Value?.ToString() ?? "";
+                    outputStatus = Convert.ToInt32(parameters[10].Value);
+
+                    if (outputStatus <= 0)
+                        throw new Exception(outputMsg);
+
+                    return new ProductionPickDto
+                    {
+                        barcode = barcode,
+                        strMsg = outputMsg,
+                        result = outputStatus.ToString(),
+                        // 鍏朵粬闇�瑕佹槧灏勭殑瀛楁...
+                    };
+                }
+                catch (Exception ex)
+                {
+                    throw new Exception($"鍏ュ簱鏍¢獙澶辫触: {ex.Message}");
+                }
+            }
+        }
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.3