[Home] [Help]
1900: -1); --CMRO
1901:
1902:
1903: FORALL i IN 1..l_identifier_tab.COUNT
1904: UPDATE msc_alloc_supplies
1905: SET old_allocated_quantity = allocated_quantity,
1906: old_supply_date = supply_date,
1907: allocated_quantity = 0,
1908: old_refresh_number = refresh_number, -- For summary enhancement
2040: l_refresh_number_tab,
2041: l_qty_tab,
2042: l_old_demand_date,
2043: l_demand_class_tab
2044: FROM msc_alloc_supplies
2045: WHERE sr_instance_id = p_instance_id
2046: AND plan_id = p_plan_id
2047: AND stealing_flag = 1
2048: AND allocated_quantity <> 0
2076: msc_sch_wb.atp_debug('Delete_Row: l_identifier_tab.COUNT ' || l_identifier_tab.COUNT);
2077: END IF;
2078:
2079: FORALL i IN 1..l_identifier_tab.COUNT
2080: UPDATE msc_alloc_supplies
2081: SET old_allocated_quantity = allocated_quantity,
2082: old_supply_date = supply_date,
2083: allocated_quantity = 0,
2084: old_refresh_number = refresh_number, -- For summary enhancement
2370: (MSC_ATP_PVT.G_ALLOCATION_METHOD = 1)) THEN
2371:
2372: IF PG_DEBUG in ('Y', 'C') THEN
2373: msc_sch_wb.atp_debug('Remove_Invalid_SD_Rec: before delete of ' ||
2374: ' msc_alloc_supplies');
2375: END IF;
2376:
2377: DELETE FROM MSC_ALLOC_SUPPLIES
2378: WHERE parent_transaction_id = c1.identifier3
2373: msc_sch_wb.atp_debug('Remove_Invalid_SD_Rec: before delete of ' ||
2374: ' msc_alloc_supplies');
2375: END IF;
2376:
2377: DELETE FROM MSC_ALLOC_SUPPLIES
2378: WHERE parent_transaction_id = c1.identifier3
2379: AND plan_id = c1.identifier2;
2380:
2381: IF PG_DEBUG in ('Y', 'C') THEN
2378: WHERE parent_transaction_id = c1.identifier3
2379: AND plan_id = c1.identifier2;
2380:
2381: IF PG_DEBUG in ('Y', 'C') THEN
2382: msc_sch_wb.atp_debug('Remove_Invalid_SD_Rec: ' || 'No. of supply deleted from msc_alloc_supplies = '|| SQL%ROWCOUNT);
2383: END IF;
2384: END IF;
2385: -- Allocated ATP Based on Planning Details -- Agilent changes End
2386:
3000: (MSC_ATP_PVT.G_ALLOCATION_METHOD = 1)) THEN
3001:
3002: IF PG_DEBUG in ('Y', 'C') THEN
3003: msc_sch_wb.atp_debug('Update_Planned_Order: before update of' ||
3004: ' msc_alloc_supplies');
3005: END IF;
3006:
3007: UPDATE msc_alloc_supplies
3008: SET old_supply_date = supply_date,
3003: msc_sch_wb.atp_debug('Update_Planned_Order: before update of' ||
3004: ' msc_alloc_supplies');
3005: END IF;
3006:
3007: UPDATE msc_alloc_supplies
3008: SET old_supply_date = supply_date,
3009: old_allocated_quantity = allocated_quantity,
3010: supply_date = NVL(p_date, supply_date),
3011: allocated_quantity = NVL(p_quantity, allocated_quantity),
4104: */
4105:
4106: IF PG_DEBUG in ('Y', 'C') THEN
4107: msc_sch_wb.atp_debug('Undo_Delete_Row: before update of ' ||
4108: ' msc_alloc_supplies');
4109: END IF;
4110:
4111: FORALL m IN 1..p_del_demand_ids.COUNT
4112: UPDATE msc_alloc_supplies
4108: ' msc_alloc_supplies');
4109: END IF;
4110:
4111: FORALL m IN 1..p_del_demand_ids.COUNT
4112: UPDATE msc_alloc_supplies
4113: SET allocated_quantity = old_allocated_quantity ,
4114: supply_date = old_supply_date ,
4115: old_allocated_quantity = null,
4116: old_supply_date = null,
4565:
4566: SELECT msc_supplies_s.nextval into p_transaction_id from dual;
4567:
4568: IF PG_DEBUG in ('Y', 'C') THEN
4569: msc_sch_wb.atp_debug('Add_Stealing_Supply_Details: ' || 'before insert into msc_alloc_supplies-Stealing Info');
4570: END IF;
4571:
4572: --ssurendr 25-NOV-2002: From_Demand_Class added in both the insert statements for alloc w/b drill down
4573: INSERT INTO MSC_ALLOC_SUPPLIES
4569: msc_sch_wb.atp_debug('Add_Stealing_Supply_Details: ' || 'before insert into msc_alloc_supplies-Stealing Info');
4570: END IF;
4571:
4572: --ssurendr 25-NOV-2002: From_Demand_Class added in both the insert statements for alloc w/b drill down
4573: INSERT INTO MSC_ALLOC_SUPPLIES
4574: (plan_id, inventory_item_id, organization_id, sr_instance_id,
4575: demand_class, supply_date, parent_transaction_id,
4576: allocated_quantity, order_type, sales_order_line_id,demand_source_type, stealing_flag, --cmro
4577: created_by, creation_date, last_updated_by, last_update_date, from_demand_class,
4592:
4593: -- Next add the Stolen Data.
4594:
4595: IF PG_DEBUG in ('Y', 'C') THEN
4596: msc_sch_wb.atp_debug('Add_Stealing_Supply_Details: ' || 'before insert into msc_alloc_supplies-Stolen Info');
4597: END IF;
4598:
4599: INSERT INTO MSC_ALLOC_SUPPLIES
4600: (plan_id, inventory_item_id, organization_id, sr_instance_id,
4595: IF PG_DEBUG in ('Y', 'C') THEN
4596: msc_sch_wb.atp_debug('Add_Stealing_Supply_Details: ' || 'before insert into msc_alloc_supplies-Stolen Info');
4597: END IF;
4598:
4599: INSERT INTO MSC_ALLOC_SUPPLIES
4600: (plan_id, inventory_item_id, organization_id, sr_instance_id,
4601: demand_class, supply_date, parent_transaction_id,
4602: allocated_quantity, order_type, sales_order_line_id,demand_source_type, stealing_flag, --cmro
4603: created_by, creation_date, last_updated_by, last_update_date, from_demand_class,
4663: END IF;
4664:
4665: MSC_ATP_DB_UTILS.Delete_Pegging(c1.pegging_id);
4666:
4667: DELETE MSC_ALLOC_SUPPLIES
4668: WHERE parent_transaction_id = c1.identifier3
4669: AND plan_id = c1.identifier2
4670: AND sr_instance_id = c1.identifier1;
4671:
4669: AND plan_id = c1.identifier2
4670: AND sr_instance_id = c1.identifier1;
4671:
4672: IF PG_DEBUG in ('Y', 'C') THEN
4673: msc_sch_wb.atp_debug('Remove_Invalid_Future_SD: ' || 'Records deleted from msc_alloc_supplies = '|| SQL%ROWCOUNT);
4674: END IF;
4675:
4676: END LOOP;
4677: CLOSE pegging;
5156: (MSC_ATP_PVT.G_ALLOCATION_METHOD = 1)) THEN
5157:
5158: IF PG_DEBUG in ('Y', 'C') THEN
5159: msc_sch_wb.atp_debug('Add_Supplies: ' || ' before insert into' ||
5160: ' msc_alloc_supplies');
5161: END IF;
5162:
5163: INSERT INTO MSC_ALLOC_SUPPLIES(
5164: PLAN_ID,
5159: msc_sch_wb.atp_debug('Add_Supplies: ' || ' before insert into' ||
5160: ' msc_alloc_supplies');
5161: END IF;
5162:
5163: INSERT INTO MSC_ALLOC_SUPPLIES(
5164: PLAN_ID,
5165: INVENTORY_ITEM_ID,
5166: ORGANIZATION_ID,
5167: SR_INSTANCE_ID,
6007: (MSC_ATP_PVT.G_HIERARCHY_PROFILE = 1) AND
6008: (MSC_ATP_PVT.G_ALLOCATION_METHOD = 1)) THEN
6009:
6010: IF PG_DEBUG in ('Y', 'C') THEN
6011: msc_sch_wb.atp_debug('Hide_SD_Rec: before update of msc_alloc_supplies');
6012: END IF;
6013:
6014: UPDATE MSC_ALLOC_SUPPLIES
6015: SET inventory_item_id = -1*inventory_item_id
6010: IF PG_DEBUG in ('Y', 'C') THEN
6011: msc_sch_wb.atp_debug('Hide_SD_Rec: before update of msc_alloc_supplies');
6012: END IF;
6013:
6014: UPDATE MSC_ALLOC_SUPPLIES
6015: SET inventory_item_id = -1*inventory_item_id
6016: WHERE parent_transaction_id = c1.identifier3
6017: AND plan_id = c1.identifier2
6018: AND inventory_item_id > 0;
6017: AND plan_id = c1.identifier2
6018: AND inventory_item_id > 0;
6019:
6020: IF PG_DEBUG in ('Y', 'C') THEN
6021: msc_sch_wb.atp_debug('Hide_SD_Rec: ' || 'No. of supply updated from msc_alloc_supplies = '|| SQL%ROWCOUNT);
6022: END IF;
6023: END IF;
6024: IF NVL(c1.char1, '@@@') <> '@@@' THEN
6025:
6029: AND plan_id = c1.identifier2
6030: AND inventory_item_id > 0;
6031:
6032: IF PG_DEBUG in ('Y', 'C') THEN
6033: msc_sch_wb.atp_debug('Hide_SD_Rec: ' || 'No. of stealing demand updated from msc_alloc_supplies = '|| SQL%ROWCOUNT);
6034: END IF;
6035: END IF;
6036: END IF; -- IF NVL(c1.inventory_item_id, -1) > 0 THEN
6037: ELSE -- IF c1.supply_demand_type = 2 THEN
6187: (MSC_ATP_PVT.G_ALLOCATED_ATP = 'Y') AND
6188: (MSC_ATP_PVT.G_HIERARCHY_PROFILE = 1) AND
6189: (MSC_ATP_PVT.G_ALLOCATION_METHOD = 1)) THEN
6190:
6191: DELETE FROM MSC_ALLOC_SUPPLIES
6192: WHERE parent_transaction_id = c1.identifier3
6193: AND plan_id = c1.identifier2;
6194:
6195: IF PG_DEBUG in ('Y', 'C') THEN
6192: WHERE parent_transaction_id = c1.identifier3
6193: AND plan_id = c1.identifier2;
6194:
6195: IF PG_DEBUG in ('Y', 'C') THEN
6196: msc_sch_wb.atp_debug('Delete_SD_Rec: ' || 'No. of supply deleted from msc_alloc_supplies = '|| SQL%ROWCOUNT);
6197: END IF;
6198: END IF;
6199: IF NVL(c1.char1, '@@@') <> '@@@' THEN
6200:
6202: WHERE demand_id = c1.identifier3
6203: AND plan_id = c1.identifier2;
6204:
6205: IF PG_DEBUG in ('Y', 'C') THEN
6206: msc_sch_wb.atp_debug('Delete_SD_Rec: ' || 'No. of stealing demands deleted from msc_alloc_supplies = '|| SQL%ROWCOUNT);
6207: END IF;
6208: END IF;
6209: END IF; -- IF NVL(c1.inventory_item_id, -1) > 0 THEN
6210:
6356: (MSC_ATP_PVT.G_ALLOCATED_ATP = 'Y') AND
6357: (MSC_ATP_PVT.G_HIERARCHY_PROFILE = 1) AND
6358: (MSC_ATP_PVT.G_ALLOCATION_METHOD = 1)) THEN
6359:
6360: UPDATE MSC_ALLOC_SUPPLIES
6361: SET inventory_item_id = -1*inventory_item_id
6362: WHERE parent_transaction_id = c1.identifier3
6363: AND plan_id = c1.identifier2
6364: AND inventory_item_id < 0;
6363: AND plan_id = c1.identifier2
6364: AND inventory_item_id < 0;
6365:
6366: IF PG_DEBUG in ('Y', 'C') THEN
6367: msc_sch_wb.atp_debug('Restore_SD_Rec: ' || 'No. of supply updated from msc_alloc_supplies = '|| SQL%ROWCOUNT);
6368: END IF;
6369: END IF;
6370: IF NVL(c1.char1, '@@@') <> '@@@' THEN
6371:
6375: AND plan_id = c1.identifier2
6376: AND inventory_item_id < 0;
6377:
6378: IF PG_DEBUG in ('Y', 'C') THEN
6379: msc_sch_wb.atp_debug('Restore_SD_Rec: ' || 'No. of stealing demands updated from msc_alloc_supplies = '|| SQL%ROWCOUNT);
6380: END IF;
6381: END IF;
6382: END IF; -- IF NVL(c1.inventory_item_id, -1) > 0 THEN
6383: