541: PROCEDURE job_off_internal(p_wip_entity_id IN NUMBER, p_operation_seq_num NUMBER)
542: IS
543: BEGIN
544:
545: update wip_operations
546: set employee_id = null
547: where wip_entity_id = p_wip_entity_id
548: and operation_seq_num = p_operation_seq_num
549: and employee_id is not null;
823: and wrat.start_date is not null
824: and wrat.end_date is null
825: and wrat.process_status <> 4);
826:
827: update wip_operations wo
828: set
829: wo.actual_completion_date =
830: nvl(greatest( ( select max(wor.actual_completion_date)
831: from wip_operation_resources wor
915: l_curr_op number;
916:
917: cursor op_seq_num_cursor is
918: select operation_seq_num
919: from wip_operations
920: where wip_entity_id = p_wip_entity_id
921: and operation_seq_num >= p_from_op
922: and operation_seq_num <= p_to_op;
923: BEGIN
1438: l_organization_id number;
1439: l_department_id number;
1440:
1441: cursor org_dept_cursor is select wo.organization_id, wo.department_id
1442: from wip_operations wo
1443: where wo.wip_entity_id = p_wip_entity_id
1444: and wo.operation_seq_num = p_operation_seq_num;
1445: BEGIN
1446: open org_dept_cursor;
1477: and wor.operation_seq_num = p_operation_seq_num
1478: and wor.actual_start_date is not null;
1479:
1480: cursor min_start_date_wo_cursor is select min(wo.actual_start_date)
1481: from wip_operations wo
1482: where wo.wip_entity_id = p_wip_entity_id
1483: and wo.actual_start_date is not null;
1484: BEGIN
1485:
1510: from dual;
1511: end if;
1512:
1513: if l_min_start_date is not null then
1514: update wip_operations set
1515: actual_start_date = l_min_start_date
1516: where wip_entity_id = p_wip_entity_id
1517: and operation_seq_num = p_operation_seq_num;
1518: end if;
1595: open max_end_date_wor_cursor;
1596: fetch max_end_date_wor_cursor into l_max_end_date;
1597: if max_end_date_wor_cursor%FOUND then
1598: if l_max_end_date is not null then
1599: update wip_operations set
1600: actual_completion_date = l_max_end_date
1601: where wip_entity_id = p_wip_entity_id
1602: and operation_seq_num = p_operation_seq_num;
1603: end if;
1636: p_resource_seq_num => null,
1637: p_resource_id => null,
1638: p_instance_id => null,
1639: p_start_date => p_start_date);
1640: update wip_operations set
1641: projected_completion_date = l_projected_completion_date
1642: where wip_entity_id = p_wip_entity_id
1643: and operation_seq_num = p_operation_seq_num;
1644: END update_proj_completion_dates;
1650: l_job_status varchar2(1);
1651: l_employee_id number;
1652:
1653: cursor job_status_cursor is select employee_id
1654: from wip_operations wo
1655: where wo.wip_entity_id = p_wip_entity_id
1656: and wo.operation_seq_num = p_operation_seq_num;
1657: BEGIN
1658: l_job_status := 'N';
1689:
1690: if (l_job_status = 'Y') then
1691: l_status := 'O';
1692: elsif (l_job_status = 'N') then
1693: update wip_operations set
1694: employee_id = p_employee_id
1695: where wip_entity_id = p_wip_entity_id
1696: and operation_seq_num = p_operation_seq_num;
1697: l_status := 'S';
2490: l_last_op_qty number;
2491:
2492: cursor last_op_qty_cursor is
2493: select (wo.quantity_in_queue + wo.quantity_running)
2494: from wip_operations wo
2495: where wo.wip_entity_id = p_wip_entity_id
2496: and wo.operation_seq_num = p_operation_seq_num;
2497: BEGIN
2498: open last_op_qty_cursor;
2508: l_last_job_qty number;
2509:
2510: cursor last_job_qty_cursor is
2511: select (wo.scheduled_quantity - wo.quantity_completed - nvl(wo.cumulative_scrap_quantity, 0))
2512: from wip_operations wo
2513: where wo.wip_entity_id = p_wip_entity_id
2514: and wo.operation_seq_num = p_operation_seq_num;
2515: BEGIN
2516: open last_job_qty_cursor;