-- 新增领料出库的编码规则 2019-8-22
-- t_cr_coderule
IF NOT EXISTS (SELECT 1 FROM t_cr_coderule WHERE fid = '/S9B8W3DWA45') 
INSERT INTO t_cr_coderule(FID, FNUMBER, FRULETYPE, FBIZOBJECTID, FSPLITSIGN, FCTRLMODE, FAPPMODE, FEXAMPLE, FEXAMPLELENGTH, FENABLE, FSTATUS, FCREATORID, FCREATETIME, FMODIFIERID, FMODIFYTIME, FDISABLERID, FDISABLEDATE, FMASTERID, FISUPDATERECOVER)
values ('05R=KQDVRXWV', ' ', null, 'im_materialreqoutbill', '-', '1', '2', ' ', ' ', '1', 'C', 1, {ts'2019-08-22 18:08:00'}, 1, {ts'2019-08-22 18:08:00'}, null, null, '05R=KQDVRXWV', '0');

-- t_cr_coderule_l
IF NOT EXISTS (SELECT 1 FROM t_cr_coderule_l WHERE FPKID = '05R=KQDVRUIL') 
insert into t_cr_coderule_l (FPKID, FID, FLOCALEID, FNAME) values ('05R=KQDVRUIL', '05R=KQDVRXWV', 'zh_CN', '领料出库单编码规则');

IF NOT EXISTS (SELECT 1 FROM t_cr_coderule_l WHERE FPKID = '05R=KQDVRUIK') 
insert into t_cr_coderule_l (FPKID, FID, FLOCALEID, FNAME) values ('05R=KQDVRUIK', '05R=KQDVRXWV', 'zh_TW', '領料出庫單編碼規則');

-- t_cr_coderuleentry
IF NOT EXISTS (SELECT 1 FROM t_cr_coderuleentry WHERE FENTRYID = '05R=KQET01U+') 
insert into t_cr_coderuleentry (FENTRYID, FID, FSEQ, FATTRIBUTETYPE, FATTUSINGMODE, FVALUEATRIBUTE, FFORMAT, FSETTINGVALUE, FLENGTH, FINITIAL, FSTEP, FADDCHAR, FISSPLITSIGN, FADDSTYLE, FCUTSTYLE, FISSORTITEM, FSPLITSIGN, FISVISABLE)
values ('05R=KQET01U+', '05R=KQDVRXWV', 0, '1', ' ', ' ', 'LLCK', ' ', 8, 1, 1, ' ', '0', '1', '1', '0', ' ', '1');

IF NOT EXISTS (SELECT 1 FROM t_cr_coderuleentry WHERE FENTRYID = '05R=KQET01U/') 
insert into t_cr_coderuleentry (FENTRYID, FID, FSEQ, FATTRIBUTETYPE, FATTUSINGMODE, FVALUEATRIBUTE, FFORMAT, FSETTINGVALUE, FLENGTH, FINITIAL, FSTEP, FADDCHAR, FISSPLITSIGN, FADDSTYLE, FCUTSTYLE, FISSORTITEM, FSPLITSIGN, FISVISABLE)
values ('05R=KQET01U/', '05R=KQDVRXWV', 1, '2', '1', 'biztime', 'yyMMdd', ' ', 8, 1, 1, ' ', '1', '1', '1', '1', '-', '1');

IF NOT EXISTS (SELECT 1 FROM t_cr_coderuleentry WHERE FENTRYID = '05R=KQET01U0') 
insert into t_cr_coderuleentry (FENTRYID, FID, FSEQ, FATTRIBUTETYPE, FATTUSINGMODE, FVALUEATRIBUTE, FFORMAT, FSETTINGVALUE, FLENGTH, FINITIAL, FSTEP, FADDCHAR, FISSPLITSIGN, FADDSTYLE, FCUTSTYLE, FISSORTITEM, FSPLITSIGN, FISVISABLE)
values ('05R=KQET01U0', '05R=KQDVRXWV', 2, '16', '1', ' ', ' ', ' ', 6, 1, 1, ' ', '1', '1', '1', '0', '-', '1');


