| | |
| | | using System.Linq; |
| | | using Newtonsoft.Json; |
| | | using Tiger.IBusiness; |
| | | using static Tiger.Business.Biz; |
| | | using Microsoft.AspNetCore.Http; |
| | | |
| | | namespace Tiger.Business |
| | |
| | | } |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |