From e15bfe0813c80c47e4244323635a177766574235 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期三, 21 八月 2024 11:51:19 +0800 Subject: [PATCH] 工艺路线保存修改 --- Tiger.Business/MES/Biz.Route.cs | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Tiger.Business/MES/Biz.Route.cs b/Tiger.Business/MES/Biz.Route.cs index 6f8873b..38f5200 100644 --- a/Tiger.Business/MES/Biz.Route.cs +++ b/Tiger.Business/MES/Biz.Route.cs @@ -379,8 +379,11 @@ y.AsInsertable.ExecuteCommand(); y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand(); } - db.Deleteable<MES_PROD_OPER>().Where(x => x.PROD_CODE == routeData.route.PROD_CODE && !SqlFunc.ContainsArray(nodeIds, x.NODE_ID)).ExecuteCommand(); - db.Deleteable<MES_PROD_ACTION>().Where(x => x.PROD_CODE == routeData.route.PROD_CODE && !SqlFunc.ContainsArray(actIds, x.ACT_ID)).ExecuteCommand(); + if (!routeData.route.PROD_CODE.IsNullOrEmpty()) + { + db.Deleteable<MES_PROD_OPER>().Where(x => x.PROD_CODE == routeData.route.PROD_CODE && !SqlFunc.ContainsArray(nodeIds, x.NODE_ID)).ExecuteCommand(); + db.Deleteable<MES_PROD_ACTION>().Where(x => x.PROD_CODE == routeData.route.PROD_CODE && !SqlFunc.ContainsArray(actIds, x.ACT_ID)).ExecuteCommand(); + } db.Deleteable<MES_ROUTE_NODE>(false).Where(x => x.ROT_ID == routeData.route.ID).ExecuteCommand(); db.Deleteable<MES_ROUTE_EDGE>(false).Where(x => x.ROT_ID == routeData.route.ID).ExecuteCommand(); db.Deleteable<MES_ROUTE_NODE_ACT>(false).Where(x => x.ROT_ID == routeData.route.ID).ExecuteCommand(); @@ -396,13 +399,16 @@ { db.Insertable(routeData.acts).ExecuteCommand(); } - if (operList.Count > 0) + if (!routeData.route.PROD_CODE.IsNullOrEmpty()) { - db.Insertable(operList).ExecuteCommand(); - } - if (actList.Count > 0) - { - db.Insertable(actList).ExecuteCommand(); + if (operList.Count > 0) + { + db.Insertable(operList).ExecuteCommand(); + } + if (actList.Count > 0) + { + db.Insertable(actList).ExecuteCommand(); + } } }); if (!dbTran.IsSuccess) -- Gitblit v1.9.3