feat(ocp): prodlink check added

This commit is contained in:
2025-03-25 18:56:36 -05:00
parent 51267f5202
commit f9cd3fb881
3 changed files with 99 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
export const prolinkQuery = `
select * from (
select *
From(select
V_Maschinen_ProdPlanungen.MaschinenStandort as Machine,
V_Maschinen_ProdPlanungen.IdProdPlanung as AlplaLabelOnline,
prolink.lot Prolink,
case when AlplaPROD_test1.dbo.V_Maschinen_ProdPlanungen.IdProdPlanung <> prolink.lot
Then 'IncorrectLot'
Else 'Good' end as LotCheck
from AlplaPROD_test1.dbo.V_Maschinen_ProdPlanungen (nolock)
left join
(
SELECT *
FROM (SELECT IdMaschine,
Produktionslos as lot,
Startzeit as StartTime,
Upd_Date,
ROW_NUMBER() OVER (PARTITION BY IdMaschine ORDER BY Upd_Date DESC) RN_Prolink
FROM AlplaPROD_test1.dbo.T_HistoryProduktionsdaten (nolock)
WHERE Upd_Date BETWEEN DATEADD(DD, - 10, getdate()) AND DATEADD(DD, 1, getdate())) a
WHERE RN_Prolink = 1
) as prolink on AlplaPROD_test1.dbo.V_Maschinen_ProdPlanungen.IdMaschine=prolink.IdMaschine) a
) a
`;