/** 预置对公费用应用  **/
IF NOT EXISTS (select 1 from t_eb_structofbill where fid = 1272282989140655333)
INSERT INTO t_eb_structofbill(fid, flongnumber, fmemberid, fparentid, fisleaf, flevel, fnumber, fmodelid, fisdefault, freferedstatus, fstatus, fenable, fdisablerid, fdisabledate, fcreatorid, fcreatetime, fmodifierid, fmodifytime, ffieldtable, fmasterid, fseq, fisfromouter, fbilltype, ffullname, fname, fversion)
VALUES(1272282989140655333, ' ', 0, (SELECT maxid FROM (select max(fid) maxid from t_eb_structofbill where fbilltype = 'cloud' and fnumber = 'ESC')a), '0', 2, 'cexp', 0, '0', '0', 'C', '1', 0, NULL, 111111111111, {ts'2020-08-08  18:08:08'}, 111111111111, {ts'2020-08-08  18:08:08'}, ' ', 0, 0, '0', 'application', ' ', ' ', ' ');

IF NOT EXISTS (select 1 from t_eb_structofbill_l where fpkid = '2+9CLEMW6RCQ')
INSERT INTO t_eb_structofbill_l
(fpkid, fid, flocaleid, ffullname, fname, fversion)
VALUES('2+9CLEMW6RCQ', 1272282989140655333, 'zh_CN', ' ', '对公费用', ' ');

/** 修改暂估单名称  **/
update t_eb_structofbill_l set fname = '暂估单' where fid in (select fid from t_eb_structofbill where fnumber = 'er_costestimatebill');

/** 修改对公报销单、立项单、费用预提单、暂估单、预付单、费用分摊单  **/
update t_eb_structofbill set fparentid = 1272282989140655333 where fnumber in ('er_publicreimbursebill','er_applyprojectbill','er_withholdingbill','er_costestimatebill','er_prepaybill','er_expensesharebill');

/** 更改了单据的所属应用，维度匹配规则引用了应用，也做对应数据升级。  **/
update t_eb_dimmateruleapp set fapplication = 1272282989140655333,fshowname = '员工服务云.对公费用' where fentryid in (
	select a.fentryid from t_eb_dimmaterulebill a,t_eb_structofbill b where a.fbillid = b.fid and b.fnumber in ('er_publicreimbursebill','er_applyprojectbill','er_withholdingbill','er_costestimatebill','er_prepaybill','er_expensesharebill')
);


