| | |
| | | select A.plan_qty,M.partname,S.ng_qty,S.bad_qty from TK_Wrk_Man A |
| | | inner join (select wo_code, isnull(sum(ng_qty),0) as ng_qty,isnull(sum(bad_qty),0) as bad_qty from TK_Wrk_Step where ng_qty>0 or bad_qty>0 group by wo_code) S on A.wo_code=S.wo_code |
| | | inner join TMateriel_Info M on A.materiel_code=M.partcode |
| | | where A.lm_date between @startopendate and @endclosedate and S.ng_qty>0 or S.bad_qty>0 |
| | | where A.lm_date between @startopendate and @endclosedate |
| | | ) as AA |
| | | group by AA.partname |
| | | order by defect_qty desc"; |
| | |
| | | select A.plan_qty,T.stepname,S.ng_qty,S.bad_qty from TK_Wrk_Man A |
| | | inner join (select wo_code,step_code, isnull(sum(ng_qty),0) as ng_qty,isnull(sum(bad_qty),0) as bad_qty from TK_Wrk_Step where ng_qty>0 or bad_qty>0 group by wo_code,step_code) S on A.wo_code=S.wo_code |
| | | inner join TStep T on S.step_code=T.stepcode |
| | | where A.lm_date between @startopendate and @endclosedate and S.ng_qty>0 or S.bad_qty>0 |
| | | where A.lm_date between @startopendate and @endclosedate |
| | | ) as AA |
| | | group by AA.stepname |
| | | order by defect_qty desc"; |