--区分追加　伝票作成　取込
insert 
into mst_kbn( 
    kbtype
    , kbcd
    , kbmei
    , hyojijun
    , hyojimei
    , biko
    , haishifg
    , sakuseiuserid
    , sakuseinichiji
    , koshinuserid
    , koshinnichiji
) 
select
    'DENPYOSAKUSEIKB'
    , '4'
    , '取込'
    , 4
    , '取込'
    , '取込'
    , 0
    , 'admin'
    , clock_timestamp()
    , 'admin'
    , clock_timestamp() 
where
    not exists ( 
        select
            0 
        from
            mst_kbn 
        where
            kbtype = 'DENPYOSAKUSEIKB' 
            and kbcd = '4'
    )
;

--メニュー追加　受注取込
insert 
into mst_menu( 
    menucd
    , oyamenucd
    , menumei
    , hyojikb
    , kinocd
    , hyojijun
    , gaiyo
    , sakuseiuserid
    , sakuseinichiji
    , koshinuserid
    , koshinnichiji
    , kengengrp
    , haishifg
) 
select  
    '1056'
    , '0020'
    , '受注取込'
    , '2'
    , 'B000000007'
    , 207
    , 'CSVを取込受注を作成します。'
    , 'admin'
    , clock_timestamp()
    , 'admin'
    , clock_timestamp()
    , '1'
    , 0
where not exists (select 0 from mst_menu where menucd = '1056' and kengengrp = '1') 
;

