yl
2024-03-29 9c634fd767aec36ef97c3a814bf7a29c67d20ee1
VueWebApi/DLL/DAL/ProductionManagementDAL.cs
@@ -579,7 +579,7 @@
                var sql = @"select A.id, A.status,A.wotype,A.printcount,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.plan_qty,A.wkshp_code,C.org_name as wkshp_name,
                            A.route_code,E.name as route_name,A.stck_code,F.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,W.saleOrderCode,U.username as lm_user,A.lm_date
                            from TK_Wrk_Man A
                            left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code
                            left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code and A.sourceid=W.id
                            left join TMateriel_Info B on A.materiel_code=B.partcode
                            left join TOrganization C on A.wkshp_code=C.org_code
                            left join T_Sec_Stck D on A.stck_code=D.code 
@@ -662,7 +662,7 @@
                var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.plan_qty,A.wkshp_code,C.org_name as wkshp_name,
                            A.route_code,E.name as route_name,A.stck_code,F.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,W.saleOrderCode,U.username as lm_user,A.lm_date,S.bad_qty
                            from TK_Wrk_Man A
                            left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code
                            left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code and A.sourceid=W.id
                            left join (select wo_code,sum(bad_qty) as bad_qty from  TK_Wrk_Step where bad_qty>0 group by wo_code) S on A.wo_code=S.wo_code
                            left join TMateriel_Info B on A.materiel_code=B.partcode
                            left join TOrganization C on A.wkshp_code=C.org_code
@@ -1686,7 +1686,7 @@
                        B.m_po,W.saleOrderCode
                        from TK_Wrk_Step A
                        left join TK_Wrk_Man B on A.wo_code=B.wo_code
                        left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code
                        left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code and B.sourceid=W.id
                        left join TMateriel_Info M on B.materiel_code=M.partcode
                        left join TStep S on A.step_code=S.stepcode
                        left join TOrganization F on B.wkshp_code=F.org_code
@@ -1809,7 +1809,7 @@
                            B.m_po,W.saleOrderCode
                            from TK_Wrk_Step A
                            left join TK_Wrk_Man B on A.wo_code=B.wo_code
                            left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code
                            left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code and B.sourceid=W.id
                            left join TMateriel_Info M on B.materiel_code=M.partcode
                            left join TStep S on A.step_code=S.stepcode
                            left join TOrganization F on B.wkshp_code=F.org_code
@@ -1922,7 +1922,7 @@
                        B.m_po,W.saleOrderCode
                        from TK_Wrk_Step A
                        left join TK_Wrk_Man B on A.wo_code=B.wo_code
                        left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code
                        left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code and B.sourceid=W.id
                        left join TMateriel_Info M on B.materiel_code=M.partcode
                        left join TStep S on A.step_code=S.stepcode
                        left join TOrganization F on B.wkshp_code=F.org_code
@@ -1995,7 +1995,7 @@
                        from TK_Wrk_Step A
                        left join  TStep T on A.step_code=T.stepcode
                        left join  TK_Wrk_Man M on A.wo_code=M.wo_code
                        left join TKimp_Ewo W on M.m_po=W.wo and M.materiel_code=W.materiel_code
                        left join TKimp_Ewo W on M.m_po=W.wo and M.materiel_code=W.materiel_code and M.sourceid=W.id
                        left join  TMateriel_Info P on M.materiel_code=P.partcode
                        where A.wo_code=@ordercode and A.step_code=@stepcode";
                dynamicParams.Add("@ordercode", ordercode);
@@ -3537,7 +3537,7 @@
                            ,(select sum(S.ng_qty)  from TK_Wrk_Step S where S.wo_code=A.wo_code and S.isend='Y') as ng_qty
                            ,(select sum(S.bad_qty)  from TK_Wrk_Step S where S.wo_code=A.wo_code and S.isend='Y') as bad_qty
                            from TK_Wrk_Man A
                            left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code
                            left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code and A.sourceid=W.id
                            left join TMateriel_Info B on A.materiel_code=B.partcode
                            left join TOrganization C on A.wkshp_code=C.org_code
                            left join T_Sec_Stck D on A.stck_code=D.code