DBA Data[Home] [Help]

PACKAGE: APPS.CSF_TASK_ASSIGNMENTS_PUB

Source


1 PACKAGE csf_task_assignments_pub AS
2 /* $Header: CSFPTASS.pls 120.9 2007/11/15 13:38:58 venjayar ship $ */
3 
4   /**
5    * Creates a New Task Assignment for the given Task with the given attributes.
6    *
7    * If there exists any Cancelled Task Assignment for the Task with the given
8    * Resource Information, then that Task Assignment is reused rather than creating a
9    * new Task Assignment afresh.
10    * <br>
11    * If the Trip ID corresponding to the Task Assignment is passed as FND_API.G_MISS_NUM
12    * then the user doesnt want to link the Assignment to any Trip. So the Trip ID will
13    * be saved as NULL corresponding to the Task Assignment.
14    * If Trip ID is passed as NULL or not passed at all, then the API will try to find a
15    * Trip corresponding to the Assignment. Since we are dependent on Trips Model, any
16    * Assignment created for a Field Service Task should be linked to a Trip (based on
17    * Actual Date / Scheduled Dates). If there exists no Trip or there exists multiple trips,
18    * then the API will error out. If Assignment shouldnt be linked to any Trip, then
19    * Trip ID should be passed as FND_API.G_MISS_NUM.
20    * <br>
21    * Except for Task ID, Resouce ID, Resource Type Code all other parameters are optional.
22    */
23   PROCEDURE create_task_assignment (
24     p_api_version                  IN          NUMBER
25   , p_init_msg_list                IN          VARCHAR2 DEFAULT NULL
26   , p_commit                       IN          VARCHAR2 DEFAULT NULL
27   , p_validation_level             IN          NUMBER   DEFAULT NULL
28   , x_return_status                OUT NOCOPY  VARCHAR2
29   , x_msg_count                    OUT NOCOPY  NUMBER
30   , x_msg_data                     OUT NOCOPY  VARCHAR2
31   , p_task_assignment_id           IN          NUMBER   DEFAULT NULL
32   , p_task_id                      IN          NUMBER
33   , p_task_name                    IN          VARCHAR2 DEFAULT NULL
34   , p_task_number                  IN          VARCHAR2 DEFAULT NULL
35   , p_resource_type_code           IN          VARCHAR2
36   , p_resource_id                  IN          NUMBER
37   , p_resource_name                IN          VARCHAR2 DEFAULT NULL
38   , p_actual_effort                IN          NUMBER   DEFAULT NULL
39   , p_actual_effort_uom            IN          VARCHAR2 DEFAULT NULL
40   , p_schedule_flag                IN          VARCHAR2 DEFAULT NULL
41   , p_alarm_type_code              IN          VARCHAR2 DEFAULT NULL
42   , p_alarm_contact                IN          VARCHAR2 DEFAULT NULL
43   , p_sched_travel_distance        IN          NUMBER   DEFAULT NULL
44   , p_sched_travel_duration        IN          NUMBER   DEFAULT NULL
45   , p_sched_travel_duration_uom    IN          VARCHAR2 DEFAULT NULL
46   , p_actual_travel_distance       IN          NUMBER   DEFAULT NULL
47   , p_actual_travel_duration       IN          NUMBER   DEFAULT NULL
48   , p_actual_travel_duration_uom   IN          VARCHAR2 DEFAULT NULL
49   , p_actual_start_date            IN          DATE     DEFAULT NULL
50   , p_actual_end_date              IN          DATE     DEFAULT NULL
51   , p_palm_flag                    IN          VARCHAR2 DEFAULT NULL
52   , p_wince_flag                   IN          VARCHAR2 DEFAULT NULL
53   , p_laptop_flag                  IN          VARCHAR2 DEFAULT NULL
54   , p_device1_flag                 IN          VARCHAR2 DEFAULT NULL
55   , p_device2_flag                 IN          VARCHAR2 DEFAULT NULL
56   , p_device3_flag                 IN          VARCHAR2 DEFAULT NULL
57   , p_resource_territory_id        IN          NUMBER   DEFAULT NULL
58   , p_assignment_status_id         IN          NUMBER   DEFAULT NULL
59   , p_shift_construct_id           IN          NUMBER   DEFAULT NULL
60   , p_object_capacity_id           IN          NUMBER   DEFAULT NULL
61   , p_update_task                  IN          VARCHAR2 DEFAULT NULL
62   , x_task_assignment_id           OUT NOCOPY  NUMBER
63   , x_ta_object_version_number     OUT NOCOPY  NUMBER
64   , x_task_object_version_number   OUT NOCOPY  NUMBER
65   , x_task_status_id               OUT NOCOPY  NUMBER
66   );
67 
68   /**
69    * Update an existing Task Assignment with new Task Attributes
70    *
71    * Given the Task Assignment ID and Task Object Version Number, it calls
72    * JTF Task Assignment API to update the Task Assignment with the new Attributes.
73    * It is actually a two step process
74    *    1. Updating the Task Assignment with the new Task Attributes except Status
75    *    2. Updating the Task Assignment with the new Task Status (if not FND_API.G_MISS_NUM)
76    *       by calling UPDATE_ASSIGNMENT_STATUS.
77    * <br>
78    * Because of the two step process, the returned Task Assignment Object
79    * Version Number might be incremented by 2 when user might have expected an
80    * increment of only 1.
81    * <br>
82    * Except Task Assignment ID and Object Version Number parameters, all are optional.
83    * <br>
84    * Note that for parameters starting from P_TASK_NUMBER till P_ABORT_WORKFLOW, the
85    * function CSF_UTIL_PVT.G_MISS_*** is called so that Forms / Libraries calling
86    * the API currently will not be affected by the error "PL/SQL ERROR 512: Implementation
87    * Restriction". Note that CHR(0) can be hardcoded rather than the performance
88    * intensive CSF_UTIL_PVT.GET_MISS_CHAR... but it is resulting in the error
89    * "PL/SQL ERROR 707: unsupported construct or internal error [2601]" when
90    * the parameter's default is CHR(0). Its working for other MISS values..except
91    * for MISS_CHAR.
92    */
93   PROCEDURE update_task_assignment (
94     p_api_version                  IN              NUMBER
95   , p_init_msg_list                IN              VARCHAR2 DEFAULT NULL
96   , p_commit                       IN              VARCHAR2 DEFAULT NULL
97   , p_validation_level             IN              NUMBER   DEFAULT NULL
98   , x_return_status                OUT    NOCOPY   VARCHAR2
99   , x_msg_count                    OUT    NOCOPY   NUMBER
100   , x_msg_data                     OUT    NOCOPY   VARCHAR2
101   , p_task_assignment_id           IN              NUMBER
102   , p_object_version_number        IN OUT NOCOPY   NUMBER
103   , p_task_id                      IN              NUMBER   DEFAULT fnd_api.g_miss_num
104   , p_resource_type_code           IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
105   , p_resource_id                  IN              NUMBER   DEFAULT fnd_api.g_miss_num
106   , p_resource_territory_id        IN              NUMBER   DEFAULT fnd_api.g_miss_num
107   , p_assignment_status_id         IN              NUMBER   DEFAULT fnd_api.g_miss_num
108   , p_actual_start_date            IN              DATE     DEFAULT fnd_api.g_miss_date
109   , p_actual_end_date              IN              DATE     DEFAULT fnd_api.g_miss_date
110   , p_sched_travel_distance        IN              NUMBER   DEFAULT fnd_api.g_miss_num
111   , p_sched_travel_duration        IN              NUMBER   DEFAULT fnd_api.g_miss_num
112   , p_sched_travel_duration_uom    IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
113   , p_shift_construct_id           IN              NUMBER   DEFAULT fnd_api.g_miss_num
114   , p_object_capacity_id           IN              NUMBER   DEFAULT fnd_api.g_miss_num
115   , p_update_task                  IN              VARCHAR2 DEFAULT NULL
116   , p_task_number                  IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
117   , p_task_name                    IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
118   , p_resource_name                IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
119   , p_actual_effort                IN              NUMBER   DEFAULT csf_util_pvt.get_miss_num
120   , p_actual_effort_uom            IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
121   , p_actual_travel_distance       IN              NUMBER   DEFAULT csf_util_pvt.get_miss_num
122   , p_actual_travel_duration       IN              NUMBER   DEFAULT csf_util_pvt.get_miss_num
123   , p_actual_travel_duration_uom   IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
124   , p_attribute1                   IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
125   , p_attribute2                   IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
126   , p_attribute3                   IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
127   , p_attribute4                   IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
128   , p_attribute5                   IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
129   , p_attribute6                   IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
130   , p_attribute7                   IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
131   , p_attribute8                   IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
132   , p_attribute9                   IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
133   , p_attribute10                  IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
134   , p_attribute11                  IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
135   , p_attribute12                  IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
136   , p_attribute13                  IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
137   , p_attribute14                  IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
138   , p_attribute15                  IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
139   , p_attribute_category           IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
140   , p_show_on_calendar             IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
141   , p_category_id                  IN              NUMBER   DEFAULT csf_util_pvt.get_miss_num
142   , p_schedule_flag                IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
143   , p_alarm_type_code              IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
144   , p_alarm_contact                IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
145   , p_palm_flag                    IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
146   , p_wince_flag                   IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
147   , p_laptop_flag                  IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
148   , p_device1_flag                 IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
149   , p_device2_flag                 IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
150   , p_device3_flag                 IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
151   , p_enable_workflow              IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
152   , p_abort_workflow               IN              VARCHAR2 DEFAULT csf_util_pvt.get_miss_char
153   , x_task_object_version_number   OUT    NOCOPY   NUMBER
154   , x_task_status_id               OUT    NOCOPY   NUMBER
155   );
156 
157   /**
158    * Update the Status of the Task Assignment with the given Status and propagate to the
159    * Task also if required.
160    * <br>
161    * Task Assignment is updated with the new Status if the Transition from the current
162    * status to the new status is allowed as determined by
163    * CSF_TASKS_PUB.VALIDATE_STATE_TRANSITION. Transition validation is done only
164    * when Validation Level is passed as FULL.
165    * <br>
166    * In addition to updating the Task Assignment Status, the following operations are also
167    * done
168    *   1. If the Task corresponding to the given Task Assignment has no other
169    *      Open / Active Task Assignments other than the given one, then the Assignment
170    *      Status is propagated to the Task also. If there exists any other Active
171    *      Assignment, then the Task is not updated.
172    *      The parameters P_TASK_OBJECT_VERSION_NUMBER and X_TASK_STATUS_ID reflect
173    *      the Object Version Number and Task Status ID of the Task in Database
174    *      irrespective of the fact whether the update has taken place or not. <br>
175    *
176    *   2. If the Assignment goes to Cancelled (as per the new status), then if any
177    *      Spares Order is linked to the Assignment, they are cleaned up by calling
178    *      CLEAN_MATERIAL_TRANSACTION of Spares. <br>
179    *
180    *   3. If the Assignment goes to Assigned (as per the new status), and the
181    *      old status is not Assigned, then Orders are created and linked to the
182    *      Task Assignment. <br>
183    *
184    *   4. If the Assignnment goes to Working (as per the new status), then it means
185    *      that the Resource is working on the Task and so his location should be updated
186    *      to reflect the location of the Task. This is required by Map Functionality.
187    *      THIS IS WRONG AND SHOULD BE REMOVED. MAP SHOULD BE USING HZ_LOCATIONS TABLE. <br>
188    *
189    * @param  p_api_version                  API Version (1.0)
190    * @param  p_init_msg_list                Initialize Message List
191    * @param  p_commit                       Commit the Work
192    * @param  p_validation_level             Validate the given Parameters
193    * @param  x_return_status                Return Status of the Procedure.
194    * @param  x_msg_count                    Number of Messages in the Stack.
195    * @param  x_msg_data                     Stack of Error Messages.
196    * @param  p_task_assignment_id           Task Assignment ID of the Assignment to be updated
197    * @param  p_assignment_status_id         New Status ID for the Assignment
198    * @param  p_old_assignment_status_id     Old Status ID for the Assignment
199    * @param  p_show_on_calendar             <Dont Know>
200    * @param  p_object_version_number        Current Task Version and also container for new one.
201    * @param  x_task_object_version_number   Task Object Version Number (either old or new)
202    * @param  x_task_status_id               Task Status ID (either old or new)
203    */
204   PROCEDURE update_assignment_status (
205     p_api_version                  IN            NUMBER
206   , p_init_msg_list                IN            VARCHAR2 DEFAULT NULL
207   , p_commit                       IN            VARCHAR2 DEFAULT NULL
208   , p_validation_level             IN            NUMBER   DEFAULT NULL
209   , x_return_status                OUT    NOCOPY VARCHAR2
210   , x_msg_count                    OUT    NOCOPY NUMBER
211   , x_msg_data                     OUT    NOCOPY VARCHAR2
212   , p_task_assignment_id           IN            NUMBER
213   , p_object_version_number        IN OUT NOCOPY NUMBER
214   , p_assignment_status_id         IN            NUMBER
215   , p_update_task                  IN            VARCHAR2 DEFAULT NULL
216   , p_show_on_calendar             IN            VARCHAR2 DEFAULT 'Y'
217   , x_task_object_version_number   OUT    NOCOPY NUMBER
218   , x_task_status_id               OUT    NOCOPY NUMBER
219   );
220 
221 END;