[Home] [Help]
545:
546:
547: -- Bug 2585710. Store ship set item inventory numbers into 8i temp table.
548:
549: DELETE MSC_SHIP_SET_TEMP;
550:
551: FORALL j IN 1..l_count
552: --s_cto_rearch
553: INSERT INTO MSC_SHIP_SET_TEMP(INVENTORY_ITEM_ID, VISITED_FLAG, MIN_REGION_VALUE, line_id)
549: DELETE MSC_SHIP_SET_TEMP;
550:
551: FORALL j IN 1..l_count
552: --s_cto_rearch
553: INSERT INTO MSC_SHIP_SET_TEMP(INVENTORY_ITEM_ID, VISITED_FLAG, MIN_REGION_VALUE, line_id)
554: VALUES (l_dest_ship_set_item_list(j), 0, 0, l_line_ids(j));
555:
556: ELSE
557:
628: IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
629: IF PG_DEBUG in ('Y', 'C') THEN
630: msc_sch_wb.atp_debug('Atp_Sources: ' || 'Error occured in procedure Get_Sources_Info');
631: END IF;
632: DELETE MSC_SHIP_SET_TEMP;
633: x_return_status := FND_API.G_RET_STS_ERROR;
634: return;
635: END IF;
636:
651: END IF;
652:
653: -- Fix for bug 1454524, no need to join based on assignment set as only
654: -- 1 assignment set is supported for a plan.
655: -- Bug 2585710. Rewriting the dynamic SQL in static form. Using msc_ship_set_temp
656: SELECT
657: nvl(s.source_organization_id, -1),
658: -- nvl(s.sr_instance_id2,-1),
659: decode(nvl(min(s.source_type),
688: x_atp_sources.Ship_Method,
689: x_atp_sources.Sup_Cap_Type -- For supplier intransit LT project
690: FROM
691: msc_item_sourcing s,
692: msc_ship_set_temp msst,
693: msc_trading_partner_sites mtps -- For supplier intransit LT project
694: WHERE
695: s.inventory_item_id = msst.inventory_item_id
696: AND s.organization_id = p_organization_id
747: x_atp_sources.Lead_Time,
748: x_atp_sources.Ship_Method,
749: x_atp_sources.Sup_Cap_Type -- For supplier intransit LT project
750: FROM msc_sources_v s,
751: msc_ship_set_temp msst
752: WHERE s.inventory_item_id = msst.inventory_item_id
753: AND s.organization_id = p_organization_id
754: AND s.sr_instance_id = p_instance_id
755: AND s.assignment_set_id = p_assign_set_id
1029: msc_sr_receipt_org receiptorg,
1030: msc_sr_source_org sourceorg,
1031: msc_sr_assignments msa,
1032: msc_system_items msi,
1033: msc_ship_set_temp msst
1034: WHERE
1035: msa.assignment_type = 3
1036: AND msa.assignment_set_id = p_assign_set_id
1037: AND msa.inventory_item_id = msst.inventory_item_id
1094: msc_sr_receipt_org receiptorg,
1095: msc_sr_source_org sourceorg,
1096: msc_sr_assignments msa,
1097: msc_item_categories cat,
1098: msc_ship_set_temp msst
1099: WHERE msa.assignment_type = 2 and
1100: msa.assignment_set_id = p_assign_set_id and
1101: msa.inventory_item_id = msst.inventory_item_id
1102: AND msa.sourcing_rule_id = msr.sourcing_rule_id
1168: msc_sr_receipt_org receiptorg,
1169: msc_sr_source_org sourceorg,
1170: msc_sr_assignments msa,
1171: msc_system_items msi,
1172: msc_ship_set_temp msst
1173: WHERE
1174: msa.assignment_type = 1
1175: AND msa.assignment_set_id = p_assign_set_id
1176: AND msa.sourcing_rule_id = msr.sourcing_rule_id
1232: msc_sr_receipt_org receiptorg,
1233: msc_sr_source_org sourceorg,
1234: msc_sr_assignments msa,
1235: msc_system_items msi,
1236: msc_ship_set_temp msst
1237: WHERE
1238: msa.assignment_type = 1
1239: AND msa.assignment_set_id = p_assign_set_id
1240: AND msa.sourcing_rule_id = msr.sourcing_rule_id
6426: IF PG_DEBUG in ('Y', 'C') THEN
6427: msc_sch_wb.atp_debug('Get_Sources_Info: '|| 'Searching sources at level 1 (item-org)');
6428: END IF;
6429:
6430: -- At first level, visited_flag in table msc_ship_set_temp is 0 for all rows.
6431: -- Therefore no need for clause 'AND msst.visisble_flag = 0'.
6432:
6433: -- Find and insert the sources in msc_atp_sources_temp
6434: INSERT INTO MSC_ATP_SOURCES_TEMP (inventory_item_id, Organization_Id, Instance_Id,
6452: MSC_SR_RECEIPT_ORG RECEIPT_ORG,
6453: MSC_SOURCING_RULES MSR,
6454: MSC_SR_ASSIGNMENTS MSRA,
6455: MSC_TP_SITE_ID_LID MTSIL,
6456: MSC_SHIP_SET_TEMP MSST
6457: WHERE
6458: MSRA.ASSIGNMENT_TYPE = 6 /* ITEM-ORG */
6459: AND MSRA.ASSIGNMENT_SET_ID = p_assignment_set_id
6460: AND MSRA.PARTNER_ID IS NOT NULL
6493: END IF;
6494:
6495:
6496: -- Mark all the items for which sources are/have been found.
6497: UPDATE msc_ship_set_temp
6498: set visited_flag = 1
6499: where inventory_item_id in (select inventory_item_id from msc_atp_sources_temp);
6500:
6501: l_updated_rows := SQL%ROWCOUNT;
6588: MSC_SR_RECEIPT_ORG RECEIPT_ORG_INNER,
6589: MSC_SOURCING_RULES MSR_INNER,
6590: MSC_SR_ASSIGNMENTS MSRA_INNER,
6591: MSC_REGIONS_TEMP MRT_INNER,
6592: MSC_SHIP_SET_TEMP MSST_INNER
6593: WHERE
6594: MSRA_INNER.ASSIGNMENT_TYPE = 9
6595: AND MSRA_INNER.ASSIGNMENT_SET_ID = p_assignment_set_id
6596: AND MSRA_INNER.REGION_ID = MRT_INNER.REGION_ID
6620:
6621: IF (l_inventory_item_id_arr.COUNT > 0) THEN
6622:
6623: -- Step1: All the items for which sources are found,
6624: -- update column min_region_value and visited_flag in msc_ship_set_temp.
6625: IF PG_DEBUG in ('Y', 'C') THEN
6626: msc_sch_wb.atp_debug('Get_Sources_Info: '|| 'For following items, the min region value found');
6627: FOR i IN 1..l_inventory_item_id_arr.COUNT LOOP
6628: msc_sch_wb.atp_debug('Get_Sources_Info: '|| 'Item: '|| l_inventory_item_id_arr(i)
6631: END IF;
6632:
6633:
6634: FORALL i IN l_inventory_item_id_arr.FIRST..l_inventory_item_id_arr.LAST
6635: UPDATE msc_ship_set_temp
6636: SET min_region_value = l_min_region_value_arr(i),
6637: visited_flag = 1
6638: WHERE inventory_item_id = l_inventory_item_id_arr(i);
6639:
6662: MSC_SR_RECEIPT_ORG RECEIPT_ORG,
6663: MSC_SOURCING_RULES MSR,
6664: MSC_SR_ASSIGNMENTS MSRA,
6665: MSC_REGIONS_TEMP MRT,
6666: MSC_SHIP_SET_TEMP MSST
6667: WHERE
6668: MSRA.ASSIGNMENT_TYPE = 9
6669: AND MSRA.ASSIGNMENT_SET_ID = p_assignment_set_id
6670: AND MSRA.REGION_ID = MRT.REGION_ID
6700: -- Step3: Check if I need to stop here.
6701:
6702: SELECT COUNT(*)
6703: INTO l_items_visited
6704: FROM MSC_SHIP_SET_TEMP
6705: WHERE VISITED_FLAG = 1;
6706:
6707: IF (l_items_visited = p_ship_set_item_count) THEN
6708: -- We have to stop search and return from here. But before returning,
6801: MSC_SR_RECEIPT_ORG RECEIPT_ORG,
6802: MSC_SOURCING_RULES MSR,
6803: MSC_SR_ASSIGNMENTS MSRA,
6804: MSC_TP_SITE_ID_LID MTSIL,
6805: MSC_SHIP_SET_TEMP MSST
6806: WHERE
6807: MSRA.ASSIGNMENT_TYPE = 5 /* CATEGORY-ORG */
6808: AND MSRA.ASSIGNMENT_SET_ID = p_assignment_set_id
6809: AND MSRA.PARTNER_ID IS NOT NULL
6842: msc_sch_wb.atp_debug('Get_Sources_Info: '|| 'Found some sources for some ship set items at level 3');
6843: END IF;
6844:
6845: -- Mark all the items for which sources are/have been found.
6846: UPDATE msc_ship_set_temp
6847: set visited_flag = 1
6848: where inventory_item_id in (select inventory_item_id from msc_atp_sources_temp);
6849:
6850: l_updated_rows := SQL%ROWCOUNT;
6945: MSC_SR_RECEIPT_ORG RECEIPT_ORG,
6946: MSC_SOURCING_RULES MSR,
6947: MSC_SR_ASSIGNMENTS MSRA,
6948: -- MSC_TP_SITE_ID_LID MTSIL,
6949: MSC_SHIP_SET_TEMP MSST
6950: WHERE
6951:
6952: MSRA.ASSIGNMENT_TYPE = 3 /* ITEM */
6953: AND MSRA.ASSIGNMENT_SET_ID = p_assignment_set_id
6985: msc_sch_wb.atp_debug('Get_Sources_Info: '|| 'Found some sources for some ship set items at level 4');
6986: END IF;
6987:
6988: -- Mark all the items for which sources are/have been found.
6989: UPDATE msc_ship_set_temp
6990: set visited_flag = 1
6991: where inventory_item_id in (select distinct(inventory_item_id) from msc_atp_sources_temp);
6992:
6993: l_updated_rows := SQL%ROWCOUNT;
7078: MSC_SR_RECEIPT_ORG RECEIPT_ORG_INNER,
7079: MSC_SOURCING_RULES MSR_INNER,
7080: MSC_SR_ASSIGNMENTS MSRA_INNER,
7081: MSC_REGIONS_TEMP MRT_INNER,
7082: MSC_SHIP_SET_TEMP MSST_INNER
7083: WHERE
7084:
7085: MSRA_INNER.ASSIGNMENT_TYPE = 8 /* CATEGORY-REGION */
7086: AND MSRA_INNER.ASSIGNMENT_SET_ID = p_assignment_set_id
7109: GROUP BY MSST_INNER.INVENTORY_ITEM_ID;
7110:
7111: IF (l_inventory_item_id_arr.COUNT > 0) THEN
7112:
7113: -- Step1: For all the items found, update column min_region_value in msc_ship_set_temp.
7114: -- Also update the column visited_flag
7115: IF PG_DEBUG in ('Y', 'C') THEN
7116: msc_sch_wb.atp_debug('Get_Sources_Info: '|| 'For following items, the min region value found');
7117: FOR i IN 1..l_inventory_item_id_arr.COUNT LOOP
7120: END LOOP;
7121: END IF;
7122:
7123: FORALL i IN l_inventory_item_id_arr.FIRST..l_inventory_item_id_arr.LAST
7124: UPDATE msc_ship_set_temp
7125: SET min_region_value = l_min_region_value_arr(i),
7126: visited_flag = 1
7127: WHERE inventory_item_id = l_inventory_item_id_arr(i);
7128:
7151: MSC_SR_RECEIPT_ORG RECEIPT_ORG,
7152: MSC_SOURCING_RULES MSR,
7153: MSC_SR_ASSIGNMENTS MSRA,
7154: MSC_REGIONS_TEMP MRT,
7155: MSC_SHIP_SET_TEMP MSST
7156: WHERE
7157:
7158: MSRA.ASSIGNMENT_TYPE = 8 /* CATEGORY-REGION */
7159: AND MSRA.ASSIGNMENT_SET_ID = p_assignment_set_id
7190: -- Step3: Check if I need to stop here.
7191:
7192: SELECT COUNT(*)
7193: INTO l_items_visited
7194: FROM MSC_SHIP_SET_TEMP
7195: WHERE VISITED_FLAG = 1;
7196:
7197: IF (l_items_visited = p_ship_set_item_count) THEN
7198: -- We have to stop search and return from here. But before returning,
7277: MSC_SR_RECEIPT_ORG RECEIPT_ORG,
7278: MSC_SOURCING_RULES MSR,
7279: MSC_SR_ASSIGNMENTS MSRA,
7280: -- MSC_TP_SITE_ID_LID MTSIL,
7281: MSC_SHIP_SET_TEMP MSST
7282: WHERE
7283:
7284: MSRA.ASSIGNMENT_TYPE = 2 /* CATEGORY */
7285: AND MSRA.ASSIGNMENT_SET_ID = p_assignment_set_id
7318: msc_sch_wb.atp_debug('Get_Sources_Info: '|| 'Found some sources for some ship set items at level 6');
7319: END IF;
7320:
7321: -- Mark all the items for which sources are/have been found.
7322: UPDATE msc_ship_set_temp
7323: set visited_flag = 1
7324: where inventory_item_id in (select inventory_item_id from msc_atp_sources_temp);
7325:
7326: l_updated_rows := SQL%ROWCOUNT;
7420: MSC_SR_RECEIPT_ORG RECEIPT_ORG,
7421: MSC_SOURCING_RULES MSR,
7422: MSC_SR_ASSIGNMENTS MSRA,
7423: MSC_TP_SITE_ID_LID MTSIL,
7424: MSC_SHIP_SET_TEMP MSST
7425: WHERE
7426: MSRA.ASSIGNMENT_TYPE = 4 /* ORG */
7427: AND MSRA.ASSIGNMENT_SET_ID = p_assignment_set_id
7428: AND MSRA.PARTNER_ID IS NOT NULL
7460: msc_sch_wb.atp_debug('Get_Sources_Info: '|| 'Found some sources for some ship set items at level 7');
7461: END IF;
7462:
7463: -- Mark all the items for which sources are/have been found.
7464: UPDATE msc_ship_set_temp
7465: set visited_flag = 1
7466: where inventory_item_id in (select inventory_item_id from msc_atp_sources_temp);
7467:
7468: l_updated_rows := SQL%ROWCOUNT;
7553: MSC_SR_RECEIPT_ORG RECEIPT_ORG_INNER,
7554: MSC_SOURCING_RULES MSR_INNER,
7555: MSC_SR_ASSIGNMENTS MSRA_INNER,
7556: MSC_REGIONS_TEMP MRT_INNER,
7557: MSC_SHIP_SET_TEMP MSST_INNER
7558: WHERE
7559: MSRA_INNER.ASSIGNMENT_TYPE = 7 /* REGION */
7560: AND MSRA_INNER.ASSIGNMENT_SET_ID = p_assignment_set_id
7561: AND MSRA_INNER.REGION_ID = MRT_INNER.REGION_ID
7582: GROUP BY MSST_INNER.INVENTORY_ITEM_ID;
7583:
7584: IF (l_inventory_item_id_arr.COUNT > 0) THEN
7585:
7586: -- Step1: For all the items found, update column min_region_value in msc_ship_set_temp.
7587: -- Also update the column visited_flag
7588: IF PG_DEBUG in ('Y', 'C') THEN
7589: msc_sch_wb.atp_debug('Get_Sources_Info: '|| 'For following items, the min region value found');
7590: FOR i IN 1..l_inventory_item_id_arr.COUNT LOOP
7593: END LOOP;
7594: END IF;
7595:
7596: FORALL i IN l_inventory_item_id_arr.FIRST..l_inventory_item_id_arr.LAST
7597: UPDATE msc_ship_set_temp
7598: SET min_region_value = l_min_region_value_arr(i),
7599: visited_flag = 1
7600: WHERE inventory_item_id = l_inventory_item_id_arr(i);
7601:
7624: MSC_SR_RECEIPT_ORG RECEIPT_ORG,
7625: MSC_SOURCING_RULES MSR,
7626: MSC_SR_ASSIGNMENTS MSRA,
7627: MSC_REGIONS_TEMP MRT,
7628: MSC_SHIP_SET_TEMP MSST
7629: WHERE
7630:
7631: MSRA.ASSIGNMENT_TYPE = 7 /* REGION */
7632: AND MSRA.ASSIGNMENT_SET_ID = p_assignment_set_id
7662: -- Step3: Check if I need to stop here.
7663:
7664: SELECT COUNT(*)
7665: INTO l_items_visited
7666: FROM MSC_SHIP_SET_TEMP
7667: WHERE VISITED_FLAG = 1;
7668:
7669: IF (l_items_visited = p_ship_set_item_count) THEN
7670: -- We have to stop search and return from here. But before returning,
7749: MSC_SR_RECEIPT_ORG RECEIPT_ORG,
7750: MSC_SOURCING_RULES MSR,
7751: MSC_SR_ASSIGNMENTS MSRA,
7752: -- MSC_TP_SITE_ID_LID MTSIL,
7753: MSC_SHIP_SET_TEMP MSST
7754: WHERE
7755: MSRA.ASSIGNMENT_TYPE = 1 /* GLOBAL */
7756: AND MSRA.ASSIGNMENT_SET_ID = p_assignment_set_id
7757: AND MSRA.SOURCING_RULE_ID = MSR.SOURCING_RULE_ID
7789: msc_sch_wb.atp_debug('Get_Sources_Info: '|| 'Found some sources for some ship set items at level 9');
7790: END IF;
7791:
7792: -- Mark all the items for which sources are/have been found.
7793: UPDATE msc_ship_set_temp
7794: set visited_flag = 1
7795: where inventory_item_id in (select inventory_item_id from msc_atp_sources_temp);
7796:
7797: l_updated_rows := SQL%ROWCOUNT;