yuanrf пре 1 година
родитељ
комит
e29780f746
1 измењених фајлова са 10 додато и 2 уклоњено
  1. 10 2
      OASystem/OASystem.Api/Controllers/BaiduOCRController.cs

+ 10 - 2
OASystem/OASystem.Api/Controllers/BaiduOCRController.cs

@@ -118,7 +118,15 @@ namespace OASystem.API.Controllers
                         {
                             var item = dataList.First(s => s.row_start == i && s.col_start == j);
                             string words = item.words.Replace("\\n", "");
-                            string values = dicHeader[j];
+                            string values = string.Empty;
+                            try
+                            {
+                                values = dicHeader[j];
+                            }
+                            catch (Exception)
+                            {
+                               throw new Exception("有未能识别的列头请检查 : " + JsonConvert.SerializeObject(headerList.Select(x => x.words)));
+                            }
 
                             if (words.IsNullOrWhiteSpace())
                             {
@@ -218,7 +226,7 @@ namespace OASystem.API.Controllers
             catch (Exception ex)
             {
                 jw.Code = 400;
-                jw.Msg = "程序异常!";
+                jw.Msg = "程序异常!" + ex.Message;
                 jw.Data = new string[0];
             }