From 4043a2fe2103c7960b74acbccdcc876d11f83f0f Mon Sep 17 00:00:00 2001
From: chenzx <m15572880737@163.com>
Date: 星期三, 11 十二月 2024 18:40:16 +0800
Subject: [PATCH] czx20241211接口更新

---
 GasolineBlend/Controllers/TreeDiagramRecord.cs |   44 ++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/GasolineBlend/Controllers/TreeDiagramRecord.cs b/GasolineBlend/Controllers/TreeDiagramRecord.cs
index b2c9209..605cd83 100644
--- a/GasolineBlend/Controllers/TreeDiagramRecord.cs
+++ b/GasolineBlend/Controllers/TreeDiagramRecord.cs
@@ -15,7 +15,7 @@
     {
         private TreeDiagramRecordBLL _acc = new TreeDiagramRecordBLL();
         /// <summary>
-        ///鑾峰彇鍦板尯鏅鸿兘浣撴暟鎹�
+        ///鑾峰彇鏌ヨ鍘嗗彶鏁版嵁
         /// </summary>
         /// <param name="CompanyName"></param>
         /// <returns></returns>
@@ -39,7 +39,7 @@
         }
 
         /// <summary>
-        ///娣诲姞鏅鸿兘浣�
+        ///娣诲姞鍘嗗彶鏁版嵁
         /// </summary>
         /// <param name="Keyword"></param>
         /// <returns></returns>
@@ -48,8 +48,13 @@
         {
             try
             {
-                bool isDeleted = _acc.AddTreeDiagramRecord(treeDiagramRecord);
-                return isDeleted ? SuccessNoShow() : Error();
+                var list = _acc.GetTreeDiagramRecordIsName(treeDiagramRecord.CompanyName);
+                if (list.Count == 0)
+                {
+                    bool isAdd = _acc.AddTreeDiagramRecord(treeDiagramRecord);
+                    return isAdd ? SuccessNoShow() : Error();
+                }
+                return SuccessNoShow(data: null);
             }
             catch (Exception e)
             {
@@ -60,5 +65,36 @@
             }
         }
 
+        /// <summary>
+        ///淇敼鍘嗗彶鏁版嵁
+        /// </summary>
+        /// <param name="Keyword"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public ActionResult UpdateTreeDiagramRecord(TreeDiagramRecord treeDiagramRecord)
+        {
+            try
+            {
+                var list = _acc.GetTreeDiagramRecordIsName(treeDiagramRecord.CompanyName);
+                if (list != null && list.Count != 0)
+                {
+                    bool isUpdata = _acc.UpdateTreeDiagramRecord(treeDiagramRecord);
+                    return isUpdata ? SuccessNoShow() : Error();
+                }
+                else {
+                    bool isUpdata = _acc.AddTreeDiagramRecord(treeDiagramRecord);
+                }
+                return SuccessNoShow(data: null);
+            }
+            catch (Exception e)
+            {
+                LogHelper.Write(Level.Error, "淇敼鏅鸿兘浣� UpdateTreeDiagramRecord" +
+                    "" +
+                    "", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
+                return Error();
+            }
+        }
+
+
     }
 }

--
Gitblit v1.8.0