How Can We Help?
Wykonanie planu zgrubnego
Zapytanie zwraca:
1) Pozycje planu produkcji pobrane z planu zgrubnego
2) Pozycje planu zgrubnego nie przekazane do planu produkcji
3) Pozycje planu produkcji, które nie zostały pobrane z planu zgrubnego, a dodane ręcznie
Parametrem jest kod planu zgrubnego.
select I.ShortName as 'Kod produktu', I.Name as 'Nazwa produktu', PPZ.PlanQty as 'Il. planowana zgrubna', isnull(sum(PP.CompletedQty),0) as 'Il. wykonana', ' ' as 'Dodano do Planu produkcji' from Manufacture.MasterScheduleLine PPZ left outer join Manufacture.LinkedObject as LO on LO.ChildId = PPZ.Id and LO.BusinessObjectParent = 16 and LO.BusinessObjectChild = 78 left outer join Manufacture.MRP as PP on PP.Id = LO.ParentId inner join Manufacture.MasterSchedule as PZ on PZ.Id = PPZ.MasterScheduleId inner join Manufacture.Item as I on I.Id = PPZ.ItemId where PZ.ShortName = @PZ and PPZ.ParentId = 0 group by I.ShortName, I.Name, PPZ.PlanQty union select I.ShortName as 'Kod produktu', I.Name as 'Nazwa produktu', isnull(PPZ.PlanQty,0) as 'Il. planowana zgrubna', PP.CompletedQty as 'Il. wykonana', PP.CreatedDate as 'Dodano do Planu produkcji' from Manufacture.MRP as PP full join Manufacture.LinkedObject as LO on LO.ParentId = PP.Id and LO.BusinessObjectParent = 16 and LO.BusinessObjectChild = 78 full join Manufacture.MasterScheduleLine as PPZ on PPZ.Id = LO.ChildId inner join Manufacture.Item as I on I.Id = PP.ItemId left join Manufacture.MasterSchedule as PZ on PZ.Id = PPZ.MasterScheduleId where PP.Description not like 'wg harmon%'