From c94422ed360de8e75fa62e745689cfa02d53d0ff Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期六, 04 五月 2024 11:05:07 +0800
Subject: [PATCH] 工艺路线更新

---
 Tiger.Business/MES/Biz.Route.cs |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/Tiger.Business/MES/Biz.Route.cs b/Tiger.Business/MES/Biz.Route.cs
index b397e91..b79435d 100644
--- a/Tiger.Business/MES/Biz.Route.cs
+++ b/Tiger.Business/MES/Biz.Route.cs
@@ -342,6 +342,38 @@
                 }
                 return await Task.FromResult(result);
             }
+
+            /// <summary>
+            /// 鍒犻櫎宸ヨ壓璺嚎
+            /// </summary>
+            /// <param name="routeId"></param>
+            /// <returns></returns>
+            public async Task<ApiAction> DeleteRoute(string routeId) {
+                var result = new ApiAction();
+                try
+                {
+                    //鏌ヨ鏄惁宸茬粡鏈夊伐鍗曞湪鐢ㄦ垨鑰呮湁缁戝畾浜у搧
+
+                    var db = Db;
+                    var dbTran = db.UseTran(() =>
+                    {
+                        db.Deleteable<MES_ROUTE_NODE>(false).Where(x => x.ROT_ID == routeId).ExecuteCommand();
+                        db.Deleteable<MES_ROUTE_EDGE>(false).Where(x => x.ROT_ID == routeId).ExecuteCommand();
+                        db.Deleteable<MES_ROUTE_NODE_ACT>(false).Where(x => x.ROT_ID == routeId).ExecuteCommand();
+                        db.Deleteable<MES_ROUTE>().Where(x => x.ID == routeId).ExecuteCommand();
+                    });
+                    if (!dbTran.IsSuccess)
+                    {
+                        result.IsSuccessed = false;
+                        result.LocaleMsg = new($"鍒犻櫎宸ヨ壓璺嚎寮傚父");
+                    }
+                }
+                catch (Exception ex)
+                {
+                    result.CatchExceptionWithLog(ex, "鍒犻櫎宸ヨ壓璺嚎寮傚父");
+                }
+                return await Task.FromResult(result);
+            }
         }
     }
 }

--
Gitblit v1.9.3