From 04a14d3a56f9a64668a920e2dfe21d2a7daf89b3 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期一, 06 三月 2023 16:37:42 +0800
Subject: [PATCH] 1.节拍工价新增、编辑加工价类型字段区分自制、外协 2.工序编辑,工序类型切换保存时删除对应节拍工价表 3.工单派发时判断区分自制、外协工序 4.计件工资报表增加剔除工序参数

---
 VueWebApi/DLL/DAL/ProductModelDAL.cs |   79 +++++++++++++++++++++++++++++++++------
 1 files changed, 67 insertions(+), 12 deletions(-)

diff --git a/VueWebApi/DLL/DAL/ProductModelDAL.cs b/VueWebApi/DLL/DAL/ProductModelDAL.cs
index daea8e0..1994769 100644
--- a/VueWebApi/DLL/DAL/ProductModelDAL.cs
+++ b/VueWebApi/DLL/DAL/ProductModelDAL.cs
@@ -1578,6 +1578,9 @@
                             //淇敼宸ュ簭琛ㄥ叧鑱斿伐浣滅珯鏍囪瘑
                             sql_1 = @"update TStep set is_eqp='N' where stepcode=@stepcode";
                             list.Add(new { str = sql_1, parm = new { stepcode = stepcode } });
+                            //鍒犻櫎璁惧鑺傛媿宸ヤ环琛�
+                            sql_1 = @"delete TPrteEqp_Stad  where step_code=@stepcode";
+                            list.Add(new { str = sql_1, parm = new { stepcode = stepcode } });
                         }
                     }
 
