From 4ef0acfc95e9e654ae142f8d5b21d68c55ddfc8d Mon Sep 17 00:00:00 2001 From: 南骏 池 <chiffly@163.com> Date: 星期二, 27 五月 2025 10:37:04 +0800 Subject: [PATCH] 1.巡检新增扫描工单获取检验信息 --- service/QC/IpqcService.cs | 59 +++++++++++++++++++++++++++++ Controllers/QC/IpqcController.cs | 20 +++++++++ 2 files changed, 78 insertions(+), 1 deletions(-) diff --git a/Controllers/QC/IpqcController.cs b/Controllers/QC/IpqcController.cs index 1bd8deb..234f36e 100644 --- a/Controllers/QC/IpqcController.cs +++ b/Controllers/QC/IpqcController.cs @@ -119,5 +119,23 @@ } } - + [HttpPost("createByWomdaa")] + public ResponseResult CreateByWomdaa(dynamic query) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.CreateByWomdaa(query); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } } \ No newline at end of file diff --git a/service/QC/IpqcService.cs b/service/QC/IpqcService.cs index 58c47fb..3165c8d 100644 --- a/service/QC/IpqcService.cs +++ b/service/QC/IpqcService.cs @@ -5,6 +5,8 @@ using NewPdaSqlServer.entity; using NewPdaSqlServer.util; using SqlSugar; +using System.Data; +using System.Data.SqlClient; using static Azure.Core.HttpHeader; using static Microsoft.EntityFrameworkCore.DbLoggerCategory; @@ -164,4 +166,61 @@ return withOracle; } + + + public dynamic CreateByWomdaa(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.inOrderGuid1?.ToString())) + throw new ArgumentException("妫�楠屽崟GUID涓嶈兘涓虹┖", nameof(query.inOrderGuid1)); + + if (string.IsNullOrEmpty(query.DAA001?.ToString())) + throw new ArgumentException("宸ュ崟鍙蜂笉鑳戒负绌�", nameof(query.inOrderGuid1)); + + var _strMsg = ""; + var _status = -1; + + using (var conn = new SqlConnection(DbHelperSQL.strConn)) + using (var cmd = new SqlCommand("ipqc_createByWomdaa", conn)) + { + try + { + conn.Open(); + cmd.CommandType = CommandType.StoredProcedure; + + SqlParameter[] parameters = + { + new("@po_outMsg", SqlDbType.NVarChar, 150) { Direction = ParameterDirection.Output }, + new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output }, + new("@pi_user", SqlDbType.NVarChar, 150) { Value = query.userAccount }, + new("@pi_OrderGuid1", SqlDbType.UniqueIdentifier) { Value = Guid.Parse(query.inOrderGuid1.ToString()) }, + new("@pi_DAA001", SqlDbType.NVarChar, 150) { Value = query.DAA001.ToString() }, + new("@pi_inP1", SqlDbType.NVarChar, 20) { Value = query.pi_inP1 ?? DBNull.Value }, + new("@pi_inP2", SqlDbType.NVarChar, 20) { Value = query.pi_inP2 ?? DBNull.Value } + }; + + cmd.Parameters.AddRange(parameters); + cmd.ExecuteNonQuery(); + + _strMsg = parameters[0].Value?.ToString() ?? ""; + _status = Convert.ToInt32(parameters[1].Value ?? -1); + + if (_status <= 0) throw new Exception(_strMsg); + + return new + { + message = _strMsg, + status = _status + }; + } + catch (Exception ex) + { + throw new Exception($"妫�楠屽崟鏇存柊澶辫触锛歿ex.Message}"); + } + } +} } \ No newline at end of file -- Gitblit v1.9.3