--库存事务  scm
--增加库存事务分组‘委外入库单’
delete from t_im_invschemegroup where fid = 989767452978082816
insert into t_im_invschemegroup (FID, FNUMBER, FPARENTID, FLEVEL, FLONGNUMBER, FISLEAF, FENABLE, FSTATUS, FCREATORID, FCREATETIME, FMODIFIERID, FMODIFYTIME, FDISABLERID, FDISABLEDATE, FMASTERID)
values (989767452978082816, 'ominbill', 0, 1, 'ominbill', '1', '1', 'C', 22132776, {ts'2019-10-08 10:34:02'}, 22132776, {ts'2019-10-08 10:34:02'}, 0, null, 989767452978082816);
--库存事务分组多语言
delete from t_im_invschemegroup_l where FPKID = '12JVSGYYWH2F';
insert into t_im_invschemegroup_l (FPKID, FID, FLOCALEID, FNAME, FFULLNAME)
values ('12JVSGYYWH2F', 989767452978082816, 'zh_CN', '委外入库单', '委外入库单');

delete from t_im_invschemegroup_l where FPKID = '12JVSGYYWH2G';
insert into t_im_invschemegroup_l (FPKID, FID, FLOCALEID, FNAME, FFULLNAME)
values ('12JVSGYYWH2G', 989767452978082816, 'zh_TW', '委外入庫單', ' ');

--增加库存事务--119-表头 1191
DELETE FROM t_im_invschemes where FID = 989769200216310784;
insert into t_im_invschemes (FID, FNUMBER, FCREATORID, FMODIFIERID, FENABLE, FCREATETIME, FMODIFYTIME, FMASTERID, FGROUPID, FDISABLERID, FDISABLEDATE, FINVDC, FTRANSCEIVERTYPEID, FINVSTATUSID, FISOUTUPDATE, FOUTINVSTATUSID, FOWNERTYPE, FKEEPERTYPE, FOUTOWNERTYPE, FOUTKEEPERTYPE, FISINUPDATE, FISPRESET, FBILLFORMID, FISNOTUPDATE)
values (989769200216310784, '119', 22132776, 22132776, '1', {ts'2019-10-08 10:34:02'}, {ts'2019-10-08 10:34:02'}, 989769200216310784, 989767452978082816, 0, null, 'A', 687616874967685120, 691928582720825344, '0','0', 'bos_org', 'bos_org', ' ', ' ', '1','1','im_mdc_ominbill', '0');

DELETE FROM t_im_invschemes where FID = 991113611055510528;
insert into t_im_invschemes (FID, FNUMBER, FCREATORID, FMODIFIERID, FENABLE, FCREATETIME, FMODIFYTIME, FMASTERID, FGROUPID, FDISABLERID, FDISABLEDATE, FINVDC, FTRANSCEIVERTYPEID, FINVSTATUSID, FISOUTUPDATE, FOUTINVSTATUSID, FOWNERTYPE, FKEEPERTYPE, FOUTOWNERTYPE, FOUTKEEPERTYPE, FISINUPDATE, FISPRESET, FBILLFORMID, FISNOTUPDATE)
values (991113611055510528, '1191', 22132776, 22132776, '1', {ts'2019-10-08 10:34:02'}, {ts'2019-10-08 10:34:02'}, 991113611055510528, 989767452978082816, 0, null, 'A', 687617195957770240, 691928582720825344, '0','0', 'bos_org', 'bos_org', ' ', ' ', '1','1','im_mdc_ominbill', '0');


DELETE FROM t_im_invschemes_l where FPKID = '12JW37HFUF8U';
insert into t_im_invschemes_l (FPKID, FID, FLOCALEID, FNAME, FDESCRIPTION)
values ('12JW37HFUF8U', 989769200216310784, 'zh_CN', '普通委外入库', '普通委外入库');

DELETE FROM t_im_invschemes_l where FPKID = '12JW37HFUF8V';
insert into t_im_invschemes_l (FPKID, FID, FLOCALEID, FNAME, FDESCRIPTION)
values ('12JW37HFUF8V', 989769200216310784, 'zh_TW', '普通委外入庫', '普通委外入庫');

DELETE FROM t_im_invschemes_l where FPKID = '12QA=XRF+X7+';
insert into t_im_invschemes_l (FPKID, FID, FLOCALEID, FNAME, FDESCRIPTION)
values ('12QA=XRF+X7+', 991113611055510528, 'zh_CN', '普通委外退货', '普通委外退货');

