体验零代码搭建

ORACLE ERP导数据(BOM清单)

网友投稿  ·  2023-05-25 02:05  ·  所有内容  ·  阅读 440


【 技术文档】 方法:把数据导入BOM清单的方法是,把数据导入接口表中,让其自动运行既可。上传文件的时候,要注意使 用ASCII字符模式。 1、自己建立一中转表 drop table cux_bill_temp; create table cux_bill_temp( bill_sequence_id number, assembly_item_id number, organization_id

ORACLE ERP导数据(BOM清单)

ORACLE ERP导数据(BOM清单)

【 技术文档】

方法:把数据导入BOM清单的方法是,把数据导入接口表中,让其自动运行既可。上传文件的时候,要注意使 用ASCII字符模式。

1、自己建立一中转表

drop table cux_bill_temp;

create table cux_bill_temp(

bill_sequence_id number,

assembly_item_id number,

organization_id number,

assembly_item varchar2(50), --BOM

item_num number, --项目序列

operation_seq_num number, --工序序列

PLANNING_FACTOR number, --计划%d100

wip_supply_type number, --供应类型

supply_type varchar2(50),

supply_subinventory varchar2(50), --供应子库存

OPTIONAL number, --可选的

OPTIONAL_disp varchar2(10), --可选的

MUTUALLY_EXCLUSIVE_OPTIONS number, --互不相容

MUTUALLY_EXCLUSIVE_O_disp varchar2(10), --互不相容

attribute1 varchar2(50), --排序号

row_num number)

;

2、删除中转表中的数据

delete cux_bill_temp;

3、把要导入的数据放在扩展名为*.csv的文件中,且要相对应于中转表的字段,本例中的文件名为bill.csv。

另外的脚本文件为bill.ctl,其内容如下:

options (skip=1) //跳过第一行,一般第一行为其字段说明

LOAD DATA

INFILE bill.csv //bill.csv为数据文件

APPEND

INTO TABLE cux_bill_temp

FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'

(与中转表相对应的字段列表)

登录进入ORACLE数据库服务器,利用命令:(sqlload 用户名/密码@数据库名)载入文件bill.csv的数据入中转表。

4、查看中转表中的记录数(以备导入数据后进行对比)

select count(*) from cux_bill_temp;

5、去除导入时在表bill.csv中的关键字段的空格字符,以免影响导入。

update cux_bill_temp

set ASSEMBLY_ITEM=replace(ASSEMBLY_ITEM,' ',''),

COMPONENT_ITEM=replace(COMPONENT_ITEM,' ','');

6、查看是否有重复的选项(既是否重复了Item)

from cux_bill_temp

having count(*)>1;

如果有重复的Item,则要删除(或是重新合并)

delete cux_bill_temp

where row_num in (select min(row_num) from cux_bill_temp

having count(*)>1);

以下步骤为选做(如有重复才做,没有重复不做7-10)

7、再重新建立一个临时表(对于有重复数据,则只取一条数据,现取row_num最小的一条)

drop table cux_bill_a;

create table cux_bill_a

as

select assembly_item,

PLANNING_FACTOR,

supply_type,

supply_subinventory,

OPTIONAL_disp,

MUTUALLY_EXCLUSIVE_O_disp,

attribute1,

min(row_num) row_num

from cux_bill_temp

group by assembly_item,

PLANNING_FACTOR,

supply_type,

supply_subinventory,

OPTIONAL_disp,

MUTUALLY_EXCLUSIVE_O_disp,

attribute1;

8、删除cux_bill_temp表

delete cux_bill_temp;

9、再重cux_bill_a表中把数据导入给cux_bill_temp表,完成把重复数据剔除的功能

insert into cux_bill_temp(

assembly_item,

PLANNING_FACTOR,

supply_type,

supply_subinventory,

OPTIONAL_disp,

MUTUALLY_EXCLUSIVE_O_disp,

attribute1,

row_num)

select assembly_item,

PLANNING_FACTOR,

supply_type,

supply_subinventory,

OPTIONAL_disp,

MUTUALLY_EXCLUSIVE_O_disp,

attribute1,

row_num

from cux_bill_a;

10、删除表cux_bill_a

drop table cux_bill_a;

11、再检查一次表,是否有重复的数据

from cux_bill_temp

having count(*)>1;

12、查看在mtl_system_items表中,既是在库存表中,有没有不存在的Item.

select distinct item

from (

select distinct assembly_item item

from cux_bill_temp b

where not exists (select null from mtl_system_items where segment1=b.assembly_item and organization_id=2)

union

from cux_bill_temp b

)

order by item;


PLM、ERP是制造业信息化主力军 << 上一篇
2023-05-25 02:05
遭遇经济危机实施中的ERP是否要暂停?
2023-05-25 02:05
下一篇 >>

相关推荐