亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 數據庫 > Oracle > 正文

ORACLE ERP導數據(BOM清單)

2024-08-29 13:48:25
字體:
來源:轉載
供稿:網友

  
方法:把數據導入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
  component_sequence_id   number,
  component_quantity   number, --組件數量
  item_num    number, --項目序列
  Operation_seq_num   number, --工序序列
  component_item_id   number,
  component_item   varchar2(50),  --組件
  PLANNING_FACTOR   number,  --計劃%d100
  component_yield_factor  number,  --產出率d1
  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)
  select assembly_item,component_item,min(row_num),count(*)
  from cux_bill_temp
  group by assembly_item,component_item
  having count(*)>1;
 假如有重復的Item,則要刪除(或是重新合并)
delete cux_bill_temp
where row_num in (select min(row_num) from cux_bill_temp
 
group by assembly_item,component_item
  having count(*)>1);
以下步驟為選做(如有重復才做,沒有重復不做7-10)
7、再重新建立一個臨時表(對于有重復數據,則只取一條數據,現取row_num最小的一條)
  drop table cux_bill_a;

create table cux_bill_a
as
select assembly_item,
 component_item,
 component_quantity,
 PLANNING_FACTOR,
 component_yield_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,
 component_item,
 component_quantity,
 PLANNING_FACTOR,
 component_yield_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,
 component_item,
 component_quantity,
 PLANNING_FACTOR,
 component_yield_factor,
 supply_type,
 supply_subinventory,
 OPTIONAL_disp,
 MUTUALLY_EXCLUSIVE_O_disp,
 attribute1,
 row_num)
select assembly_item,
 component_item,
 component_quantity,
 PLANNING_FACTOR,
 component_yield_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、再檢查一次表,是否有重復的數據
   select assembly_item,component_item,min(row_num),count(*)
from cux_bill_temp
group by assembly_item,component_item
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
select distinct component_item item
from cux_bill_temp b
where not exists (select null from mtl_system_items where segment1=b.component_item and organization_id=2)
)
order by item;
13、假如在mtl_system_items中,有不存在的物品ITEM時,要把其刪除(或是把這些物品Item導入到系統中)
  刪除:delete cux_bill_temp b
        where  not exists (select null from mtl_system_items where segment1=b.component_item and organization_id=2);
        delete cux_bill_temp a
        where not exists  (select null from mtl_system_items where segment1=a.assembly_item  and organization_id=2);
14、對沒有物品Item的進行處理,把其放入另一臨時表cux_item_temp中(以備查詢及導入mtl_system_items表中)
   delete cux_item_temp;

insert into cux_item_temp(
 segment1,description)
select distinct item,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
select distinct component_item item
from cux_bill_temp b
where not exists (select null from mtl_system_items where segment1=b.component_item and organization_id=2)
)
;

將找到沒有ITEM的BOM數據放到另一個表中,以備下次ITEM導入后在導BOM
create table cux_bom_temp1
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
select distinct component_item item
from cux_bill_temp b
where not exists (select null from mtl_system_items where segment1=b.component_item and organization_id=2)
)
-----------------------------------------------------------------------------------------------------------

15、從表mtl_system_items中把物品的編碼ID加入中轉表cux_bill_temp表(從項目主組織)中
  update cux_bill_temp b
     set assembly_item_id=(select inventory_item_id from mtl_system_items
   where segment1=b.assembly_item and organization_id=2),
         component_item_id=(select inventory_item_id from mtl_system_items
                             where segment1=b.component_item and organization_id=2);
16、查看是否有沒有物品ID的編碼存在(既沒有物品的ID被導入臨時表cux_bill_temp中)
   select row_num
     from cux_bill_temp
    where assembly_item_id is null or component_item_id is null;
