服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-05-01 40de162dfa4b631efc0ed0e6b89d54ac1236e95b
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)
                    {