131: l_errMsg VARCHAR2(80);
132: l_entryType NUMBER;
133: l_logLevel NUMBER := to_number(fnd_log.g_current_runtime_level);
134: begin
135: x_returnStatus := fnd_api.g_ret_sts_success;
136: if (l_logLevel <= wip_constants.trace_logging) then
137: l_params(1).paramName := 'p_orgID';
138: l_params(1).paramValue := p_orgID;
139: l_params(2).paramName := 'p_wipEntityID';
142: p_params => l_params,
143: x_returnStatus => x_returnStatus);
144: end if;
145:
146: if(fnd_api.to_boolean(p_initMsgList)) then
147: fnd_msg_pub.initialize;
148: end if;
149:
150: select backflush_lot_entry_type
153: where organization_id = p_orgID;
154:
155:
156: x_compLots.reset;
157: x_returnStatus := fnd_api.g_ret_sts_success; --assume we will be able to derive everything
158: loop
159: if(x_compLots.getCurrentItem(l_curItem)) then
160: if(l_curItem.wip_supply_type not in (wip_constants.push, wip_constants.op_pull, wip_constants.assy_pull)) then
161: goto END_OF_LOOP;
164: if(l_treeID is not null
165: and l_prevItem <> l_curItem.inventory_item_id) then
166: --if destroy trees is true, free the tree. otherwise, we just
167: --need to reset the l_treeID variable
168: if(fnd_api.to_boolean(p_destroyTrees)) then
169: inv_quantity_tree_pvt.free_tree(p_api_version_number => 1.0,
170: p_init_msg_lst => fnd_api.g_false,
171: p_tree_id => l_treeID,
172: x_return_status => l_returnStatus,
166: --if destroy trees is true, free the tree. otherwise, we just
167: --need to reset the l_treeID variable
168: if(fnd_api.to_boolean(p_destroyTrees)) then
169: inv_quantity_tree_pvt.free_tree(p_api_version_number => 1.0,
170: p_init_msg_lst => fnd_api.g_false,
171: p_tree_id => l_treeID,
172: x_return_status => l_returnStatus,
173: x_msg_count => l_msgCount,
174: x_msg_data => l_msgData);
183: p_treeSrcName => p_treeSrcName,
184: x_treeID => l_treeID,
185: x_compLots => x_compLots,
186: x_returnStatus => l_returnStatus);
187: if(l_returnStatus = fnd_api.g_ret_sts_unexp_error) then
188: l_errMsg := 'deriveSingleItem failed';
189: raise fnd_api.g_exc_unexpected_error;
190: elsif(l_returnStatus = fnd_api.g_ret_sts_error) then
191: x_returnStatus := fnd_api.g_ret_sts_error;
185: x_compLots => x_compLots,
186: x_returnStatus => l_returnStatus);
187: if(l_returnStatus = fnd_api.g_ret_sts_unexp_error) then
188: l_errMsg := 'deriveSingleItem failed';
189: raise fnd_api.g_exc_unexpected_error;
190: elsif(l_returnStatus = fnd_api.g_ret_sts_error) then
191: x_returnStatus := fnd_api.g_ret_sts_error;
192: end if;
193:
186: x_returnStatus => l_returnStatus);
187: if(l_returnStatus = fnd_api.g_ret_sts_unexp_error) then
188: l_errMsg := 'deriveSingleItem failed';
189: raise fnd_api.g_exc_unexpected_error;
190: elsif(l_returnStatus = fnd_api.g_ret_sts_error) then
191: x_returnStatus := fnd_api.g_ret_sts_error;
192: end if;
193:
194: --set up data for the next iteration of the loop
187: if(l_returnStatus = fnd_api.g_ret_sts_unexp_error) then
188: l_errMsg := 'deriveSingleItem failed';
189: raise fnd_api.g_exc_unexpected_error;
190: elsif(l_returnStatus = fnd_api.g_ret_sts_error) then
191: x_returnStatus := fnd_api.g_ret_sts_error;
192: end if;
193:
194: --set up data for the next iteration of the loop
195: l_prevItem := l_curItem.inventory_item_id;
199: end loop;
200:
201: --destroy the last tree if the user has not requested it persist
202: if(l_treeID is not null and
203: fnd_api.to_boolean(p_destroyTrees)) then
204: inv_quantity_tree_pvt.free_tree(p_api_version_number => 1.0,
205: p_init_msg_lst => fnd_api.g_false,
206: p_tree_id => l_treeID,
207: x_return_status => l_returnStatus,
201: --destroy the last tree if the user has not requested it persist
202: if(l_treeID is not null and
203: fnd_api.to_boolean(p_destroyTrees)) then
204: inv_quantity_tree_pvt.free_tree(p_api_version_number => 1.0,
205: p_init_msg_lst => fnd_api.g_false,
206: p_tree_id => l_treeID,
207: x_return_status => l_returnStatus,
208: x_msg_count => l_msgCount,
209: x_msg_data => l_msgData);
215: p_procReturnStatus => x_returnStatus,
216: p_msg => 'procedure success',
217: x_returnStatus => l_returnStatus); --discard logging return status
218: end if;
219: if(fnd_api.to_boolean(p_endDebug)) then
220: wip_logger.cleanup(x_returnStatus => l_returnStatus);
221: end if;
222: exception
223: when fnd_api.g_exc_unexpected_error then
219: if(fnd_api.to_boolean(p_endDebug)) then
220: wip_logger.cleanup(x_returnStatus => l_returnStatus);
221: end if;
222: exception
223: when fnd_api.g_exc_unexpected_error then
224: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
225: if (l_logLevel <= wip_constants.trace_logging) then
226: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveLots',
227: p_procReturnStatus => x_returnStatus,
220: wip_logger.cleanup(x_returnStatus => l_returnStatus);
221: end if;
222: exception
223: when fnd_api.g_exc_unexpected_error then
224: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
225: if (l_logLevel <= wip_constants.trace_logging) then
226: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveLots',
227: p_procReturnStatus => x_returnStatus,
228: p_msg => l_errMsg,
227: p_procReturnStatus => x_returnStatus,
228: p_msg => l_errMsg,
229: x_returnStatus => l_returnStatus); --discard logging return status
230: end if;
231: if(fnd_api.to_boolean(p_endDebug)) then
232: wip_logger.cleanup(x_returnStatus => l_returnStatus);
233: end if;
234: when others then
235: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
231: if(fnd_api.to_boolean(p_endDebug)) then
232: wip_logger.cleanup(x_returnStatus => l_returnStatus);
233: end if;
234: when others then
235: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
236: if (l_logLevel <= wip_constants.trace_logging) then
237: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveLots',
238: p_procReturnStatus => x_returnStatus,
239: p_msg => 'unexpected error:' || SQLERRM,
241: end if;
242: fnd_msg_pub.add_exc_msg(p_pkg_name => 'wip_autoLotProc_priv',
243: p_procedure_name => 'deriveLots',
244: p_error_text => SQLERRM);
245: if(fnd_api.to_boolean(p_endDebug)) then
246: wip_logger.cleanup(x_returnStatus => l_returnStatus);
247: end if;
248: end deriveLots;
249: /*
353: mmtt.revision
354: order by mmtt.inventory_item_id, mmtt.transaction_temp_id;
355: begin
356: savepoint wiplotpb_10;
357: x_returnStatus := fnd_api.g_ret_sts_success;
358:
359: if (l_logLevel <= wip_constants.trace_logging) then
360: l_params(1).paramName := 'p_cplTxnID';
361: l_params(1).paramValue := p_cplTxnID;
369: p_params => l_params,
370: x_returnStatus => x_returnStatus);
371: end if;
372:
373: if(fnd_api.to_boolean(p_initMsgList)) then
374: fnd_msg_pub.initialize;
375: end if;
376:
377: if(p_cplTxnID is not null) then
435: p_txnActionID => l_itemRec.txnActionID,
436: p_serControlCode => l_itemRec.serialControlCode,
437: x_serialReturnStatus => l_tempReturnStatus,
438: x_returnStatus => x_returnStatus);
439: if(x_returnStatus <> fnd_api.g_ret_sts_success) then
440: l_errMsg := 'check serial failed';
441: raise fnd_api.g_exc_unexpected_error;
442: end if;
443: l_serialReturnStatus := worstReturnStatus(l_serialReturnStatus, l_tempReturnStatus);
437: x_serialReturnStatus => l_tempReturnStatus,
438: x_returnStatus => x_returnStatus);
439: if(x_returnStatus <> fnd_api.g_ret_sts_success) then
440: l_errMsg := 'check serial failed';
441: raise fnd_api.g_exc_unexpected_error;
442: end if;
443: l_serialReturnStatus := worstReturnStatus(l_serialReturnStatus, l_tempReturnStatus);
444: end if;
445: end if;
447: end loop;
448: deriveLots(x_compLots => l_compObj,
449: p_orgID => p_orgID,
450: p_wipEntityID => p_wipEntityID,
451: p_initMsgList => fnd_api.g_false,
452: p_endDebug => fnd_api.g_false,
453: p_destroyTrees => fnd_api.g_true,
454: p_treeMode => inv_quantity_tree_pvt.g_reservation_mode,
455: p_treeSrcName => null,
448: deriveLots(x_compLots => l_compObj,
449: p_orgID => p_orgID,
450: p_wipEntityID => p_wipEntityID,
451: p_initMsgList => fnd_api.g_false,
452: p_endDebug => fnd_api.g_false,
453: p_destroyTrees => fnd_api.g_true,
454: p_treeMode => inv_quantity_tree_pvt.g_reservation_mode,
455: p_treeSrcName => null,
456: x_returnStatus => l_lotReturnStatus);
449: p_orgID => p_orgID,
450: p_wipEntityID => p_wipEntityID,
451: p_initMsgList => fnd_api.g_false,
452: p_endDebug => fnd_api.g_false,
453: p_destroyTrees => fnd_api.g_true,
454: p_treeMode => inv_quantity_tree_pvt.g_reservation_mode,
455: p_treeSrcName => null,
456: x_returnStatus => l_lotReturnStatus);
457:
455: p_treeSrcName => null,
456: x_returnStatus => l_lotReturnStatus);
457:
458: x_returnStatus := worstReturnStatus(l_serialReturnStatus, l_lotReturnStatus);
459: if(x_returnStatus = fnd_api.g_ret_sts_unexp_error) then
460: l_errMsg := 'derive lots failed';
461: raise fnd_api.g_exc_unexpected_error;
462: end if;
463: --otherwise we at least derived some lot info
457:
458: x_returnStatus := worstReturnStatus(l_serialReturnStatus, l_lotReturnStatus);
459: if(x_returnStatus = fnd_api.g_ret_sts_unexp_error) then
460: l_errMsg := 'derive lots failed';
461: raise fnd_api.g_exc_unexpected_error;
462: end if;
463: --otherwise we at least derived some lot info
464: if(p_cplTxnID is not null) then
465: open c_cplItems;
499: end if;
500: if(l_compObj.setNextItem) then
501: if(not l_compObj.getCurrentItem(l_item)) then
502: l_errMsg := 'object error';
503: raise fnd_api.g_exc_unexpected_error;
504: end if;
505: if (l_logLevel <= wip_constants.full_logging) then
506: wip_logger.log('found item: ' || l_item.inventory_item_id, l_returnStatus);
507: end if;
576: p_procReturnStatus => x_returnStatus,
577: p_msg => 'procedure success',
578: x_returnStatus => l_returnStatus); --discard logging return status
579: end if;
580: if(fnd_api.to_boolean(p_endDebug)) then
581: wip_logger.cleanup(x_returnStatus => l_returnStatus);
582: end if;
583: exception
584: when fnd_api.g_exc_unexpected_error then
580: if(fnd_api.to_boolean(p_endDebug)) then
581: wip_logger.cleanup(x_returnStatus => l_returnStatus);
582: end if;
583: exception
584: when fnd_api.g_exc_unexpected_error then
585: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
586: rollback to wiplotpb_10;
587: if (l_logLevel <= wip_constants.trace_logging) then
588: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveLotsFromMMTT',
581: wip_logger.cleanup(x_returnStatus => l_returnStatus);
582: end if;
583: exception
584: when fnd_api.g_exc_unexpected_error then
585: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
586: rollback to wiplotpb_10;
587: if (l_logLevel <= wip_constants.trace_logging) then
588: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveLotsFromMMTT',
589: p_procReturnStatus => x_returnStatus,
589: p_procReturnStatus => x_returnStatus,
590: p_msg => l_errMsg,
591: x_returnStatus => l_returnStatus); --discard logging return status
592: end if;
593: if(fnd_api.to_boolean(p_endDebug)) then
594: wip_logger.cleanup(x_returnStatus => l_returnStatus);
595: end if;
596: when others then
597: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
593: if(fnd_api.to_boolean(p_endDebug)) then
594: wip_logger.cleanup(x_returnStatus => l_returnStatus);
595: end if;
596: when others then
597: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
598: rollback to wiplotpb_10;
599: fnd_msg_pub.add_exc_msg(p_pkg_name => 'wip_autoLotProc_priv',
600: p_procedure_name => 'deriveLotsFromMMTT',
601: p_error_text => SQLERRM);
604: p_procReturnStatus => x_returnStatus,
605: p_msg => 'unexpected error:' || SQLERRM,
606: x_returnStatus => l_returnStatus); --discard logging return status
607: end if;
608: if(fnd_api.to_boolean(p_endDebug)) then
609: wip_logger.cleanup(x_returnStatus => l_returnStatus);
610: end if;
611: end deriveLotsFromMMTT;
612: */
775: mti.revision
776: order by mti.inventory_item_id, mti.transaction_temp_id;
777: */
778: begin
779: x_returnStatus := fnd_api.g_ret_sts_success;
780: savepoint wiplotpb_10;
781:
782: if (l_logLevel <= wip_constants.trace_logging) then
783: l_params(1).paramName := 'p_txnHdrID';
794: p_params => l_params,
795: x_returnStatus => x_returnStatus);
796: end if;
797:
798: if(fnd_api.to_boolean(p_initMsgList)) then
799: fnd_msg_pub.initialize;
800: end if;
801:
802: l_compObj := system.wip_lot_serial_obj_t(null,null,null,null,null,null);
900: p_txnActionID => l_itemRecTbl.txnActionID(i),
901: p_serControlCode => l_itemRecTbl.serialControlCode(i),
902: x_serialReturnStatus => l_tempReturnStatus,
903: x_returnStatus => x_returnStatus);
904: if(x_returnStatus <> fnd_api.g_ret_sts_success) then
905: l_errMsg := 'check serial failed';
906: raise fnd_api.g_exc_unexpected_error;
907: end if;
908: l_serialReturnStatus := worstReturnStatus(l_serialReturnStatus, l_tempReturnStatus);
902: x_serialReturnStatus => l_tempReturnStatus,
903: x_returnStatus => x_returnStatus);
904: if(x_returnStatus <> fnd_api.g_ret_sts_success) then
905: l_errMsg := 'check serial failed';
906: raise fnd_api.g_exc_unexpected_error;
907: end if;
908: l_serialReturnStatus := worstReturnStatus(l_serialReturnStatus, l_tempReturnStatus);
909: elsif (l_serialTaggedCode = WIP_CONSTANTS.SER_TAGGED) then -- bug fix 10053619
910: l_errMsg := 'item under serial control';
907: end if;
908: l_serialReturnStatus := worstReturnStatus(l_serialReturnStatus, l_tempReturnStatus);
909: elsif (l_serialTaggedCode = WIP_CONSTANTS.SER_TAGGED) then -- bug fix 10053619
910: l_errMsg := 'item under serial control';
911: l_serialReturnStatus := fnd_api.g_ret_sts_error;
912: end if;
913: end if;
914: end loop;
915:
915:
916: deriveLots(x_compLots => l_compObj,
917: p_orgID => p_orgID,
918: p_wipEntityID => p_wipEntityID,
919: p_initMsgList => fnd_api.g_false,
920: p_endDebug => fnd_api.g_false,
921: p_destroyTrees => fnd_api.g_true,
922: p_treeMode => inv_quantity_tree_pvt.g_reservation_mode,
923: p_treeSrcName => null,
916: deriveLots(x_compLots => l_compObj,
917: p_orgID => p_orgID,
918: p_wipEntityID => p_wipEntityID,
919: p_initMsgList => fnd_api.g_false,
920: p_endDebug => fnd_api.g_false,
921: p_destroyTrees => fnd_api.g_true,
922: p_treeMode => inv_quantity_tree_pvt.g_reservation_mode,
923: p_treeSrcName => null,
924: x_returnStatus => l_lotReturnStatus);
917: p_orgID => p_orgID,
918: p_wipEntityID => p_wipEntityID,
919: p_initMsgList => fnd_api.g_false,
920: p_endDebug => fnd_api.g_false,
921: p_destroyTrees => fnd_api.g_true,
922: p_treeMode => inv_quantity_tree_pvt.g_reservation_mode,
923: p_treeSrcName => null,
924: x_returnStatus => l_lotReturnStatus);
925:
923: p_treeSrcName => null,
924: x_returnStatus => l_lotReturnStatus);
925:
926: x_returnStatus := worstReturnStatus(l_serialReturnStatus, l_lotReturnStatus);
927: if(x_returnStatus = fnd_api.g_ret_sts_unexp_error) then
928: l_errMsg := 'derive lots failed';
929: raise fnd_api.g_exc_unexpected_error;
930: end if;
931:
925:
926: x_returnStatus := worstReturnStatus(l_serialReturnStatus, l_lotReturnStatus);
927: if(x_returnStatus = fnd_api.g_ret_sts_unexp_error) then
928: l_errMsg := 'derive lots failed';
929: raise fnd_api.g_exc_unexpected_error;
930: end if;
931:
932: --otherwise we at least derived some lot info
933: l_compObj.reset;
947: end if;
948: if(l_compObj.setNextItem) then
949: if(not l_compObj.getCurrentItem(l_item)) then
950: l_errMsg := 'object error';
951: raise fnd_api.g_exc_unexpected_error;
952: end if;
953: if (l_logLevel <= wip_constants.full_logging) then
954: wip_logger.log('found item: ' || l_item.inventory_item_id, l_returnStatus);
955: end if;
1019: p_procReturnStatus => x_returnStatus,
1020: p_msg => 'procedure success',
1021: x_returnStatus => l_returnStatus); --discard logging return status
1022: end if;
1023: if(fnd_api.to_boolean(p_endDebug)) then
1024: wip_logger.cleanup(x_returnStatus => l_returnStatus);
1025: end if;
1026: exception
1027: when fnd_api.g_exc_unexpected_error then
1023: if(fnd_api.to_boolean(p_endDebug)) then
1024: wip_logger.cleanup(x_returnStatus => l_returnStatus);
1025: end if;
1026: exception
1027: when fnd_api.g_exc_unexpected_error then
1028: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
1029: rollback to wiplotpb_10;
1030: if (l_logLevel <= wip_constants.trace_logging) then
1031: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveLotsFromMTI',
1024: wip_logger.cleanup(x_returnStatus => l_returnStatus);
1025: end if;
1026: exception
1027: when fnd_api.g_exc_unexpected_error then
1028: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
1029: rollback to wiplotpb_10;
1030: if (l_logLevel <= wip_constants.trace_logging) then
1031: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveLotsFromMTI',
1032: p_procReturnStatus => x_returnStatus,
1032: p_procReturnStatus => x_returnStatus,
1033: p_msg => l_errMsg,
1034: x_returnStatus => l_returnStatus); --discard logging return status
1035: end if;
1036: if(fnd_api.to_boolean(p_endDebug)) then
1037: wip_logger.cleanup(x_returnStatus => l_returnStatus);
1038: end if;
1039: when others then
1040: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
1036: if(fnd_api.to_boolean(p_endDebug)) then
1037: wip_logger.cleanup(x_returnStatus => l_returnStatus);
1038: end if;
1039: when others then
1040: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
1041: rollback to wiplotpb_10;
1042: fnd_msg_pub.add_exc_msg(p_pkg_name => 'wip_autoLotProc_priv',
1043: p_procedure_name => 'deriveLotsFromMTI',
1044: p_error_text => SQLERRM);
1047: p_procReturnStatus => x_returnStatus,
1048: p_msg => 'unexpected error:' || SQLERRM,
1049: x_returnStatus => l_returnStatus); --discard logging return status
1050: end if;
1051: if(fnd_api.to_boolean(p_endDebug)) then
1052: wip_logger.cleanup(x_returnStatus => l_returnStatus);
1053: end if;
1054: end deriveLotsFromMTI;
1055:
1120: l_returnStatus VARCHAR2(1);
1121: l_enabled VARCHAR2(1);
1122: l_logLevel NUMBER := fnd_log.g_current_runtime_level;
1123: begin
1124: x_returnStatus := fnd_api.g_ret_sts_success;
1125: l_cond := x_compLots.getCurrentItem(l_item);
1126:
1127: if (l_logLevel <= wip_constants.trace_logging) then
1128: l_params(1).paramName := 'p_orgID';
1149: end if;
1150:
1151: if (not l_cond) then
1152: l_errMsg := 'current item not set';
1153: raise fnd_api.g_exc_unexpected_error;
1154: end if;
1155:
1156: l_rmnQty := abs(l_item.primary_quantity);
1157:
1210: end if;
1211:
1212: if(l_rmnQty <> 0) then
1213: l_errMsg := 'could not derive all qty. ' || l_rmnQty || ' remaining.';
1214: raise fnd_api.g_exc_error;
1215: end if;
1216:
1217: if (l_logLevel <= wip_constants.trace_logging) then
1218: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveTxnLots',
1221: x_returnStatus => l_returnStatus); --discard logging return status
1222: end if;
1223:
1224: exception
1225: when fnd_api.g_exc_error then
1226: x_returnStatus:= fnd_api.g_ret_sts_error; --let caller know item was not fully derived
1227: if (l_logLevel <= wip_constants.trace_logging) then
1228: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveTxnLots',
1229: p_procReturnStatus => x_returnStatus,
1222: end if;
1223:
1224: exception
1225: when fnd_api.g_exc_error then
1226: x_returnStatus:= fnd_api.g_ret_sts_error; --let caller know item was not fully derived
1227: if (l_logLevel <= wip_constants.trace_logging) then
1228: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveTxnLots',
1229: p_procReturnStatus => x_returnStatus,
1230: p_msg => l_errMsg,
1229: p_procReturnStatus => x_returnStatus,
1230: p_msg => l_errMsg,
1231: x_returnStatus => l_returnStatus); --discard logging return status
1232: end if;
1233: when fnd_api.g_exc_unexpected_error then
1234: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
1235: if (l_logLevel <= wip_constants.trace_logging) then
1236: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveTxnLots',
1237: p_procReturnStatus => x_returnStatus,
1230: p_msg => l_errMsg,
1231: x_returnStatus => l_returnStatus); --discard logging return status
1232: end if;
1233: when fnd_api.g_exc_unexpected_error then
1234: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
1235: if (l_logLevel <= wip_constants.trace_logging) then
1236: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveTxnLots',
1237: p_procReturnStatus => x_returnStatus,
1238: p_msg => 'error: ' || l_errMsg,
1238: p_msg => 'error: ' || l_errMsg,
1239: x_returnStatus => l_returnStatus); --discard logging return status
1240: end if;
1241: when others then
1242: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
1243: if(c_retTxnBasedLots%ISOPEN) then
1244: close c_retTxnBasedLots;
1245: elsif(c_retTxnBasedLots%ISOPEN) then
1246: close c_negRetTxnBasedLots;
1371: and nvl(mln.expiration_date, sysdate + 1) > sysdate
1372: group by tln.lot_number
1373: order by tln.lot_number ;
1374: begin
1375: x_returnStatus := fnd_api.g_ret_sts_success;
1376: l_cond := x_compLots.getCurrentItem(l_item);
1377:
1378: if (l_logLevel <= wip_constants.trace_logging) then
1379: l_params(1).paramName := 'p_orgID';
1462: l_demand_source_header_id := 0;
1463: end;
1464:
1465: inv_quantity_tree_pvt.create_tree(p_api_version_number => 1.0,
1466: p_init_msg_lst => fnd_api.g_false,
1467: p_organization_id => p_orgID,
1468: p_inventory_item_id => l_item.inventory_item_id,
1469: p_tree_mode => p_treeMode,
1470: p_is_revision_control => (l_item.revision is not null),
1483: x_msg_data => l_msgData,
1484: x_tree_id => x_treeID);
1485: end if;
1486:
1487: if(x_returnStatus <> fnd_api.g_ret_sts_success) then
1488: l_errMsg := 'tree creation failed';
1489: raise fnd_api.g_exc_unexpected_error;
1490: end if;
1491:
1485: end if;
1486:
1487: if(x_returnStatus <> fnd_api.g_ret_sts_success) then
1488: l_errMsg := 'tree creation failed';
1489: raise fnd_api.g_exc_unexpected_error;
1490: end if;
1491:
1492: if(p_entryType in (wip_constants.recdate_full, wip_constants.recdate_exc)) then
1493: open c_receiptOrderedLots(v_itemID => l_item.inventory_item_id,
1523: end if ;
1524: /* End of addition for Wilson Greatbatch Enhancement */
1525: else
1526: l_errMsg := 'manual entry';
1527: raise fnd_api.g_exc_error; --manual selection.
1528: end if;
1529:
1530: loop
1531: if(p_entryType in (wip_constants.recdate_full, wip_constants.recdate_exc)) then
1569: goto END_OF_LOOP;
1570: end if;
1571:
1572: inv_quantity_tree_pvt.query_tree(p_api_version_number => 1.0,
1573: p_init_msg_lst => fnd_api.g_false,
1574: p_tree_id => x_treeID,
1575: p_revision => l_item.revision,
1576: p_lot_number => l_lotNumber,
1577: p_subinventory_code => l_item.supply_subinventory,
1590: x_att => l_qtyAvailToTxt,
1591: x_atr => l_qtyAvailToRsv);
1592:
1593:
1594: if(x_returnStatus <> fnd_api.g_ret_sts_success) then
1595: l_errMsg := 'qty tree query failed';
1596: raise fnd_api.g_exc_unexpected_error;
1597: end if;
1598:
1592:
1593:
1594: if(x_returnStatus <> fnd_api.g_ret_sts_success) then
1595: l_errMsg := 'qty tree query failed';
1596: raise fnd_api.g_exc_unexpected_error;
1597: end if;
1598:
1599: -- Check if Lot is already entered into MTLI and populate into l_lot_qty_selected
1600: -- If Lot Number is not found then l_lot_qty_selected will be populated as zero Qty.
1630: p_attributes => null);
1631:
1632:
1633: inv_quantity_tree_pvt.update_quantities(p_api_version_number => 1.0,
1634: p_init_msg_lst => fnd_api.g_false,
1635: p_tree_id => x_treeID,
1636: p_revision => l_item.revision,
1637: p_lot_number => l_lotNumber,
1638: p_subinventory_code => l_item.supply_subinventory,
1652: x_qr => l_qtyRsved2,
1653: x_qs => l_qtySuggested2,
1654: x_att => l_qtyAvailToTxt2,
1655: x_atr => l_qtyAvailToRsv2);
1656: if(x_returnStatus <> fnd_api.g_ret_sts_success) then
1657: l_errMsg := 'qty tree update failed';
1658: raise fnd_api.g_exc_unexpected_error;
1659: end if;
1660:
1654: x_att => l_qtyAvailToTxt2,
1655: x_atr => l_qtyAvailToRsv2);
1656: if(x_returnStatus <> fnd_api.g_ret_sts_success) then
1657: l_errMsg := 'qty tree update failed';
1658: raise fnd_api.g_exc_unexpected_error;
1659: end if;
1660:
1661: if (l_logLevel <= wip_constants.full_logging) then
1662: wip_logger.log('updating treeID' || x_treeID, l_returnStatus);
1685: end if;
1686:
1687: if(l_rmnQty > 0) then
1688: l_errMsg := 'could not derive all qty. ' || l_rmnQty || ' remaining.';
1689: raise fnd_api.g_exc_error;
1690: end if;
1691:
1692: if (l_logLevel <= wip_constants.trace_logging) then
1693: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveIssueLots',
1696: x_returnStatus => l_returnStatus); --discard logging return status
1697: end if;
1698:
1699: exception
1700: when fnd_api.g_exc_error then
1701: x_returnStatus:= fnd_api.g_ret_sts_error; --let caller know item was not fully derived
1702: if (l_logLevel <= wip_constants.trace_logging) then
1703: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveIssueLots',
1704: p_procReturnStatus => x_returnStatus,
1697: end if;
1698:
1699: exception
1700: when fnd_api.g_exc_error then
1701: x_returnStatus:= fnd_api.g_ret_sts_error; --let caller know item was not fully derived
1702: if (l_logLevel <= wip_constants.trace_logging) then
1703: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveIssueLots',
1704: p_procReturnStatus => x_returnStatus,
1705: p_msg => l_errMsg,
1704: p_procReturnStatus => x_returnStatus,
1705: p_msg => l_errMsg,
1706: x_returnStatus => l_returnStatus); --discard logging return status
1707: end if;
1708: when fnd_api.g_exc_unexpected_error then
1709: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
1710: if(c_receiptOrderedLots%ISOPEN) then
1711: close c_receiptOrderedLots;
1712: elsif(c_expDateOrderedLots%ISOPEN) then
1705: p_msg => l_errMsg,
1706: x_returnStatus => l_returnStatus); --discard logging return status
1707: end if;
1708: when fnd_api.g_exc_unexpected_error then
1709: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
1710: if(c_receiptOrderedLots%ISOPEN) then
1711: close c_receiptOrderedLots;
1712: elsif(c_expDateOrderedLots%ISOPEN) then
1713: close c_expDateOrderedLots;
1718: p_msg => 'error: ' || l_errMsg,
1719: x_returnStatus => l_returnStatus); --discard logging return status
1720: end if;
1721: when others then
1722: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
1723: if(c_receiptOrderedLots%ISOPEN) then
1724: close c_receiptOrderedLots;
1725: elsif(c_expDateOrderedLots%ISOPEN) then
1726: close c_expDateOrderedLots;
1755: l_item system.wip_component_obj_t;
1756: l_logLevel NUMBER := fnd_log.g_current_runtime_level;
1757: begin
1758:
1759: x_returnStatus := fnd_api.g_ret_sts_success;
1760: if (l_logLevel <= wip_constants.trace_logging) then
1761: l_params(1).paramName := 'p_orgID';
1762: l_params(1).paramValue := p_orgID;
1763: l_params(2).paramName := 'p_wipEntityID';
1777: savepoint wipbflpb40;
1778:
1779: if(not x_compLots.getCurrentItem(l_item)) then
1780: l_errMsg := 'unable to get current item';
1781: raise fnd_api.g_exc_unexpected_error;
1782: end if;
1783:
1784: l_TxnTypeID := getTxnType(l_item.transaction_action_id);
1785: select lot_control_code, serial_number_control_code,
1799: p_qty => abs(l_item.primary_quantity),
1800: p_txnActionID => l_item.transaction_action_id,
1801: p_serControlCode => l_serialControlCode,
1802: x_returnStatus => x_returnStatus);
1803: if(x_returnStatus <> fnd_api.g_ret_sts_success) then
1804: l_errMsg := 'not enough serial #s';
1805: raise fnd_api.g_exc_unexpected_error;
1806: else
1807: l_errMsg := 'item under serial control';
1801: p_serControlCode => l_serialControlCode,
1802: x_returnStatus => x_returnStatus);
1803: if(x_returnStatus <> fnd_api.g_ret_sts_success) then
1804: l_errMsg := 'not enough serial #s';
1805: raise fnd_api.g_exc_unexpected_error;
1806: else
1807: l_errMsg := 'item under serial control';
1808: raise fnd_api.g_exc_error;
1809: end if;
1804: l_errMsg := 'not enough serial #s';
1805: raise fnd_api.g_exc_unexpected_error;
1806: else
1807: l_errMsg := 'item under serial control';
1808: raise fnd_api.g_exc_error;
1809: end if;
1810: elsif (l_serialTaggedCode = WIP_CONSTANTS.SER_TAGGED) then -- Bug 9907143: added for serial tagging enhancement for SUN
1811: l_errMsg := 'item under serial control';
1812: raise fnd_api.g_exc_error;
1808: raise fnd_api.g_exc_error;
1809: end if;
1810: elsif (l_serialTaggedCode = WIP_CONSTANTS.SER_TAGGED) then -- Bug 9907143: added for serial tagging enhancement for SUN
1811: l_errMsg := 'item under serial control';
1812: raise fnd_api.g_exc_error;
1813: end if;
1814:
1815: --if uncontrolled, return success (no derivation necessary)
1816: if(l_lotControlCode = wip_constants.no_lot) then
1813: end if;
1814:
1815: --if uncontrolled, return success (no derivation necessary)
1816: if(l_lotControlCode = wip_constants.no_lot) then
1817: x_returnStatus := fnd_api.g_ret_sts_success;
1818: if (l_logLevel <= wip_constants.trace_logging) then
1819: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveSingleItem',
1820: p_procReturnStatus => x_returnStatus,
1821: p_msg => 'procedure success (no derivation necessary)',
1831: if(l_item.transaction_action_id not in (wip_constants.isscomp_action,
1832: wip_constants.retcomp_action,
1833: wip_constants.retnegc_action)) then
1834: l_errMsg := 'non-derivable txn action:' || l_item.transaction_action_id;
1835: raise fnd_api.g_exc_error;
1836: end if;
1837:
1838:
1839: --for issues, check out all the lots in the specified location
1855: p_entryType => p_entryType,
1856: x_compLots => x_compLots,
1857: x_returnStatus => x_returnStatus);
1858: end if;
1859: if(x_returnStatus = fnd_api.g_ret_sts_unexp_error) then
1860: raise fnd_api.g_exc_unexpected_error;
1861: end if;
1862:
1863: if (l_logLevel <= wip_constants.trace_logging) then
1856: x_compLots => x_compLots,
1857: x_returnStatus => x_returnStatus);
1858: end if;
1859: if(x_returnStatus = fnd_api.g_ret_sts_unexp_error) then
1860: raise fnd_api.g_exc_unexpected_error;
1861: end if;
1862:
1863: if (l_logLevel <= wip_constants.trace_logging) then
1864: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveSingleItem',
1867: x_returnStatus => l_returnStatus); --discard logging return status
1868: end if;
1869:
1870: exception
1871: when fnd_api.g_exc_error then
1872: x_returnStatus := fnd_api.g_ret_sts_error;
1873: if (l_logLevel <= wip_constants.trace_logging) then
1874: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveSingleItem',
1875: p_procReturnStatus => x_returnStatus,
1868: end if;
1869:
1870: exception
1871: when fnd_api.g_exc_error then
1872: x_returnStatus := fnd_api.g_ret_sts_error;
1873: if (l_logLevel <= wip_constants.trace_logging) then
1874: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveSingleItem',
1875: p_procReturnStatus => x_returnStatus,
1876: p_msg => 'error' || l_errMsg,
1876: p_msg => 'error' || l_errMsg,
1877: x_returnStatus => l_returnStatus); --discard logging return status
1878: end if;
1879: rollback to wipbflpb40;
1880: when fnd_api.g_exc_unexpected_error then
1881: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
1882: if (l_logLevel <= wip_constants.trace_logging) then
1883: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveSingleItem',
1884: p_procReturnStatus => x_returnStatus,
1877: x_returnStatus => l_returnStatus); --discard logging return status
1878: end if;
1879: rollback to wipbflpb40;
1880: when fnd_api.g_exc_unexpected_error then
1881: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
1882: if (l_logLevel <= wip_constants.trace_logging) then
1883: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.deriveSingleItem',
1884: p_procReturnStatus => x_returnStatus,
1885: p_msg => 'unexp error raised:',
1886: x_returnStatus => l_returnStatus); --discard logging return status
1887: end if;
1888: rollback to wipbflpb40;
1889: when others then
1890: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
1891: fnd_msg_pub.add_exc_msg(p_pkg_name => 'wip_autoLotProc_priv',
1892: p_procedure_name => 'deriveSingleItem',
1893: p_error_text => SQLERRM);
1894: if (l_logLevel <= wip_constants.trace_logging) then
1903:
1904: function findTxnAction(p_isForwardTxn in VARCHAR2,
1905: p_qty in NUMBER) return number is
1906: begin
1907: if(fnd_api.to_boolean(p_isForwardTxn)) then
1908: if(p_qty > 0) then
1909: return wip_constants.isscomp_action;
1910: else
1911: return wip_constants.issnegc_action;
1933: l_txnTypeID NUMBER;
1934: l_logLevel NUMBER := fnd_log.g_current_runtime_level;
1935: begin
1936:
1937: x_returnStatus := fnd_api.g_ret_sts_success;
1938: if (l_logLevel <= wip_constants.trace_logging) then
1939: l_params(1).paramName := 'p_itemID';
1940: l_params(1).paramValue := p_itemID;
1941: l_params(2).paramName := 'p_orgID';
1957: l_errMsg := 'serial requirement not a whole #';
1958: fnd_message.set_name('WIP', 'COMP_INVALID_SER_QTY');
1959: fnd_message.set_token('ITEM', p_itemName);
1960: fnd_msg_pub.add;
1961: raise fnd_api.g_exc_unexpected_error;
1962: end if;
1963:
1964: l_txnTypeID := getTxnType(p_txnActionID);
1965:
2007: group by revision;
2008:
2009: elsif(p_txnActionID = wip_constants.issnegc_action) then
2010: if(p_serControlCode = wip_constants.dyn_rcv_sn) then
2011: x_returnStatus := fnd_api.g_ret_sts_success;
2012: if (l_logLevel <= wip_constants.trace_logging) then
2013: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.checkSerialQuantity',
2014: p_procReturnStatus => x_returnStatus,
2015: p_msg => 'procedure success (neg issue and serial is dyn at recpt)',
2045: fnd_message.set_name('WIP', 'NO_COMP_SERIAL_NUMBERS');
2046: fnd_message.set_token('ITEM', p_itemName);
2047: fnd_msg_pub.add;
2048: l_errMsg := 'error: not enough serials available';
2049: raise fnd_api.g_exc_unexpected_error;
2050: else
2051: x_returnStatus := fnd_api.g_ret_sts_success;
2052: end if;
2053: if (l_logLevel <= wip_constants.trace_logging) then
2047: fnd_msg_pub.add;
2048: l_errMsg := 'error: not enough serials available';
2049: raise fnd_api.g_exc_unexpected_error;
2050: else
2051: x_returnStatus := fnd_api.g_ret_sts_success;
2052: end if;
2053: if (l_logLevel <= wip_constants.trace_logging) then
2054: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.checkSerialQuantity',
2055: p_procReturnStatus => x_returnStatus,
2056: p_msg => 'procedure success',
2057: x_returnStatus => l_returnStatus);
2058: end if;
2059: exception
2060: when fnd_api.g_exc_unexpected_error then
2061: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
2062: if (l_logLevel <= wip_constants.trace_logging) then
2063: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.checkSerialQuantity',
2064: p_procReturnStatus => x_returnStatus,
2057: x_returnStatus => l_returnStatus);
2058: end if;
2059: exception
2060: when fnd_api.g_exc_unexpected_error then
2061: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
2062: if (l_logLevel <= wip_constants.trace_logging) then
2063: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.checkSerialQuantity',
2064: p_procReturnStatus => x_returnStatus,
2065: p_msg => l_errMsg,
2068: when others then
2069: fnd_msg_pub.add_exc_msg(p_pkg_name => 'wip_autoLotProc_priv',
2070: p_procedure_name => 'checkSerialQuantity',
2071: p_error_text => SQLERRM);
2072: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
2073: if (l_logLevel <= wip_constants.trace_logging) then
2074: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.checkSerialQuantity',
2075: p_procReturnStatus => x_returnStatus,
2076: p_msg => 'unexp error ' || SQLERRM,
2115: to_serial_number toSerial
2116: from mtl_serial_numbers_interface
2117: where transaction_interface_id = p_txnIntID;
2118: begin
2119: x_returnStatus := fnd_api.g_ret_sts_success;
2120: if (l_logLevel <= wip_constants.trace_logging) then
2121: l_params(1).paramName := 'p_txnTmpID';
2122: l_params(1).paramValue := p_txnTmpID;
2123: l_params(2).paramName := 'p_txnIntID';
2142: l_params(11).paramValue := p_serControlCode;
2143: wip_logger.entryPoint(p_procName => 'wip_autoLotProc_priv.checkSerial',
2144: p_params => l_params,
2145: x_returnStatus => x_returnStatus);
2146: if(x_returnStatus <> fnd_api.g_ret_sts_success) then
2147: raise fnd_api.g_exc_unexpected_error;
2148: end if;
2149: end if;
2150:
2143: wip_logger.entryPoint(p_procName => 'wip_autoLotProc_priv.checkSerial',
2144: p_params => l_params,
2145: x_returnStatus => x_returnStatus);
2146: if(x_returnStatus <> fnd_api.g_ret_sts_success) then
2147: raise fnd_api.g_exc_unexpected_error;
2148: end if;
2149: end if;
2150:
2151: if(p_txnTmpID is not null) then
2171: x_errorcode => l_errCode)) then
2172: l_totalQty := l_totalQty + l_serQty;
2173: else
2174: l_errMsg := 'mtl_serial_check.inv_serial_info returned false';
2175: raise fnd_api.g_exc_unexpected_error;
2176: end if;
2177: end loop;
2178:
2179: if(c_tmpSerials%ISOPEN) then
2189: p_qty => abs(p_qty),
2190: p_txnActionID => p_txnActionID,
2191: p_serControlCode => p_serControlCode,
2192: x_returnStatus => x_serialReturnStatus);
2193: if(x_serialReturnStatus = fnd_api.g_ret_sts_success) then --enough serial numbers exist to complete this transaction
2194: raise fnd_api.g_exc_error;
2195: else
2196: raise fnd_api.g_exc_unexpected_error;
2197: end if;
2190: p_txnActionID => p_txnActionID,
2191: p_serControlCode => p_serControlCode,
2192: x_returnStatus => x_serialReturnStatus);
2193: if(x_serialReturnStatus = fnd_api.g_ret_sts_success) then --enough serial numbers exist to complete this transaction
2194: raise fnd_api.g_exc_error;
2195: else
2196: raise fnd_api.g_exc_unexpected_error;
2197: end if;
2198:
2192: x_returnStatus => x_serialReturnStatus);
2193: if(x_serialReturnStatus = fnd_api.g_ret_sts_success) then --enough serial numbers exist to complete this transaction
2194: raise fnd_api.g_exc_error;
2195: else
2196: raise fnd_api.g_exc_unexpected_error;
2197: end if;
2198:
2199: end if;
2200:
2204: p_msg => 'procedure success',
2205: x_returnStatus => l_returnStatus);
2206: end if;
2207: exception
2208: when fnd_api.g_exc_error then
2209: x_serialReturnStatus := fnd_api.g_ret_sts_error;
2210: x_returnStatus := fnd_api.g_ret_sts_success;
2211: if (l_logLevel <= wip_constants.trace_logging) then
2212: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.checkSerial',
2205: x_returnStatus => l_returnStatus);
2206: end if;
2207: exception
2208: when fnd_api.g_exc_error then
2209: x_serialReturnStatus := fnd_api.g_ret_sts_error;
2210: x_returnStatus := fnd_api.g_ret_sts_success;
2211: if (l_logLevel <= wip_constants.trace_logging) then
2212: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.checkSerial',
2213: p_procReturnStatus => x_returnStatus,
2206: end if;
2207: exception
2208: when fnd_api.g_exc_error then
2209: x_serialReturnStatus := fnd_api.g_ret_sts_error;
2210: x_returnStatus := fnd_api.g_ret_sts_success;
2211: if (l_logLevel <= wip_constants.trace_logging) then
2212: wip_logger.exitPoint(p_procName => 'wip_autoLotProc_priv.checkSerial',
2213: p_procReturnStatus => x_returnStatus,
2214: p_msg => 'insufficient serial qty. only found ' || l_totalQty,
2213: p_procReturnStatus => x_returnStatus,
2214: p_msg => 'insufficient serial qty. only found ' || l_totalQty,
2215: x_returnStatus => l_returnStatus);
2216: end if;
2217: when fnd_api.g_exc_unexpected_error then
2218: x_serialReturnStatus := fnd_api.g_ret_sts_unexp_error;
2219: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
2220: if(c_tmpSerials%ISOPEN) then
2221: close c_tmpSerials;
2214: p_msg => 'insufficient serial qty. only found ' || l_totalQty,
2215: x_returnStatus => l_returnStatus);
2216: end if;
2217: when fnd_api.g_exc_unexpected_error then
2218: x_serialReturnStatus := fnd_api.g_ret_sts_unexp_error;
2219: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
2220: if(c_tmpSerials%ISOPEN) then
2221: close c_tmpSerials;
2222: elsif(c_intSerials%ISOPEN) then
2215: x_returnStatus => l_returnStatus);
2216: end if;
2217: when fnd_api.g_exc_unexpected_error then
2218: x_serialReturnStatus := fnd_api.g_ret_sts_unexp_error;
2219: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
2220: if(c_tmpSerials%ISOPEN) then
2221: close c_tmpSerials;
2222: elsif(c_intSerials%ISOPEN) then
2223: close c_intSerials;
2228: p_msg => l_errMsg,
2229: x_returnStatus => l_returnStatus);
2230: end if;
2231: when others then
2232: x_serialReturnStatus := fnd_api.g_ret_sts_unexp_error;
2233: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
2234: if(c_tmpSerials%ISOPEN) then
2235: close c_tmpSerials;
2236: elsif(c_intSerials%ISOPEN) then
2229: x_returnStatus => l_returnStatus);
2230: end if;
2231: when others then
2232: x_serialReturnStatus := fnd_api.g_ret_sts_unexp_error;
2233: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
2234: if(c_tmpSerials%ISOPEN) then
2235: close c_tmpSerials;
2236: elsif(c_intSerials%ISOPEN) then
2237: close c_intSerials;
2248: end checkSerial;
2249:
2250: function worstReturnStatus(p_status1 VARCHAR2, p_status2 VARCHAR2) return VARCHAR2 is
2251: begin
2252: if(p_status1 = fnd_api.g_ret_sts_unexp_error or
2253: p_status2 = fnd_api.g_ret_sts_unexp_error) then
2254: return fnd_api.g_ret_sts_unexp_error;
2255: elsif(p_status1 = fnd_api.g_ret_sts_error or
2256: p_status2 = fnd_api.g_ret_sts_error) then
2249:
2250: function worstReturnStatus(p_status1 VARCHAR2, p_status2 VARCHAR2) return VARCHAR2 is
2251: begin
2252: if(p_status1 = fnd_api.g_ret_sts_unexp_error or
2253: p_status2 = fnd_api.g_ret_sts_unexp_error) then
2254: return fnd_api.g_ret_sts_unexp_error;
2255: elsif(p_status1 = fnd_api.g_ret_sts_error or
2256: p_status2 = fnd_api.g_ret_sts_error) then
2257: return fnd_api.g_ret_sts_error;
2250: function worstReturnStatus(p_status1 VARCHAR2, p_status2 VARCHAR2) return VARCHAR2 is
2251: begin
2252: if(p_status1 = fnd_api.g_ret_sts_unexp_error or
2253: p_status2 = fnd_api.g_ret_sts_unexp_error) then
2254: return fnd_api.g_ret_sts_unexp_error;
2255: elsif(p_status1 = fnd_api.g_ret_sts_error or
2256: p_status2 = fnd_api.g_ret_sts_error) then
2257: return fnd_api.g_ret_sts_error;
2258: else
2251: begin
2252: if(p_status1 = fnd_api.g_ret_sts_unexp_error or
2253: p_status2 = fnd_api.g_ret_sts_unexp_error) then
2254: return fnd_api.g_ret_sts_unexp_error;
2255: elsif(p_status1 = fnd_api.g_ret_sts_error or
2256: p_status2 = fnd_api.g_ret_sts_error) then
2257: return fnd_api.g_ret_sts_error;
2258: else
2259: return fnd_api.g_ret_sts_success;
2252: if(p_status1 = fnd_api.g_ret_sts_unexp_error or
2253: p_status2 = fnd_api.g_ret_sts_unexp_error) then
2254: return fnd_api.g_ret_sts_unexp_error;
2255: elsif(p_status1 = fnd_api.g_ret_sts_error or
2256: p_status2 = fnd_api.g_ret_sts_error) then
2257: return fnd_api.g_ret_sts_error;
2258: else
2259: return fnd_api.g_ret_sts_success;
2260: end if;
2253: p_status2 = fnd_api.g_ret_sts_unexp_error) then
2254: return fnd_api.g_ret_sts_unexp_error;
2255: elsif(p_status1 = fnd_api.g_ret_sts_error or
2256: p_status2 = fnd_api.g_ret_sts_error) then
2257: return fnd_api.g_ret_sts_error;
2258: else
2259: return fnd_api.g_ret_sts_success;
2260: end if;
2261: end worstReturnStatus;
2255: elsif(p_status1 = fnd_api.g_ret_sts_error or
2256: p_status2 = fnd_api.g_ret_sts_error) then
2257: return fnd_api.g_ret_sts_error;
2258: else
2259: return fnd_api.g_ret_sts_success;
2260: end if;
2261: end worstReturnStatus;
2262:
2263: function getTxnType(p_txnActionID IN NUMBER) return NUMBER is
2291: begin
2292:
2293: l_qty := 0 ;
2294:
2295: x_returnStatus := fnd_api.g_ret_sts_success;
2296:
2297: if (l_logLevel <= wip_constants.trace_logging) then
2298: l_params(1).paramName := 'p_organization_id';
2299: l_params(1).paramValue := p_organization_id;
2431: wip_logger.log('primary_quantity : ' || p_item.primary_quantity,
2432: l_returnStatus);
2433: wip_logger.log('derived_quantity : ' || l_derivedQty, l_returnStatus);
2434: l_errMsg := 'return quantity missmatch';
2435: raise fnd_api.g_exc_unexpected_error;
2436: END IF;
2437:
2438: IF (l_logLevel <= wip_constants.trace_logging) THEN
2439: wip_logger.exitPoint(
2443: x_returnStatus => l_returnStatus); --discard return status
2444: END IF;
2445:
2446: EXCEPTION
2447: WHEN fnd_api.g_exc_unexpected_error THEN
2448: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
2449: IF (l_logLevel <= wip_constants.trace_logging) THEN
2450: wip_logger.exitPoint(
2451: p_procName => 'wip_autoLotProc_priv.deriveSingleItemFromMOG',
2444: END IF;
2445:
2446: EXCEPTION
2447: WHEN fnd_api.g_exc_unexpected_error THEN
2448: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
2449: IF (l_logLevel <= wip_constants.trace_logging) THEN
2450: wip_logger.exitPoint(
2451: p_procName => 'wip_autoLotProc_priv.deriveSingleItemFromMOG',
2452: p_procReturnStatus => x_returnStatus,
2458: fnd_message.set_token('ENTITY1', p_item.item_name);
2459: fnd_msg_pub.add;
2460:
2461: WHEN others THEN
2462: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
2463: IF (l_logLevel <= wip_constants.trace_logging) THEN
2464: wip_logger.exitPoint(
2465: p_procName => 'wip_autoLotProc_priv.deriveSingleItemFromMOG',
2466: p_procReturnStatus => x_returnStatus,
2553: IF(c_revisionComp%ISOPEN) THEN
2554: CLOSE c_revisionComp;
2555: END IF;
2556:
2557: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
2558: IF (l_logLevel <= wip_constants.trace_logging) THEN
2559: wip_logger.exitPoint(
2560: p_procName => 'wip_autoLotProc_priv.setItemRevision',
2561: p_procReturnStatus => x_returnStatus,
2591: END IF;
2592:
2593: SAVEPOINT s_deriveLotsFromMOG;
2594:
2595: IF(fnd_api.to_boolean(p_initMsgList)) THEN
2596: fnd_msg_pub.initialize;
2597: END IF;
2598:
2599: x_compLots.reset;
2597: END IF;
2598:
2599: x_compLots.reset;
2600: --assume we will be able to derive everything
2601: x_returnStatus := fnd_api.g_ret_sts_success;
2602:
2603: LOOP
2604: IF(x_compLots.getCurrentItem(l_curItem)) THEN
2605: IF(l_curItem.wip_supply_type NOT IN (WIP_CONSTANTS.PUSH,
2622: p_item => l_curItem,
2623: x_compLots => x_compLots,
2624: x_returnStatus => l_returnStatus);
2625:
2626: IF(l_returnStatus = fnd_api.g_ret_sts_unexp_error) THEN
2627: l_errMsg := 'setItemRevision failed';
2628: raise fnd_api.g_exc_unexpected_error;
2629: END IF;
2630: END IF;
2624: x_returnStatus => l_returnStatus);
2625:
2626: IF(l_returnStatus = fnd_api.g_ret_sts_unexp_error) THEN
2627: l_errMsg := 'setItemRevision failed';
2628: raise fnd_api.g_exc_unexpected_error;
2629: END IF;
2630: END IF;
2631:
2632: deriveSingleItemFromMOG(p_parentObjID => p_objectID,
2634: p_item => l_curItem,
2635: x_compLots => x_compLots,
2636: x_returnStatus => l_returnStatus);
2637:
2638: IF(l_returnStatus = fnd_api.g_ret_sts_unexp_error) THEN
2639: l_errMsg := 'deriveSingleItemFromMOG failed';
2640: raise fnd_api.g_exc_unexpected_error;
2641: END IF;
2642:
2636: x_returnStatus => l_returnStatus);
2637:
2638: IF(l_returnStatus = fnd_api.g_ret_sts_unexp_error) THEN
2639: l_errMsg := 'deriveSingleItemFromMOG failed';
2640: raise fnd_api.g_exc_unexpected_error;
2641: END IF;
2642:
2643: END IF; -- x_compLots.getCurrentItem(l_curItem)
2644: <
2654: x_returnStatus => l_returnStatus);
2655: END IF;
2656:
2657: EXCEPTION
2658: WHEN fnd_api.g_exc_unexpected_error THEN
2659: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
2660: IF (l_logLevel <= wip_constants.trace_logging) THEN
2661: wip_logger.exitPoint(
2662: p_procName => 'wip_autoLotProc_priv.deriveLotsFromMOG',
2655: END IF;
2656:
2657: EXCEPTION
2658: WHEN fnd_api.g_exc_unexpected_error THEN
2659: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
2660: IF (l_logLevel <= wip_constants.trace_logging) THEN
2661: wip_logger.exitPoint(
2662: p_procName => 'wip_autoLotProc_priv.deriveLotsFromMOG',
2663: p_procReturnStatus => x_returnStatus,
2666: END IF;
2667: ROLLBACK TO s_deriveLotsFromMOG;
2668:
2669: WHEN others THEN
2670: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
2671: IF (l_logLevel <= wip_constants.trace_logging) THEN
2672: wip_logger.exitPoint(
2673: p_procName => 'wip_autoLotProc_priv.deriveLotsFromMOG',
2674: p_procReturnStatus => x_returnStatus,