[Home] [Help]
3098:
3099: begin
3100:
3101: l_stmt_num := 1;
3102: WSMPLCVA.load_org_table;
3103:
3104: l_stmt_num := 2;
3105: WSMPLCVA.load_subinventory;
3106:
3101: l_stmt_num := 1;
3102: WSMPLCVA.load_org_table;
3103:
3104: l_stmt_num := 2;
3105: WSMPLCVA.load_subinventory;
3106:
3107: l_stmt_num := 3;
3108: WSMPLCVA.load_class_code;
3109:
3104: l_stmt_num := 2;
3105: WSMPLCVA.load_subinventory;
3106:
3107: l_stmt_num := 3;
3108: WSMPLCVA.load_class_code;
3109:
3110: if lbji_debug = 'Y' then
3111: fnd_file.put_line(fnd_file.log, 'loading org/subinv/class-code values into memory (once per worker).. Success.');
3112: end if;
3495:
3496:
3497: l_stmt_num := 100;
3498: -- *** validate org id begin ***
3499: xst := WSMPLCVA.v_org.exists(v_wlji_org(v_index));
3500: if xst = false then
3501: l_error_code := -1;
3502: process_invalid_field('ORGANIZATION ID',
3503: '',
3782: -- CZH: why only for standard job ???
3783: if v_wlji_load_type(v_index) = 5 and v_wlji_job_type(v_index) <> 3 then
3784:
3785: if v_wlji_mode_flag(v_index) = 1 then
3786: xst := WSMPLCVA.v_item.exists(v_wlji_item(v_index));
3787: else -- mode flag 2
3788: str := to_char(v_wlji_item(v_index))||
3789: to_char(v_wsli(v_wlji_source_line_id(v_index)).inventory_item_id);
3790: hash_value := dbms_utility.get_hash_value(str, 37, 1073741824);
3788: str := to_char(v_wlji_item(v_index))||
3789: to_char(v_wsli(v_wlji_source_line_id(v_index)).inventory_item_id);
3790: hash_value := dbms_utility.get_hash_value(str, 37, 1073741824);
3791:
3792: xst := WSMPLCVA.v_mode2_item.exists(hash_value)
3793: AND WSMPLCVA.v_mode2_item(hash_value).INVENTORY_ITEM_ID =
3794: v_wsli(v_wlji_source_line_id(v_index)).inventory_item_id
3795: AND WSMPLCVA.v_mode2_item(hash_value).PRIMARY_ITEM_ID = v_wlji_item(v_index);
3796: end if;
3789: to_char(v_wsli(v_wlji_source_line_id(v_index)).inventory_item_id);
3790: hash_value := dbms_utility.get_hash_value(str, 37, 1073741824);
3791:
3792: xst := WSMPLCVA.v_mode2_item.exists(hash_value)
3793: AND WSMPLCVA.v_mode2_item(hash_value).INVENTORY_ITEM_ID =
3794: v_wsli(v_wlji_source_line_id(v_index)).inventory_item_id
3795: AND WSMPLCVA.v_mode2_item(hash_value).PRIMARY_ITEM_ID = v_wlji_item(v_index);
3796: end if;
3797:
3791:
3792: xst := WSMPLCVA.v_mode2_item.exists(hash_value)
3793: AND WSMPLCVA.v_mode2_item(hash_value).INVENTORY_ITEM_ID =
3794: v_wsli(v_wlji_source_line_id(v_index)).inventory_item_id
3795: AND WSMPLCVA.v_mode2_item(hash_value).PRIMARY_ITEM_ID = v_wlji_item(v_index);
3796: end if;
3797:
3798: if xst = false then
3799:
3835: end if; -- xst = false
3836:
3837: if xst = false AND l_no_of_records <> 0 then
3838: if v_wlji_mode_flag(v_index) = 2 then
3839: WSMPLCVA.v_mode2_item(hash_value).INVENTORY_ITEM_ID :=
3840: v_wsli(v_wlji_source_line_id(v_index)).inventory_item_id;
3841: WSMPLCVA.v_mode2_item(hash_value).PRIMARY_ITEM_ID :=
3842: v_wlji_item(v_index);
3843: else -- mode flag = 1
3837: if xst = false AND l_no_of_records <> 0 then
3838: if v_wlji_mode_flag(v_index) = 2 then
3839: WSMPLCVA.v_mode2_item(hash_value).INVENTORY_ITEM_ID :=
3840: v_wsli(v_wlji_source_line_id(v_index)).inventory_item_id;
3841: WSMPLCVA.v_mode2_item(hash_value).PRIMARY_ITEM_ID :=
3842: v_wlji_item(v_index);
3843: else -- mode flag = 1
3844: WSMPLCVA.v_item(v_wlji_item(v_index)) := v_wlji_item(v_index);
3845: end if;
3840: v_wsli(v_wlji_source_line_id(v_index)).inventory_item_id;
3841: WSMPLCVA.v_mode2_item(hash_value).PRIMARY_ITEM_ID :=
3842: v_wlji_item(v_index);
3843: else -- mode flag = 1
3844: WSMPLCVA.v_item(v_wlji_item(v_index)) := v_wlji_item(v_index);
3845: end if;
3846: end if;
3847:
3848: if l_error_code <> 0 then
3986: if v_wlji_load_type(v_index) = 5 then
3987:
3988: IF v_wlji_coproducts_supply(v_index) is NULL THEN
3989: v_wlji_coproducts_supply(v_index) :=
3990: WSMPLCVA.v_org(v_wlji_org(v_index)).COPRODUCTS_SUPPLY_DEFAULT;
3991: ELSIF ( v_wlji_coproducts_supply(v_index) <> 1
3992: OR v_wlji_coproducts_supply(v_index) <> 2) THEN
3993: v_wlji_coproducts_supply(v_index) := 2;
3994: END IF;
4071: -- do the subinventory validation here...
4072: -- validation of subinv begin
4073: str := to_char(v_wlji_org(v_index))||v_wlji_completion_subinventory(v_index);
4074: hash_value := dbms_utility.get_hash_value(str, 37, 1073741824);
4075: if WSMPLCVA.v_subinv.exists(hash_value) then
4076: NULL;
4077: else
4078: l_aux_mesg := '';
4079: process_invalid_field('COMPLETION SUBINVENTORY',
4249:
4250: if v_wlji_last_updt_by(v_index) is NULL then
4251: v_wlji_last_updt_by(v_index) := l_user;
4252: else
4253: xst := WSMPLCVA.v_user.exists(v_wlji_last_updt_by(v_index));
4254: if xst = false then
4255: begin
4256: select 1
4257: into l_no_of_records
4269: end;
4270: end if;
4271:
4272: if xst = false AND l_no_of_records <> 0 then
4273: WSMPLCVA.v_user(v_wlji_last_updt_by(v_index)) := v_wlji_last_updt_by(v_index);
4274: end if;
4275:
4276:
4277: if l_error_code <> 0 then
4297:
4298: if v_wlji_created_by(v_index) is NULL then
4299: v_wlji_created_by(v_index) := l_user;
4300: else
4301: xst := WSMPLCVA.v_user.exists(v_wlji_created_by(v_index));
4302: if xst = false then
4303: begin
4304: select 1
4305: into l_no_of_records
4315: end;
4316: end if;
4317:
4318: if xst = false AND l_no_of_records <> 0 then
4319: WSMPLCVA.v_user(v_wlji_created_by(v_index)) := v_wlji_created_by(v_index);
4320: end if;
4321:
4322: if l_error_code <> 0 then
4323: l_error_count := l_error_count + 1;
4567: v_wlji_class_code(v_index) := NULL;
4568: end;
4569:
4570: IF v_wlji_class_code(v_index) is NULL then
4571: v_wlji_class_code(v_index) := WSMPLCVA.v_org(v_wlji_org(v_index)).DEFAULT_ACCT_CLASS_CODE;
4572: END IF;
4573:
4574: END IF;
4575:
4579:
4580: ELSE
4581: str := to_char(v_wlji_org(v_index))||v_wlji_class_code(v_index);
4582: hash_value := dbms_utility.get_hash_value(str, 37, 1073741824);
4583: if WSMPLCVA.v_class_code.exists(hash_value) then
4584: NULL;
4585: else
4586: raise no_data_found;
4587: end if;
4717: --EA bug 3299026
4718:
4719: -- *** last_updated_by ***
4720: l_stmt_num := 601;
4721: xst := WSMPLCVA.v_user.exists(v_wsli(v_wlji_source_line_id(v_index)).last_updated_by);
4722: if xst = false then
4723: begin
4724: select 1
4725: into l_no_of_records
4737: end;
4738: end if;
4739:
4740: if xst = false AND l_no_of_records <> 0 then
4741: WSMPLCVA.v_user(v_wsli(v_wlji_source_line_id(v_index)).last_updated_by)
4742: := v_wsli(v_wlji_source_line_id(v_index)).last_updated_by;
4743: end if;
4744:
4745: if l_error_code <> 0 then
4751: xst := true;
4752:
4753: -- *** created_by ***
4754: l_stmt_num := 602;
4755: xst := WSMPLCVA.v_user.exists(v_wsli(v_wlji_source_line_id(v_index)).created_by);
4756: if xst = false then
4757: begin
4758: select 1
4759: into l_no_of_records
4771: end;
4772: end if;
4773:
4774: if xst = false AND l_no_of_records <> 0 then
4775: WSMPLCVA.v_user(v_wsli(v_wlji_source_line_id(v_index)).created_by)
4776: := v_wsli(v_wlji_source_line_id(v_index)).created_by;
4777: end if;
4778:
4779: if l_error_code <> 0 then
5651: v_wlji_completion_locator_id(v_index) IS NULL THEN
5652:
5653: str := to_char(v_wlji_org(v_index))||v_wlji_completion_subinventory(v_index);
5654: hash_value := dbms_utility.get_hash_value(str, 37, 1073741824);
5655: if WSMPLCVA.v_subinv.exists(hash_value) then
5656: NULL;
5657: else
5658: l_aux_mesg := '';
5659: process_invalid_field('COMPLETION SUBINVENTORY',
6182: p_overcompl_tol_value => null,
6183: p_end_item_unit_number => null,
6184: p_rtg_op_seq_num => null,
6185: p_src_client_server => 0,
6186: p_po_creation_time => WSMPLCVA.v_org(v_wlji_org(v_index)).PO_CREATION_TIME,
6187: p_error_code => l_error_code,
6188: p_error_msg => l_error_msg);
6189:
6190: if l_error_code <> 0 then
6401:
6402: l_stmt_num := 712;
6403: -- abb H: optional scrap accounting
6404: -- if (p_old_status_type IN (1,6)) and (v_wlji_status_type(v_index) = 3) and
6405: -- WSMPLCVA.v_org(v_wlji_org(v_index)).ESTIMATED_SCRAP_ACCOUNTING = 1
6406: -- and p_old_job_type = 1 then
6407:
6408: if (p_old_status_type IN (1,6)) and (v_wlji_status_type(v_index) = 3) and
6409: wsmputil.WSM_ESA_ENABLED(p_wip_entity_id => v_wlji_wip_entity_id(v_index),
6490: -- 1. user updates only status from unreleased to released, quantity unchanged
6491: -- 2. user updates only quantity (increases) for a released job, status is unchanged
6492: -- 3. user updates staus to released, and increases quantity.
6493:
6494: if WSMPLCVA.v_org(v_wlji_org(v_index)).PO_CREATION_TIME <> WIP_CONSTANTS.MANUAL_CREATION then
6495:
6496: if (v_wlji_status_type(v_index) = 3 and p_old_status_type = 1) then
6497: if wsmputil.check_osp_operation(v_wlji_wip_entity_id(v_index), l_osp_op_seq_num , v_wlji_org(v_index)) then
6498: l_atleast_one_osp_exists := l_atleast_one_osp_exists + 1;
6822: p_overcompl_tol_value => v_wlji_overcompl_tol_value(v_index),
6823: p_end_item_unit_number => v_wlji_end_item_unit_number(v_index),
6824: p_rtg_op_seq_num => null,
6825: p_src_client_server => 0,
6826: p_po_creation_time => WSMPLCVA.v_org(v_wlji_org(v_index)).PO_CREATION_TIME,
6827: p_date_released => v_wlji_date_released(v_index),
6828: p_error_code => l_error_code,
6829: p_error_msg => l_error_msg);
6830:
7286: l_stmt_num := 1100;
7287: -- *** material transaction for mode 2 jobs begin ***
7288: if v_wlji_mode_flag(v_index) = 2 then
7289:
7290: IF WSMPLCVA.v_org(v_wlji_org(v_index)).MAX_ORG_ACC_PERIODS is null or
7291: WSMPLCVA.v_org(v_wlji_org(v_index)).MAX_ORG_ACC_PERIODS = 0
7292: then
7293: l_error_code := -1;
7294: process_errorred_field('WIP',
7287: -- *** material transaction for mode 2 jobs begin ***
7288: if v_wlji_mode_flag(v_index) = 2 then
7289:
7290: IF WSMPLCVA.v_org(v_wlji_org(v_index)).MAX_ORG_ACC_PERIODS is null or
7291: WSMPLCVA.v_org(v_wlji_org(v_index)).MAX_ORG_ACC_PERIODS = 0
7292: then
7293: l_error_code := -1;
7294: process_errorred_field('WIP',
7295: 'WIP_NO_ACCT_PERIOD',
7296: l_stmt_num);
7297: GOTO skip_mat_trans;
7298: end if;
7299:
7300: if WSMPLCVA.v_org(v_wlji_org(v_index)).MAX_STK_LOC_CNTRL is null then
7301: WSMPLCVA.v_org(v_wlji_org(v_index)).MAX_STK_LOC_CNTRL := 1;
7302: end if;
7303:
7304: l_stmt_num := 1120;
7297: GOTO skip_mat_trans;
7298: end if;
7299:
7300: if WSMPLCVA.v_org(v_wlji_org(v_index)).MAX_STK_LOC_CNTRL is null then
7301: WSMPLCVA.v_org(v_wlji_org(v_index)).MAX_STK_LOC_CNTRL := 1;
7302: end if;
7303:
7304: l_stmt_num := 1120;
7305: /* commented out by BBK for DUAL usage reduction.
7363: 35, /* TRANSACTION_TYPE_ID */
7364: 1, /* TRANSACTION_ACTION_ID */
7365: 5, /* TRANSACTION_SOURCE_TYPE_ID */
7366: SYSDATE, /* TRANSACTION_DATE */
7367: WSMPLCVA.v_org(v_wlji_org(v_index)).MAX_ORG_ACC_PERIODS, /*ACCT_PERIOD_ID */
7368: 'WSM',
7369: to_char(v_wlji_source_line_id(v_index)), /* SOURCE_LINE_ID */
7370: 5, /* WIP_ENTITY_TYPE */
7371: 1, /* neg req flag */