

-- 预置数据  BOM版本规则
--zhaohui_zeng  2019-12-14

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionrule WHERE FID = 780605109909666816) 
insert into t_bd_bomversionrule (FID, FNUMBER, FSTATUS, FCREATORID, FMODIFIERID, FENABLE, FCREATETIME, FMODIFYTIME, FMASTERID, FCREATEORGID, FORGID, FCTRLSTRATEGY, FTYPE, FISDEFAULT)
values ('780605109909666816', '01', 'C', '780304743258919936', '780304743258919936', '1', {ts'2019-12-14 01:34:02'}, {ts'2019-12-14 01:34:02'}, '780605109909666816', '100000', '100000', '5', 'A', '1');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionrule_l WHERE FPKID = '0EVSP1LXW15L') 
insert into t_bd_bomversionrule_l (FPKID, FID, FLOCALEID, FNAME)
values ('0EVSP1LXW15L', '780605109909666816', 'zh_CN', '默认版本规则');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionrule_l WHERE FPKID = '0EVSP1LXW15M') 
insert into t_bd_bomversionrule_l (FPKID, FID, FLOCALEID, FNAME)
values ('0EVSP1LXW15M', '780605109909666816', 'zh_TW', '默認版本規則');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry WHERE FENTRYID = '780605109934832640') 
insert into t_bd_bomversionruleentry (FID, FENTRYID, FSEQ)
values ('780605109909666816', '780605109934832640', '1');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry WHERE FENTRYID = '780605109934832641') 
insert into t_bd_bomversionruleentry (FID, FENTRYID, FSEQ)
values ('780605109909666816', '780605109934832641', '2');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry WHERE FENTRYID = '780605109934832642') 
insert into t_bd_bomversionruleentry (FID, FENTRYID, FSEQ)
values ('780605109909666816', '780605109934832642', '3');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry WHERE FENTRYID = '780605109934832643') 
insert into t_bd_bomversionruleentry (FID, FENTRYID, FSEQ)
values ('780605109909666816', '780605109934832643', '4');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry WHERE FENTRYID = '780605109934832644') 
insert into t_bd_bomversionruleentry (FID, FENTRYID, FSEQ)
values ('780605109909666816', '780605109934832644', '5');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry WHERE FENTRYID = '780605109934832645') 
insert into t_bd_bomversionruleentry (FID, FENTRYID, FSEQ)
values ('780605109909666816', '780605109934832645', '6');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry WHERE FENTRYID = '780605109934832646') 
insert into t_bd_bomversionruleentry (FID, FENTRYID, FSEQ)
values ('780605109909666816', '780605109934832646', '7');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry WHERE FENTRYID = '780605109934832647') 
insert into t_bd_bomversionruleentry (FID, FENTRYID, FSEQ)
values ('780605109909666816', '780605109934832647', '8');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry WHERE FENTRYID = '780605109934832648') 
insert into t_bd_bomversionruleentry (FID, FENTRYID, FSEQ)
values ('780605109909666816', '780605109934832648', '9');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry_l WHERE FPKID = '0EVSP1LXW15N') 
insert into t_bd_bomversionruleentry_l (FPKID, FENTRYID, FLOCALEID, FVERSION)
values ('0EVSP1LXW15N', '780605109934832640', 'zh_CN', 'V1.0');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry_l WHERE FPKID = '0EVSP1LXW15O') 
insert into t_bd_bomversionruleentry_l (FPKID, FENTRYID, FLOCALEID, FVERSION)
values ('0EVSP1LXW15O', '780605109934832640', 'zh_TW', 'V1.0');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry_l WHERE FPKID = '0EVSP1LXW15P') 
insert into t_bd_bomversionruleentry_l (FPKID, FENTRYID, FLOCALEID, FVERSION)
values ('0EVSP1LXW15P', '780605109934832641', 'zh_CN', 'V2.0');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry_l WHERE FPKID = '0EVSP1LXW15Q') 
insert into t_bd_bomversionruleentry_l (FPKID, FENTRYID, FLOCALEID, FVERSION)
values ('0EVSP1LXW15Q', '780605109934832641', 'zh_TW', 'V2.0');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry_l WHERE FPKID = '0EVSP1LXW15R') 
insert into t_bd_bomversionruleentry_l (FPKID, FENTRYID, FLOCALEID, FVERSION)
values ('0EVSP1LXW15R', '780605109934832642', 'zh_CN', 'V3.0');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry_l WHERE FPKID = '0EVSP1LXW15S') 
insert into t_bd_bomversionruleentry_l (FPKID, FENTRYID, FLOCALEID, FVERSION)
values ('0EVSP1LXW15S', '780605109934832642', 'zh_TW', 'V3.0');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry_l WHERE FPKID = '0EVSP1LXW15T') 
insert into t_bd_bomversionruleentry_l (FPKID, FENTRYID, FLOCALEID, FVERSION)
values ('0EVSP1LXW15T', '780605109934832643', 'zh_CN', 'V4.0');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry_l WHERE FPKID = '0EVSP1LXW15U') 
insert into t_bd_bomversionruleentry_l (FPKID, FENTRYID, FLOCALEID, FVERSION)
values ('0EVSP1LXW15U', '780605109934832643', 'zh_TW', 'V4.0');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry_l WHERE FPKID = '0EVSP1LXW15V') 
insert into t_bd_bomversionruleentry_l (FPKID, FENTRYID, FLOCALEID, FVERSION)
values ('0EVSP1LXW15V', '780605109934832644', 'zh_CN', 'V5.0');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry_l WHERE FPKID = '0EVSP1LXW15W') 
insert into t_bd_bomversionruleentry_l (FPKID, FENTRYID, FLOCALEID, FVERSION)
values ('0EVSP1LXW15W', '780605109934832644', 'zh_TW', 'V5.0');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry_l WHERE FPKID = '0EVSP1LXW15X') 
insert into t_bd_bomversionruleentry_l (FPKID, FENTRYID, FLOCALEID, FVERSION)
values ('0EVSP1LXW15X', '780605109934832645', 'zh_CN', 'V6.0');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry_l WHERE FPKID = '0EVSP1LXW15Y') 
insert into t_bd_bomversionruleentry_l (FPKID, FENTRYID, FLOCALEID, FVERSION)
values ('0EVSP1LXW15Y', '780605109934832645', 'zh_TW', 'V6.0');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry_l WHERE FPKID = '0EVSP1LXW15Z') 
insert into t_bd_bomversionruleentry_l (FPKID, FENTRYID, FLOCALEID, FVERSION)
values ('0EVSP1LXW15Z', '780605109934832646', 'zh_CN', 'V7.0');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry_l WHERE FPKID = '0EVSP1LXW16+') 
insert into t_bd_bomversionruleentry_l (FPKID, FENTRYID, FLOCALEID, FVERSION)
values ('0EVSP1LXW16+', '780605109934832646', 'zh_TW', 'V7.0');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry_l WHERE FPKID = '0EVSP1LXW16/') 
insert into t_bd_bomversionruleentry_l (FPKID, FENTRYID, FLOCALEID, FVERSION)
values ('0EVSP1LXW16/', '780605109934832647', 'zh_CN', 'V8.0');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry_l WHERE FPKID = '0EVSP1LXW160') 
insert into t_bd_bomversionruleentry_l (FPKID, FENTRYID, FLOCALEID, FVERSION)
values ('0EVSP1LXW160', '780605109934832647', 'zh_TW', 'V8.0');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry_l WHERE FPKID = '0EVSP1LXW161') 
insert into t_bd_bomversionruleentry_l (FPKID, FENTRYID, FLOCALEID, FVERSION)
values ('0EVSP1LXW161', '780605109934832648', 'zh_CN', 'V9.0');

