1 PACKAGE flm_util AUTHID CURRENT_USER AS
2 /* $Header: FLMUTILS.pls 115.5 2003/05/02 01:26:59 yulin ship $ */
3
4 TYPE NODE_t IS RECORD (
5 x NUMBER,
6 y NUMBER,
7 sub INTEGER
8 );
9 TYPE NODE_LIST IS TABLE OF NODE_t INDEX BY BINARY_INTEGER;
10
11 TYPE LINK_t IS RECORD (
12 n1 INTEGER,
13 n2 INTEGER
14 );
15 TYPE LINK_LIST IS TABLE OF LINK_t INDEX BY BINARY_INTEGER;
16
17 FLM_APPLICATION_ID CONSTANT NUMBER := 714;
18
19 FUNCTION get_key_flex_category(cat_id IN NUMBER) return VARCHAR2;
20 FUNCTION get_key_flex_item(item_id IN NUMBER, org_id IN NUMBER) return VARCHAR2;
21 FUNCTION get_key_flex_location(loc_id IN NUMBER, org_id IN NUMBER) return VARCHAR2;
22
23 /******************************************************************************
24 * set_graph_coordinates, when passed in a graph, will position the nodes
25 * automatically.
26 * First we position all notes in a logical x-coordinate system;
27 * After this step, all nodes are divided into one or more connected components
28 * of a directed graph. X-position of a node is actually the relative position
29 * to its neighbors; Then for each component, at each x-position, we put nodes
30 * there into different logical y-positions (also relative position);
31 * Finally, we move those nodes into world coordinate system one component
32 * above another (vertically).
33 ******************************************************************************/
34 PROCEDURE set_graph_coordinates(llist LINK_LIST, nlist IN OUT NOCOPY NODE_LIST);
35
36 /***********************************************
37 * check whether Flow Manufacturing Application
38 * is installed.
39 ***********************************************/
40 FUNCTION Get_Install_Status RETURN VARCHAR2;
41
42
43 /****************************************************
44 * to handle dynamic sql parameter binding
45 * What we do is to maintain a list of bind
46 * variables, their name and value
47 * and do the binding later when do_binds is called
48 *
49 * Example :
50 * flm_util.init_bind;
51 *
52 * ...
53 * l_where_clause := l_where_clause || ' AND wip_entity_id =:wip_entity_id '
54 * flm_util.add_bind(':wip_entity_id' , p_wip_entity_id);
55 *
56 * l_cursor := dbms_sql.open_cursor(l_sql);
57 * dbms_sql.parse(...);
58 *
59 * flm_util.do_binds(l_cursor);
60 *
61 * dbms_sql.execute(...);
62 * ...
63 ****************************************************/
64 TYPE t_bind_rec IS RECORD (
65 name VARCHAR2(256),
66 data_type NUMBER, -- 1 string, 2 numer, 3 date
67 value_string VARCHAR2(1024),
68 value_number NUMBER,
69 value_date DATE );
70
71 TYPE t_bind_table IS TABLE OF t_bind_rec
72 INDEX BY BINARY_INTEGER;
73
74 g_bind_table t_bind_table;
75
76 PROCEDURE init_bind;
77
78 FUNCTION get_next_bind_seq RETURN NUMBER;
79
80 PROCEDURE add_bind(p_name IN VARCHAR2, p_string IN VARCHAR2);
81
82 PROCEDURE add_bind(p_name IN VARCHAR2, p_number IN NUMBER);
83
84 PROCEDURE add_bind(p_name IN VARCHAR2, p_date IN DATE);
85
86 PROCEDURE do_binds( p_cursor IN INTEGER );
87
88 /**********************************************************
89 * Construction where clause for cateogry/item flex fiedls.
90 * It's done in a segment by segment fasion.
91 * These two uses the bind procedures (above), so make sure
92 * the caller use them also.
93 *
94 * These two are moved from Mrp_Flow_Schedule_Util package.
95 *********************************************************/
96 FUNCTION Category_Where_Clause ( p_cat_lo IN VARCHAR2,
97 p_cat_hi IN VARCHAR2,
98 p_table_name IN VARCHAR2,
99 p_cat_struct_id IN NUMBER,
100 p_where OUT NOCOPY VARCHAR2,
101 x_err_buf OUT NOCOPY VARCHAR2 )
102 RETURN BOOLEAN;
103
104 FUNCTION Item_Where_Clause( p_item_lo IN VARCHAR2,
105 p_item_hi IN VARCHAR2,
106 p_table_name IN VARCHAR2,
107 x_where OUT NOCOPY VARCHAR2,
108 x_err_buf OUT NOCOPY VARCHAR2)
109 RETURN BOOLEAN;
110
111
112 END flm_util;