You can reserve material driven by a set of commodity codes and sizes.
You can pass a list of commodity codes and sizes along with each drawing. If all items on a drawing are needed, Intergraph Smart® Construction does not pass a list of commodity codes and sizes. As for the tagged items, the tag number becomes the commodity code, and this allows you to pass a list of tagged items.
Implementation
The wp_array is a PL/SQL table with two dimensions inside the API. The content of this PL/SQL table is passed into the function write_fa_header and the values are stored in a database table M_API_COMM_CODES to track the data.
Here is an extract of the function specification:
TYPE cc_rec IS RECORD
( commodity_code m_commodity_codes.commodity_code%TYPE,
input_1 m_idents.input_1%TYPE,
input_2 m_idents.input_2%TYPE,
input_3 m_idents.input_3%TYPE,
input_4 m_idents.input_4%TYPE,
input_5 m_idents.input_5%TYPE );
TYPE cc_array IS TABLE OF cc_rec INDEX BY BINARY_INTEGER;
TYPE wp_rec IS RECORD
( WP_ID m_work_packs.wp_id%TYPE
,WP_CODE m_work_packs.wp_code%TYPE
,WP_TYPE m_work_packs.wp_type%TYPE DEFAULT 'S'
,LOCKED_IND m_work_packs.locked_ind%TYPE DEFAULT 'N'
,PRIORITY_TYPE m_work_packs.priority_type%TYPE DEFAULT 'WP'
,M_USR_ID m_work_packs.m_usr_id%TYPE
,ATTR_CODE m_attrs.attr_code%TYPE
,AQC1_CODE m_adm_query_conds.aqc_code%TYPE
,AQC2_CODE m_adm_query_conds.aqc_code%TYPE
,AQC3_CODE m_adm_query_conds.aqc_code%TYPE
,AQC4_CODE m_adm_query_conds.aqc_code%TYPE
,AQC5_CODE m_adm_query_conds.aqc_code%TYPE
,ORDER_SEQ m_wp_to_fahs.order_seq%TYPE
,ROS_DATE m_wp_to_fahs.ros_date%TYPE
,ATTR_SORT m_wp_to_fahs.attr_sort%TYPE
,API_CC_TAB cc_array
,API_ATTR_TAB attr_array);
TYPE wp_array IS TABLE OF wp_rec INDEX BY BINARY_INTEGER;
Here is an example of incoming values:
p_wp(1).api_cc_tab(1).commodity_code := '165201ETOF2E205';
p_wp(1).api_cc_tab(1).input_1 := 0;
p_wp(1).api_cc_tab(1).input_2 := 0;
p_wp(1).api_cc_tab(1).input_3 := 0;
p_wp(1).api_cc_tab(1).input_4 := 0;
p_wp(1).api_cc_tab(1).input_5 := 0;
p_wp(1).api_cc_tab(2).commodity_code := '165201EFOF2J042';
p_wp(1).api_cc_tab(2).input_1 := 0;
p_wp(1).api_cc_tab(2).input_2 := 0;
p_wp(1).api_cc_tab(2).input_3 := 0;
p_wp(1).api_cc_tab(2).input_4 := 0;
p_wp(1).api_cc_tab(2).input_5 := 0;
To limit the forecast run/reservation run to the incoming values, a Where condition (for idents) is automatically generated and attached to the generated work package.
The following is the MV_WHERE view created for the Where condition:
CREATE OR REPLACE FORCE VIEW M_SYS.MV_WHERE_10000000538 (IDENT, LN_ID, LP_ID, RLI_ID)
AS
SELECT IDENT , NULL, NULL, NULL
FROM mvp_idents i, mvp_commodity_codes cc
WHERE i.commodity_id = cc.commodity_id
AND EXISTS (SELECT 1 FROM m_api_comm_codes apcc
WHERE apcc.commodity_code = cc.commodity_code
AND NVL(apcc.input_1,-1) = NVL(i.input_1,-1)
AND NVL(apcc.input_2,-1) = NVL(i.input_2,-1)
AND NVL(apcc.input_3,-1) = NVL(i.input_3,-1)
AND NVL(apcc.input_4,-1) = NVL(i.input_4,-1)
AND NVL(apcc.input_5,-1) = NVL(i.input_5,-1)
AND apcc.aqc_id = 10000000538)
The incoming values are stored in the M_API_COMM_CODES table.