DELETE FROM t_im_invschemes_l where FPKID = '12QA=XRF+X7/';
insert into t_im_invschemes_l (FPKID, FID, FLOCALEID, FNAME, FDESCRIPTION)
values ('12QA=XRF+X7/', 991113611055510528, 'zh_TW', '普通委外退貨', '普通委外退貨');

--入库库存类型单据体
DELETE FROM t_im_invtypeentry WHERE FENTRYID = 989769200249865216;
insert into t_im_invtypeentry (FID, FENTRYID, FSEQ, FISDEFAULT, FINVTYPEID)
values (989769200216310784, 989769200249865216, 1, '1', 688884005529250816);

DELETE FROM t_im_invtypeentry WHERE FENTRYID = 989769200249865217;
insert into t_im_invtypeentry (FID, FENTRYID, FSEQ, FISDEFAULT, FINVTYPEID)
values (989769200216310784, 989769200249865217, 2, '0', 688884099724930048);

DELETE FROM t_im_invtypeentry WHERE FENTRYID = 991113611097453568;
insert into t_im_invtypeentry (FID, FENTRYID, FSEQ, FISDEFAULT, FINVTYPEID)
values (991113611055510528, 991113611097453568, 1, '1', 688884005529250816);

DELETE FROM t_im_invtypeentry WHERE FENTRYID = 991113611097453569;
insert into t_im_invtypeentry (FID, FENTRYID, FSEQ, FISDEFAULT, FINVTYPEID)
values (991113611055510528, 991113611097453569, 2, '0', 688884099724930048);


--关联业务类型
DELETE FROM t_im_biztypeentry WHERE FENTRYID = 989770710350066688;
insert into t_im_biztypeentry (FID, FENTRYID, FSEQ, FBIZTYPEID, FALLOWMANUALADD)
values (989769200216310784, 989770710350066688, 1, 966651870204521472, '1');

DELETE FROM t_im_biztypeentry WHERE FENTRYID = 991198649210155008;
insert into t_im_biztypeentry (FID, FENTRYID, FSEQ, FBIZTYPEID, FALLOWMANUALADD)
values (991113611055510528, 991198649210155008, 1, 990500657985463296, '1');


-- 委外入库单负数显红清单 scm 
IF NOT EXISTS (SELECT 1 FROM t_im_billfieldsetting WHERE FID = '990341398719007744') 
insert into t_im_billfieldsetting (FID, FBILL, FSTATUS, FENABLE, FCREATORID, FCREATETIME, FMODIFIERID, FMODIFYTIME, FNAME)
values ('990341398719007744', 'im_mdc_ominbill', 'C', '1', '1', {ts'2020-06-26 18:17:00'}, '1', {ts'2020-06-26 18:17:00'}, ' ');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951808') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951808', '1', '物料明细.数量', 'qty', 'billentry', 'billentry.qty', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951809') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951809', '2', '物料明细.基本数量', 'baseqty', 'billentry', 'billentry.baseqty', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951810') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951810', '3', '物料明细.辅助数量', 'qtyunit2nd', 'billentry', 'billentry.qtyunit2nd', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951811') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951811', '4', '物料明细.折扣额', 'discountamount', 'billentry', 'billentry.discountamount', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951812') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951812', '5', '物料明细.税额', 'taxamount', 'billentry', 'billentry.taxamount', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951813') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951813', '6', '物料明细.税额本位币', 'curtaxamount', 'billentry', 'billentry.curtaxamount', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951814') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951814', '7', '物料明细.金额', 'amount', 'billentry', 'billentry.amount', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951815') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951815', '8', '物料明细.金额本位币', 'curamount', 'billentry', 'billentry.curamount', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951816') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951816', '9', '物料明细.价税合计', 'amountandtax', 'billentry', 'billentry.amountandtax', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951817') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951817', '10', '物料明细.价税合计本位币', 'curamountandtax', 'billentry', 'billentry.curamountandtax', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951818') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951818', '11', '物料明细.剩余退库数量', 'remainreturnqty', 'billentry', 'billentry.remainreturnqty', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951819') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951819', '12', '物料明细.剩余退库基本数量', 'remainreturnbaseqty', 'billentry', 'billentry.remainreturnbaseqty', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951820') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951820', '13', '物料明细.剩余应付数量', 'remainjoinpriceqty', 'billentry', 'billentry.remainjoinpriceqty', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951821') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951821', '14', '物料明细.剩余应付基本数量', 'remainjoinpricebaseqty', 'billentry', 'billentry.remainjoinpricebaseqty', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951822') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951822', '15', '物料明细.累计退库数量', 'returnqty', 'billentry', 'billentry.returnqty', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951823') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951823', '16', '物料明细.累计退库基本数量', 'returnbaseqty', 'billentry', 'billentry.returnbaseqty', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951824') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951824', '17', '物料明细.累计应付数量', 'joinpriceqty', 'billentry', 'billentry.joinpriceqty', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951825') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951825', '18', '物料明细.累计应付基本数量', 'joinpricebaseqty', 'billentry', 'billentry.joinpricebaseqty', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951826') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951826', '19', '物料明细.已核销数量', 'verifyqty', 'billentry', 'billentry.verifyqty', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951827') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951827', '20', '物料明细.已核销基本数量', 'verifybaseqty', 'billentry', 'billentry.verifybaseqty', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951828') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951828', '21', '物料明细.未核销数量', 'unverifyqty', 'billentry', 'billentry.unverifyqty', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951829') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951829', '22', '物料明细.未核销基本数量', 'unverifybaseqty', 'billentry', 'billentry.unverifybaseqty', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951830') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951830', '23', '物料明细.VMI已结算数量', 'vmisettleqty', 'billentry', 'billentry.vmisettleqty', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951831') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951831', '24', '物料明细.VMI已结算基本数量', 'vmisettlebaseqty', 'billentry', 'billentry.vmisettlebaseqty', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951832') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951832', '25', '物料明细.VMI剩余结算数量', 'vmiremainsettleqty', 'billentry', 'billentry.vmiremainsettleqty', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951833') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951833', '26', '物料明细.VMI剩余结算基本数量', 'vmiremainsettlebaseqty', 'billentry', 'billentry.vmiremainsettlebaseqty', '1');

 IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '990341398760951833') 
