| | |
| | | public async Task<dynamic> SubmitIQCToOA(dynamic queryObj) |
| | | { |
| | | // 修改参数验证字段名 |
| | | //if (queryObj.userId.IsNullOrEmpty()) throw new Exception("用户id不允许为空"); |
| | | if (string.IsNullOrEmpty(queryObj.userId.ToString())) throw new Exception("用户id不允许为空"); |
| | | if (string.IsNullOrEmpty(queryObj.qcczdGuid.ToString())) throw new Exception("异常处置单id不能为空"); |
| | | //if (queryObj.qcczdGuid.IsNullOrEmpty()) throw new Exception("异常处置单id不能为空"); // 原参数名为 qcczdGuid |
| | | |
| | | try |
| | |
| | | } |
| | | } |
| | | |
| | | return JObject.Parse(response.Content.ToString()); // 直接解析为JObject |
| | | var result = JObject.Parse(response.Content.ToString()); |
| | | |
| | | // 新增状态更新(当OA返回成功时) |
| | | if (result.code?.ToString() == "SUCCESS") |
| | | { |
| | | var updateSql = @"UPDATE Mes_QC_Exceptional |
| | | SET checkStatus = 1, |
| | | checkDate = GETDATE(), |
| | | checkBy = (select top 1 u.[ACCOUNT] from [dbo].[SYS_USER] u where u.guid = @edtUserCode) |
| | | WHERE GUID = @inOrderGuid"; |
| | | |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | using (var cmd = new SqlCommand(updateSql, conn)) |
| | | { |
| | | try |
| | | { |
| | | conn.Open(); |
| | | //cmd.Parameters.AddWithValue("@dt", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); |
| | | cmd.Parameters.AddWithValue("@edtUserCode", queryObj.userId?.ToString()); |
| | | cmd.Parameters.AddWithValue("@inOrderGuid", queryObj.qcczdGuid?.ToString()); |
| | | cmd.ExecuteNonQuery(); |
| | | } |
| | | catch (Exception updateEx) |
| | | { |
| | | Console.WriteLine($"状态更新失败: {updateEx.Message}"); |
| | | } |
| | | finally |
| | | { |
| | | conn.Close(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return result; // 直接解析为JObject |
| | | |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | _httpClient?.Dispose(); |
| | | } |
| | | } |
| | | } |