feat(psi): more psi work

This commit is contained in:
2025-09-22 22:41:51 -05:00
parent edbc7cefd8
commit cb2e6252e0
15 changed files with 1262 additions and 28 deletions

View File

@@ -70,3 +70,75 @@ where CONVERT(date, Upd_Date) BETWEEN @StartDate AND @EndDate
order by Bol_PrintDate desc
`;
export const deliveryByDateRangeAndAv = `
use [test1_AlplaPROD2.0_Read]
SELECT
r.[ArticleHumanReadableId]
,[ReleaseNumber]
,h.CustomerOrderNumber
,x.CustomerLineItemNumber
,[CustomerReleaseNumber]
,[ReleaseState]
,[DeliveryState]
,ea.JournalNummer
,[ReleaseConfirmationState]
,[PlanningState]
,format(r.[OrderDate], 'yyyy-MM-dd HH:mm') as OrderDate
,FORMAT(r.[DeliveryDate], 'yyyy-MM-dd HH:mm') as DeliveryDate
,FORMAT(r.[LoadingDate], 'yyyy-MM-dd HH:mm') as LoadingDate
,[Quantity]
,[DeliveredQuantity]
,r.[AdditionalInformation1]
,r.[AdditionalInformation2]
,[TradeUnits]
,[LoadingUnits]
,[Trucks]
,[LoadingToleranceType]
,[SalesPrice]
,[Currency]
,[QuantityUnit]
,[SalesPriceRemark]
,r.[Remark]
,[Irradiated]
,r.[CreatedByEdi]
,[DeliveryAddressHumanReadableId]
,[CustomerArtNo]
,[TotalPrice]
,r.[ArticleAlias]
FROM [order].[Release] (nolock) as r
left join
[order].LineItem as x on
r.LineItemId = x.id
left join
[order].Header as h on
x.HeaderId = h.id
--bol stuff
left join
AlplaPROD_test1.dbo.V_LadePlanungenLadeAuftragAbruf (nolock) as zz
on zz.AbrufIdAuftragsAbruf = r.ReleaseNumber
left join
(select * from (SELECT
ROW_NUMBER() OVER (PARTITION BY IdJournal ORDER BY add_date DESC) AS RowNum
,*
FROM [AlplaPROD_test1].[dbo].[T_Lieferungen] (nolock)) x
where RowNum = 1) as ea on
zz.IdLieferschein = ea.IdJournal
where
r.ArticleHumanReadableId in ([articles])
--r.ReleaseNumber = 1452
and r.DeliveryDate between '[startDate]' and '[endDate]'
order by DeliveryDate desc
`;

View File

@@ -0,0 +1,17 @@
export const forecastByAvs = `
SELECT
[DeliveryAddressHumanReadableId]
,[DeliveryAddressDescription]
,[ArticleHumanReadableId]
,[ArticleDescription]
,[QuantityType]
,[CustomerArticleNumber]
,format([RequirementDate],'yyyy-MM-dd') RequirementDate
,[Quantity]
,[TradeUnits]
,[LoadingUnits]
,[ArticleAlias]
FROM [test1_AlplaPROD2.0_Read].[forecast].[Forecast] (nolock)
where ArticleHumanReadableId in ([articles])
`;

View File

@@ -0,0 +1,11 @@
export const getCurrentLabel = `
SELECT FORMAT(Add_Date,'yyyy-MM-dd HH:mm') as PrintTime
,[IdMaschine]
,[LfdNr]
FROM [AlplaPROD_test1].[dbo].[T_EtikettenGedruckt] (nolock)
where IdMaschine = [macId]
and FORMAT(Add_Date,'yyyy-MM-dd HH:mm') like '[time]'
order by Add_Date desc
`;