17、對其中導入的數據進行處理
   update cux_bill_temp
      set OPTIONAL=1
    where upper(OPTIONAL_disp) like 'Y%';

   update cux_bill_temp
      set OPTIONAL=2
    where OPTIONAL is null;

   update cux_bill_temp
      set MUTUALLY_EXCLUSIVE_OPTIONS=1
    where upper(MUTUALLY_EXCLUSIVE_O_DISP) like 'Y%';

   update cux_bill_temp
      set MUTUALLY_EXCLUSIVE_OPTIONS=2
    where MUTUALLY_EXCLUSIVE_O_DISP is null;
18、查看cux_bill_temp中的數據處理是否有漏
  select count(*)
    from cux_bill_temp
   where OPTIONAL is null
      or MUTUALLY_EXCLUSIVE_OPTIONS is null
      or assembly_item_id is null
      or component_item_id is null;
19、更新其內的WIP_SUPPLY_TYPE;

  update cux_bill_temp
     set WIP_SUPPLY_TYPE=6
   where component_item like 'B%';
20、刪除表中的包(cux_bill_temp中),其相對應于表bom_bill_of_materials(既在表中已經存在了些選項包,不必導入包頭,只需導入包內容既可)
  delete cux_bill_temp t
where exists (select null from bom_bill_of_materials where assembly_item_id=t.assembly_item_id and organization_id=2);
21、利用已經寫好的包寫入數據(既寫入接口表bom_bill_of_mtls_interface)
   exec cux_bom_temp.insert_bill_15(1);
select count(*) from cux_bill_temp temp
where exits (select null from bom_inventory_components  b
           where temp.bill_sequence_id=b.bill_sequence_id
             and temp.component_item_id=b.component_item_id);

delete cux_bill_temp temp
where exists (select null from bom_inventory_components  b
           where b.bill_sequence_id=temp.bill_sequence_id
             and b.component_item_id=temp.component_item_id);

   exec cux_bom_temp.insert_bill_10(1);
22、對寫入的數據在接口表中的情況進行查看
   select count(*) from bom_bill_of_mtls_interface;
23、接著更新
  exec cux_bom_temp.insert_bill_15(1);

  select count(*) from cux_bill_temp where bill_sequence_id is null;
 
  exec cux_bom_temp.insert_bill_20(1);
去提交請求

select count(*) from bom_inventory_comps_interface;
(導入成功后)對組件進行排序
  exec cux_bom_temp.update_bill_item_num4;

  select count(*) from bom_inventory_comps_interface;
24、對于接口表中的數據進行導入
delete bom_bill_of_mtls_interface;
insert into bom_bill_of_mtls_interface(
 assembly_type,assembly_item_id,
 organization_id,
        PRocess_flag,transaction_type)
select  distinct 1,assembly_item_id,
 1,
 1,'CREATE'
