工单导入此处为离散任务导入
1、标准工单open interface
wip_job_schedule_interface
group_id | Number | wip_job_schedule_interface_s.NEXTVAL |
load_type | Number | 新建标准离散工单给1 1 Create Standard Discrete Job 2 Create Pending Repetitive Schedule 3 Update Standard or Non-Standard Discrete Job 4 Create Non-Standard Discrete Job |
allow_explosion | Varchar2(1) | N 需要自定义组件需求和工序,写入wip_job_dtls_interface Y 自动用标准BOM和Routing展开 |
process_phase | Number | 给2 2 Validation 3 Explosion 4 Completion 5 Creation |
process_status | Number | 给1 1 Pending 2 Running 3 Error 4 Complete 5 Warning |
status_type | Number | 工单状态 1 UnReleased 3 Released 需要开会计期 |
wip_supply_type | Number | 供应类型,不给的话默认是Based on Bill 1 Push 2 Assembly Pull 3 Operation Pull 4 Bulk 5 Supplier 6 Phantom 7 Based on Bill |
job_name | Varcahr2 | 任务号,不给的话系统自动生成 |
organization_id | Number | 库存Current Inv Organization |
class_code | Varchar2(10) | WIP_ACCOUNTING_CLASSES.class_code |
primary_item_id | Number | 装配件ID |
start_quantity | Number | 计划生产量;非标可以=0,标准必须>0;只能是主单位数量 |
scheduling_method | Number | 排产方法 1 Routing-based 2 Item Lead Time 3 Mannual |
first_unit_start_date | Date | 计划开始日期 |
source_code | Varchar2 | 来源代码,随便给,一般是来源系统名 |
5个who字段 |
| 习惯上都要给 |
insertintowip_job_schedule_interface WJSI
( WJSI.Group_Id,
WJSI.LOAD_TYPE,
WJSI.ALLOW_EXPLOSION,
WJSI.PROCESS_PHASE,
WJSI.PROCESS_STATUS,
WJSI.STATUS_TYPE,
WJSI.WIP_SUPPLY_TYPE,
WJSI.JOB_NAME,
WJSI.ORGANIZATION_ID,
WJSI.CLASS_CODE,
WJSI.PRIMARY_ITEM_ID,
WJSI.START_QUANTITY,
WJSI.SCHEDULING_METHOD,
WJSI.FIRST_UNIT_START_DATE,
WJSI.SOURCE_CODE,
WJSI.LAST_UPDATE_DATE,
WJSI.LAST_UPDATED_BY,
WJSI.CREATION_DATE,
WJSI.CREATED_BY,
WJSI.LAST_UPDATE_LOGIN)
values
(
1,
1,
'Y',
2,
1,
1,
1,
'jam_test',
85,
'JW-FPC',
38746,
100,
'1',
SYSDATE + 2,
'11',
SYSDATE,1553,SYSDATE,1553,NULL
)
2、标准工单API
DECLARE
l_iface_rec wip.wip_job_schedule_interface%ROWTYPE;
l_cur_mfg_org_id NUMBER := 85; --Current InvOrganization
l_user_id NUMBER := 1553; --User ID, Sysadmin here
x_return_status VARCHAR2(30);
x_return_message VARCHAR2(4000);
BEGIN
l_iface_rec.last_update_date := SYSDATE;
l_iface_rec.last_updated_by := l_user_id;
l_iface_rec.creation_date := SYSDATE;
l_iface_rec.created_by := l_user_id;
l_iface_rec.last_update_login := -1;
SELECT4INTO l_iface_rec.group_id FROM dual;
l_iface_rec.load_type := 1;
l_iface_rec.allow_explosion := 'Y';
l_iface_rec.process_phase := 2;
l_iface_rec.process_status := 1;
l_iface_rec.status_type := 1;
l_iface_rec.job_name := 'jam_test2';
l_iface_rec.organization_id := l_cur_mfg_org_id;
l_iface_rec.class_code := 'JW-FPC';
l_iface_rec.primary_item_id :=38746;
l_iface_rec.start_quantity := 10;
l_iface_rec.scheduling_method := '1';
l_iface_rec.first_unit_start_date:= SYSDATE;
l_iface_rec.source_code := 'Test Only';
l_iface_rec.source_line_id := 987654321;
INSERTINTO wip.wip_job_schedule_interface VALUES l_iface_rec;
dbms_output.put_line(l_iface_rec.group_id);
fnd_msg_pub.initialize;
x_return_status :=fnd_api.g_ret_sts_success;
wip_massload_pub.massloadjobs(p_groupid => l_iface_rec.group_id,
p_validationlevel => fnd_api.g_valid_level_full,
p_commitflag => 0, --1 commit; 0 nocommit
x_returnstatus =>x_return_status,
x_errormsg =>x_return_message);
IF (x_return_status <>fnd_api.g_ret_sts_success) THEN
dbms_output.put_line('x_return_status: ' ||x_return_status);
dbms_output.put_line('x_return_message: ' || x_return_message);
ENDIF;
EXCEPTION
WHENOTHERSTHEN
x_return_status :=fnd_api.g_ret_sts_unexp_error;
dbms_output.put_line('x_return_message: ' ||x_return_message);
RAISE;
END;
3、非标准工单
对于非标准工单我们不需要参考BOM展开,但是我们要添加组件,工序,资源
这样我们就需要用到wip_job_dtls_interface这个table
这个我试了一下比较麻烦,可自行研究