[Home] [Help]
46: IF x_mode = RESULTS_MODE AND x_dblink IS NOT NULL THEN
47: -- Deletes any records in the
48: -- cchen : add database link to the subquery
49: sql_stmt :=
50: 'DELETE FROM MRP_ATP_DETAILS_TEMP'||l_dynstring||
51: ' WHERE session_id = :x_session_id '||
52: ' and order_line_id in ( '||
53: ' select order_line_id from mrp_atp_schedule_temp'||l_dynstring||
54: ' where session_id = :x_session_id_1 '||
63: END IF;
64: END IF;
65: /* -- bug3378648:we dont need this sql as this should be done locally
66:
67: -- moved deleting old records from mrp_atp_details_temp to call_schedule_remote
68:
69: /*
70: MSC_ATP_UTILS.PUT_SD_DATA(x_atp_supply_demand, x_dblink, x_session_id);
71: IF PG_DEBUG in ('Y', 'C') THEN
186: and status_flag in (1, 2, 99);
187: --and status_flag in (1, 99);
188:
189: --delete local detail data
190: delete mrp_atp_details_temp
191: where session_id = x_session_id;
192:
193: --transfer the date from source to dest mrp_atp_schedule_temp
194: MSC_ATP_UTILS.Transfer_scheduling_data(x_session_id, x_dblink, REQUEST_MODE);
1479:
1480: IF p_dblink IS NULL THEN
1481: FORALL j IN 1..p_atp_period.level.COUNT
1482:
1483: INSERT INTO mrp_atp_details_temp
1484: (
1485: session_id,
1486: scenario_id,
1487: order_line_id,
1565: -- dsting: added stuff for creation_date, created_by,
1566: -- last_update_date, last_updated_by, last_update_login
1567:
1568: sql_stmt := '
1569: INSERT INTO mrp_atp_details_temp'||p_dblink||'
1570: (
1571: session_id,
1572: scenario_id,
1573: order_line_id,
1737: -- dsting: added creation_date, created_by,
1738: -- last_update_date, last_updated_by, last_update_login
1739:
1740: sql_stmt := '
1741: INSERT INTO mrp_atp_details_temp@'||p_dblink|| '
1742: (session_id,
1743: order_line_id,
1744: pegging_id,
1745: parent_pegging_id,
1824: , :created_by
1825: , sysdate
1826: , :created_by
1827: , :created_by
1828: FROM mrp_atp_details_temp
1829: WHERE record_type = 3
1830: AND session_id = :x_session_id ';
1831:
1832: EXECUTE IMMEDIATE sql_stmt USING
1843:
1844: -- after the insert is done, delete the pegging records
1845: -- at the server since they are not needed anymore
1846: begin
1847: DELETE from mrp_atp_details_temp
1848: WHERE record_type = 3
1849: AND session_id = p_session_id;
1850: exception
1851: when others then null;
1976: x_atp_period.identifier1,
1977: x_atp_period.identifier2,
1978: x_atp_period.pegging_id,
1979: x_atp_period.end_pegging_id
1980: FROM mrp_atp_details_temp
1981: WHERE session_id = p_session_id
1982: and record_type = 1
1983: and pegging_id in (select pegging_id from mrp_atp_details_temp
1984: where session_id = p_session_id
1979: x_atp_period.end_pegging_id
1980: FROM mrp_atp_details_temp
1981: WHERE session_id = p_session_id
1982: and record_type = 1
1983: and pegging_id in (select pegging_id from mrp_atp_details_temp
1984: where session_id = p_session_id
1985: and record_type = 3);
1986:
1987: IF PG_DEBUG in ('Y', 'C') THEN
2050: x_atp_supply_demand.disposition_type,
2051: x_atp_supply_demand.disposition_name,
2052: x_atp_supply_demand.Supply_Demand_Source_Type_name,
2053: x_atp_supply_demand.end_pegging_id
2054: FROM mrp_atp_details_temp
2055: WHERE session_id = p_session_id
2056: and record_type = 2
2057: and pegging_id in (select pegging_id from mrp_atp_details_temp
2058: where session_id = p_session_id
2053: x_atp_supply_demand.end_pegging_id
2054: FROM mrp_atp_details_temp
2055: WHERE session_id = p_session_id
2056: and record_type = 2
2057: and pegging_id in (select pegging_id from mrp_atp_details_temp
2058: where session_id = p_session_id
2059: and record_type = 3);
2060:
2061:
2068: /*
2069: * dsting 10/1/02
2070: *
2071: * IF dblink is set then
2072: * transfer data from dest mrp_atp_details_temp to src
2073: * ELSE it's a nondistributed setup
2074: * transfer data from mrp_atp_Details_temp to pl/sql tables
2075: *
2076: */
2070: *
2071: * IF dblink is set then
2072: * transfer data from dest mrp_atp_details_temp to src
2073: * ELSE it's a nondistributed setup
2074: * transfer data from mrp_atp_Details_temp to pl/sql tables
2075: *
2076: */
2077: PROCEDURE Transfer_mrp_atp_details_temp(
2078: p_dblink IN VARCHAR2,
2073: * ELSE it's a nondistributed setup
2074: * transfer data from mrp_atp_Details_temp to pl/sql tables
2075: *
2076: */
2077: PROCEDURE Transfer_mrp_atp_details_temp(
2078: p_dblink IN VARCHAR2,
2079: p_session_id IN NUMBER
2080: ) IS
2081: sql_stmt VARCHAR2(10000);
2208:
2209: BEGIN
2210:
2211: IF PG_DEBUG in ('Y', 'C') THEN
2212: msc_sch_wb.atp_debug('Transfer_mrp_atp_details_temp: ' || 'PROCEDURE Transfer_SD_And_Period_Data');
2213: END IF;
2214:
2215: IF p_dblink IS NOT NULL THEN
2216: -- transfer period (record_type 1) and s/d (2) and pegging (3) data
2215: IF p_dblink IS NOT NULL THEN
2216: -- transfer period (record_type 1) and s/d (2) and pegging (3) data
2217: -- that appear in the pegging tree
2218: IF PG_DEBUG in ('Y', 'C') THEN
2219: msc_sch_wb.atp_debug('Transfer_mrp_atp_details_temp: ' || 'apps_ver: ' || MSC_ATP_PVT.G_APPS_VER);
2220: END IF;
2221:
2222: sql_stmt := 'Insert into mrp_atp_details_temp@' || p_dblink || ' (';
2223:
2218: IF PG_DEBUG in ('Y', 'C') THEN
2219: msc_sch_wb.atp_debug('Transfer_mrp_atp_details_temp: ' || 'apps_ver: ' || MSC_ATP_PVT.G_APPS_VER);
2220: END IF;
2221:
2222: sql_stmt := 'Insert into mrp_atp_details_temp@' || p_dblink || ' (';
2223:
2224: IF MSC_ATP_PVT.G_APPS_VER >= 3 THEN
2225: sql_stmt := sql_stmt || l_std_cols || l_apps_v3_cols ||
2226: ' ) select ' || l_std_cols || l_apps_v3_cols;
2229: ' ) select ' || l_std_cols;
2230: END IF;
2231:
2232: sql_stmt := sql_stmt ||
2233: 'from mrp_atp_details_temp
2234: where session_id = :p_session_id
2235: and record_type in (1, 2, 3)
2236: and pegging_id in (Select pegging_id from mrp_atp_details_temp
2237: where session_id = :p_session_id
2232: sql_stmt := sql_stmt ||
2233: 'from mrp_atp_details_temp
2234: where session_id = :p_session_id
2235: and record_type in (1, 2, 3)
2236: and pegging_id in (Select pegging_id from mrp_atp_details_temp
2237: where session_id = :p_session_id
2238: and record_type = 3)';
2239: IF PG_DEBUG in ('Y', 'C') THEN
2240: msc_sch_wb.atp_debug('Transfer_mrp_atp_details_temp: ' || 'dsting: '||sql_stmt);
2236: and pegging_id in (Select pegging_id from mrp_atp_details_temp
2237: where session_id = :p_session_id
2238: and record_type = 3)';
2239: IF PG_DEBUG in ('Y', 'C') THEN
2240: msc_sch_wb.atp_debug('Transfer_mrp_atp_details_temp: ' || 'dsting: '||sql_stmt);
2241: END IF;
2242: execute immediate sql_stmt using p_session_id , p_session_id;
2243:
2244: IF PG_DEBUG in ('Y', 'C') THEN
2241: END IF;
2242: execute immediate sql_stmt using p_session_id , p_session_id;
2243:
2244: IF PG_DEBUG in ('Y', 'C') THEN
2245: msc_sch_wb.atp_debug('Transfer_mrp_atp_details_temp: ' || 'dsting: '|| SQL%ROWCOUNT);
2246: END IF;
2247: END IF;
2248:
2249: END Transfer_mrp_atp_details_temp;
2245: msc_sch_wb.atp_debug('Transfer_mrp_atp_details_temp: ' || 'dsting: '|| SQL%ROWCOUNT);
2246: END IF;
2247: END IF;
2248:
2249: END Transfer_mrp_atp_details_temp;
2250:
2251: /*
2252: * dsting 10/16/02
2253: *
2269: msc_sch_wb.atp_debug('Copy_MRP_SD_Recs: ' || ' p_old_pegging_id: ' || p_old_pegging_id);
2270: msc_sch_wb.atp_debug('Copy_MRP_SD_Recs: ' || ' p_pegging_id: ' || p_pegging_id);
2271: END IF;
2272:
2273: INSERT INTO mrp_atp_details_temp (
2274: session_id,
2275: scenario_id,
2276: order_line_id,
2277: ATP_Level,
2344: created_by,
2345: last_update_date,
2346: last_updated_by,
2347: last_update_login
2348: FROM mrp_atp_details_temp
2349: where pegging_id = p_old_pegging_id
2350: and record_type = 2;
2351:
2352: IF PG_DEBUG in ('Y', 'C') THEN
2375: ---distributed database:
2376: IF PG_DEBUG in ('Y', 'C') THEN
2377: msc_sch_wb.atp_debug('Process_Supply_Demand_details: ' || 'Distributed environment. Put from dest to source table');
2378: END IF;
2379: sql_stmt := 'Insert into mrp_atp_details_temp' || l_dynstring ||
2380: '(select * from mrp_atp_details_temp
2381: where session_id = :p_session_id
2382: and record_type = 2
2383: and pegging_id in (Select pegging_id from mrp_atp_details_temp
2376: IF PG_DEBUG in ('Y', 'C') THEN
2377: msc_sch_wb.atp_debug('Process_Supply_Demand_details: ' || 'Distributed environment. Put from dest to source table');
2378: END IF;
2379: sql_stmt := 'Insert into mrp_atp_details_temp' || l_dynstring ||
2380: '(select * from mrp_atp_details_temp
2381: where session_id = :p_session_id
2382: and record_type = 2
2383: and pegging_id in (Select pegging_id from mrp_atp_details_temp
2384: where session_id = :p_session_id
2379: sql_stmt := 'Insert into mrp_atp_details_temp' || l_dynstring ||
2380: '(select * from mrp_atp_details_temp
2381: where session_id = :p_session_id
2382: and record_type = 2
2383: and pegging_id in (Select pegging_id from mrp_atp_details_temp
2384: where session_id = :p_session_id
2385: and record_type = 3))';
2386: execute immediate sql_stmt using p_session_id , p_session_id;
2387:
2450: x_atp_supply_demand.disposition_type,
2451: x_atp_supply_demand.disposition_name,
2452: x_atp_supply_demand.Supply_Demand_Source_Type_name,
2453: x_atp_supply_demand.end_pegging_id
2454: FROM mrp_atp_details_temp
2455: WHERE session_id = p_session_id
2456: and record_type = 2
2457: and pegging_id in (select pegging_id from mrp_atp_details_temp
2458: where session_id = p_session_id
2453: x_atp_supply_demand.end_pegging_id
2454: FROM mrp_atp_details_temp
2455: WHERE session_id = p_session_id
2456: and record_type = 2
2457: and pegging_id in (select pegging_id from mrp_atp_details_temp
2458: where session_id = p_session_id
2459: and record_type = 3);
2460:
2461:
2497:
2498: IF p_dblink IS NULL THEN
2499:
2500: FORALL j IN 1..p_atp_supply_demand.level.COUNT
2501: INSERT INTO mrp_atp_details_temp
2502: (
2503: session_id,
2504: scenario_id,
2505: order_line_id,
2585: -- dsting: added stuff for creation_date, created_by,
2586: -- last_update_date, last_updated_by, last_update_login
2587:
2588: sql_stmt := '
2589: INSERT INTO mrp_atp_details_temp@'||p_dblink||'
2590: (
2591: session_id,
2592: scenario_id,
2593: order_line_id,