25:
26:
27:
28: -- This procedure accepts job header, bills and routing information and inserts it into
29: -- WIP_JOB_SCHEDULE_INTERFACE table. This procedure inserts one record at a time, hence
30: -- this procedure needs to be called in a loop for multiple jobs being submitted
31: -- to WIP Mass Load. If all the records need to be processed by a single WIP Mass Load
32: -- request, they should all be passed in the the same group_id.
33:
40: )
41: IS
42:
43: -- Job Record to hold the Job header, bills and routing information being inserted
44: -- into wip_job_schedule_interface
45:
46: l_job_header_rec wip_job_schedule_interface%ROWTYPE;
47:
48:
42:
43: -- Job Record to hold the Job header, bills and routing information being inserted
44: -- into wip_job_schedule_interface
45:
46: l_job_header_rec wip_job_schedule_interface%ROWTYPE;
47:
48:
49: -- variables used for FND_LOG debug messages
50:
52: l_proc_level NUMBER := FND_LOG.LEVEL_PROCEDURE;
53: l_mod_name VARCHAR2(2000) := 'csd.plsql.csd_wip_job_pvt.insert_job_header.';
54:
55:
56: -- Constants Used for Inserting into wip_job_schedule_interface,
57: -- These are the values needed for WIP Mass Load to pick up the records
58:
59: -- Indicates that the process Phase is Validation
60: l_validation_phase CONSTANT NUMBER := 2;
152: l_job_header_rec.completion_subinventory := p_job_bill_routing_rec.completion_subinventory;
153: l_job_header_rec.completion_locator_id := p_job_bill_routing_rec.completion_locator_id;
154:
155:
156: --insert into table wip_job_schedule_interface
157: BEGIN
158: INSERT INTO wip_job_schedule_interface
159: (
160: last_update_date,
154:
155:
156: --insert into table wip_job_schedule_interface
157: BEGIN
158: INSERT INTO wip_job_schedule_interface
159: (
160: last_update_date,
161: last_updated_by,
162: creation_date,
242:
243: END insert_job_header;
244:
245: -- overloaded version of insert job header. receives the job header rec and inserts into the
246: -- wip_job_schedule_interface table.
247: -- The job header rec is created as ROWTYPE of wip_job_schedule_interface.
248: -- 12.1 Create Job from Estimates change, subhat.
249:
250: PROCEDURE insert_job_header
243: END insert_job_header;
244:
245: -- overloaded version of insert job header. receives the job header rec and inserts into the
246: -- wip_job_schedule_interface table.
247: -- The job header rec is created as ROWTYPE of wip_job_schedule_interface.
248: -- 12.1 Create Job from Estimates change, subhat.
249:
250: PROCEDURE insert_job_header
251: (
248: -- 12.1 Create Job from Estimates change, subhat.
249:
250: PROCEDURE insert_job_header
251: (
252: p_job_header_rec IN wip_job_schedule_interface%ROWTYPE,
253: x_return_status OUT NOCOPY VARCHAR2
254: )
255: IS
256:
254: )
255: IS
256:
257: -- Job Record to hold the Job header, bills and routing information being inserted
258: -- into wip_job_schedule_interface
259:
260: l_job_header_rec wip_job_schedule_interface%ROWTYPE := p_job_header_rec;
261:
262:
256:
257: -- Job Record to hold the Job header, bills and routing information being inserted
258: -- into wip_job_schedule_interface
259:
260: l_job_header_rec wip_job_schedule_interface%ROWTYPE := p_job_header_rec;
261:
262:
263: -- variables used for FND_LOG debug messages
264:
266: l_proc_level NUMBER := FND_LOG.LEVEL_PROCEDURE;
267: l_mod_name VARCHAR2(2000) := 'csd.plsql.csd_wip_job_pvt.insert_job_header.';
268:
269:
270: -- Constants Used for Inserting into wip_job_schedule_interface,
271: -- These are the values needed for WIP Mass Load to pick up the records
272:
273: -- Indicates that the process Phase is Validation
274: lc_validation_phase CONSTANT NUMBER := 2;
316: l_job_header_rec.last_updated_by := fnd_global.user_id;
317: l_job_header_rec.last_update_login := fnd_global.login_id;
318:
319:
320: --insert into table wip_job_schedule_interface
321: BEGIN
322: INSERT INTO wip_job_schedule_interface
323: (
324: wip_entity_id,
318:
319:
320: --insert into table wip_job_schedule_interface
321: BEGIN
322: INSERT INTO wip_job_schedule_interface
323: (
324: wip_entity_id,
325: interface_id,
326: last_update_date,
479:
480:
481: -- This procedure checks if the specified Job name exists in the
482: -- specified organization. It checks if it exists in
483: -- wip_entities or wip_job_schedule_interface table.
484: -- If it exists, then an Error status is returned.
485: -- If it does not exist in either of the tables, then
486: -- a Sucess status is returned.
487: -- This procedure is used whenever a job_name is generated, to confirm that
511: -- Job does not exist in WIP_entities, check if it is already inserted in the interface table by another
512: -- process and so may be in the process of getting into WIP.
513: -- If it exists, do not want to use this job name, so return Error
514:
515: Select count(*) into l_job_count from wip_job_schedule_interface where job_name = p_job_name and
516: organization_id = p_organization_id ;
517:
518: IF l_job_count = 0 THEN
519:
524: RETURN;
525:
526: ELSE
527:
528: -- Job exists in wip_job_schedule_interface table, hence return Error status
529:
530: x_return_status := FND_API.G_RET_STS_ERROR;
531: RETURN;
532:
788: -- WIP Mass Load and updates CSD tables with the newly created jobs information.
789: -- It achieves this by calling helper procedures.
790: --
791: -- This API inserts Job header, Bills and Routing information passed in into
792: -- WIP_JOB_SCHEDULE_INTERFACE table by calling procedure insert_job_header.
793: --
794: -- If job name is not passed in, then it is generated here by appending a
795: -- sequence generated number to the job_name_prefix passed in.
796: -- If job name is passed in, it is validated to make sure that it is unique
956:
957: l_default_ro_item := nvl(FND_PROFILE.VALUE('CSD_DEFAULT_RO_ITEM_AS_MATERIAL_ON_JOB'), 'N');
958:
959: -- Get the Group_id to be used for WIP Mass Load, All the records inserted into
960: -- wip_job_schedule_interface have the same group_id , so that one WIP Mass Load
961: -- request can process all the records
962:
963: if (l_default_ro_item = 'N') then
964: SELECT wip_job_schedule_interface_s.NEXTVAL INTO l_group_id FROM dual;
960: -- wip_job_schedule_interface have the same group_id , so that one WIP Mass Load
961: -- request can process all the records
962:
963: if (l_default_ro_item = 'N') then
964: SELECT wip_job_schedule_interface_s.NEXTVAL INTO l_group_id FROM dual;
965:
966: else
967: OPEN c_repair_line_info(p_repair_line_id);
968: FETCH c_repair_line_info into
1005:
1006: IF p_x_job_bill_routing_tbl.COUNT = 0 THEN
1007:
1008: if (l_default_ro_item = 'Y') then
1009: SELECT wip_job_schedule_interface_s.NEXTVAL INTO l_group_id FROM dual;
1010: End if;
1011:
1012: p_x_job_bill_routing_tbl(0).group_id := l_group_id;
1013:
1033: END IF;
1034:
1035:
1036: -- Call procedure to insert job header and job name information
1037: -- into wip_job_schedule_interface table
1038:
1039:
1040: insert_job_header( p_job_header_rec => p_job_header_rec,
1041: p_job_bill_routing_rec => l_job_bill_routing_rec,
1141:
1142: LOOP
1143:
1144: if (l_default_ro_item = 'Y') then
1145: SELECT wip_job_schedule_interface_s.NEXTVAL INTO l_group_id FROM dual;
1146: End if;
1147:
1148: p_x_job_bill_routing_tbl(rt_ctr).group_id := l_group_id;
1149:
1198: 'Just before calling insert_job_header');
1199: END IF;
1200:
1201: -- Call procedure to insert job header and bills, routing information
1202: -- into wip_job_schedule_interface table
1203: -- All the records inserted into the WIP interface table
1204: -- are passed the same group_id and hence will be processed by one WIP Mass Load
1205: -- request.
1206:
1788: p_ESTM_JOB_DETLS_REC_TYPE IN ESTM_JOB_DETLS_REC_TYPE
1789: ) IS
1790:
1791: -- Job Record to hold the Job header, bills and routing information being inserted
1792: -- into wip_job_schedule_interface
1793:
1794: l_job_header_rec wip_job_schedule_interface%ROWTYPE;
1795:
1796: lc_api_name CONSTANT VARCHAR2(30) := 'CREATE_WIP_JOB';
1790:
1791: -- Job Record to hold the Job header, bills and routing information being inserted
1792: -- into wip_job_schedule_interface
1793:
1794: l_job_header_rec wip_job_schedule_interface%ROWTYPE;
1795:
1796: lc_api_name CONSTANT VARCHAR2(30) := 'CREATE_WIP_JOB';
1797: lc_api_version_number CONSTANT NUMBER := 1.0;
1798:
1918:
1919:
1920: -- Get the Group_id to be used for WIP Create Job,
1921:
1922: SELECT wip_job_schedule_interface_s.NEXTVAL INTO l_job_header_rec.group_id FROM dual;
1923:
1924: l_job_header_rec.interface_id := l_job_header_rec.group_id;
1925:
1926: generate_job_name ( p_job_prefix =>l_job_prefix,
1975: END IF;
1976:
1977: -- Call procedure to insert job header and bills, routing
1978: -- information
1979: -- into wip_job_schedule_interface table
1980:
1981:
1982: insert_job_header( p_job_header_rec =>
1983: l_job_header_rec,