-- WorkOrderComponent Archive Query
-- Source: QADTA.F3111 (current) + ARCDTAQA.F3111 (archived)
-- Used by: GetWorkOrderComponentsArchive() - on-demand historical retrieval
-- Note: Not scheduled, used for historical lookups

SELECT woc.WMUKID AS UniqueID,
       woc.WMDOCO AS WorkOrderNumber,
       TRIM(woc.WMLOTN) AS LotNumber,
       TRIM(woc.WMCMCU) AS BranchCode,
       woc.WMCPIT AS ShortItemNumber,
       woc.WMTRQT AS Quantity,
       woc.WMUPMJ AS DateUpdated,
       woc.WMTDAY AS TimeUpdated
  FROM QADTA.F3111 woc
 WHERE TRIM(woc.WMLOTN) IS NOT NULL

UNION ALL

SELECT woc.WMUKID AS UniqueID,
       woc.WMDOCO AS WorkOrderNumber,
       TRIM(woc.WMLOTN) AS LotNumber,
       TRIM(woc.WMCMCU) AS BranchCode,
       woc.WMCPIT AS ShortItemNumber,
       woc.WMTRQT AS Quantity,
       woc.WMUPMJ AS DateUpdated,
       woc.WMTDAY AS TimeUpdated
  FROM ARCDTAQA.F3111 woc
 WHERE TRIM(woc.WMLOTN) IS NOT NULL
