| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | 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)); |
| | | |
| | | if (string.IsNullOrEmpty(query.KbBar?.ToString())) |
| | | throw new ArgumentException("卡板条码不允许为空", nameof(query.KbBar)); |
| | | |
| | | var _strMsg = ""; |
| | | var _status = -1; |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | using (var cmd = new SqlCommand("prc_pda_KBbar_submitInspection", conn)) |
| | | { |
| | | try |
| | | { |
| | | conn.Open(); |
| | | cmd.CommandType = CommandType.StoredProcedure; |
| | | SqlParameter[] parameters = |
| | | { |
| | | new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount }, |
| | | new("@pi_kb_barcode", SqlDbType.NVarChar, 100) { Value = query.KbBar }, |
| | | new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output }, |
| | | new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output } |
| | | }; |
| | | |
| | | foreach (var parameter in parameters) |
| | | cmd.Parameters.Add(parameter); |
| | | |
| | | cmd.ExecuteNonQuery(); |
| | | |
| | | _strMsg = parameters[2].Value?.ToString() ?? ""; |
| | | _status = Convert.ToInt32(parameters[3].Value ?? -1); |
| | | |
| | | if (_status <= 0) throw new Exception(_strMsg); |
| | | |
| | | return new { |
| | | message = _strMsg, |
| | | status = _status, |
| | | kbBarcode = query.KbBar |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception($"卡板送检失败:{ex.Message}"); |
| | | } |
| | | finally |
| | | { |
| | | conn.Close(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |