fix(notifications): reprinting
All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 1m20s

correction to external labeling

ref #20
This commit is contained in:
2026-05-14 14:18:40 -05:00
parent 67f36c5499
commit c8931c7249

View File

@@ -1,16 +1,17 @@
use [test1_AlplaPROD2.0_Read] use [test1_AlplaPROD2.0_Read]
SELECT SELECT
--JSON_VALUE(content, '$.EntityId') as labelId JSON_VALUE(content, '$.EntityId') as labelId,
a.id a.id
,ActorName ,ActorName
,FORMAT(PrintDate, 'yyyy-MM-dd HH:mm') as printDate --,FORMAT(l.PrintDate, 'yyyy-MM-dd HH:mm') as printDate
,Format(COALESCE(l.PrintDate, e.ProductionDate), 'yyyy-MM-dd HH:mm') as printDate
,FORMAT(CreatedDateTime, 'yyyy-MM-dd HH:mm') createdDateTime ,FORMAT(CreatedDateTime, 'yyyy-MM-dd HH:mm') createdDateTime
,l.ArticleHumanReadableId as av ,COALESCE(l.ArticleHumanReadableId,e.ArticleHumanReadableId) as av
,l.ArticleDescription as alias ,COALESCE(l.ArticleDescription, av.Name) as alias
,PrintedCopies ,COALESCE(l.PrintedCopies, 0) as PrintedCopies
,p.name as printerName ,COALESCE(p.name,'External Label not tracked') as printerName
,RunningNumber ,COALESCE(l.RunningNumber, e.RunningNumber) as runningNumber
--,* --,*
FROM [support].[AuditLog] (nolock) as a FROM [support].[AuditLog] (nolock) as a
@@ -18,10 +19,20 @@ left join
[labelling].[InternalLabel] (nolock) as l on [labelling].[InternalLabel] (nolock) as l on
l.id = JSON_VALUE(content, '$.EntityId') l.id = JSON_VALUE(content, '$.EntityId')
OUTER APPLY (
SELECT TOP 1 *
FROM labelling.ExternalLabel e
WHERE e.id = JSON_VALUE(a.content, '$.EntityId')
ORDER BY e.Id DESC
) e
left join left join
[masterData].[printer] (nolock) as p on [masterData].[printer] (nolock) as p on
p.id = l.PrinterId p.id = l.PrinterId
left join
[masterData].[article] (nolock) as av on
av.HumanReadableId = e.ArticleHumanReadableId
where message like '%reprint%' where message like '%reprint%'
and CreatedDateTime > DATEADD(minute, -[intervalCheck], SYSDATETIMEOFFSET()) and CreatedDateTime > DATEADD(minute, -[intervalCheck], SYSDATETIMEOFFSET())
and a.id > [ignoreList] and a.id > [ignoreList]