43: l_rtgItemID number;
44: l_bomItemID number;
45: begin
46: x_returnStatus := fnd_api.g_ret_sts_success;
47: if (l_logLevel <= wip_constants.trace_logging) then
48: l_params(1).paramName := 'p_orgID';
49: l_params(1).paramValue := p_orgID;
50: l_params(2).paramName := 'p_wipEntityID';
51: l_params(2).paramValue := p_wipEntityID;
84: raise fnd_api.g_exc_unexpected_error;
85: end if;
86: end if;
87:
88: if ( p_schedulingMethod = wip_constants.routing ) then
89: if ( (p_startDate is null and p_endDate is null) or
90: ((p_startDate is not null and p_endDate is not null) and
91: /* Bug 4515999 Non standard jobs cannot have both dates not null */
92: p_jobType = wip_constants.standard) ) then
88: if ( p_schedulingMethod = wip_constants.routing ) then
89: if ( (p_startDate is null and p_endDate is null) or
90: ((p_startDate is not null and p_endDate is not null) and
91: /* Bug 4515999 Non standard jobs cannot have both dates not null */
92: p_jobType = wip_constants.standard) ) then
93: x_errorMsg := 'Must only provide one of the p_startDate and p_endDate for routing based scheduling';
94: raise fnd_api.g_exc_unexpected_error;
95: else
96: -- populate some value and then we will reschedule it later on.
106: l_endDate := p_endDate;
107: end if;
108: end if;
109:
110: if ( p_jobType = wip_constants.standard ) then
111: l_rtgItemID := p_itemID;
112: l_bomItemID := p_itemID;
113: else
114: l_rtgItemID := p_rtgRefID;
131: raise fnd_api.g_exc_unexpected_error;
132: end if;
133:
134: /* -- Bug 11893957. Call Infinite Scheduler after BOM Explosion to consider resources from Phantom Routings.
135: if ( p_schedulingMethod = wip_constants.routing ) then
136: wip_infinite_scheduler_pvt.schedule(
137: p_orgID => p_orgID,
138: p_wipEntityID => p_wipEntityID,
139: p_startDate => p_startDate,
174: raise fnd_api.g_exc_unexpected_error;
175: end if;
176:
177: -- Bug 11893957. Call Infinite Scheduler after BOM Explosion to consider resources from Phantom Routings.
178: if ( p_schedulingMethod = wip_constants.routing ) then
179: wip_infinite_scheduler_pvt.schedule(
180: p_orgID => p_orgID,
181: p_wipEntityID => p_wipEntityID,
182: p_startDate => p_startDate,
207: wip_op_resources_utilities.update_resource_instances(
208: p_wip_entity_id => p_wipEntityID,
209: p_org_id => p_orgID);
210:
211: if (l_logLevel <= wip_constants.trace_logging) then
212: wip_logger.exitPoint(p_procName => g_pkgName || '.' || l_procName,
213: p_procReturnStatus => x_returnStatus,
214: p_msg => 'success',
215: x_returnStatus => l_retStatus);
219: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
220: -- Fixed for bug 5255226
221: -- Don't need to add the x_errormsg again to stack by calling fnd_msg_pub.add_exc_msg
222: -- Removed this API call. Instead adding this error message to debug log using
223: if (l_logLevel <= wip_constants.trace_logging) then
224: wip_logger.log(x_errorMsg,l_retstatus);
225: End if;
226: -- End of Fix for bug 5255226
227:
224: wip_logger.log(x_errorMsg,l_retstatus);
225: End if;
226: -- End of Fix for bug 5255226
227:
228: if(l_logLevel <= wip_constants.trace_logging) then
229: wip_logger.exitPoint(p_procName => g_pkgName || '.' || l_procName,
230: p_procReturnStatus => x_returnStatus,
231: p_msg => x_errorMsg,
232: x_returnStatus => l_retStatus);
301: from wip_requirement_operations
302: where organization_id = p_orgID
303: and wip_entity_id = p_wipEntityID
304: and operation_seq_num < 0
305: and wip_supply_type = wip_constants.phantom;
306: begin
307:
308: x_returnStatus := fnd_api.g_ret_sts_success;
309: if (l_logLevel <= wip_constants.trace_logging) then
305: and wip_supply_type = wip_constants.phantom;
306: begin
307:
308: x_returnStatus := fnd_api.g_ret_sts_success;
309: if (l_logLevel <= wip_constants.trace_logging) then
310: l_params(1).paramName := 'p_orgID';
311: l_params(1).paramValue := p_orgID;
312: l_params(2).paramName := 'p_wipEntityID';
313: l_params(2).paramValue := p_wipEntityID;
353: if ( nvl(p_altRouting, nvl(l_altRtg,'@@@')) <> nvl(l_altRtg, '@@@') or
354: nvl(p_routingRevDate, nvl(l_rtgRevDate, fnd_api.g_miss_date)) <> nvl(l_rtgRevDate, fnd_api.g_miss_date) OR
355: /*bug 15963294: when revision changes with no change of revision date due to bom_high_date being in the future, we still reexplode*/
356: nvl(p_routingRev, nvl(l_rtgRev, fnd_api.g_miss_char)) <> nvl(l_rtgRev, fnd_api.g_miss_char) OR
357: (p_allowExplosion) or (l_jobType = wip_constants.nonstandard and nvl(p_rtgRefID, -1) <> nvl(l_rtgRefID, -1)) ) then
358: l_expRtgRequired := true;
359: if (p_altRouting = '@@@' or p_altRouting = fnd_api.g_miss_char ) then
360: l_altRtg := null;
361: else
369: if ( nvl(p_altBom, nvl(l_altBom, '@@@')) <> nvl(l_altBom, '@@@') or
370: nvl(p_bomRevDate, nvl(l_bomRevDate, fnd_api.g_miss_date)) <> nvl(l_bomRevDate, fnd_api.g_miss_date) or
371: /*bug 15963294: when revision changes with no change of revision date due to bom_high_date being in the future, we still reexplode*/
372: nvl(p_bomRev, nvl(l_bomRev, fnd_api.g_miss_char)) <> nvl(l_bomRev, fnd_api.g_miss_char) OR
373: (p_allowExplosion) or (l_jobType = wip_constants.nonstandard and nvl(p_bomRefID, -1) <> nvl(l_bomRefID, -1)) ) then
374: l_expBomRequired := true;
375: if (p_altBom = '@@@' or p_altBom = fnd_api.g_miss_char) then
376: l_altBom := null;
377: else
382: end if;
383:
384: -- Bug 9834677. Consider only job status. unless the job is unreleased, you can never explode again from bom
385: -- Bug 14292968 Consider PENDING_scheduled status for Constraint Based scheduler in Simulate Discrete Jobs.
386: if ( l_jobStatus NOT IN ( wip_constants.unreleased,wip_constants.pend_sched )) then
387: l_expRtgRequired := false;
388: l_expBomRequired := false;
389: end if;
390:
387: l_expRtgRequired := false;
388: l_expBomRequired := false;
389: end if;
390:
391: if ( p_schedulingMethod = wip_constants.routing ) then
392: if ( (p_startDate is null and p_endDate is null) or
393: (p_startDate is not null and p_endDate is not null) ) then
394: x_errorMsg := 'Must only provide one of the p_startDate and p_endDate for routing based scheduling';
395: raise fnd_api.g_exc_unexpected_error;
398: l_startDate := nvl(p_startDate, p_endDate);
399: l_endDate := l_startDate;
400: end if;
401: else
402: if (p_schedulingMethod = wip_constants.ml_manual and (p_startDate is null or p_endDate is null) ) then
403: x_errorMsg := 'Must provide both of the dates if it is not routing based scheduling';
404: raise fnd_api.g_exc_unexpected_error;
405: end if;
406: l_startDate := p_startDate;
432: x_pk1_value => to_char(p_wipEntityID),
433: x_pk3_value => to_char(p_orgID),
434: x_delete_document_flag => 'Y');
435: */
436: if ( l_jobType = wip_constants.standard ) then
437: l_rtgItemID := l_assemblyID;
438: else
439: l_rtgItemID := p_rtgRefID;
440: if p_rtgRefID is NULL then --Bug#14301607: If the Routing reference is removed, the routing should be removed for NonStdJobs
484: rescheduled even without exploding the routing when user just changes the dates */
485:
486: -- Bug 11893957. Call Infinite Scheduler after BOM Explosion to consider resources from Phantom Routings.
487: /*
488: if ( p_schedulingMethod = wip_constants.routing ) then
489: wip_infinite_scheduler_pvt.schedule(
490: p_orgID => p_orgID,
491: p_wipEntityID => p_wipEntityID,
492: p_startDate => p_startDate,
511: -- properly. We only need to do it if bom reexplosion is not required.
512: -- we also need to add the phantom resource back since it was deleted before
513:
514: if ( l_expRtgRequired and not l_expBomRequired ) then
515: if ( l_logLevel <= wip_constants.trace_logging ) then
516: wip_logger.log('Resetting the op reference in WRO.....', l_retStatus);
517: end if;
518: wip_fix_req_ops_pkg.fix(x_wip_entity_id => p_wipEntityID,
519: x_organization_id => p_orgID,
519: x_organization_id => p_orgID,
520: x_repetitive_schedule_id => null,
521: x_entity_start_date => l_startDate);
522: l_usePhantomRouting := wip_globals.use_phantom_routings(p_orgID);
523: if ( l_usePhantomRouting = wip_constants.yes ) then
524: for phan in c_phantoms loop
525: wip_explode_phantom_rtgs.explode_resources(
526: p_wip_entity_id => p_wipEntityID,
527: p_sched_id => null,
525: wip_explode_phantom_rtgs.explode_resources(
526: p_wip_entity_id => p_wipEntityID,
527: p_sched_id => null,
528: p_org_id => p_orgID,
529: p_entity_type => wip_constants.discrete,
530: p_phantom_item_id => phan.inventory_item_id,
531: p_op_seq_num => phan.operation_seq_num,
532: p_rtg_rev_date => p_routingRevDate);
533: end loop;
536:
537:
538: if ( l_expBomRequired ) then
539:
540: if ( l_jobType = wip_constants.standard ) then
541: l_bomItemID := l_assemblyID;
542: else
543: l_bomItemID := p_bomRefID;
544: end if;
616: raise fnd_api.g_exc_unexpected_error;
617: end if;
618: -- end if; --End of check on p_allowExplosion.
619: end if;
620: if ( p_schedulingMethod = wip_constants.routing ) then
621: wip_infinite_scheduler_pvt.schedule(
622: p_orgID => p_orgID,
623: p_wipEntityID => p_wipEntityID,
624: p_startDate => p_startDate,
640: and wro.organization_id = p_orgID;
641:
642: /*Bug 12580949 when scheduling method is manual, and start date and end date populated in WJSI is exactly the same as job start date and completion date, we should not update any date
643: at operation and resource level*/
644: elsif(p_schedulingMethod <> wip_constants.ml_manual or l_jobstartDate <> NVL(p_startDate, l_jobstartDate + 1) or l_jobCompDate <> NVL(p_endDate, l_jobCompDate + 1)) then
645: -- Added for Bug 8463132.
646: if ( p_schedulingMethod = wip_constants.leadtime ) then
647: select wdj.scheduled_start_date
648: into l_startDate
642: /*Bug 12580949 when scheduling method is manual, and start date and end date populated in WJSI is exactly the same as job start date and completion date, we should not update any date
643: at operation and resource level*/
644: elsif(p_schedulingMethod <> wip_constants.ml_manual or l_jobstartDate <> NVL(p_startDate, l_jobstartDate + 1) or l_jobCompDate <> NVL(p_endDate, l_jobCompDate + 1)) then
645: -- Added for Bug 8463132.
646: if ( p_schedulingMethod = wip_constants.leadtime ) then
647: select wdj.scheduled_start_date
648: into l_startDate
649: from wip_discrete_jobs wdj
650: where wdj.organization_id = p_orgID
692: p_wip_entity_id => p_wipEntityID,
693: p_org_id => p_orgID);
694:
695:
696: if (l_logLevel <= wip_constants.trace_logging) then
697: wip_logger.exitPoint(p_procName => g_pkgName || '.' || l_procName,
698: p_procReturnStatus => x_returnStatus,
699: p_msg => 'success',
700: x_returnStatus => l_retStatus);
704: x_returnStatus := fnd_api.g_ret_sts_unexp_error;
705: fnd_msg_pub.add_exc_msg(p_pkg_name => g_pkgName,
706: p_procedure_name => l_procName,
707: p_error_text => SUBSTRB(x_errorMsg, 1,240));--bug 13608871
708: if(l_logLevel <= wip_constants.trace_logging) then
709: wip_logger.exitPoint(p_procName => g_pkgName || '.' || l_procName,
710: p_procReturnStatus => x_returnStatus,
711: p_msg => x_errorMsg,
712: x_returnStatus => l_retStatus);