| | |
| | | } |
| | | |
| | | /// <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> |
| | |
| | | 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(() => |
| | | { |
| | |
| | | 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) |
| | | { |