86: Description :
87:
88: Lock the configuration. Explode the bill.
89:
90: Get the records from cz_config_details_v
91: and bom_explosions and
92: insert,update,or deletethem from order_lines.
93:
94: We will open three cursors :
101: The third to pass an operation of DELETE
102: for records which exist but are no longer selected.
103: => handle_deletes proc
104:
105: get values from cz_config_details_v
106: viz. comp_code, qty, cfg_hdr_id, rev_no
107: and bom_explosions viz.
108: component_sequence_id, sort_order, bom_item_type,
109: bill_sequence_id, top_bill_sequence_id
119: after batch validation.
120:
121: Change Record:
122: Bug 2181376: explode bill is not required since in handle_inserts
123: procedure we will selecet all required data from cz_config_details_v
124: and do not need to join with bom_explosions anymore. This change is
125: also useful for multiple instance project.
126: --------------------------------------------------------------------*/
127:
212:
213: BEGIN
214: SELECT quantity, config_item_id
215: INTO l_model_new_qty, l_model_line_rec.configuration_id
216: FROM cz_config_details_v
217: WHERE config_hdr_id = p_config_hdr_id
218: AND config_rev_nbr = p_config_rev_nbr
219: AND inventory_item_id = l_model_line_rec.inventory_item_id;
220:
408:
409: /*------------------------------------------------------------------
410: PROCEDURE Handle_Inserts
411:
412: if a component is present in cz_config_details_v but not present
413: in oe_order_lines, we need to insert it.
414:
415: Change Record:
416: Bug 2181376: explode bill is not required since in this
413: in oe_order_lines, we need to insert it.
414:
415: Change Record:
416: Bug 2181376: explode bill is not required since in this
417: procedure we will selecet all required data from cz_config_details_v
418: and do not need to join with bom_explosions anymore. This change is
419: also useful for multiple instance project
420: Bug 2869052 :
421: Default_Child_Line procedure would be called only if there are
453: ,c.instance_hdr_id, c.instance_rev_nbr
454: ,c.component_sequence_id, c.bom_sort_order
455: ,c.bom_item_type, c.config_item_id
456: ,c.line_type
457: FROM CZ_CONFIG_DETAILS_V c
458: WHERE c.config_hdr_id = p_config_hdr_id
459: AND c.config_rev_nbr = p_config_rev_nbr
460: AND NOT EXISTS
461: ( SELECT 'X'
493:
494: UPDATE oe_order_lines oe
495: SET ( configuration_id , sort_order ) =
496: (SELECT config_item_id , bom_sort_order --bug6628691
497: FROM cz_config_details_v
498: WHERE config_hdr_id = p_config_hdr_id
499: AND config_rev_nbr = p_config_rev_nbr
500: AND component_code = oe.component_code
501: )
516:
517: UPDATE oe_order_lines oe
518: SET ( configuration_id , sort_order ) =
519: (SELECT config_item_id , bom_sort_order --bug6628691
520: FROM cz_config_details_v
521: WHERE config_hdr_id = p_config_hdr_id
522: AND config_rev_nbr = p_config_rev_nbr
523: AND component_code = oe.component_code
524: )
792:
793: /*------------------------------------------------------------
794: PROCEDURE Handle_Inserts_Old
795:
796: if a component is present in cz_config_details_v but not present
797: in oe_order_lines, we need to insert it.
798:
799: Change Record:
800: Bug 2181376: explode bill is not required since in this
797: in oe_order_lines, we need to insert it.
798:
799: Change Record:
800: Bug 2181376: explode bill is not required since in this
801: procedure we will selecet all required data from cz_config_details_v
802: and do not need to join with bom_explosions anymore. This change is
803: also useful for multiple instance project.
804: Bug 2869052 :
805: Default_Child_Line procedure would be called only if there are
821: SELECT c.component_code, c.quantity
822: ,c.uom_code, c.inventory_item_id
823: ,c.component_sequence_id, c.bom_sort_order
824: ,c.bom_item_type
825: FROM CZ_CONFIG_DETAILS_V c
826: WHERE c.config_hdr_id = p_config_hdr_id
827: AND c.config_rev_nbr = p_config_rev_nbr
828: AND NOT EXISTS
829: ( SELECT 'X'
959: /*-----------------------------------------------------------
960: PROCEDURE Handle_Updates
961:
962: If quantity of a component is different in oe_order_lines and
963: cz_config_details_v, we need to update that component.
964:
965: for config UI only: if there is a constraint on qty change,
966: should we pass a hardcoded reason/comment, or should we fail?
967: we should fail.
988: ,l.ordered_quantity
989: ,l.item_type_code
990: ,c.line_type
991: ,c.bom_sort_order
992: FROM CZ_CONFIG_DETAILS_V c, oe_order_lines l
993: WHERE c.config_hdr_id = p_config_hdr_id
994: AND c.config_rev_nbr = p_config_rev_nbr
995: AND (c.quantity <> l.ordered_quantity OR
996: c.line_type <> l.line_type_id OR
1098: /*-----------------------------------------------------------
1099: PROCEDURE Handle_Updates_Old
1100:
1101: If quantity of a component is different in oe_order_lines and
1102: cz_config_details_v, we need to update that component.
1103:
1104: for config UI only: if there is a constraint on qty change,
1105: should we pass a hardcoded reason/comment, or should we fail?
1106: we should fail.
1121: ,c.component_code
1122: ,c.quantity
1123: ,l.ordered_quantity
1124: ,l.item_type_code
1125: FROM CZ_CONFIG_DETAILS_V c, oe_order_lines l
1126: WHERE c.config_hdr_id = p_config_hdr_id
1127: AND c.config_rev_nbr = p_config_rev_nbr
1128: AND c.quantity <> l.ordered_quantity
1129: AND l.top_model_line_id = p_model_line_rec.line_id
1193: /*---------------------------------------------------------
1194: PROCEDURE Handle_Deletes
1195:
1196: If a component exists in oe_order_lines, but does not exist
1197: in cz_config_details_v, we need to delete that component.
1198:
1199: Change Record:
1200:
1201: bug 1939531: to not call check_if_cancellation
1231: AND l.open_flag = 'Y'
1232: AND
1233: (NOT EXISTS
1234: ( SELECT 'X'
1235: FROM CZ_CONFIG_DETAILS_V c
1236: WHERE c.component_code = l.component_code
1237: AND c.config_item_id = l.configuration_id
1238: AND c.config_hdr_id = p_config_hdr_id
1239: AND c.config_rev_nbr = p_config_rev_nbr )
1238: AND c.config_hdr_id = p_config_hdr_id
1239: AND c.config_rev_nbr = p_config_rev_nbr )
1240: OR EXISTS
1241: ( SELECT 'X'
1242: FROM CZ_CONFIG_DETAILS_V c
1243: WHERE c.component_code = l.component_code
1244: AND c.config_item_id = l.configuration_id
1245: AND c.config_hdr_id = p_config_hdr_id
1246: AND c.config_rev_nbr = p_config_rev_nbr
1382: /*---------------------------------------------------------
1383: PROCEDURE Handle_Deletes_Old
1384:
1385: If a component exists in oe_order_lines, but does not exist
1386: in cz_config_details_v, we need to delete that component.
1387:
1388: Change Record:
1389:
1390: bug 1939531: to not call check_if_cancellation
1420: AND l.open_flag = 'Y'
1421: AND
1422: (NOT EXISTS
1423: ( SELECT 'X'
1424: FROM CZ_CONFIG_DETAILS_V c
1425: WHERE c.component_code = l.component_code
1426: AND c.config_hdr_id = p_config_hdr_id
1427: AND c.config_rev_nbr = p_config_rev_nbr )
1428: OR EXISTS
1426: AND c.config_hdr_id = p_config_hdr_id
1427: AND c.config_rev_nbr = p_config_rev_nbr )
1428: OR EXISTS
1429: ( SELECT 'X'
1430: FROM CZ_CONFIG_DETAILS_V c
1431: WHERE c.component_code = l.component_code
1432: AND c.config_hdr_id = p_config_hdr_id
1433: AND c.config_rev_nbr = p_config_rev_nbr
1434: AND c.quantity = 0));
2504: FROM oe_order_lines OELNK
2505: WHERE OELNK.top_model_line_id = OEOPT.top_model_line_id
2506: AND OELNK.configuration_id =
2507: ( SELECT parent_config_item_id
2508: FROM cz_config_details_v
2509: WHERE config_hdr_id = OELNK.config_header_id
2510: AND config_rev_nbr = OELNK.config_rev_nbr
2511: AND config_item_id = OEOPT.configuration_id
2512: )
2705: FROM oe_order_lines OEATO
2706: WHERE OEOPT.top_model_line_id = OEATO.top_model_line_id
2707: AND OEATO.configuration_id =
2708: (SELECT ato_config_item_id
2709: FROM cz_config_details_v
2710: WHERE config_hdr_id = OEOPT.config_header_id
2711: AND config_rev_nbr = OEOPT.config_rev_nbr
2712: AND config_item_id = OEOPT.configuration_id)
2713: AND OEATO.open_flag = 'Y'