From 0cdfda43fa2f992614a1c0f3bd1aee48eac13797 Mon Sep 17 00:00:00 2001 From: 南骏 池 <chiffly@163.com> Date: 星期二, 19 八月 2025 10:49:11 +0800 Subject: [PATCH] 1.AGV4个接口 2.其他入库优化 --- service/Wom/WomdaaManager.cs | 191 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 191 insertions(+), 0 deletions(-) diff --git a/service/Wom/WomdaaManager.cs b/service/Wom/WomdaaManager.cs index 1ed19c5..1c101e1 100644 --- a/service/Wom/WomdaaManager.cs +++ b/service/Wom/WomdaaManager.cs @@ -1315,4 +1315,195 @@ return XtItem; } + /// <summary> + /// AGV閫佹 + /// </summary> + /// <param name="query"></param> + /// <returns></returns> + /// <exception cref="ArgumentNullException"></exception> + /// <exception cref="ArgumentException"></exception> + /// <exception cref="Exception"></exception> + public dynamic HandleAGVInspection(dynamic query) + { + if (query == null) throw new ArgumentNullException(nameof(query)); + + if (string.IsNullOrEmpty(query.userAccount?.ToString())) + throw new ArgumentException("鐢ㄦ埛璐﹀彿涓嶈兘涓虹┖", nameof(query.userAccount)); + + if (string.IsNullOrEmpty(query.KbBar?.ToString())) + throw new ArgumentException("鍗℃澘鏉$爜涓嶈兘涓虹┖", nameof(query.KbBar)); + + using (var conn = new SqlConnection(DbHelperSQL.strConn)) + { + using (var cmd = new SqlCommand("prc_pda_AgvSj", conn)) + { + cmd.CommandType = CommandType.StoredProcedure; + var parameters = new SqlParameter[] + { + new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount }, + new("@pi_kb_barcode", SqlDbType.NVarChar, 100) { Value = query.KbBar }, + new("@outMsg", SqlDbType.NVarChar, 2500) { Direction = ParameterDirection.Output }, + new("@outSum", SqlDbType.Int) { Direction = ParameterDirection.Output } + }; + + cmd.Parameters.AddRange(parameters); + conn.Open(); + cmd.ExecuteNonQuery(); + + var result = new + { + message = parameters[2].Value?.ToString(), + status = Convert.ToInt32(parameters[3].Value) + }; + + if (result.status <= 0) + throw new Exception(result.message); + + return result; + } + } + } + + public dynamic HandleAGVCall(dynamic query) + { + if (query == null) throw new ArgumentNullException(nameof(query)); + + if (string.IsNullOrEmpty(query.userAccount?.ToString())) + throw new ArgumentException("鐢ㄦ埛璐﹀彿涓嶈兘涓虹┖", nameof(query.userAccount)); + + if (string.IsNullOrEmpty(query.XtNum?.ToString())) + throw new ArgumentException("绾夸綋缂栧彿涓嶈兘涓虹┖", nameof(query.XtNum)); + + using (var conn = new SqlConnection(DbHelperSQL.strConn)) + { + using (var cmd = new SqlCommand("prc_pda_AgvHj", conn)) + { + cmd.CommandType = CommandType.StoredProcedure; + var parameters = new SqlParameter[] + { + new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount }, + new("@pi_xtNum", SqlDbType.NVarChar, 100) { Value = query.XtNum }, + new("@outMsg", SqlDbType.NVarChar, 2500) { Direction = ParameterDirection.Output }, + new("@outSum", SqlDbType.Int) { Direction = ParameterDirection.Output } + }; + + cmd.Parameters.AddRange(parameters); + conn.Open(); + cmd.ExecuteNonQuery(); + + var result = new + { + message = parameters[2].Value?.ToString(), + status = Convert.ToInt32(parameters[3].Value) + }; + + if (result.status <= 0) + throw new Exception(result.message); + + return result; + } + } + } + + + public dynamic HandleAgvJy(dynamic query) + { + if (query == null) throw new ArgumentNullException(nameof(query)); + + // 鍙傛暟楠岃瘉寮哄寲 + if (string.IsNullOrEmpty(query.userAccount?.ToString())) + throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(query.userAccount)); + + if (string.IsNullOrEmpty(query.KbBar?.ToString())) + throw new ArgumentException("鍗℃澘鏉$爜涓嶅厑璁镐负绌�", nameof(query.KbBar)); + + if (string.IsNullOrEmpty(query.jyz?.ToString())) + throw new ArgumentException("妫�楠岀粨鏋滀笉鍏佽涓虹┖", nameof(query.jyz)); + + var _strMsg = ""; + var _intSum = ""; + + using (var conn = new SqlConnection(DbHelperSQL.strConn)) + { + using (var cmd = new SqlCommand("prc_pda_AgvJy", conn)) + { + cmd.CommandType = CommandType.StoredProcedure; + + // 娣诲姞瀛樺偍杩囩▼鍙傛暟 + SqlParameter[] parameters = + { + new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount }, + new("@pi_kbBarcode", SqlDbType.NVarChar, 100) { Value = query.KbBar }, + new("@pi_jyz", SqlDbType.NVarChar, 100) { Value = query.jyz }, + new("@outMsg", SqlDbType.NVarChar, 2500) { Direction = ParameterDirection.Output }, + new("@outSum", SqlDbType.Int) { Direction = ParameterDirection.Output } + }; + + foreach (var parameter in parameters) + cmd.Parameters.Add(parameter); + + conn.Open(); + cmd.ExecuteNonQuery(); + + _strMsg = parameters[3].Value?.ToString() ?? ""; + _intSum = parameters[4].Value?.ToString() ?? "-1"; + + var result = Convert.ToInt32(_intSum); + if (result <= 0) throw new Exception(_strMsg); + + return new + { + message = _strMsg, + status = result, + kbBarcode = query.KbBar + }; + } + } + } + + public dynamic HandleAgvRk(dynamic query) + { + if (query == null) throw new ArgumentNullException(nameof(query)); + + if (string.IsNullOrEmpty(query.userAccount?.ToString())) + throw new ArgumentException("鐢ㄦ埛璐﹀彿涓嶈兘涓虹┖", nameof(query.userAccount)); + + if (string.IsNullOrEmpty(query.KbBar?.ToString())) + throw new ArgumentException("鍗℃澘鏉$爜涓嶈兘涓虹┖", nameof(query.KbBar)); + + if (string.IsNullOrEmpty(query.Postition?.ToString())) + throw new ArgumentException("妤煎眰浣嶇疆涓嶈兘涓虹┖", nameof(query.Postition)); + + using (var conn = new SqlConnection(DbHelperSQL.strConn)) + { + using (var cmd = new SqlCommand("prc_pda_AgvRk", conn)) + { + cmd.CommandType = CommandType.StoredProcedure; + var parameters = new SqlParameter[] + { + new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount }, + new("@pi_kb_barcode", SqlDbType.NVarChar, 100) { Value = query.KbBar }, + new("@pi_kb_Postition", SqlDbType.NVarChar, 100) { Value = query.Postition }, + new("@outMsg", SqlDbType.NVarChar, 2500) { Direction = ParameterDirection.Output }, + new("@outSum", SqlDbType.Int) { Direction = ParameterDirection.Output } + }; + + cmd.Parameters.AddRange(parameters); + conn.Open(); + cmd.ExecuteNonQuery(); + + var result = new + { + message = parameters[3].Value?.ToString(), + status = Convert.ToInt32(parameters[4].Value) + }; + + if (result.status <= 0) + throw new Exception(result.message); + + return result; + } + } + } + } \ No newline at end of file -- Gitblit v1.9.3