diff --git a/lstV2/server/services/sqlServer/querys/ocp/lots.ts b/lstV2/server/services/sqlServer/querys/ocp/lots.ts index 580cf17..195e86e 100644 --- a/lstV2/server/services/sqlServer/querys/ocp/lots.ts +++ b/lstV2/server/services/sqlServer/querys/ocp/lots.ts @@ -1,14 +1,14 @@ export const lotQuery = ` select IdMaschinen_ProdPlanung as LabelOnlineID, - IdMaschine as machineID, + x.IdMaschine as machineID, MaschinenStandort as MachineLocation, MaschinenBez as MachineDescription, - IdProdPlanung as lot, + x.IdProdPlanung as lot, prolink.lot as ProlinkLot, - IdArtikelvarianten as AV, - ArtikelVariantenBez as Alias, - convert(varchar, add_date, 20) as Add_Date, - Add_user, + x.IdArtikelvarianten as AV, + x.ArtikelVariantenBez as Alias, + convert(varchar, x.add_date, 20) as Add_Date, + x.Add_user, idEtikettenDrucker as printerID, b.name as PrinterName, CAST(TotalPlannedLoadingUnits as float) as PlannedQTY, @@ -23,21 +23,26 @@ select IdMaschinen_ProdPlanung as LabelOnlineID, else 'no' end as overPrinting, CustomerHumanReadableId as CustomerId, CustomerName as CustomerName, - idMaschine as MachineID, + x.idMaschine as MachineID, prolink.lastProlinkUpdate as lastProlinkUpdate, IdEtikettenLayoutPalette as palletLabel, AnzahlKopienPalette as pallerCopies, IdEtikettenLayoutKarton as cartonLabel, AnzahlKopienKarton as cartonCopies, - IsTechnicallyReleased + IsTechnicallyReleased, + DruckStatus as allowPrinting, + p.MaschZyklus as cycleTime, + x.StueckzahlJePalette, + p.WerkzeugKavität, + (((x.StueckzahlJePalette /p.WerkzeugKavität) * p.MaschZyklus) * (p.MaschAuslastung/100)) * .70 as timeTOmakeInSeconds --* from AlplaPROD_test1.dbo.V_Maschinen_ProdPlanungen x (nolock) join - [test1_AlplaPROD2.0_Read].[productionControlling].[ProducedLot] on + [test1_AlplaPROD2.0_Read].[productionControlling].[ProducedLot](nolock) on x.IdProdPlanung = [test1_AlplaPROD2.0_Read].[productionControlling].[ProducedLot].ProductionLotHumanReadableId left join - [test1_AlplaPROD2.0_Read].masterData.Printer as b on + [test1_AlplaPROD2.0_Read].masterData.Printer (nolock) as b on x.IdEtikettenDrucker = b.HumanReadableId -- adding in prolink lot left join @@ -51,5 +56,16 @@ select IdMaschinen_ProdPlanung as LabelOnlineID, ) as prolink on x.idMaschine = prolink.prolinkMachineId - where IsTechnicallyReleased = 1 + ----packagin info + --left join + --[test1_AlplaPROD2.0_Read].[masterData].[PackagingInstruction] (nolock) pkg on + --pkg.HumanReadableId = x.IdVpkVorschrift + + -- cycle time info + left join + AlplaPROD_test1.dbo.V_ProdPlanung (nolock) as p on + p.IdProdPlanung = x.IdProdPlanung + + + where IsTechnicallyReleased = 1 and DruckStatus = 1 `;