select ws.id, ws.objversion
from PLMWorkScheduleItems ws
INNER JOIN PLMReqRoutines ReqR ON (ReqR.id = ws.ReqRoutine_id)
INNER JOIN PLMReqOutputItems ReqO ON (ReqR.parent_id = ReqO.ID)
INNER JOIN PLMReqNodes ReqN ON (ReqO.owner_id = ReqN.ID)
INNER JOIN PLMProduceRequests Req ON (ReqN.parent_id = Req.ID)
INNER JOIN PLMPQParams ReqQ ON (Req.docqueue_id = ReqQ.docqueue_id)
INNER JOIN PLMWorkPlaces WP ON (ws.Workplace_id = WP.ID)
where Req.ID = :PDOID
and ws.status in (0,1)
and (ws.JORoutine_id is null)
and WP.CRPPlan > 0
and ReqR.Planned = 'A'
and ReqQ.InPlan = 'A'
and ReqR.TAC+ReqR.TBC > 0
Generated by ABRA Software a.s. 27.10.2021 16:34:49