insert into t_im_fieldsettingentry (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '990341398760951833', '26', '物料明细.VMI剩余结算基本数量', 'vmiremainsettlebaseqty', 'billentry', 'billentry.vmiremainsettlebaseqty', '1');

IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '1031791018783352832') 
insert into T_IM_FIELDSETTINGENTRY (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '1031791018783352832', 27, '物料明细.委外已核销数量', 'outverifyqty', 'billentry', 'billentry.outverifyqty', '1');

IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '1031791018783352833') 
insert into T_IM_FIELDSETTINGENTRY (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '1031791018783352833', 28, '物料明细.委外已核销基本数量', 'outverifybaseqty', 'billentry', 'billentry.outverifybaseqty', '1');

IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '1031791018783352834') 
insert into T_IM_FIELDSETTINGENTRY (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '1031791018783352834', 29, '物料明细.委外未核销数量', 'outunverifyqty', 'billentry', 'billentry.outunverifyqty', '1');

IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '1031791018783352835') 
insert into T_IM_FIELDSETTINGENTRY (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990341398719007744', '1031791018783352835', 30, '物料明细.委外未核销基本数量', 'outunverifybaseqty', 'billentry', 'billentry.outunverifybaseqty', '1');

IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '1031791464688076800') 
insert into T_IM_FIELDSETTINGENTRY (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990474800621166592', '1031791464688076800', 19, '物料明细.委外已核销数量', 'outverifyqty', 'billentry', 'billentry.outverifyqty', '1');

IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '1031791464688076801') 
insert into T_IM_FIELDSETTINGENTRY (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990474800621166592', '1031791464688076801', 20, '物料明细.委外已核销基本数量', 'outverifybaseqty', 'billentry', 'billentry.outverifybaseqty', '1');

IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '1031791464688076802') 
insert into T_IM_FIELDSETTINGENTRY (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990474800621166592', '1031791464688076802', 21, '物料明细.委外未核销数量', 'outunverifyqty', 'billentry', 'billentry.outunverifyqty', '1');

IF NOT EXISTS (SELECT 1 FROM t_im_fieldsettingentry WHERE FENTRYID = '1031791464688076803') 
insert into T_IM_FIELDSETTINGENTRY (FID, FENTRYID, FSEQ, FFIELDNAME, FFIELD, FENTRYENTITYID, FFULLFIELD, FISINVERSE)
values ('990474800621166592', '1031791464688076803', 22, '物料明细.委外未核销基本数量', 'outunverifybaseqty', 'billentry', 'billentry.outunverifybaseqty', '1');

