Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select distinct substring(ahp.business_key_, 7, 12) as number
- , CASE WHEN AR.text_ IS NULL THEN 'Nový' ELSE AR.text_ END as taskStatus
- , CASE
- WHEN EXISTS(select *
- from ac_order_item a
- left join ac_product_item p on a.product_item_id = p.product_item_id
- where a.process_instance_id = API.id
- and p.product_code = 'KLIMA-PREDNOSTNE-INSTALACIE') then true
- else false end as priorityInstallation
- , CASE
- WHEN EXISTS(select *
- from ac_order_item a
- left join ac_product_item p on a.product_item_id = p.product_item_id
- where a.process_instance_id = API.id
- and p.product_code = 'KLIMA-PREDNOSTNE-INSTALACIE') then 'áno'
- else 'nie' end as priorityInstallationString
- , (select first_value(item.device_name) over ()
- from ac_inventory_item item
- where item.process_instance_id = API.id) as acType
- , task.NAME_ as taskName
- , task.start_time_ as taskCreated --??
- , to_char(task.start_time_, 'DD.MM.YYYY') as taskCreatedString --??
- , task.ID_ as taskId
- , task.ASSIGNEE_ as assignee2
- , task.TASK_DEF_KEY_ as taskDefKey
- , AC.business_partner_number as customerOp
- , concat(BPA.firstname, ' ', BPA.lastname) as customer
- , API.created as processStart
- , to_char(API.created, 'DD.MM.YYYY') as processStartString
- , ARV.text_ as mechanicName
- , ATD.text_ as assignTaskDate
- , AR.text_ as acceptationResult
- , API.id as process_id
- , API.agreement_id
- , REQ.text_ as requestId
- , BPA.business_partner_number as businessPartnerNumber
- , MADR.city as city
- , MADR.street as street
- , ADE.phone_number as phoneNumber
- , concat(USR.FIRST_, ' ', USR.last_) as assignee
- , array_to_string(
- (select array_agg(II.group_id_) from ACT_RU_IDENTITYLINK II where II.task_id_ = task.ID_), ' ,') as identGroup
- from act_hi_taskinst task
- left join ACT_ID_USER USR on USR.ID_ = task.assignee_
- left join act_hi_procinst ahp on task.proc_inst_id_ = ahp.id_
- left join act_ru_variable ARV on ARV.proc_inst_id_ = task.proc_inst_id_ AND ARV.name_ = 'mechanicName'
- left join act_ru_variable REQ on REQ.proc_inst_id_ = task.proc_inst_id_ AND REQ.name_ = 'requestId'
- left join act_ru_variable ATD on ATD.proc_inst_id_ = task.proc_inst_id_ AND ATD.name_ = 'assignTaskDate'
- left join act_ru_variable AR on AR.proc_inst_id_ = task.proc_inst_id_ AND AR.is_concurrent_local_ = true AND
- AR.name_ = 'acceptationResult'
- left join ac_agreement AA on AA.num = substring(ahp.business_key_, 7, 12)::bigint
- left join ac_business_partner_agr BPA ON BPA.business_partner_agr_id = AA.business_partner_id
- left join ac_address MADR ON MADR.address_id = BPA.main_addr_id
- left join ac_process_instance API on AA.agreement_id = API.agreement_id
- left join ac_delivery ADE on ADE.delivery_id = API.delivery_id
- left join ac_customer AC on AC.customer_id = API.customer_id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement