1 PACKAGE WSH_NEW_DELIVERY_ACTIONS as
2 /* $Header: WSHDEACS.pls 120.3 2008/01/14 15:38:12 skanduku noship $ */
3
4 G_USER_NAME VARCHAR2(200);
5 g_error_level VARCHAR2(1);
6
7 /********************************************************************************
8 * The following global variables are added as part of Ship Message
9 * Customization Project. These varibles are accessed from WSHDEACB.pls and
10 * WSHDEVLB.pls. Variables ending with _act -> activity and _msg -> message
11 ******************************************************************************/
12 g_ship_confirm_act CONSTANT VARCHAR2(200) := 'SHIP_CONFIRM_MESSAGE';
13 g_missing_inv_cntl_msg CONSTANT VARCHAR2(200) := 'MISSING_CONTROLS';
14 g_break_ship_set_msg CONSTANT VARCHAR2(200) := 'BREAK_SHIP_SET';
15 g_break_smc_msg CONSTANT VARCHAR2(200) := 'BREAK_SMC';
16 g_invalid_material_status_msg CONSTANT VARCHAR2(200) := 'INVALID_MATERIAL_STATUS';
17
18 /*The following variable is checked for count in CONFIRM_DELIVERY Procedure.
19 Value for this varibale is set in WSH_DELIVERY_VALIDATIONS.CHECK_CONFIRM Procedure*/
20 g_break_ship_set_or_smc NUMBER := 0;
21
22 /********************* Ship Message Customization Changes End ****************/
23
24
25 TYPE ship_method_type is TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER;
26
27 /* J TP Release */
28 --
29 -- Procedure: FIRM
30 -- Parameters: p_del_rows - Delivery_ids to be firmed
31 -- x_return_status - status of procedure call
32 -- Description: This procedure will firm a delivery
33 --
34 PROCEDURE FIRM
35 (p_del_rows IN wsh_util_core.id_tab_type,
36 x_return_status OUT NOCOPY VARCHAR2);
37
38 --
39 -- Procedure: Plan
40 -- Parameters: p_del_rows - Delivery_ids to be planned
41 -- x_return_status - status of procedure call
42 -- Description: This procedure will Plan a delivery for shipment
43 --
44 PROCEDURE Plan
45 (p_del_rows IN wsh_util_core.id_tab_type,
46 x_return_status OUT NOCOPY VARCHAR2,
47 p_called_for_sc IN BOOLEAN default false);
48
49 --
50 -- Procedure: Unplan
51 -- Parameters: p_del_rows - Delivery_ids of deliveries to be unplanned
52 -- x_return_status - status of procedure call
53 -- Description: This procedure will unplan a delivery
54 --
55
56 PROCEDURE Unplan
57 (p_del_rows IN wsh_util_core.id_tab_type,
58 x_return_status OUT NOCOPY VARCHAR2);
59
60
61 -- Bug: 2052963
62 -- Procedure: Get_Delivery_Defaults
63 -- Parameters: p_del_rows - Delivery_ids of deliveries to be confirmed
64 -- Parameters: p_org_ids - Organization ids of deliveries to be confirmed
65 -- x_autocreate_flag - enables/disables trip information
66 -- x_autointransit_flag - enables/disables setting in-transit for trip
67 -- x_autoclose_flag - enables/disables setting trip closure
68 -- x_return_status - status of procedure call
69 -- x_sc_rule_id - if all deliveries belong to same org and hence
70 -- have a common ship confirm rule specified
71 -- x_ac_bol_flag - along with Ship Confirm Rule,what is the
72 -- value of BOL flag
73 -- x_defer_interface_flag - Value for the Ship Confirm Rule
74 -- x_sc_rule_name - Ship Confirm Rule Name
75
76 -- Description: Gets the Default Delivery Parameters
77 -- Including Document Set(id and Name) for the Org.
78 -- associated with the Delivery(s).
79 --
80
81 PROCEDURE Get_Delivery_Defaults
82 (p_del_rows IN wsh_util_core.id_tab_type,
83 p_org_ids IN wsh_util_core.id_tab_type,
84 p_ship_method_code_vals IN ship_method_type,
85 x_autointransit_flag OUT NOCOPY VARCHAR2,
86 x_autoclose_flag OUT NOCOPY VARCHAR2,
87 x_report_set_id OUT NOCOPY NUMBER,
88 x_report_set_name OUT NOCOPY VARCHAR2,
89 x_ship_method_name OUT NOCOPY VARCHAR2,
90 x_return_status OUT NOCOPY VARCHAR2,
91 x_sc_rule_id OUT NOCOPY NUMBER,
92 x_ac_bol_flag OUT NOCOPY VARCHAR2,
93 x_defer_interface_flag OUT NOCOPY VARCHAR2,
94 x_sc_rule_name OUT NOCOPY VARCHAR2
95
96 );
97
98
99 -- Procedure: Confirm_Delivery
100 -- Parameters: p_del_rows - Delivery_ids of deliveries to be confirmed
101 -- p_action_flag - 'S' for Ship Entered, Ship Unspecified Full
102 -- 'B' for Ship Entered, Backorder Unspecified
103 -- 'A' Ship All
104 -- p_intransit_flag - 'Y' for autocreate_trip closes first stop
105 -- p_autoclose_flag - 'Y' closes autocreated trip and stops
106 -- p_stage_del_flag - 'Y' creates a new delivery for the staged lines
107 -- p_report_set_id - report set for delivery
108 -- p_ship_method - ship method for autocreated trip
109 -- p_actual_dep_date - actual departure date for pickup stop on autocreated trip
110 -- p_defer_interface_flag - 'Y' to skip concurrent program submission, bug 1578251
111 -- p_send_945_flag - 'Y' to trigger outbound shipment advice for delivery with WSH lines
112 -- x_return_status - status of procedure call
113 -- Description: This procedure will update shipped quantities of the details
114 -- on each delivery and confirms each delivery
115
116
117 PROCEDURE Confirm_Delivery
118 (p_del_rows IN wsh_util_core.id_tab_type,
119 p_action_flag IN VARCHAR2,
120 p_intransit_flag IN VARCHAR2,
121 p_close_flag IN VARCHAR2,
122 p_stage_del_flag IN VARCHAR2,
123 p_report_set_id IN NUMBER,
124 p_ship_method IN VARCHAR2,
125 p_actual_dep_date IN DATE,
126 p_bol_flag IN VARCHAR2,
127 p_mc_bol_flag IN VARCHAR2 DEFAULT 'N',
128 p_defer_interface_flag IN VARCHAR2,
129 p_send_945_flag IN VARCHAR2 DEFAULT NULL,
130 p_autocreate_trip_flag IN varchar2 default 'Y',
131 x_return_status OUT NOCOPY VARCHAR2,
132 --tkt
133 p_caller IN VARCHAR2 DEFAULT NULL) ;
134
135 --
136 -- Procedure: Change_Status
137 -- Parameters: p_del_rows - Delivery_ids of deliveries to be planned
138 -- p_action - action to be performed
139 -- p_actual_date - date the action is performed
140 -- NOTE: this is used to populate the initial and ultimate dates
141 -- always pass NULL if calling directly
142 -- x_return_status - status of procedure call
143 -- Description: This procedure will Change Status of deliveries
144 -- Values for p_action are
145 -- - PACK
146 -- - REOPEN
147 -- - IN-TRANSIT
148 -- - CLOSE
149 -- NOTE: For CONFIRM use confirm_delivery procedure
150 --
151
152 PROCEDURE Change_Status
153 (p_del_rows IN wsh_util_core.id_tab_type,
154 p_action IN VARCHAR2,
155 p_actual_date IN DATE DEFAULT NULL,
156 x_return_status OUT NOCOPY VARCHAR2,
157 --tkt
158 p_caller IN VARCHAR2 DEFAULT NULL) ;
159
160
161
162 --
163 -- Procedure: Update_Leg_Sequence
164 -- Parameters: p_delivery_id - Delivery_id of delivery to be planned
165 -- x_return_status - status of procedure call
166 -- Description: This procedure will update sequence number of delivery legs
167 --
168 /* H integration - anxsharm */
169 PROCEDURE Update_Leg_Sequence
170 (p_delivery_id IN NUMBER,
171 p_update_flag IN VARCHAR2 DEFAULT 'Y',
172 x_return_status OUT NOCOPY VARCHAR2);
173
174
175 --
176 -- Procedure: Set_Load_Tender
177 -- Parameters: p_del_rows - Delivery ids to be tendered
178 -- x_return_status - status of procedure call
179 -- Description: This procedure is used to Tender/Cancel loads to carriers. It
180 -- calls the wsh_delivery_legs_actions API for delivery legs on
181 -- each delivery
182 -- p_action - 'TENDER', 'CANCEL'
183 --
184 -- COMMENTING OUT AS LOAD TENDER FUNCTIONALITY IS TEMPORARILY REMOVED
185 /*
186 PROCEDURE Set_Load_Tender
187 (p_del_rows IN wsh_util_core.id_tab_type,
188 p_action IN VARCHAR2,
189 x_return_status OUT NOCOPY VARCHAR2);
190 */
191 --
192 -- Procedure: Generate_Loading_Seq
193 -- Parameters: p_del_rows - Delivery ids
194 -- x_return_status - status of procedure call
195 -- Description: This procedure is used to generate loading sequence for deliveries
196 --
197
198 PROCEDURE Generate_Loading_Seq
199 (p_del_rows IN wsh_util_core.id_tab_type,
200 x_return_status OUT NOCOPY VARCHAR2);
201
202
203 --
204 -- Procedure: Assign_Delivery_Update
205 -- Parameters: p_delivery_id - Delivery id
206 -- p_del_params - Parameters to update the delivery with
207 -- x_return_status - status of procedure call
208 -- Description: This procedure is used to update the delivery with grouping
209 -- attribute values from lines, while assigning lines to delivery
210 --
211
212 PROCEDURE Assign_Delivery_Update
213 (p_delivery_id IN NUMBER,
214 p_del_params IN wsh_delivery_autocreate.grp_attr_rec_type,
215 x_return_status OUT NOCOPY VARCHAR2);
216
217
218
219 -- **************************************************************************
220 -- PATCHSET H CHANGES FOR FTE INTEGRATION with CARRIER SELECTION
221 --
222 -- [AAB]
223 -- [03/02/2002]
224 --
225
226 TYPE TableNumbers is TABLE of NUMBER INDEX BY BINARY_INTEGER; -- table number type
227 TYPE TableVarchar30 is TABLE of VARCHAR2(30) INDEX BY BINARY_INTEGER; -- table varchar(30) type
228 TYPE TableVarchar3 is TABLE of VARCHAR2(3) INDEX BY BINARY_INTEGER; -- table varchar(3) type
229 TYPE TableDate is TABLE of DATE INDEX BY BINARY_INTEGER;
230
231
232 PROCEDURE PROCESS_CARRIER_SELECTION(p_delivery_id_tab IN OUT NOCOPY WSH_UTIL_CORE.Id_Tab_Type,
233 p_batch_id IN NUMBER,
234 p_form_flag IN VARCHAR2,
235 p_organization_id IN NUMBER DEFAULT NULL,
236 -- csun deliveryMerge
237 p_caller IN VARCHAR2 DEFAULT NULL,
238 x_return_message OUT NOCOPY VARCHAR2,
239 x_return_status OUT NOCOPY VARCHAR2);
240
241 -- deliveryMerge
242 G_NO_APPENDING VARCHAR2(1) := 'N';
243 G_START_OF_STAGING VARCHAR2(1) := 'S';
244 G_END_OF_STAGING VARCHAR2(1) := 'E';
245 G_START_OF_PACKING VARCHAR2(1) := 'A';
246 G_START_OF_SHIPPING VARCHAR2(1) := 'W';
247
248 PROCEDURE Adjust_Planned_Flag(
249 p_delivery_ids IN wsh_util_core.id_tab_type,
250 p_caller IN VARCHAR2,
251 p_force_appending_limit IN VARCHAR2,
252 p_call_lcss IN VARCHAR2 DEFAULT 'N',
253 p_event IN VARCHAR2 DEFAULT NULL,
254 x_return_status OUT NOCOPY VARCHAR2,
255 p_called_for_sc IN BOOLEAN default false);
256
257
258 -- J-IB-NPARIKH-{
259 -- ----------------------------------------------------------------------
260 -- Procedure: update_freight_terms
261 -- Parameters: p_delivery_id in number
262 -- p_action_code in varchar2
263 -- 'ASSIGN' : Assign lines to delivery
264 -- 'UNASSIGN' : Unassign lines from delivery
265 -- p_line_freight_terms_code in varchar2
266 -- NULL : Caller did not pass value
267 -- 'NULL' : Lines assigned/unassigned have mixed/null freight terms
268 -- Other value: All lines assigned/unassigned have same freight term , equal to this value
269 -- Description: This procedure can be called after assign/unassign lines from delivery.
270 -- ----------------------------------------------------------------------
271 PROCEDURE update_freight_terms
272 (
273 p_delivery_id IN NUMBER,
274 p_action_code IN VARCHAR2 DEFAULT 'UNASSIGN',
275 p_line_freight_terms_Code IN VARCHAR2 DEFAULT NULL,
276 x_freight_terms_Code OUT NOCOPY VARCHAR2,
277 x_return_status OUT NOCOPY VARCHAR2
278 ) ;
279 --
280 --
281 PROCEDURE setClose
282 (
283 p_in_rec IN WSH_DELIVERY_VALIDATIONS.ChgStatus_in_rec_type,
284 x_return_status OUT NOCOPY VARCHAR2
285 ) ;
286 PROCEDURE setInTransit
287 (
288 p_in_rec IN WSH_DELIVERY_VALIDATIONS.ChgStatus_in_rec_type,
289 x_return_status OUT NOCOPY VARCHAR2
290 ) ;
291
292
293 PROCEDURE update_ship_from_location
294 (
295 p_delivery_id IN NUMBER,
296 p_location_id IN NUMBER,
297 x_return_status OUT NOCOPY VARCHAR2
298 ) ;
299
300
301 -- J-IB-NPARIKH-}
302
303 -- J-IB-HEALI-{
304 PROCEDURE Process_Leg_Sequence
305 ( p_delivery_id IN NUMBER,
306 p_update_del_flag IN VARCHAR2,
307 p_update_leg_flag IN VARCHAR2,
308 x_leg_complete OUT NOCOPY boolean,
309 x_return_status OUT NOCOPY VARCHAR2);
310 -- J-IB-HEALI-}
311
312 /**________________________________________________________________________
313 --
314 -- Name:
315 -- Assign_Del_to_Consol_Del
316 --
317 -- Purpose:
318 -- This API assigns a deliveries to a parent (consolidation)
319 -- delivery. If the caller is FTE consolidation SRS, we
320 -- assume that the child deliveries have already been validated
321 -- as eligible to be assigned to the parent delivery.
322 -- Parameters:
323 -- p_del_tab: Table of deliveries that need to be assigned
324 -- p_parent_del: Parent delivery id that will be assigne to
325 -- p_caller: Calling entity/action
326 -- x_return_status: status
327 **/
328
329 Procedure Assign_Del_to_Consol_Del(
330 p_del_tab IN WSH_NEW_DELIVERIES_PVT.Delivery_Attr_Tbl_Type,
331 p_parent_del_id IN NUMBER,
332 p_caller IN VARCHAR2,
333 x_return_status OUT NOCOPY VARCHAR2);
334
335
336 --
337 -- Name:
338 -- Unassign_Dels_from_Consol_Del
339 --
340 -- Purpose:
341 -- This API unassigns deliveries from a parent (consolidation)
342 -- delivery. If the parent delivery becomes empty we delete the
343 -- parent delivery. Currently this will be called with
344 -- assumption that all and only all deliveries in the parent
345 -- delivery will be unassigned all at the same time.
346 --
347 -- Parameters:
348 -- p_del_tab: Table of deliveries that need to be unassigned
349 -- p_parent_del_ids: Parent deliveries that will be unassigned from
350 -- and eventually deleted.
351 -- p_caller: Calling entity/action
352 -- x_return_status: status
353
354
355 Procedure Unassign_Dels_from_Consol_Del(
356 p_parent_del IN NUMBER,
357 p_caller IN VARCHAR2,
358 p_del_tab IN OUT NOCOPY wsh_util_core.id_tab_type,
359 x_return_status OUT NOCOPY VARCHAR2);
360
361
362 --OTM R12, function to check if delivery is empty or not
363 FUNCTION IS_DELIVERY_EMPTY (p_delivery_id IN NUMBER) RETURN VARCHAR2;
364 --
365
366 END WSH_NEW_DELIVERY_ACTIONS;