| | |
| | | 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); |
| | |
| | | try |
| | | { |
| | | //富尔达车间质量数字化看板,不良明细(取质检工序,按产线统计) |
| | | sql = @"select row_number() over(order by MM.lm_date,MM.wo_code) as RowNum,MM.lm_date,MM.wo_code,A.materiel_code,MM.step_code,T.stepname,A.good_qty as report_qty,A.ng_qty, |
| | | defect_name=( STUFF(( SELECT ',' + B.name |
| | | FROM CSR_WorkRecord_Defect N |
| | | inner join TDefect B on N.defect_code=B.code |
| | | where record_id=MM.record_id |
| | | FOR |
| | | XML PATH('') |
| | | ), 1, 1, '') ) |
| | | from CSR_WorkRecord_Defect as MM |
| | | inner join TK_Wrk_Record A on MM.record_id=a.id |
| | | inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code |
| | | inner join TStep T on MM.step_code=T.stepcode |
| | | where MM.step_code=@StepCode and MM.style='B' and A.style='B' and A.ng_qty>0 and S.status<>'CLOSED' |
| | | group by MM.lm_date,MM.record_id,MM.wo_code,A.materiel_code,MM.step_code,T.stepname,A.good_qty,A.ng_qty"; |
| | | sql = @"select row_number() over(order by MM.lm_date,MM.wo_code) as RowNum,MM.lm_date,A.eqp_code,E.name as eqp_name,MM.wo_code,A.materiel_code,M.partname,MM.step_code,T.stepname,A.good_qty as report_qty,A.ng_qty, |
| | | defect_name=( STUFF(( SELECT ',' + B.name |
| | | FROM CSR_WorkRecord_Defect N |
| | | inner join TDefect B on N.defect_code=B.code |
| | | where record_id=MM.record_id |
| | | FOR |
| | | XML PATH('') |
| | | ), 1, 1, '') ) |
| | | from CSR_WorkRecord_Defect as MM |
| | | inner join TK_Wrk_Record A on MM.record_id=a.id |
| | | inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code |
| | | inner join TStep T on MM.step_code=T.stepcode |
| | | inner join TEqpInfo E on A.eqp_code=E.code |
| | | inner join TMateriel_Info M on A.materiel_code=M.partcode |
| | | where MM.step_code=@StepCode and MM.style='B' and A.style='B' and A.ng_qty>0 and S.status<>'CLOSED' |
| | | group by MM.lm_date,MM.record_id,A.eqp_code,E.name,MM.wo_code,A.materiel_code,M.partname,MM.step_code,T.stepname,A.good_qty,A.ng_qty"; |
| | | dynamicParams.Add("@StepCode", StepCode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | mes.code = "200"; |