@@ -2018,12 +2021,12 @@
             try
             {
                 //閫氳繃浜у搧缂栫爜鏌ユ壘鍏宠仈鐨勫伐鑹鸿矾绾夸俊鎭�
-                sql = @"select B.stepcode as code,B.stepname as name   
+                sql = @"select B.stepcode as code,B.stepname as name,B.flwtype as flag   
                         from TFlw_Rtdt A
                         inner join TStep B on A.step_code=B.stepcode
                         where A.rout_code=@routecode and B.is_delete<>'1' and A.is_delete<>'1'";
                 dynamicParams.Add("@routecode", routecode);
-                var data = DapperHelper.select<ObjectData>(sql, dynamicParams);
+                var data = DapperHelper.select<StepDefect>(sql, dynamicParams);
                 mes.code = "200";
                 mes.Message = "鏌ヨ鎴愬姛!";
                 mes.data = data;
@@ -2068,29 +2071,81 @@
         #endregion
 
         #region[鏍规嵁宸ュ簭绾跨紪鐮佹煡鎵惧叧鑱旇澶囬泦鍚圿
-        public static ToMessage StepSelectEqpList(string partcode, string routecode, string stepcode, int startNum, int endNum, string prop, string order)
+        public static ToMessage StepSelectEqpList(string partcode, string routecode, string stepcode,string steptype, int startNum, int endNum, string prop, string order)
         {
             var dynamicParams = new DynamicParameters();
-            string search = "";
+            string search = "", sql = "";
+            int total = 0;
             try
             {
                 // --------------鏌ヨ鎸囧畾鏁版嵁--------------
-                var total = 0; //鎬绘潯鏁�
-                var sql = @"select B.code as eqpcode,B.name as eqpname,B.wksp_code,T.org_name as wksp_name,A.eqp_value,A.stand_value,A.cavity_qty,A.unprice  
+                if (steptype == "Z")  //鑷埗宸ュ簭
+                {
+                    total = 0; //鎬绘潯鏁�
+                    //sql = @"select B.code as eqpcode,B.name as eqpname,B.wksp_code,T.org_name as wksp_name,A.eqp_value,A.stand_value,A.cavity_qty,A.unprice  
+                    //        from (
+                    //        select materiel_code, eqp_code,eqp_value,stand_value,cavity_qty,unprice   from TPrteEqp_Stad
+                    //        where materiel_code=@partcode  and route_code=@routecode and step_code=@stepcode 
+                    //        union all
+                    //        select @partcode as materiel_code,eqp_code,'0' as eqp_value,'0' as stand_value,'0' as cavity_qty,'0' as unprice
+                    //        from TFlw_Rteqp where step_code=@stepcode and style='E' and @partcode+eqp_code+step_code not in(select materiel_code+eqp_code+step_code  from TPrteEqp_Stad)
+                    //        ) A
+                    //        left join TEqpInfo B on A.eqp_code=B.code 
+                    //        left join TOrganization T on B.wksp_code=T.org_code 
+                    //        left join TMateriel_Info C on A.materiel_code=C.partcode
+                    //        where B.is_delete<>'1' and  T.is_delete<>'1' and C.is_delete<>'1' ";
+
+                    sql = @"select B.code as eqpcode,B.name as eqpname,B.wksp_code,T.org_name as wksp_name,A.eqp_value,A.stand_value,A.cavity_qty,A.unprice  
                             from (
                             select materiel_code, eqp_code,eqp_value,stand_value,cavity_qty,unprice   from TPrteEqp_Stad
                             where materiel_code=@partcode  and route_code=@routecode and step_code=@stepcode 
                             union all
-                            select @partcode as materiel_code,eqp_code,'0' as eqp_value,'0' as stand_value,'0' as cavity_qty,'0' as unprice
-                            from TFlw_Rteqp where step_code=@stepcode and style='E' and @partcode+eqp_code+step_code not in(select materiel_code+eqp_code+step_code  from TPrteEqp_Stad)
+                            select @partcode as materiel_code,C.eqp_code,'0' as eqp_value,'0' as stand_value,'0' as cavity_qty,'0' as unprice
+                            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 and B.step_code=@stepcode and style='E' and @partcode+A.code+C.eqp_code+B.step_code 
+                            not in(select materiel_code+route_code+eqp_code+step_code  from TPrteEqp_Stad where materiel_code=@partcode and route_code=@routecode and step_code=@stepcode)
                             ) A
                             left join TEqpInfo B on A.eqp_code=B.code 
                             left join TOrganization T on B.wksp_code=T.org_code 
                             left join TMateriel_Info C on A.materiel_code=C.partcode
-                            where B.is_delete<>'1' and  T.is_delete<>'1' and C.is_delete<>'1' ";
-                dynamicParams.Add("@partcode", partcode);
-                dynamicParams.Add("@routecode", routecode);
-                dynamicParams.Add("@stepcode", stepcode);
+                            where B.is_delete<>'1' and  T.is_delete<>'1' and C.is_delete<>'1'";
+                    dynamicParams.Add("@partcode", partcode);
+                    dynamicParams.Add("@routecode", routecode);
+                    dynamicParams.Add("@stepcode", stepcode);
+                }
+                else  //澶栧崗宸ュ簭
+                {
+                    total = 0; //鎬绘潯鏁�
+                    //sql = @"select B.code as eqpcode,B.name as eqpname,'' as wksp_code,'' as wksp_name,A.eqp_value,A.stand_value,A.cavity_qty,A.unprice  
+                    //        from (
+                    //        select materiel_code, eqp_code,eqp_value,stand_value,cavity_qty,unprice   from TPrteEqp_Stad
+                    //        where materiel_code=@partcode  and route_code=@routecode and step_code=@stepcode 
+                    //        union all
+                    //        select @partcode as materiel_code,eqp_code,'0' as eqp_value,'0' as stand_value,'0' as cavity_qty,'0' as unprice
+                    //        from TFlw_Rteqp where step_code=@stepcode and style='W' and @partcode+eqp_code+step_code not in(select materiel_code+eqp_code+step_code  from TPrteEqp_Stad)
+                    //        ) A
+                    //        left join TCustomer B on A.eqp_code=B.code
+                    //        where B.is_delete<>'1'";
+                    sql = @"select B.code as eqpcode,B.name as eqpname,'' as wksp_code,'' as wksp_name,A.eqp_value,A.stand_value,A.cavity_qty,A.unprice 
+                            from (
+                            select materiel_code, eqp_code,eqp_value,stand_value,cavity_qty,unprice   from TPrteEqp_Stad
+                            where materiel_code=@partcode  and route_code=@routecode and step_code=@stepcode 
+                            union all
+                            select @partcode as materiel_code,C.eqp_code,'0' as eqp_value,'0' as stand_value,'0' as cavity_qty,'0' as unprice
+                            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 and B.step_code=@stepcode and style='W' and @partcode+A.code+C.eqp_code+B.step_code 
+                            not in(select materiel_code+route_code+eqp_code+step_code  from TPrteEqp_Stad where materiel_code=@partcode and route_code=@routecode and step_code=@stepcode)
+                            ) A
+                            left join TCustomer B on A.eqp_code=B.code
+                            where B.is_delete<>'1'";
+                    dynamicParams.Add("@partcode", partcode);
+                    dynamicParams.Add("@routecode", routecode);
+                    dynamicParams.Add("@stepcode", stepcode);
+                }
                 var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
                 mes.code = "200";
                 mes.Message = "鏌ヨ鎴愬姛!";

--
Gitblit v1.9.3