From 3192ff04681684737f4394e5699b1015109179c3 Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期三, 21 八月 2024 22:55:50 +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