-- 新增生产入库单的编码规则
IF NOT EXISTS (SELECT 1 FROM t_cr_coderule WHERE fid = '05OVGZV439UL') 
INSERT INTO T_CR_CODERULE (FID, FNUMBER, FRULETYPE, FBIZOBJECTID, FSPLITSIGN, FCTRLMODE, FAPPMODE, FEXAMPLE, FEXAMPLELENGTH, FENABLE, FSTATUS, FCREATORID, FCREATETIME, FMODIFIERID, FMODIFYTIME, FDISABLERID, FDISABLEDATE, FMASTERID, FISUPDATERECOVER) VALUES('05OVGZV439UL', ' ', NULL, 'im_productinbill', '-', '1', '2', ' ', ' ', '1', 'C', 1,  {ts'2019-08-21 17:14:25'}, 1,  {ts'2019-08-21 17:14:25'}, NULL, NULL, '05OVGZV439UL', '0');

IF NOT EXISTS (SELECT 1 FROM t_cr_coderule_l WHERE FPKID = '05OVGZV43DJE') 
INSERT INTO T_CR_CODERULE_L (FPKID, FID, FLOCALEID, FNAME) VALUES('05OVGZV43DJE', '05OVGZV439UL', 'zh_CN', '生产入库单编码规则');
IF NOT EXISTS (SELECT 1 FROM t_cr_coderule_l WHERE FPKID = '05OVGZV43DJD') 
INSERT INTO T_CR_CODERULE_L (FPKID, FID, FLOCALEID, FNAME) VALUES('05OVGZV43DJD', '05OVGZV439UL', 'zh_TW', '生產入庫單編碼規則');

IF NOT EXISTS (SELECT 1 FROM t_cr_coderuleentry WHERE FENTRYID = '05OVGZXN/H0F') 
INSERT INTO T_CR_CODERULEENTRY (FENTRYID, FID, FSEQ, FATTRIBUTETYPE, FATTUSINGMODE, FVALUEATRIBUTE, FFORMAT, FSETTINGVALUE, FLENGTH, FINITIAL, FSTEP, FADDCHAR, FISSPLITSIGN, FADDSTYLE, FCUTSTYLE, FISSORTITEM, FSPLITSIGN, FISVISABLE) VALUES('05OVGZXN/H0F', '05OVGZV439UL', 0, '1', ' ', ' ', 'SCRK', ' ', 8, 1, 1, ' ', '0', '1', '1', '0', ' ', '1');
IF NOT EXISTS (SELECT 1 FROM t_cr_coderuleentry WHERE FENTRYID = '05OVGZXN/H0G') 
INSERT INTO T_CR_CODERULEENTRY (FENTRYID, FID, FSEQ, FATTRIBUTETYPE, FATTUSINGMODE, FVALUEATRIBUTE, FFORMAT, FSETTINGVALUE, FLENGTH, FINITIAL, FSTEP, FADDCHAR, FISSPLITSIGN, FADDSTYLE, FCUTSTYLE, FISSORTITEM, FSPLITSIGN, FISVISABLE) VALUES('05OVGZXN/H0G', '05OVGZV439UL', 1, '2', '1', 'biztime', 'yyMMdd', ' ', 8, 1, 1, ' ', '1', '1', '1', '1', '-', '1');
IF NOT EXISTS (SELECT 1 FROM t_cr_coderuleentry WHERE FENTRYID = '05OVGZXN/H0H') 
INSERT INTO T_CR_CODERULEENTRY (FENTRYID, FID, FSEQ, FATTRIBUTETYPE, FATTUSINGMODE, FVALUEATRIBUTE, FFORMAT, FSETTINGVALUE, FLENGTH, FINITIAL, FSTEP, FADDCHAR, FISSPLITSIGN, FADDSTYLE, FCUTSTYLE, FISSORTITEM, FSPLITSIGN, FISVISABLE) VALUES('05OVGZXN/H0H', '05OVGZV439UL', 2, '16', '1', ' ', ' ', ' ', 6, 1, 1, ' ', '1', '1', '1', '0', '-', '1');


