yl
2023-03-08 819289e1cfaa581fd6aafe9e43f5450d2860ba56
VueWebApi/DLL/DAL/KanBanManagerentDAL.cs
@@ -462,15 +462,26 @@
            try
            {
                //获取产线销售订单报工信息,报工数量>0  且工单状态为非关闭状态  且工序为末道工序 (--and (S.good_qty+S.ng_qty+S.bad_qty)<S.plan_qty)
                //sql = @"select AA.saleOrderCode,AA.materiel_code,AA.partname,sum(AA.good_qty) as good_qty   from (
                //        select distinct A.saleOrderCode,A.materiel_code,M.partname,isnull(S.good_qty,0) as good_qty
                //        from TKimp_Ewo A
                //        left join TK_Wrk_Man B on A.wo=B.m_po and A.materiel_code=B.materiel_code
                //        left join TK_Wrk_Step S on B.wo_code=S.wo_code and S.isend='Y'
                //        left join TFlw_Rteqp R on S.step_code=R.step_code
                //        left  join TMateriel_Info M on A.materiel_code=M.partcode
                //        where A.saleOrderCode is not null and A.saleOrderCode<>''
                //        and R.eqp_code=@lineCode and B.status<>'CLOSED'
                //        ) as AA
                //        group by AA.saleOrderCode,AA.materiel_code,AA.partname";
                sql = @"select AA.saleOrderCode,AA.materiel_code,AA.partname,sum(AA.good_qty) as good_qty   from (
                        select distinct A.saleOrderCode,A.materiel_code,M.partname,isnull(S.good_qty,0) as good_qty
                        from TKimp_Ewo A
                        left join TK_Wrk_Man B on A.wo=B.m_po and A.materiel_code=B.materiel_code 
                        left join TK_Wrk_Step S on B.wo_code=S.wo_code and S.isend='Y' 
                        left join TFlw_Rteqp R on S.step_code=R.step_code
                        left join TK_Wrk_Record T on S.wo_code=T.wo_code
                        left  join TMateriel_Info M on A.materiel_code=M.partcode
                        where A.saleOrderCode is not null and A.saleOrderCode<>'' 
                        and R.eqp_code=@lineCode and B.status<>'CLOSED'
                        and T.eqp_code=@lineCode and B.status<>'CLOSED'
                        ) as AA
                        group by AA.saleOrderCode,AA.materiel_code,AA.partname";
                dynamicParams.Add("@lineCode", lineCode);