From a7496b3785a33c14079b859c88b91a537c454cd5 Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期二, 06 八月 2024 20:03:49 +0800
Subject: [PATCH] 增加不良记录的保存

---
 Tiger.Business/DbCache/CodeRuleCache.cs |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/Tiger.Business/DbCache/CodeRuleCache.cs b/Tiger.Business/DbCache/CodeRuleCache.cs
index 4ee42d4..ca64461 100644
--- a/Tiger.Business/DbCache/CodeRuleCache.cs
+++ b/Tiger.Business/DbCache/CodeRuleCache.cs
@@ -4,6 +4,7 @@
 using System;
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
+using System.Data;
 using System.Data.Entity;
 using System.Linq;
 using System.Text;
@@ -374,10 +375,21 @@
                     his.RULE_ID = rule.ID;
                     his.GEN_CODE = string.Concat(rule.Details.OrderBy(q => q.RULE_SEQ).Select(q => q.CodeValue));
                     his.GEN_DATE = DateTime.Now;
-                    Biz.Db.Insertable(his).ExecuteCommand();
+                    try
+                    {
+                    	Biz.Db.Insertable(his).ExecuteCommand();
+                    }
+                    catch (System.Exception ex)
+                    {
+                        throw new DataException(his.GEN_CODE, ex);
+                    }
                     result.Data = his.GEN_CODE;
                 }
             }
+            catch (DataException ex)
+            {
+                result.CatchExceptionWithLog(ex.InnerException, Biz.L("BAS.CodeRule.GenerateSnHisException", ruleCode, ex.Message));
+            }
             catch (System.Exception ex)
             {
                 result.CatchExceptionWithLog(ex, Biz.L("BAS.CodeRule.GenerateException", ruleCode, string.Join(", ", args)));

--
Gitblit v1.9.3