From e3c82e71128ed653e99db4dcef474c7b6aa464c8 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期一, 21 十一月 2022 10:35:54 +0800
Subject: [PATCH] nothing

---
 VueWebApi/DLL/DAL/ProductModelDAL.cs |   47 ++++++++++++++++++++++++++++++++++-------------
 1 files changed, 34 insertions(+), 13 deletions(-)

diff --git a/VueWebApi/DLL/DAL/ProductModelDAL.cs b/VueWebApi/DLL/DAL/ProductModelDAL.cs
index f073b22..17276d1 100644
--- a/VueWebApi/DLL/DAL/ProductModelDAL.cs
+++ b/VueWebApi/DLL/DAL/ProductModelDAL.cs
@@ -1095,34 +1095,52 @@
         }
         #endregion
 
-        #region[鐗╂枡娓呭崟鍒犻櫎]
-        public static ToMessage DeleteBoIventory(string bomid)
+        #region[宸ヨ壓璺嚎鍒犻櫎]
+        public static ToMessage DeleteRoute(string routecode)
         {
             var sql = "";
             List<object> list = new List<object>();
             var dynamicParams = new DynamicParameters();
             try
             {
-                list.Clear();
-                //鍒ゆ柇鐗╂枡绫诲瀷鏄惁鏈夊叧鑱旂墿鏂�
-                sql = @"select materiel_code from TK_Wrk_Man   where materiel_code in (select materiel_code from TBom_Main  where id=@bomid ) and bom_id=@bomid";
-                dynamicParams.Add("@bomid", bomid);
+                //鍒ゆ柇宸ヨ壓璺嚎鏄惁琚伐鍗曞紩鐢�(琚紩鐢ㄥ垯涓嶈兘鍒犻櫎)
+                sql = @"select *   from TK_Wrk_Man where route_code=@routecode";
+                dynamicParams.Add("@routecode", routecode);
                 var data = DapperHelper.selectdata(sql, dynamicParams);
                 if (data.Rows.Count > 0)
                 {
                     mes.code = "300";
                     mes.count = 0;
-                    mes.Message = "褰撳墠鐗╂枡娓呭崟宸茶宸ュ崟鍏宠仈浣跨敤,涓嶅厑璁稿垹闄�!";
+                    mes.Message = "宸ヨ壓璺嚎宸茶宸ュ崟寮曠敤锛屼笉鍏佽鍒犻櫎!";
                     mes.data = null;
+                    return mes;
                 }
                 else
                 {
-                    //鍒犻櫎鐗╂枡娓呭崟瀛愯〃
-                    sql = @"delete TBom_Deta where m_id=@bomid";
-                    list.Add(new { str = sql, parm = new { bomid = bomid } });
-                    //鍒犻櫎鐗╂枡娓呭崟涓昏〃
-                    sql = @"delete TBom_Main where id=@bomid";
-                    list.Add(new { str = sql, parm = new { bomid = bomid } });
+                    //鍒ゆ柇褰撳墠宸ヨ壓璺嚎鏄惁鏈夎缃妭鎷嶅伐浠�(鏈夎缃紝鎻愮ず鍏堝垹闄よ妭鎷嶅伐浠疯缃�)
+                    sql = @"select *   from TPrteEqp_Stad where route_code=@routecode";
+                    dynamicParams.Add("@routecode", routecode);
+                    var data0 = DapperHelper.selectdata(sql, dynamicParams);
+                    if (data0.Rows.Count > 0)
+                    {
+                        mes.code = "300";
+                        mes.count = 0;
+                        mes.Message = "宸ヨ壓璺嚎宸茶缃妭鎷嶅伐浠凤紝璇峰厛鍒犻櫎璁剧疆!";
+                        mes.data = null;
+                        return mes;
+                    }
+                    else
+                    {
+                        //鍒犻櫎宸ヨ壓璺嚎鍏宠仈宸ュ簭琛�
+                        sql = @"delete TFlw_Rtdt  where rout_code=@routecode";
+                        list.Add(new { str = sql, parm = new { routecode = routecode } });
+                        //鍒犻櫎宸ヨ壓璺嚎琛�
+                        sql = @"delete TFlw_Rout  where code=@routecode";
+                        list.Add(new { str = sql, parm = new { routecode = routecode } });
+                        //鍒犻櫎鐗╂枡鍏宠仈宸ヨ壓璺嚎琛�
+                        sql = @"delete TMateriel_Route  where route_code=@routecode";
+                        list.Add(new { str = sql, parm = new { routecode = routecode } });
+                    }
                     bool aa = DapperHelper.DoTransaction(list);
                     if (aa)
                     {
@@ -1130,6 +1148,7 @@
                         mes.count = 0;
                         mes.Message = "鍒犻櫎鎴愬姛!";
                         mes.data = null;
+                        return mes;
                     }
                     else
                     {
@@ -1137,6 +1156,7 @@
                         mes.count = 0;
                         mes.Message = "鍒犻櫎澶辫触!";
                         mes.data = null;
+                        return mes;
                     }
                 }
             }
@@ -1146,6 +1166,7 @@
                 mes.count = 0;
                 mes.Message = e.Message;
                 mes.data = null;
+                return mes;
             }
             return mes;
         }

--
Gitblit v1.9.3