yl
2023-03-21 635fc964ea4b1efbd8340040b50bffa2c9b84187
VueWebApi/DLL/DAL/KanBanManagerentDAL.cs
@@ -58,12 +58,17 @@
                {
                    string[] selects = Array.ConvertAll<string, string>(shopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[] 
                    //查询产线下已开工的加工单信息
                    sql = @"select distinct E.saleOrderCode,A.wo_code,P.plan_qty,M.partcode,M.partname,M.partspec,T.name as uomname   from TK_Wrk_Record A
                    sql = @"select *  from (
                                    select distinct E.saleOrderCode,A.wo_code,P.plan_qty,M.partcode,M.partname,M.partspec,T.name as uomname,S.good_qty,S.ng_qty,S.bad_qty   from TK_Wrk_Record A
                                    inner join TK_Wrk_Man P on A.wo_code=P.wo_code
                                    left join TMateriel_Info M on P.materiel_code=M.partcode
                                    left join TUom T on M.uom_code=T.code 
                                    left join TKimp_Ewo E on P.m_po=E.wo and P.sourceid=E.id
                                    where P.status<>'CLOSED' and P.status<>'NEW' and P.wkshp_code in @shopcode and A.style='S' and A.step_seq='1'";
                                    left join (
                                      select wo_code,sum(good_qty) as good_qty,sum(ng_qty) as ng_qty,sum(bad_qty) as bad_qty  from TK_Wrk_Step where isend='Y' group by wo_code
                                    ) S on P.wo_code=S.wo_code
                                    where P.status<>'CLOSED' and P.status<>'NEW' and P.wkshp_code in @shopcode and A.style='S' and A.step_seq='1' and A.lm_date>dateadd(month,-1,getdate())
                                    ) as AA where AA.plan_qty>(AA.good_qty+aa.bad_qty+AA.ng_qty)";
                    var data0 = DapperHelper.selectlist(sql, new { shopcode = selects.ToArray() });
                
                    if (data0.Rows.Count > 0)
@@ -161,7 +166,8 @@
                         inner join TKimp_Ewo E on A.m_po=E.wo and A.sourceid=E.id
                         left  join TMateriel_Info M on A.materiel_code=M.partcode
                         left  join TUom U on M.uom_code=U.code
                         where A.status<>'CLOSED' and A.wkshp_code in @shopcode and A.is_delete<>'1' and B.isend='Y'
                         where A.status<>'CLOSED' and A.wkshp_code in @shopcode and A.is_delete<>'1' and B.isend='Y' and A.lm_date>dateadd(month,-1,getdate())
                         and A.plan_qty>(B.good_qty+B.ng_qty+B.bad_qty)
                         )as A ";
                var data = DapperHelper.selectlist(sql, new { shopcode = selects.ToArray() });
                mes.code = "200";