|
@@ -221,6 +221,70 @@ namespace Ropin.Inspection.Common.Helper
|
|
|
return almData;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public async Task<bool> UpdateAlm(string dataStr)
|
|
|
+ {
|
|
|
+ if (loginResult == null)
|
|
|
+ {
|
|
|
+ loginResult = await GetToken();
|
|
|
+ }
|
|
|
+ if (loginResult == null || loginResult.RefreshToken == null)
|
|
|
+ {
|
|
|
+ log.Info($"AI-AI报警修改-token 为空");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ bool result = false;
|
|
|
+ string url = AIConst.ApiUrl + AIConst.AlmUpdateDispose;
|
|
|
+ using (var client = _httpClientFactory.CreateClient())
|
|
|
+ {
|
|
|
+
|
|
|
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", loginResult.AccessToken);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ var request = new HttpRequestMessage(HttpMethod.Post, url)
|
|
|
+ {
|
|
|
+ Content = new StringContent(dataStr, System.Text.Encoding.UTF8, "application/json")
|
|
|
+ };
|
|
|
+ request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var response = await client.SendAsync(request);
|
|
|
+ response.EnsureSuccessStatusCode();
|
|
|
+ if (response.IsSuccessStatusCode)
|
|
|
+ {
|
|
|
+ var strReturn = await response.Content.ReadAsStringAsync();
|
|
|
+ AIModel<object> ResponseRestult = JsonConvert.DeserializeObject<AIModel<object>>(strReturn);
|
|
|
+ if (ResponseRestult != null && ResponseRestult.code == "200")
|
|
|
+ {
|
|
|
+ result = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ log.Info($"AI报警修改-失败【{strReturn}】");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (HttpRequestException ex)
|
|
|
+ {
|
|
|
+ log.Info($"AI报警修改-异常【{ex.Message}】");
|
|
|
+ }
|
|
|
+ catch (JsonException ex)
|
|
|
+ {
|
|
|
+ log.Info($"AI报警修改-响应异常【{ex.Message}】");
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ log.Info($"AI报警修改-时发生未知异常【{ex.Message}】");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -621,5 +685,6 @@ namespace Ropin.Inspection.Common.Helper
|
|
|
public const string HistoricAlmrecord = "/AlmRecord/HistoryPage";
|
|
|
public const string AlmDispose = "/AlmRecord/NotPage";
|
|
|
public const string AlmDeleteDispose = "/AlmRecord/Delete";
|
|
|
+ public const string AlmUpdateDispose = "/AlmRecord/AlmRecordUpdate";
|
|
|
}
|
|
|
}
|