SELECT SC.COde as code, DQ.code || '-' || CAST(JORQ.OrdNumber AS VARCHAR(10)) || '/' ||PE.code as DocNumber,
SU.Code as MainUnitCode, SU.UnitRate as MainUnitRate,{FIELDS}
FROM PLMJONodes N
JOIN PLMJOInputItems A ON A.Owner_ID = N.ID
JOIN PLMJONodes NMI ON NMI.ID = N.Master_ID
JOIN PLMJOOutputItems MI ON MI.Owner_ID = NMI.ID
JOIN StoreCards SC ON SC.ID=N.StoreCard_ID
LEFT JOIN StoreUnits SU ON SC.ID=SU.Parent_ID and SC.MainUnitCode = SU.Code
JOIN PLMJobOrders JORQ ON JORQ.ID = N.Parent_ID
JOIN DocQueues DQ ON DQ.ID = JORQ.DocQueue_ID
JOIN Periods PE ON PE.ID = JORQ.Period_ID
where JORQ.FinishedAt$Date = 0 and N.Issue = 0
{ANDWHERE}
union all
SELECT SC.COde as code, DQ.code || '-' || CAST(JORQ.OrdNumber AS VARCHAR(10)) || '/' ||PE.code as DocNumber,
SU.Code as MainUnitCode, SU.UnitRate as MainUnitRate,{FIELDS}
FROM PLMReqNodes N
JOIN PLMReqInputItems A ON A.Owner_ID = N.ID
JOIN PLMReqNodes NMI ON NMI.ID = N.Master_ID
JOIN PLMReqOutputItems MI ON MI.Owner_ID = NMI.ID
JOIN StoreCards SC ON SC.ID=N.StoreCard_ID
LEFT JOIN StoreUnits SU ON SC.ID=SU.Parent_ID and SC.MainUnitCode = SU.Code
JOIN PLMProduceRequests JORQ ON JORQ.ID = N.Parent_ID
JOIN DocQueues DQ ON DQ.ID = JORQ.DocQueue_ID
JOIN Periods PE ON PE.ID = JORQ.Period_ID
where JORQ.joborder_id is null and N.Issue = 0
{ANDWHERE}
order by 1,3 DESC,2
| Alias | CLSID objektu | Prefix | Popis |
|---|---|---|---|
| A | URVJ2ULRJ4B43EK1QLU3A2OXR0 | ||
| SC | C3V5QDVZ5BDL342M01C0CX3FCC | StoreCard | Skladová karta |
JORQ.PlanedStartAt$Date >= {:LOW} and
JORQ.PlanedStartAt$Date < {:HIGH}
##CASEOR {:VALUE} #
##1#(DQ.DocumentType = 'PQ')
##2#(DQ.DocumentType = 'JO')
##END#
Generated by ABRA Software a.s. 27.10.2021 16:36