feat(notificaitons): fixed and corrections to get them working properly
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
export const customerInvNoHold = `
|
||||
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
|
||||
and x.IdWarenlager not in (6, 1)
|
||||
--and IdAdressen
|
||||
|
||||
|
||||
group by x.IdArtikelVarianten
|
||||
,ArtikelVariantenAlias
|
||||
,IdProdPlanung
|
||||
--,c.Description
|
||||
,IdAdressen
|
||||
,x.AdressBez
|
||||
--, x.Lfdnr
|
||||
order by x.IdArtikelVarianten
|
||||
`;
|
||||
27
server/services/sqlServer/querys/dataMart/openOrders.ts
Normal file
27
server/services/sqlServer/querys/dataMart/openOrders.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
export const openOrders = `
|
||||
Select LEFT(ArtikelVariantenAlias, charindex(' ', ArtikelVariantenAlias) - 1) customerItemNumber,
|
||||
x.IdArtikelVarianten AS article,
|
||||
ArtikelVariantenAlias AS articleDescription,
|
||||
IdAuftragsAbruf as releaseNumber,
|
||||
AuftragsNummer AS header,
|
||||
AuftragsNummer as customerLineItemNo,
|
||||
AbrufNummer AS customerReleaseNumber,
|
||||
AbrufMengeVPK AS pallets,
|
||||
AbrufMenge AS qty,
|
||||
y.TradeUnits AS cartons,
|
||||
IdAdresse AS customerID,
|
||||
LieferAdressBez as DeliveryAddressDescription,
|
||||
AbrufLadeDatum AS loadingDate,
|
||||
AbrufLiefertermin AS deliveryDate
|
||||
--,OrderStatus = 'loading'
|
||||
--,*
|
||||
FROM alplaprod_test1.dbo.V_TrackerAuftragsAbrufe (nolock) x
|
||||
|
||||
left join
|
||||
[test1_AlplaPROD2.0_Read].[order].[Release] (nolock) y on
|
||||
x.IdAuftragsAbruf = y.ReleaseNumber
|
||||
|
||||
--WHERE AbrufStatus = 1 AND AbrufLiefertermin < getdate() + 5 AND GelieferteMenge = 0
|
||||
WHERE AbrufStatus = 1 AND AbrufLiefertermin between getDate() + -[sDay] and getdate() + [eDay] AND GelieferteMenge = 0
|
||||
ORDER BY AbrufLiefertermin
|
||||
`;
|
||||
45
server/services/sqlServer/querys/notifications/blocking.ts
Normal file
45
server/services/sqlServer/querys/notifications/blocking.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
export const blockQuery = `
|
||||
SELECT
|
||||
'Alert! new blocking order: #' + cast(HumanReadableId as varchar) + ' - ' + ArticleVariantDescription as subject,
|
||||
cast([HumanReadableId] as varchar) as blockingNumber,
|
||||
[ArticleVariantDescription] as article,
|
||||
cast([CustomerHumanReadableId] as varchar) + ' - ' + [CustomerDescription] as customer,
|
||||
convert(varchar(10), [test1_AlplaPROD2.0_Reporting].[reporting_blocking].[BlockingOrder].[BlockingDate], 101) + ' - ' + convert(varchar(5), [test1_AlplaPROD2.0_Reporting].[reporting_blocking].[BlockingOrder].[BlockingDate], 108) as blockingDate,
|
||||
cast(ArticleVariantHumanReadableId as varchar) + ' - ' + ArticleVariantDescription as av,
|
||||
case when [test1_AlplaPROD2.0_Reporting].[reporting_blocking].[BlockingOrder].Remark = '' or [test1_AlplaPROD2.0_Reporting].[reporting_blocking].[BlockingOrder].Remark is NULL then 'Please reach out to quality for the reason this was placed on hold as a remark was not entered during the blocking processs' else [test1_AlplaPROD2.0_Reporting].[reporting_blocking].[BlockingOrder].Remark end as remark,
|
||||
cast(FORMAT(TotalAmountOfPieces, '###,###') as varchar) + ' / ' + cast(LoadingUnit as varchar) as peicesAndLoadingUnits,
|
||||
[test1_AlplaPROD2.0_Reporting].[reporting_blocking].[BlockingOrder].ProductionLotHumanReadableId as lotNumber,
|
||||
cast(IdGlobalBlockingDefectsGroup as varchar) + ' - ' + BD.Description as mainDefectGroup,
|
||||
cast(IdGlobalBlockingDefect as varchar) + ' - ' + MD.Description as mainDefect,
|
||||
sent=0,
|
||||
lot.MachineLocation as line,
|
||||
HumanReadableId
|
||||
FROM [test1_AlplaPROD2.0_Reporting].[reporting_blocking].[BlockingOrder] (nolock)
|
||||
|
||||
/*** Join 1.0 table to get correct id info to link ***/
|
||||
join
|
||||
[AlplaPROD_test1].[dbo].[T_BlockingOrders] (nolock) AS BO
|
||||
on [HumanReadableId] = BO.[IdBlockingOrder]
|
||||
|
||||
|
||||
/*** Get the main defect info ***/
|
||||
Inner join
|
||||
[AlplaPROD_test1].[dbo].[T_BlockingDefectsGroups] (nolock) as BD
|
||||
ON BO.IdMainDefectGroup = BD.IdBlockingDefectsGroup
|
||||
|
||||
INNER join
|
||||
[AlplaPROD_test1].[dbo].[T_BlockingDefects] as MD
|
||||
ON BO.IdMainDefect = MD.IdBlockingDefect
|
||||
/*** get lot info ***/
|
||||
|
||||
left join
|
||||
(SELECT [MachineLocation]
|
||||
,[MachineDescription]
|
||||
,[ProductionLotHumanReadableId]
|
||||
FROM [test1_AlplaPROD2.0_Reporting].[reporting_productionControlling].[ProducedLot]) as lot
|
||||
on [test1_AlplaPROD2.0_Reporting].[reporting_blocking].[BlockingOrder].ProductionLotHumanReadableId = lot.ProductionLotHumanReadableId
|
||||
|
||||
where [test1_AlplaPROD2.0_Reporting].[reporting_blocking].[BlockingOrder].[BlockingDate] between getdate() - 1 and getdate() + 1
|
||||
and [test1_AlplaPROD2.0_Reporting].[reporting_blocking].[BlockingOrder].BlockingTrigger = 1
|
||||
and HumanReadableId NOT IN ([sentBlockingOrders])
|
||||
`;
|
||||
Reference in New Issue
Block a user