7: MAX_BUCKETS CONSTANT INTEGER := 36;
8: var_plan_start_date DATE;
9:
10: -- ==============================================================
11: -- This procedure populates one row in MRP_WORKBENCH_BUCKET_DATES
12: -- ==============================================================
13: PROCEDURE populate_row(arg_organization_id IN NUMBER,
14: arg_compile_designator IN VARCHAR2,
15: arg_bucket_type IN NUMBER,
29: counter BINARY_INTEGER := 0; -- Array counter
30:
31: -- -------------------------------------------------------------------
32: -- Date array to store days/weeks/periods this array will be used to
33: -- insert into MRP_WORKBENCH_BUCKET_DATES. It will have the following
34: -- data in it
35: -- 1 ... arg_num_days Daily
36: -- arg_num_days + 1 ... arg_num_days + arg_num_weeks Weekly
37: -- arg_num_daye + arg_num_weeks + 1 ... MAX_BUCKETS + 1 Periodic
292: END LOOP;
293: END IF; -- < MAX_BUCKETS
294:
295: -- ----------------------------------------------------------
296: -- Insert the var_dates array into MRP_WORKBENCH_BUCKET_DATES
297: -- ----------------------------------------------------------
298: var_user_id := FND_PROFILE.VALUE('USER_ID');
299: INSERT INTO mrp_workbench_bucket_dates
300: (organization_id,
295: -- ----------------------------------------------------------
296: -- Insert the var_dates array into MRP_WORKBENCH_BUCKET_DATES
297: -- ----------------------------------------------------------
298: var_user_id := FND_PROFILE.VALUE('USER_ID');
299: INSERT INTO mrp_workbench_bucket_dates
300: (organization_id,
301: compile_designator,
302: bucket_type,
303: last_update_date,
332: END populate_row;
333:
334:
335: -- ====================================================================
336: -- Create all rows in MRP_WORKBENCH_BUCKET_DATES
337: -- ====================================================================
338: PROCEDURE populate_bucket_dates ( arg_organization_id IN NUMBER,
339: arg_compile_designator IN VARCHAR2) IS
340:
338: PROCEDURE populate_bucket_dates ( arg_organization_id IN NUMBER,
339: arg_compile_designator IN VARCHAR2) IS
340:
341: var_current_start_date DATE; -- Current first date in
342: -- MRP_WORKBENCH_BUCKET_DATES
343: recreate BOOLEAN := FALSE;
344: var_curr_start_date1 DATE; -- Current first date in MRP_WORKBENCH_BUCKET_DATES
345: -- for current data.
346: recreate1 BOOLEAN := FALSE;
340:
341: var_current_start_date DATE; -- Current first date in
342: -- MRP_WORKBENCH_BUCKET_DATES
343: recreate BOOLEAN := FALSE;
344: var_curr_start_date1 DATE; -- Current first date in MRP_WORKBENCH_BUCKET_DATES
345: -- for current data.
346: recreate1 BOOLEAN := FALSE;
347: BEGIN
348:
347: BEGIN
348:
349: -- --------------------------------------------------
350: -- First figure out if we need to do recreate rows in
351: -- MRP_WORKBENCH_BUCKET_DATES
352: -- --------------------------------------------------
353:
354: BEGIN
355:
354: BEGIN
355:
356: SELECT date1
357: INTO var_current_start_date
358: FROM mrp_workbench_bucket_dates
359: WHERE compile_designator = arg_compile_designator
360: AND organization_id = arg_organization_id
361: AND bucket_type = DAILY_BUCKET;
362:
378: BEGIN
379:
380: SELECT date1
381: INTO var_curr_start_date1
382: FROM mrp_workbench_bucket_dates
383: WHERE compile_designator = arg_compile_designator
384: AND organization_id = arg_organization_id
385: AND bucket_type = -1;
386:
427: END IF;
428:
429: IF recreate = TRUE THEN
430:
431: DELETE mrp_workbench_bucket_dates
432: WHERE compile_designator = arg_compile_designator
433: AND organization_id = arg_organization_id
434: AND bucket_type IN (DAILY_BUCKET, WEEKLY_BUCKET, PERIODIC_BUCKET);
435:
469: -- Reset var_plan_start_date to sysdate
470: -- ----------------------------------------------
471: var_plan_start_date := TRUNC(sysdate);
472: BEGIN
473: DELETE mrp_workbench_bucket_dates
474: WHERE compile_designator = arg_compile_designator
475: AND organization_id = arg_organization_id
476: AND bucket_type IN (-1, -2, -3);
477: EXCEPTION WHEN NO_DATA_FOUND THEN