feat(datamart): migrations completed remaining is the deactivation that will be ran by anylitics
Some checks failed
Build and Push LST Docker Image / docker (push) Failing after 39s
Some checks failed
Build and Push LST Docker Image / docker (push) Failing after 39s
This commit is contained in:
45
backend/prodSql/queries/datamart.customerInventory.sql
Normal file
45
backend/prodSql/queries/datamart.customerInventory.sql
Normal file
@@ -0,0 +1,45 @@
|
||||
select x.idartikelVarianten as av
|
||||
,ArtikelVariantenAlias as Alias
|
||||
--x.Lfdnr as RunningNumber,
|
||||
--,round(sum(EinlagerungsMengeVPKSum),0) as Total_Pallets
|
||||
--,sum(EinlagerungsMengeSum) as Total_PalletQTY
|
||||
,round(sum(VerfuegbareMengeVPKSum),0) as Avalible_Pallets
|
||||
,sum(VerfuegbareMengeSum) as Avaliable_PalletQTY
|
||||
,sum(case when c.Description LIKE '%COA%' then GesperrteMengeVPKSum else 0 end) as COA_Pallets
|
||||
,sum(case when c.Description LIKE '%COA%' then GesperrteMengeSum else 0 end) as COA_QTY
|
||||
--,sum(case when c.Description NOT LIKE '%COA%' then GesperrteMengeVPKSum else 0 end) as Held_Pallets
|
||||
--,sum(case when c.Description NOT LIKE '%COA%' then GesperrteMengeSum else 0 end) as Held_QTY
|
||||
,IdProdPlanung as Lot
|
||||
--,IdAdressen
|
||||
--,x.AdressBez
|
||||
--,*
|
||||
from [AlplaPROD_test1].dbo.[V_LagerPositionenBarcodes] (nolock) x
|
||||
|
||||
left join
|
||||
[AlplaPROD_test1].dbo.T_EtikettenGedruckt (nolock) on
|
||||
x.Lfdnr = T_EtikettenGedruckt.Lfdnr AND T_EtikettenGedruckt.Lfdnr > 1
|
||||
|
||||
left join
|
||||
|
||||
(SELECT *
|
||||
FROM [AlplaPROD_test1].[dbo].[T_BlockingDefects] (nolock) where Active = 1) as c
|
||||
on x.IdMainDefect = c.IdBlockingDefect
|
||||
/*
|
||||
The data below will be controlled by the user in excell by default everything will be passed over
|
||||
IdAdressen = 3
|
||||
*/
|
||||
where
|
||||
--IdArtikelTyp = 1
|
||||
x.IdWarenlager not in (6, 1)
|
||||
--and IdAdressen
|
||||
--and x.IdWarenlager in (0)
|
||||
|
||||
|
||||
group by x.IdArtikelVarianten
|
||||
,ArtikelVariantenAlias
|
||||
,IdProdPlanung
|
||||
--,c.Description
|
||||
,IdAdressen
|
||||
,x.AdressBez
|
||||
--, x.Lfdnr
|
||||
order by x.IdArtikelVarianten
|
||||
Reference in New Issue
Block a user