495: p_resource_id IN NUMBER,
496: p_resource_seq_num IN NUMBER) IS
497:
498: SELECT AOR.OPERATION_RESOURCE_ID, WOR.start_date, WOR.completion_date,
499: (select wo1.department_id from wip_operations wo1
500: where wo1.wip_entity_id = aw.wip_entity_id
501: and wo1.operation_seq_num = p_operation_seq_num) department_id,
502: WOR.resource_seq_num
503: FROM WIP_OPERATION_RESOURCES WOR,
521: AND EXISTS (SELECT 'x'
522: FROM mtl_employees_current_view pf,
523: bom_resource_employees bre,
524: bom_dept_res_instances bdri,
525: wip_operations wo,
526: bom_department_resources bdr
527: WHERE WO.wip_entity_id = AW.wip_entity_id
528: AND WO.operation_seq_num = AWO.operation_sequence_num
529: -- AND WO.department_id = bdri.department_id
858: p_operation_seq_num IN NUMBER) IS
859:
860: SELECT AOR.OPERATION_RESOURCE_ID, WOR.resource_seq_num, WOR.resource_id,
861: WOR.start_date, WOR.completion_date,
862: (select wo1.department_id from wip_operations wo1
863: where wo1.wip_entity_id = aw.wip_entity_id
864: and wo1.operation_seq_num = p_operation_seq_num) department_id
865: FROM WIP_OPERATION_RESOURCES WOR,
866: AHL_OPERATION_RESOURCES AOR, AHL_WORKORDER_OPERATIONS AWO, AHL_WORKORDERS AW,
881: AND EXISTS (SELECT 'x'
882: FROM mtl_employees_current_view pf,
883: bom_resource_employees bre,
884: bom_dept_res_instances bdri,
885: wip_operations wo,
886: bom_department_resources bdr
887: WHERE WO.wip_entity_id = AW.wip_entity_id
888: AND WO.operation_seq_num = AWO.operation_sequence_num
889: --AND WO.department_id = bdri.department_id
1181: p_workorder_id IN NUMBER) IS
1182:
1183: SELECT AOR.OPERATION_RESOURCE_ID, WOR.operation_seq_num, WOR.resource_id,
1184: WOR.resource_seq_num, WOR.start_date, WOR.completion_date,
1185: (select wo1.department_id from wip_operations wo1
1186: where wo1.wip_entity_id = aw.wip_entity_id
1187: and wo1.operation_seq_num = AWO.operation_sequence_num) department_id
1188: FROM WIP_OPERATION_RESOURCES WOR,
1189: AHL_OPERATION_RESOURCES AOR, AHL_WORKORDER_OPERATIONS AWO, AHL_WORKORDERS AW,
1202: AND EXISTS (SELECT 'x'
1203: FROM mtl_employees_current_view pf,
1204: bom_resource_employees bre,
1205: bom_dept_res_instances bdri,
1206: wip_operations wo,
1207: bom_department_resources bdr
1208: WHERE WO.wip_entity_id = AW.wip_entity_id
1209: AND WO.operation_seq_num = AWO.operation_sequence_num
1210: --AND WO.department_id = bdri.department_id
1481: l_employee_id NUMBER;
1482: l_workorder_name wip_entities.wip_entity_name%TYPE;
1483: l_workorder_id NUMBER;
1484: l_org_code mtl_parameters.organization_code%TYPE;
1485: l_operation_seq_num wip_operations.operation_seq_num%TYPE;
1486:
1487: l_resource_seq_num wip_operation_resources.resource_seq_num%TYPE;
1488:
1489: l_resource_id NUMBER;
1772: p_wip_entity_id IN NUMBER) IS
1773: SELECT WOR.operation_seq_num, WOR.resource_id,
1774: WOR.resource_seq_num, BRS.unit_of_measure uom_code,
1775: WO.organization_id, WO.department_id
1776: FROM wip_operations wo,
1777: wip_operation_resources WOR,
1778: bom_resources BRS
1779: WHERE wo.wip_entity_id = WOR.wip_entity_id
1780: AND wo.operation_seq_num = WOR.operation_seq_num
1802: p_operation_seq_num IN NUMBER) IS
1803: SELECT WOR.operation_seq_num, WOR.resource_id,
1804: WOR.resource_seq_num, BRS.unit_of_measure uom_code,
1805: WO.organization_id, WO.department_id
1806: FROM wip_operations wo,
1807: wip_operation_resources WOR,
1808: bom_resources BRS
1809: WHERE wo.wip_entity_id = WOR.wip_entity_id
1810: AND wo.operation_seq_num = WOR.operation_seq_num
1834: p_resource_seq_num IN NUMBER) IS
1835: SELECT WOR.operation_seq_num, WOR.resource_id,
1836: WOR.resource_seq_num, BRS.unit_of_measure uom_code,
1837: WO.organization_id, WO.department_id
1838: FROM wip_operations wo,
1839: wip_operation_resources WOR,
1840: bom_resources BRS
1841: WHERE wo.wip_entity_id = WOR.wip_entity_id
1842: AND wo.operation_seq_num = WOR.operation_seq_num
1862: -- across all operations. (transit tech case).
1863: CURSOR c_person_req_WO(p_wip_entity_id IN NUMBER) IS
1864: SELECT WOR.operation_seq_num, WOR.resource_id,
1865: WOR.resource_seq_num, BRS.unit_of_measure uom_code
1866: FROM wip_operations wo,
1867: wip_operation_resources WOR,
1868: bom_resources BRS
1869: WHERE wo.wip_entity_id = WOR.wip_entity_id
1870: AND wo.operation_seq_num = WOR.operation_seq_num
1876: CURSOR c_person_req_OP(p_wip_entity_id IN NUMBER,
1877: p_operation_seq_num IN NUMBER) IS
1878: SELECT WOR.operation_seq_num, WOR.resource_id,
1879: WOR.resource_seq_num, BRS.unit_of_measure uom_code
1880: FROM wip_operations wo,
1881: wip_operation_resources WOR,
1882: bom_resources BRS
1883: WHERE wo.wip_entity_id = WOR.wip_entity_id
1884: AND wo.operation_seq_num = WOR.operation_seq_num
1892: p_operation_seq_num IN NUMBER,
1893: p_resource_seq_num IN NUMBER) IS
1894: SELECT WOR.operation_seq_num, WOR.resource_id,
1895: WOR.resource_seq_num, BRS.unit_of_measure uom_code
1896: FROM wip_operations wo,
1897: wip_operation_resources WOR,
1898: bom_resources BRS
1899: WHERE wo.wip_entity_id = WOR.wip_entity_id
1900: AND wo.operation_seq_num = WOR.operation_seq_num
2650: -- Query to check if for a WO and its operations, any requirements exist with no qualification for given employee.
2651: CURSOR c_unqualified_for_all_ops(p_employee_id IN NUMBER,
2652: p_wip_entity_id IN NUMBER) IS
2653: SELECT 'x'
2654: FROM wip_operations wo
2655: WHERE wo.wip_entity_id = p_wip_entity_id
2656: AND not exists ( SELECT 'x'
2657: FROM wip_operation_resources WOR,
2658: bom_resources BRS,
2670: */
2671: -- Query to check if all operations of WO have at least one person resource requirement.
2672: CURSOR c_check_res_reqd (p_wip_entity_id IN NUMBER) IS
2673: SELECT 'x'
2674: FROM WIP_OPERATIONS WO
2675: WHERE wip_entity_id = p_wip_entity_id
2676: AND exists ( SELECT 'x'
2677: FROM WIP_OPERATION_RESOURCES WOR, BOM_RESOURCES BRS
2678: WHERE WOR.wip_entity_id = WO.wip_entity_id
2685: -- Query to check if employee qualifies for multiple resource requirements within an operation at a WO level.
2686: CURSOR c_check_res_multiple_wo(p_employee_id IN NUMBER,
2687: p_wip_entity_id IN NUMBER) IS
2688: SELECT 'x'
2689: FROM wip_operations wo,
2690: wip_operation_resources WOR,
2691: bom_resources BRS
2692: WHERE wo.wip_entity_id = WOR.wip_entity_id
2693: AND wo.operation_seq_num = WOR.operation_seq_num
2709: CURSOR c_check_res_multiple_op(p_employee_id IN NUMBER,
2710: p_wip_entity_id IN NUMBER,
2711: p_operation_seq_num IN NUMBER) IS
2712: SELECT 'x'
2713: FROM wip_operations wo,
2714: wip_operation_resources WOR,
2715: bom_resources BRS
2716: WHERE wo.wip_entity_id = WOR.wip_entity_id
2717: AND wo.operation_seq_num = WOR.operation_seq_num
2755: CURSOR c_qualified_for_one_res(p_employee_id IN NUMBER,
2756: p_wip_entity_id IN NUMBER,
2757: p_operation_seq_num IN NUMBER) IS
2758: SELECT 'x'
2759: FROM wip_operations wo
2760: WHERE wo.wip_entity_id = p_wip_entity_id
2761: and wo.operation_seq_num = p_operation_seq_num
2762: AND exists ( SELECT 'x'
2763: FROM wip_operation_resources WOR,
2788: p_operation_seq_num IN NUMBER,
2789: p_resource_id IN NUMBER) IS
2790:
2791: SELECT 'x'
2792: FROM wip_operations wo,
2793: wip_operation_resources WOR
2794: WHERE wo.wip_entity_id = WOR.wip_entity_id
2795: AND wo.operation_seq_num = WOR.operation_seq_num
2796: AND wo.wip_entity_id = p_wip_entity_id
2841:
2842: -- query to get all operations for a workorder.
2843: CURSOR c_get_workorder_oper (p_wip_entity_id IN NUMBER) IS
2844: SELECT operation_seq_num
2845: FROM WIP_OPERATIONS
2846: WHERE wip_entity_id = p_wip_entity_id;
2847:
2848: l_employee_id NUMBER;
2849: l_wo_status AHL_WORKORDERS.status_code%TYPE;