From 01b5ef474e1a5d8dc682b64312f23bdbb0fdf3a7 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期三, 12 四月 2023 16:26:48 +0800
Subject: [PATCH] 1.采购到货接口修改 2.停用设备过滤

---
 VueWebApi/DLL/DAL/ProductionManagementDAL.cs |  421 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 414 insertions(+), 7 deletions(-)

diff --git a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
index a4718c2..f2336c9 100644
--- a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
+++ b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
@@ -127,7 +127,8 @@
                     //鑾峰彇鏈�澶у崟鎹彿
                     if (i == 1)  //棣栧崟鑾峰彇宸ュ崟鍙�
                     {
-                        sql = @"select isnull(max(substring(wo_code,charindex('_',wo_code)+1,len(wo_code)-charindex('_',wo_code))),0)+1 as worknumb from TK_Wrk_Man where m_po=@erpordercode";
+                        sql = @"select isnull(max(cast(substring(wo_code,charindex('_',wo_code)+1,len(wo_code)-charindex('_',wo_code)) as numeric)),0)+1 as worknumb   
+                                from TK_Wrk_Man where m_po=@erpordercode";
                         dynamicParams.Add("@erpordercode", erpordercode);
                         var data = DapperHelper.selectdata(sql, dynamicParams);
                         num = Convert.ToInt32(data.Rows[0]["WORKNUMB"].ToString());
@@ -391,6 +392,83 @@
         }
         #endregion
 
+        #region[MES鎶ュ簾琛ュ崟宸ュ崟鏌ヨ]
+        public static ToMessage MesBadOrderSearch(string mesordercode, string sourceorder, string partcode, string partname, string partspec, int startNum, string creatuser, string createdate, int endNum, string prop, string order)
+        {
+            var dynamicParams = new DynamicParameters();
+            string search = "";
+            try
+            {
+                if (mesordercode != "" && mesordercode != null)
+                {
+                    search += "and A.wo_code like '%'+@mesordercode+'%' ";
+                    dynamicParams.Add("@mesordercode", mesordercode);
+                }
+                if (sourceorder != "" && sourceorder != null)
+                {
+                    search += "and A.m_po like '%'+@sourceorder+'%' ";
+                    dynamicParams.Add("@sourceorder", sourceorder);
+                }
+                if (partcode != "" && partcode != null)
+                {
+                    search += "and A.materiel_code like '%'+@partcode+'%' ";
+                    dynamicParams.Add("@partcode", partcode);
+                }
+                if (partname != "" && partname != null)
+                {
+                    search += "and B.partname like '%'+@partname+'%' ";
+                    dynamicParams.Add("@partname", partname);
+                }
+                if (partspec != "" && partspec != null)
+                {
+                    search += "and B.partspec like '%'+@partspec+'%' ";
+                    dynamicParams.Add("@partspec", partspec);
+                }
+                if (createdate != "" && createdate != null)
+                {
+                    search += "and CONVERT(varchar(100),A.lm_date,23)=@createdate ";
+                    dynamicParams.Add("@createdate", createdate);
+                }
+                if (creatuser != "" && creatuser != null)
+                {
+                    search += "and U.username like '%'+@creatuser+'%' ";
+                    dynamicParams.Add("@creatuser", creatuser);
+                }
+
+                if (search == "")
+                {
+                    search = "and 1=1 ";
+                }
+                // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+                var total = 0; //鎬绘潯鏁�
+                var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.plan_qty,A.wkshp_code,C.org_name as wkshp_name,
+                            A.route_code,E.name as route_name,A.stck_code,F.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,U.username as lm_user,A.lm_date,S.bad_qty
+                            from TK_Wrk_Man A
+                            left join (select wo_code,sum(bad_qty) as bad_qty from  TK_Wrk_Step where bad_qty>0 group by wo_code) S on A.wo_code=S.wo_code
+                            left join TMateriel_Info B on A.materiel_code=B.partcode
+                            left join TOrganization C on A.wkshp_code=C.org_code
+                            left join T_Sec_Stck D on A.stck_code=D.code 
+                            left join TFlw_Rout E on A.route_code=E.code
+                            left join T_Sec_Stck F on A.stck_code=F.code 
+                            left join TUser U on A.lm_user=U.usercode 
+                            where A.is_delete<>'1'  and A.status='START' and A.wotype='PO' and S.bad_qty>0 " + search;
+                var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+                mes.code = "200";
+                mes.Message = "鏌ヨ鎴愬姛!";
+                mes.count = total;
+                mes.data = data.ToList();
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
         #region[浜у搧缂栫爜鏌ユ壘宸ヨ壓璺嚎涓嬫媺鎺ュ彛]
         public static ToMessage PartSelectRoute(string partcode)
         {
@@ -435,7 +513,7 @@
                         inner join TFlw_Rteqp D on C.stepcode=D.step_code
                         inner join TEqpInfo  E on D.eqp_code=E.code
                         left join TOrganization F on E.wksp_code=F.org_code
-                        where A.code=@routecode and M.materiel_code=@partcode ";
+                        where A.code=@routecode and M.materiel_code=@partcode and E.enable='Y'";
                 dynamicParams.Add("@partcode", partcode);
                 dynamicParams.Add("@routecode", routecode);
                 var data = DapperHelper.selectdata(sql, dynamicParams);
@@ -482,7 +560,6 @@
         }
         #endregion
 
-
         #region銆愮敓浜х鐞嗐�佸伐鍗曟柊澧炪�佺紪杈戞椂,閫夋嫨鎺掔▼鏄椂鑾峰彇鐗╂枡娓呭崟鐗堟湰鍙枫��
         public static ToMessage JobCreationSonAddVison(string partnumber)
         {
@@ -496,6 +573,125 @@
                 mes.code = "200";
                 mes.Message = "鏌ヨ鎴愬姛!";
                 mes.data = data;
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
+        #region[宸ュ崟娲惧彂閫夋嫨宸ヨ壓璺嚎鎴栭�夋嫨鐢熶骇杞﹂棿鏃跺垽鏂粦瀹氭潯浠禲
+        public static ToMessage SelectRouteOrWkshop(string partcode, string routecode, string wkshopcode)
+        {
+            string sql = "";
+            var dynamicParams = new DynamicParameters();
+            try
+            {
+                mes.code = "200";
+                mes.Message = "";
+                mes.data = null;
+                //鍒ゆ柇宸ヨ壓璺嚎瀵瑰簲宸ュ簭鏄惁閮芥湁鍏宠仈宸ヤ綔绔�
+                sql = @"select B.step_code,C.eqp_code from TFlw_Rout A
+                        inner join TFlw_Rtdt B on A.code=B.rout_code
+                        left join TFlw_Rteqp C on B.step_code=C.step_code
+                        where A.code=@routecode";
+                dynamicParams.Add("@routecode", routecode);
+                var dtck = DapperHelper.selectdata(sql, dynamicParams);
+                for (int i = 0; i < dtck.Rows.Count; i++)
+                {
+                    if (dtck.Rows[i].IsNull("eqp_code"))
+                    {
+                        mes.code = "300";
+                        mes.count = 0;
+                        mes.Message = "褰撳墠宸ヨ壓璺嚎瀵瑰簲宸ュ簭銆�"+dtck.Rows[i]["step_code"].ToString()+"銆戯紝鏈叧鑱旇澶囷紝璇峰叧鑱旀墍鏈夊伐搴忓搴旇澶�!";
+                        mes.data = null;
+                        return mes;
+                    }
+                }
+                //鍒ゆ柇宸ヤ綔绔�(璁惧)鏄惁鍙敤
+                sql = @"select B.step_code  from TFlw_Rout  A
+						inner join TFlw_Rtdt B on A.code=B.rout_code
+						where A.code=@routecode";
+                dynamicParams.Add("@routecode", routecode);
+                var dtck1 = DapperHelper.selectdata(sql, dynamicParams);
+                for (int i = 0; i < dtck1.Rows.Count; i++)
+                {
+                    //宸ュ簭鏌ユ壘璁惧
+                    sql = @"select E.code,E.name,E.enable  
+						from  TFlw_Rteqp C
+						left join TEqpInfo E on C.eqp_code=E.code 
+						where C.step_code=@step_code";
+                    dynamicParams.Add("@step_code", dtck1.Rows[i]["step_code"].ToString());
+                    var dtck2 = DapperHelper.selectdata(sql, dynamicParams);
+                    int query = dtck2.AsEnumerable().Where<DataRow>(a => a["enable"].ToString() =="N").Count();
+                    if (dtck1.Rows.Count == query) 
+                    {
+                        mes.code = "300";
+                        mes.count = 0;
+                        mes.Message = "褰撳墠宸ヨ壓璺嚎瀵瑰簲宸ュ簭銆�" + dtck.Rows[i]["step_code"].ToString() + "銆戯紝璁惧涓嶅彲鐢�!";
+                        mes.data = null;
+                        return mes;
+                    }
+                }
+                //鍒ゆ柇宸ヨ壓璺嚎瀵瑰簲宸ュ簭鍏宠仈鐨勫伐浣滅珯鏄惁鏈夎缃妭鎷嶅伐浠�
+                sql = @"select AA.step_code,AA.eqp_code,AA.flwtype,S.unprice  from (
+                        select A.code,B.step_code,C.eqp_code,S.flwtype from TFlw_Rout A
+                        inner join TFlw_Rtdt B on A.code=B.rout_code
+                        left join TFlw_Rteqp C on B.step_code=C.step_code
+                        left join TStep S on B.step_code=S.stepcode
+                        where A.code=@route_code
+                        ) as AA
+                        left join (select * from TPrteEqp_Stad   where materiel_code=@partcode and route_code=@route_code) as S on
+                        AA.code=S.route_code and AA.step_code=S.step_code and AA.eqp_code=S.eqp_code";
+                dynamicParams.Add("@partcode", partcode);
+                dynamicParams.Add("@route_code", routecode);
+                var dtc = DapperHelper.selectdata(sql, dynamicParams);
+                for (int i = 0; i < dtc.Rows.Count; i++)
+                {
+                    if (dtc.Rows[i]["flwtype"].ToString() == "Z") //鍒ゆ柇宸ュ簭鏄惁涓鸿嚜鍒�
+                    {
+                        if (dtc.Rows[i].IsNull("unprice") || decimal.Parse(dtc.Rows[i]["unprice"].ToString()) == 0)
+                        {
+                            mes.code = "300";
+                            mes.count = 0;
+                            mes.Message = "鑺傛媿宸ヤ环涓細褰撳墠浜у搧銆�" + partcode + "銆戯紝瀵瑰簲宸ヨ壓璺嚎銆�" + routecode + "銆戞湭璁剧疆(鎴栨湭璁剧疆鍏�)鎴栧伐浠峰皬浜庣瓑浜�0!";
+                            mes.data = null;
+                            return mes;
+                        }
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
+        #region[MES宸ュ崟鏂板銆佽幏鍙栧伐鍗曞彿]
+        public static ToMessage AddMesOrderCodeSearch()
+        {
+            string sql = "";
+            string wo_code = "";
+            var dynamicParams = new DynamicParameters();
+            try
+            {
+                //鑾峰彇鍗曟嵁鍙�
+                sql = @"SELECT 'SGPO'+CONVERT(varchar(12) , getdate(), 112 )+'_'+cast(isnull(max(cast(substring(wo_code,charindex('_',wo_code)+1,len(wo_code)-charindex('_',wo_code)) as numeric)),0)+1 as varchar) as numct
+                        FROM TK_Wrk_Man where wo_code like '%SGPO%'";
+                var data = DapperHelper.selecttable(sql);
+                mes.code = "200";
+                mes.Message = "鏌ヨ鎴愬姛!";
+                mes.data = data.Rows[0]["numct"].ToString();
             }
             catch (Exception e)
             {
@@ -614,7 +810,23 @@
                             CreateDate = DateTime.Now.ToString()
                         }
                     });
-
+                    //鍐欏叆宸ュ崟宸ヨ壓璺嚎宸ュ簭宸ヤ环澶嶅埗琛�
+                    sql = @"insert into TWoPrteEqp_Stad(wo,materiel_code,eqp_code,stand_value,opc_conver,route_code,unprice,eqp_value,cavity_qty,wkspcode,lm_user,lm_date,torg_code,is_delete,step_code)
+                           select distinct @mesordercode as wo,S.materiel_code,S.eqp_code,S.stand_value,S.opc_conver,S.route_code,S.unprice,
+                           S.eqp_value,S.cavity_qty,S.wkspcode,S.lm_user,S.lm_date,S.torg_code,S.is_delete,S.step_code
+                           from TFlw_Rtdt A
+                           inner join TFlw_Rteqp C on A.step_code=C.step_code
+                           inner join (select *   from TPrteEqp_Stad  where materiel_code=@materiel_code and route_code=@routecode) as S on C.step_code=S.step_code and C.eqp_code=S.eqp_code";
+                    list.Add(new
+                    {
+                        str = sql,
+                        parm = new
+                        {
+                            mesordercode = mesordercode,
+                            materiel_code = partcode,
+                            routecode = routecode
+                        }
+                    });
 
                     bool aa = DapperHelper.DoTransaction(list);
                     if (aa)
@@ -708,6 +920,34 @@
                             CreateDate = DateTime.Now.ToString()
                         }
                     });
+                    //鍒犻櫎宸ュ崟宸ヨ壓璺嚎宸ュ簭宸ヤ环澶嶅埗琛�
+                    sql = @"delete TWoPrteEqp_Stad where wo=@mesordercode";
+                    list.Add(new
+                    {
+                        str = sql,
+                        parm = new
+                        {
+                            mesordercode = mesordercode
+                        }
+                    });
+                    //鍐欏叆宸ュ崟宸ヨ壓璺嚎宸ュ簭宸ヤ环澶嶅埗琛�
+                    sql = @"insert into TWoPrteEqp_Stad(wo,materiel_code,eqp_code,stand_value,opc_conver,route_code,unprice,eqp_value,cavity_qty,wkspcode,lm_user,lm_date,torg_code,is_delete,step_code)
+                           select distinct @mesordercode as wo,S.materiel_code,S.eqp_code,S.stand_value,S.opc_conver,S.route_code,S.unprice,
+                           S.eqp_value,S.cavity_qty,S.wkspcode,S.lm_user,S.lm_date,S.torg_code,S.is_delete,S.step_code
+                           from TFlw_Rtdt A
+                           inner join TFlw_Rteqp C on A.step_code=C.step_code
+                           inner join (select *   from TPrteEqp_Stad  where materiel_code=@materiel_code and route_code=@routecode) as S on C.step_code=S.step_code and C.eqp_code=S.eqp_code";
+                    list.Add(new
+                    {
+                        str = sql,
+                        parm = new
+                        {
+                            mesordercode = mesordercode,
+                            materiel_code = partcode,
+                            routecode = routecode
+                        }
+                    });
+
                     bool aa = DapperHelper.DoTransaction(list);
                     if (aa)
                     {
@@ -889,6 +1129,171 @@
         #endregion
 
 
+        #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇褰撳墠宸ュ簭瀵瑰簲鐨勮澶�(鑷埗)]
+        public static ToMessage MesOrderStepEqpSearch(string orderstepqrcode)
+        {
+            var sql = "";
+            string search = "";//瀹氫箟涓�涓煡璇㈠弬鏁�,鏌ヨ鏉′欢鏈夊墠绔紶鍏�
+            string ordercode = "";
+            string stepcode = "";
+            var dynamicParams = new DynamicParameters();
+            try
+            {
+                if (orderstepqrcode != "" && orderstepqrcode != null)
+                {
+                    string[] arra = orderstepqrcode.Split(';');
+                    if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+                    {
+                        ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+                        mes.code = "300";
+                        mes.count = 0;
+                        mes.Message = "璇锋壂鎻忓伐搴忎簩缁寸爜!";
+                        mes.data = null;
+                        return mes;
+                    }
+                    if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+                    {
+                        ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+                        stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+                    }
+                }
+                if (stepcode != "")
+                {
+                    //鏌ユ壘褰撳墠宸ュ簭灞炴��
+                    sql = @"select *  from TStep  where stepcode=@stepcode";
+                    dynamicParams.Add("@stepcode", stepcode);
+                    var data0 = DapperHelper.selectdata(sql, dynamicParams);
+                    if (data0.Rows.Count > 0)
+                    {
+                        if (data0.Rows[0]["FLWTYPE"].ToString() == "W")
+                        {
+                            mes.code = "300";
+                            mes.count = 0;
+                            mes.Message = "褰撳墠宸ュ簭浠诲姟涓哄鍗忓伐搴忎换鍔�,璇峰墠寰�澶栧崗鎿嶄綔椤电鎵ц!";
+                            mes.data = null;
+                            return mes;
+                        }
+                    }
+                }
+                //鏍规嵁鏉′欢鏌ヨ宸ュ崟宸ュ簭璁惧(鑷埗宸ュ簭)
+                sql = @"select B.eqp_code,E.name as eqp_name   from TK_Wrk_Step A
+                        inner join TFlw_Rteqp B on A.step_code=B.step_code
+                        left join  TEqpInfo E on B.eqp_code=E.code
+                        where B.style='E' and A.wo_code=@ordercode and A.step_code=@stepcode
+                        order by B.eqp_code";
+                dynamicParams.Add("@ordercode", ordercode);
+                dynamicParams.Add("@stepcode", stepcode);
+                var data = DapperHelper.selectdata(sql, dynamicParams);
+                if (data.Rows.Count > 0)
+                {
+                    mes.code = "200";
+                    mes.count = 0;
+                    mes.Message = "鏌ヨ鎴愬姛!";
+                    mes.data = data;
+                    return mes;
+                }
+                else
+                {
+                    mes.code = "300";
+                    mes.count = 0;
+                    mes.Message = "褰撳墠宸ュ簭浠诲姟鏃犲彲鎵ц璁惧!";
+                    mes.data = null;
+                    return mes;
+                }
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
+        #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇褰撳墠宸ュ簭瀵瑰簲鐨勪緵鏂�(澶栧崗)]
+        public static ToMessage MesOrderWxStepEqpSearch(string orderstepqrcode)
+        {
+            var sql = "";
+            string search = "";
+            string ordercode = "";
+            string stepcode = "";
+            var dynamicParams = new DynamicParameters();
+            try
+            {
+                if (orderstepqrcode != "" && orderstepqrcode != null)
+                {
+                    string[] arra = orderstepqrcode.Split(';');
+                    if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+                    {
+                        ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+                        mes.code = "300";
+                        mes.count = 0;
+                        mes.Message = "璇锋壂鎻忓伐搴忎簩缁寸爜!";
+                        mes.data = null;
+                        return mes;
+                    }
+                    if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+                    {
+                        ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+                        stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+                    }
+                }
+                if (stepcode != "")
+                {
+                    //鏌ユ壘褰撳墠宸ュ簭灞炴��
+                    sql = @"select *  from TStep  where stepcode=@stepcode";
+                    dynamicParams.Add("@stepcode", stepcode);
+                    var data0 = DapperHelper.selectdata(sql, dynamicParams);
+                    if (data0.Rows.Count > 0)
+                    {
+                        if (data0.Rows[0]["FLWTYPE"].ToString() == "Z")
+                        {
+                            mes.code = "300";
+                            mes.count = 0;
+                            mes.Message = "褰撳墠宸ュ簭浠诲姟涓鸿嚜鍒跺伐搴忎换鍔�,璇峰墠寰�鑷埗鎿嶄綔椤电鎵ц!";
+                            mes.data = null;
+                            return mes;
+                        }
+                    }
+                }
+                //鏍规嵁鏉′欢鏌ヨ宸ュ崟宸ュ簭澶栧崗渚涙柟(澶栧崗宸ュ簭)
+                sql = @"select B.eqp_code as customercode,C.name as customername   from TK_Wrk_Step A
+                       inner join TFlw_Rteqp B on A.step_code=B.step_code
+                       left join  TCustomer C on B.eqp_code=C.code
+                       where B.style='W' and A.wo_code=@ordercode and A.step_code=@stepcode
+                       order by B.eqp_code";
+                dynamicParams.Add("@ordercode", ordercode);
+                dynamicParams.Add("@stepcode", stepcode);
+                var data = DapperHelper.selectdata(sql, dynamicParams);
+                if (data.Rows.Count > 0)
+                {
+                    mes.code = "200";
+                    mes.count = 0;
+                    mes.Message = "鏌ヨ鎴愬姛!";
+                    mes.data = data;
+                    return mes;
+                }
+                else
+                {
+                    mes.code = "300";
+                    mes.count = 0;
+                    mes.Message = "褰撳墠宸ュ簭鏃犲彲鎵ц澶栧崗渚涙柟!";
+                    mes.data = null;
+                    return mes;
+                }
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
 
         #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(鑷埗)]
         public static ToMessage MesOrderStepSearch(string orderstepqrcode, int startNum, int endNum, string prop, string order)
@@ -1403,7 +1808,8 @@
                 //鑾峰彇宸ュ簭鍏宠仈鐨勮澶�
                 sql = @"select B.code,B.name from TFlw_Rteqp A
                         left join TEqpInfo B on A.eqp_code=B.code
-                        where A.style='E' and A.step_code=@stepcode";
+                        where A.style='E' and A.step_code=@stepcode and B.enable='Y'";
+                dynamicParams.Add("@wo_code", ordercode);
                 dynamicParams.Add("@stepcode", stepcode);
                 var data = DapperHelper.selectdata(sql, dynamicParams);
                 mes.code = "200";
@@ -3388,15 +3794,16 @@
                     return list;
                 }
                 bool IsCap = false;    //鏄惁璁剧疆浜ц兘
-                //閫氳繃宸ュ崟鏌ユ壘宸ヨ壓璺嚎瀵瑰簲鍏抽敭宸ュ簭鎵�鍏宠仈鐨勮澶囨槸鍚﹀彲鐢�
+                //閫氳繃宸ュ崟鏌ユ壘瀵瑰簲杞﹂棿宸ヨ壓璺嚎涓嬪叧閿伐搴忔墍鍏宠仈鐨勮澶囨槸鍚﹀彲鐢�
                 sql = @"select distinct C.eqp_code ,D.Enable  from TK_Wrk_Man A
                        left join TFlw_Rout K on A.route_code=K.code
                        left join TFlw_Rtdt B on K.code=B.rout_code and B.first_choke='Y'
                        left join TFlw_Rteqp C on B.step_code= C.step_code
                        left join TEqpInfo D on C.eqp_code=D.code
-                       where A.wo_code=@wocode and A.materiel_code=@partcode";
+                       where A.wo_code=@wocode and A.materiel_code=@partcode and D.wksp_code=@wkshpcode";
                 dynamicParams.Add("@wocode", wocode);
                 dynamicParams.Add("@partcode", partcode);
+                dynamicParams.Add("@wkshpcode", wkshpcode);
                 var dt_0 = DapperHelper.selectdata(sql, dynamicParams);
                 if (dt_0.Rows.Count > 0)
                 {

--
Gitblit v1.9.3