服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-06-11 76ea6b9b4663f09f1b19fb1b09d876874c76defd
Tiger.Business/MES/Biz.Route.cs
@@ -10,7 +10,6 @@
using System.Linq;
using Newtonsoft.Json;
using Tiger.IBusiness;
using static Tiger.Business.Biz;
using Microsoft.AspNetCore.Http;
namespace Tiger.Business
@@ -342,6 +341,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);
            }
        }
    }
}