IF NOT EXISTS (SELECT 1 FROM t_bd_bomversionruleentry_l WHERE FPKID = '0EVSP1LXW162') 
insert into t_bd_bomversionruleentry_l (FPKID, FENTRYID, FLOCALEID, FVERSION)
values ('0EVSP1LXW162', '780605109934832648', 'zh_TW', 'V9.0');


-- 带组织基础资料要加管控策略 全局共享  BOM版本规则
--zhaohui_zeng  2019-12-14

IF NOT EXISTS (SELECT 1 FROM T_BD_DefaultCtrlStrategy WHERE FBASEDATAID = 'bd_bomversionrule') 
insert into T_BD_DefaultCtrlStrategy (FID, FNUMBER, FBASEDATAID, FCTRLVIEW, FDATATYPE, FDEFAULTMANAGESTRATEGY, FDEFAULTCTRLSTRATEGY, FISSYSTEM, FENABLE, FSTATUS, FCREATORID, FCREATETIME, FMODIFIERID, FMODIFYTIME, FDISABLERID, FDISABLEDATE, FAPPSYSTEMID, FMASTERID, FPLUGIN)
values ('780595171011410944', ' ', 'bd_bomversionrule', '4', '2', '1', '5', '0', '1', 'A', '780304743258919936', {ts'2019-12-14 01:34:02'}, '780304743258919936', {ts'2019-12-14 01:34:02'}, '0', null, '0efa1992000000ac', '780595171011410944', ' ');