from cux_bill_temp;

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
国产成人精品一区二区在线| 欧美精品在线观看91| 亚洲aa中文字幕| 国模极品一区二区三区| 成人黄色在线播放| 国产精品欧美日韩一区二区| 国产精品1区2区在线观看| 尤物yw午夜国产精品视频明星| 精品在线观看国产| 欧美第一黄网免费网站| 国产精品视频一区二区高潮| 亚洲国产精品推荐| 欧美福利视频网站| 日韩福利在线播放| 国产日韩中文字幕| 亚洲精品大尺度| 国产精国产精品| 日韩精品免费综合视频在线播放| 亚洲r级在线观看| 欧美日韩成人在线视频| 国产在线视频不卡| 1769国内精品视频在线播放| 91中文字幕一区| 日韩欧美在线视频免费观看| 国产精品一区专区欧美日韩| 国产在线视频2019最新视频| 国产精品美女999| 欧美性视频网站| 国产aⅴ夜夜欢一区二区三区| 91丨九色丨国产在线| 日韩av理论片| 亚洲2020天天堂在线观看| 欧美丝袜第一区| 日韩欧亚中文在线| 久久亚洲精品视频| 成人免费福利在线| 国产成人短视频| 中文字幕日韩在线播放| 色综合影院在线| 夜夜嗨av一区二区三区四区| 国产91精品视频在线观看| 国产精品视频色| 日韩av手机在线观看| 欧美黑人巨大精品一区二区| 欧美在线观看视频| 成人免费网站在线| 国产精品91久久| 国产精品成人一区二区| 日韩欧美在线一区| 久久久噜噜噜久久久| 国产精品v片在线观看不卡| 欧美亚洲成人网| 亚洲天堂av高清| 日本欧美一级片| 中文字幕日韩欧美| 欧美激情免费视频| 亚洲欧美中文字幕在线一区| 亚洲欧美激情一区| 欧美性感美女h网站在线观看免费| 久久久久久免费精品| 欧美黑人一级爽快片淫片高清| 成人www视频在线观看| 亚洲激情自拍图| 日本中文字幕久久看| 91久久久亚洲精品| 欧美在线精品免播放器视频| 亚洲美女视频网站| 欧美精品videosex性欧美| 亚洲曰本av电影| 国产精品爱久久久久久久| 中文字幕一区二区精品| 91美女高潮出水| 国产精品九九久久久久久久| 国产精品久久久久久五月尺| 精品视频久久久| 黄色91在线观看| 久久久精品日本| 国产一区二区香蕉| 国产精品爽黄69天堂a| 岛国精品视频在线播放| 日韩视频永久免费观看| 亚洲欧美自拍一区| 欧美大尺度激情区在线播放| 日韩国产高清污视频在线观看| 中文字幕日韩欧美在线视频| 久久资源免费视频| 九九热精品视频| 国产亚洲精品美女| 2021国产精品视频| 久久久久久国产免费| 久久精品国产综合| 91精品视频观看| 日韩欧美亚洲一二三区| 成人精品网站在线观看| 亚洲二区在线播放视频| 这里只有精品久久| 欧美性猛交xxxx黑人| 亚洲成人激情在线| 欧美日韩国产va另类| 91精品国产乱码久久久久久蜜臀| 日韩有码在线观看| 久久影视电视剧免费网站清宫辞电视| 日韩电影大全免费观看2023年上| 国产精品久久久久久久久| 日韩欧美在线视频免费观看| 91日韩在线播放| 国产亚洲日本欧美韩国| 4k岛国日韩精品**专区| 久久久久久久影视| 成人激情在线观看| 日韩在线视频线视频免费网站| 亚洲欧美一区二区三区久久| 亚洲精品中文字幕女同| 欧美日韩成人在线观看| 国产精品久久久av| 欧美日韩激情视频| 少妇精69xxtheporn| 欧美韩国理论所午夜片917电影| 青青草99啪国产免费| 亚洲无限乱码一二三四麻| 日本一区二区在线免费播放| 久久精品久久久久久国产 免费| 中文字幕日韩av综合精品| 日韩av综合网站| 中文字幕视频一区二区在线有码| 久久亚洲一区二区三区四区五区高| 国产精品盗摄久久久| 久久精品国产亚洲| 亚洲精品久久久久中文字幕欢迎你| 欧美日韩国产一区中文午夜| 国产日本欧美一区二区三区在线| 亚洲桃花岛网站| 日韩视频免费在线| 中文字幕日韩av综合精品| 国产在线观看91精品一区| 欧美午夜宅男影院在线观看| 日韩美女视频免费在线观看| 欧美极品在线播放| 精品国产一区二区三区久久狼黑人| 久久久久久一区二区三区| 欧美激情一区二区三区久久久| 国产91色在线免费| 精品久久国产精品| 国产精品亚洲综合天堂夜夜| 国内偷自视频区视频综合| 在线一区二区日韩| 久久国产精品影视| 欧美日韩精品在线观看| 日韩视频免费大全中文字幕| 性金发美女69hd大尺寸| 两个人的视频www国产精品| 国产一区二区三区在线播放免费观看| 国产丝袜一区二区三区| 成人精品视频久久久久| 欧美日韩一区二区三区在线免费观看| 国产精品一区二区电影| 欧美区在线播放| 综合国产在线视频| 川上优av一区二区线观看| 日韩视频中文字幕| 在线精品高清中文字幕| 亚洲激情第一页| 不卡av在线网站| 欧美激情精品在线|