refactor(inv with rn): now includes batch number for tetra
This commit is contained in:
@@ -59,6 +59,15 @@ sum(case when c.Description NOT LIKE '%COA%' or x.IdMainDefect = -1 then Gesperr
|
||||
,IdProdPlanung as Lot
|
||||
,IdAdressen,
|
||||
x.AdressBez
|
||||
,x.lagerabteilungkurzbez as location
|
||||
,lot.machine
|
||||
--,lot.planstart
|
||||
--,lot.planend
|
||||
,produktionsdatummin
|
||||
,'728'
|
||||
+ RIGHT(CAST(YEAR(produktionsdatummin) AS varchar(4)), 1)
|
||||
+ CAST(DATEDIFF(DAY, DATEFROMPARTS(YEAR(produktionsdatummin), 1, 1), produktionsdatummin) + 1 AS varchar(3))
|
||||
+ CAST(lot.machine AS varchar(10)) as batch
|
||||
--,*
|
||||
from [AlplaPROD_test1].dbo.[V_LagerPositionenBarcodes] (nolock) x
|
||||
|
||||
@@ -71,6 +80,22 @@ left join
|
||||
(SELECT *
|
||||
FROM [AlplaPROD_test1].[dbo].[T_BlockingDefects] where Active = 1) as c
|
||||
on x.IdMainDefect = c.IdBlockingDefect
|
||||
|
||||
/*
|
||||
get lot and machine info
|
||||
*/
|
||||
left join
|
||||
(select location as machine,
|
||||
runningnumber as lot
|
||||
,planstart
|
||||
,planend
|
||||
--,*
|
||||
from [test1_AlplaPROD2.0_Read].[productionScheduling].[ProductionLot] (nolock) x
|
||||
|
||||
left join
|
||||
[test1_AlplaPROD2.0_Read].[masterData].[Machine] (nolock) m on
|
||||
m.id = x.machineid) as lot on
|
||||
lot.lot = IdProdPlanung
|
||||
/*
|
||||
The data below will be controlled by the user in excell by default everything will be passed over
|
||||
IdAdressen = 3
|
||||
@@ -80,6 +105,11 @@ where IdArtikelTyp = 1 and x.IdWarenlager not in (6, 1)
|
||||
group by x.idartikelVarianten, ArtikelVariantenAlias, c.Description, IdAdressen,
|
||||
x.AdressBez , x.Lfdnr,
|
||||
IdProdPlanung -- this will be flagged as being removed when we do historical.
|
||||
,x.lagerabteilungkurzbez
|
||||
,lot.machine
|
||||
--,lot.planstart
|
||||
--,lot.planend
|
||||
,produktionsdatummin
|
||||
order by x.IdArtikelVarianten
|
||||
`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user