Třídová akce

Popis:
Vrátí setříděný seznam ID dílenských úkonů k hromadnému přiřazení priority
Kód:
3
Tělo:
SELECT WS.ID, WS.ReqRoutine_ID, WS.JORoutine_ID,
  COALESCE(Req.DocDate$date, JO.DocDate$date),
  COALESCE(Req.OrdNumber, JO.OrdNumber),
  COALESCE(JON.posindex, ReqN.posindex),
  COALESCE(JOR.compulsoryoperation, ReqR.compulsoryoperation),
  COALESCE(JOR.posindex, ReqR.posindex)
FROM PLMWorkScheduleItems WS
  LEFT JOIN PLMJobOrdersRoutines JOR on (WS.JORoutine_ID = JOR.ID)
  LEFT JOIN PLMJOOutputItems JOO ON (JOR.parent_id = JOO.ID)
  LEFT JOIN PLMJONodes JON ON (JOO.owner_id = JON.ID)
  LEFT JOIN PLMJobOrders JO ON (JON.parent_id = JO.ID)
  LEFT JOIN PLMReqRoutines ReqR on (WS.ReqRoutine_ID = ReqR.ID)
  LEFT JOIN PLMReqOutputItems ReqO ON (ReqR.parent_id = ReqO.ID)
  LEFT JOIN PLMReqNodes ReqN ON (ReqO.owner_id = ReqN.ID)
  LEFT JOIN PLMProduceRequests Req ON (ReqN.parent_id = Req.ID)
WHERE WS.Priority = 0
ORDER BY
  COALESCE(Req.DocDate$date, JO.DocDate$date),
  COALESCE(Req.OrdNumber, JO.OrdNumber),
  COALESCE(JON.posindex, ReqN.posindex),
  COALESCE(JOR.compulsoryoperation, ReqR.compulsoryoperation),
  COALESCE(JOR.posindex, ReqR.posindex)

Generated by ABRA Software a.s. 27.10.2021 16:34:49