From 40de162dfa4b631efc0ed0e6b89d54ac1236e95b Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期三, 01 五月 2024 00:26:49 +0800 Subject: [PATCH] 工艺路线更新 --- Tiger.Business/MES/Biz.Route.cs | 61 ++++++++++++++++++++++++++++-- 1 files changed, 56 insertions(+), 5 deletions(-) diff --git a/Tiger.Business/MES/Biz.Route.cs b/Tiger.Business/MES/Biz.Route.cs index 9a5f25b..77ab922 100644 --- a/Tiger.Business/MES/Biz.Route.cs +++ b/Tiger.Business/MES/Biz.Route.cs @@ -195,6 +195,38 @@ } /// <summary> + /// 淇濆瓨琛屼负 + /// </summary> + /// <param name="routeAct"></param> + /// <returns></returns> + public async Task<ApiAction> SaveActs(List<MES_ROUTE_NODE_ACT> routeAct) + { + var result = new ApiAction(); + try + { + var db = Db; + var dbTran = db.UseTran(() => + { + var y = db.Storageable(routeAct) + .WhereColumns(t => new { t.ID, t.GHOST_ROW }) + .ToStorage(); + y.AsInsertable.ExecuteCommand(); + y.AsUpdateable.ExecuteCommand(); + }); + if (!dbTran.IsSuccess) + { + result.IsSuccessed = false; + result.Message = $"淇濆瓨琛屼负鏁版嵁寮傚父"; + } + } + catch (Exception ex) + { + result.CatchExceptionWithLog(ex, "淇濆瓨琛屼负鏁版嵁寮傚父"); + } + return await Task.FromResult(result); + } + + /// <summary> /// 淇濆瓨 /// </summary> /// <param name="router"></param> @@ -236,11 +268,6 @@ var result = new ApiAction(); try { - var actionNode = await SaveNodes(routeData.nodes); - if (!actionNode.IsSuccessed) { return actionNode; } - var actionEdge = await SaveEdges(routeData.edges); - if (!actionEdge.IsSuccessed) { return actionEdge; } - var db = Db; var dbTran = db.UseTran(() => { @@ -252,6 +279,30 @@ y.AsInsertable.ExecuteCommand(); y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand(); } + if (routeData.nodes != null) + { + var y = db.Storageable(routeData.nodes) + .WhereColumns(t => new { t.ID, t.GHOST_ROW }) + .ToStorage(); + y.AsInsertable.ExecuteCommand(); + y.AsUpdateable.ExecuteCommand(); + } + if (routeData.edges != null) + { + var y = db.Storageable(routeData.edges) + .WhereColumns(t => new { t.ID, t.GHOST_ROW }) + .ToStorage(); + y.AsInsertable.ExecuteCommand(); + y.AsUpdateable.ExecuteCommand(); + } + if (routeData.acts != null) + { + var y = db.Storageable(routeData.acts) + .WhereColumns(t => new { t.ID, t.GHOST_ROW }) + .ToStorage(); + y.AsInsertable.ExecuteCommand(); + y.AsUpdateable.ExecuteCommand(); + } }); if (!dbTran.IsSuccess) { -- Gitblit v1.9.3