--版本定义
DELETE FROM t_mds_vrds WHERE FID = 1221728740803890176;
INSERT INTO t_mds_vrds(FID,FCYTYPE,FDTYPE,FLOSEDATE,FAUDITORID,FVERTYPE,FPERIODS,FINPUTCONTROL,FCREATEORGID,FMASTERID,FORGID,FSTATUS,FCTRLSTRATEGY,FAUDITORDATE,FNUMBER,FGROUPID,FDEFAULTORG,FCREATETIME,FMODIFIERID,FENABLE,FMODIFYTIME,FCREATORID,FPLANDM) VALUES (1221728740803890176,'1',0,NULL,0,'0',52,'material_org',100000,1221728740803890176,100000,'C','5',NULL,'Fcst',859139113973437000,0,{ts'2018-08-08  18:08:08'},1,'1',{ts'2018-08-08  18:08:08'},1,'0'); 
DELETE FROM t_mds_vrds WHERE FID = 1220352166984682496;
INSERT INTO t_mds_vrds(FID,FCYTYPE,FDTYPE,FLOSEDATE,FAUDITORID,FVERTYPE,FPERIODS,FINPUTCONTROL,FCREATEORGID,FMASTERID,FORGID,FSTATUS,FCTRLSTRATEGY,FAUDITORDATE,FNUMBER,FGROUPID,FDEFAULTORG,FCREATETIME,FMODIFIERID,FENABLE,FMODIFYTIME,FCREATORID,FPLANDM) VALUES (1220352166984682496,'1',0,NULL,0,'1',52,'material_org',100000,1220352166984682496,100000,'C','5',NULL,'Net-SOP',859139225407615000,0,{ts'2018-08-08  18:08:08'},1,'1',{ts'2018-08-08  18:08:08'},1,'0'); 
DELETE FROM t_mds_vrds WHERE FID = 1221729657536138240;
INSERT INTO t_mds_vrds(FID,FCYTYPE,FDTYPE,FLOSEDATE,FAUDITORID,FVERTYPE,FPERIODS,FINPUTCONTROL,FCREATEORGID,FMASTERID,FORGID,FSTATUS,FCTRLSTRATEGY,FAUDITORDATE,FNUMBER,FGROUPID,FDEFAULTORG,FCREATETIME,FMODIFIERID,FENABLE,FMODIFYTIME,FCREATORID,FPLANDM) VALUES (1221729657536138240,'1',0,NULL,0,'1',52,'material_org',100000,1221729657536138240,100000,'C','5',NULL,'Net-Fcst',859139225407615000,0,{ts'2018-08-08  18:08:08'},1,'1',{ts'2018-08-08  18:08:08'},1,'0'); 
DELETE FROM t_mds_vrds WHERE FID = 1221534959907378176;
INSERT INTO t_mds_vrds(FID,FCYTYPE,FDTYPE,FLOSEDATE,FAUDITORID,FVERTYPE,FPERIODS,FINPUTCONTROL,FCREATEORGID,FMASTERID,FORGID,FSTATUS,FCTRLSTRATEGY,FAUDITORDATE,FNUMBER,FGROUPID,FDEFAULTORG,FCREATETIME,FMODIFIERID,FENABLE,FMODIFYTIME,FCREATORID,FPLANDM) VALUES (1221534959907378176,'1',0,NULL,0,'0',52,'material',100000,1221534959907378176,100000,'C','5',NULL,'SOP',859139113973437000,0,{ts'2018-08-08  18:08:08'},1,'1',{ts'2018-08-08  18:08:08'},1,'0'); 
DELETE FROM t_mds_vrds WHERE FID = 1221730154234006528;
INSERT INTO t_mds_vrds(FID,FCYTYPE,FDTYPE,FLOSEDATE,FAUDITORID,FVERTYPE,FPERIODS,FINPUTCONTROL,FCREATEORGID,FMASTERID,FORGID,FSTATUS,FCTRLSTRATEGY,FAUDITORDATE,FNUMBER,FGROUPID,FDEFAULTORG,FCREATETIME,FMODIFIERID,FENABLE,FMODIFYTIME,FCREATORID,FPLANDM) VALUES (1221730154234006528,'1',0,NULL,0,'1',52,'material_org',100000,1221730154234006528,100000,'C','5',NULL,'ID',859139225407615000,0,{ts'2018-08-08  18:08:08'},1,'1',{ts'2018-08-08  18:08:08'},1,'0'); 
DELETE FROM t_mds_vrds WHERE FID = 1221730615523560448;
INSERT INTO t_mds_vrds(FID,FCYTYPE,FDTYPE,FLOSEDATE,FAUDITORID,FVERTYPE,FPERIODS,FINPUTCONTROL,FCREATEORGID,FMASTERID,FORGID,FSTATUS,FCTRLSTRATEGY,FAUDITORDATE,FNUMBER,FGROUPID,FDEFAULTORG,FCREATETIME,FMODIFIERID,FENABLE,FMODIFYTIME,FCREATORID,FPLANDM) VALUES (1221730615523560448,'0',0,NULL,0,'2',150,'material_org',100000,1221730615523560448,100000,'C','5',NULL,'DPS',1022364620804902912,0,{ts'2018-08-08  18:08:08'},1,'1',{ts'2018-08-08  18:08:08'},1,'0'); 

--版本定义多语言
DELETE FROM t_mds_vrds_l WHERE FPKID = '1U08JBKNO=V6';
INSERT INTO t_mds_vrds_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1221534959907378176,'1U08JBKNO=V6','zh_CN','SOP计划'); 
DELETE FROM t_mds_vrds_l WHERE FPKID = '1U08JBKNO=V7';
INSERT INTO t_mds_vrds_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1221534959907378176,'1U08JBKNO=V7','zh_TW','SOP計劃'); 
DELETE FROM t_mds_vrds_l WHERE FPKID = '1TWKJBVF70UC';
INSERT INTO t_mds_vrds_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1220352166984682496,'1TWKJBVF70UC','zh_CN','净SOP计划'); 
DELETE FROM t_mds_vrds_l WHERE FPKID = '1TWKJBVF70UD';
INSERT INTO t_mds_vrds_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1220352166984682496,'1TWKJBVF70UD','zh_TW','淨SOP計劃'); 
DELETE FROM t_mds_vrds_l WHERE FPKID = '1U15REKNFA0K';
INSERT INTO t_mds_vrds_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1221728740803890176,'1U15REKNFA0K','zh_CN','要货计划'); 
DELETE FROM t_mds_vrds_l WHERE FPKID = '1U15REKNFA0L';
INSERT INTO t_mds_vrds_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1221728740803890176,'1U15REKNFA0L','zh_TW','要貨計劃'); 
DELETE FROM t_mds_vrds_l WHERE FPKID = '1U15Y338Z4Y4';
INSERT INTO t_mds_vrds_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1221729657536138240,'1U15Y338Z4Y4','zh_CN','净要货计划'); 
DELETE FROM t_mds_vrds_l WHERE FPKID = '1U15Y338Z4Y5';
INSERT INTO t_mds_vrds_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1221729657536138240,'1U15Y338Z4Y5','zh_TW','淨要貨計劃'); 
DELETE FROM t_mds_vrds_l WHERE FPKID = '1U16/Q9DVA3R';
INSERT INTO t_mds_vrds_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1221730154234006528,'1U16/Q9DVA3R','zh_CN','独立需求'); 
DELETE FROM t_mds_vrds_l WHERE FPKID = '1U16/Q9DVA3S';
INSERT INTO t_mds_vrds_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1221730154234006528,'1U16/Q9DVA3S','zh_TW','獨立需求'); 
DELETE FROM t_mds_vrds_l WHERE FPKID = '1U1632C39Y6R';
INSERT INTO t_mds_vrds_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1221730615523560448,'1U1632C39Y6R','zh_CN','日排产计划'); 
DELETE FROM t_mds_vrds_l WHERE FPKID = '1U1632C39Y6S';
INSERT INTO t_mds_vrds_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1221730615523560448,'1U1632C39Y6S','zh_TW','日排產計劃');

--版本定义控制策略
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_mds_vrds_u')
DELETE FROM t_mds_vrds_u WHERE FDATAID = 1220352166984682496 and FUSEORGID = 100000;
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_mds_vrds_u')
INSERT INTO t_mds_vrds_u(FDATAID,FUSEORGID,FCREATEORGID) VALUES (1220352166984682496,100000,NULL); 
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_mds_vrds_u')
DELETE FROM t_mds_vrds_u WHERE FDATAID = 1221534959907378176 and FUSEORGID = 100000;
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_mds_vrds_u')
INSERT INTO t_mds_vrds_u(FDATAID,FUSEORGID,FCREATEORGID) VALUES (1221534959907378176,100000,NULL); 
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_mds_vrds_u')
DELETE FROM t_mds_vrds_u WHERE FDATAID = 1221728740803890176 and FUSEORGID = 100000;
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_mds_vrds_u')
INSERT INTO t_mds_vrds_u(FDATAID,FUSEORGID,FCREATEORGID) VALUES (1221728740803890176,100000,NULL); 
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_mds_vrds_u')
DELETE FROM t_mds_vrds_u WHERE FDATAID = 1221729657536138240 and FUSEORGID = 100000;
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_mds_vrds_u')
INSERT INTO t_mds_vrds_u(FDATAID,FUSEORGID,FCREATEORGID) VALUES (1221729657536138240,100000,NULL); 
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_mds_vrds_u')
DELETE FROM t_mds_vrds_u WHERE FDATAID = 1221730154234006528 and FUSEORGID = 100000;
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_mds_vrds_u')
INSERT INTO t_mds_vrds_u(FDATAID,FUSEORGID,FCREATEORGID) VALUES (1221730154234006528,100000,NULL); 
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_mds_vrds_u')
DELETE FROM t_mds_vrds_u WHERE FDATAID = 1221730615523560448 and FUSEORGID = 100000;
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_mds_vrds_u')
INSERT INTO t_mds_vrds_u(FDATAID,FUSEORGID,FCREATEORGID) VALUES (1221730615523560448,100000,NULL); 

--冲减顺序定义
DELETE FROM t_mds_setofforder WHERE FID = 1220322184170307584;
INSERT INTO t_mds_setofforder(FID,FCREATEORGID,FORDERTYPE,FORGID,FMASTERID,FTAILS,FSTATUS,FCTRLSTRATEGY,FAHEADS,FNUMBER,FCREATETIME,FMODIFIERID,FQTYPE,FENABLE,FMODIFYTIME,FCREATORID) VALUES (1220322184170307584,100000,'B',100000,1220322184170307584,100,'C','5',100,'冲减顺序',{ts'2018-08-08  18:08:08'},1,'A','1',{ts'2018-08-08  18:08:08'},1); 

--冲减顺序定义多语言
DELETE FROM t_mds_setofforder_l WHERE FPKID = '1TWEYW+MN0TR';
INSERT INTO t_mds_setofforder_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1220322184170307584,'1TWEYW+MN0TR','zh_CN','冲减顺序'); 
DELETE FROM t_mds_setofforder_l WHERE FPKID = '1TWEYW+MN0TS';
INSERT INTO t_mds_setofforder_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1220322184170307584,'1TWEYW+MN0TS','zh_TW','衝減順序'); 

--冲减顺序定义控制策略
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_mds_setofforder_u')
DELETE FROM t_mds_setofforder_u WHERE FDATAID = 1220322184170307584 and FUSEORGID = 100000;
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_mds_setofforder_u')
INSERT INTO t_mds_setofforder_u(FDATAID,FUSEORGID,FCREATEORGID) VALUES (1220322184170307584,100000,NULL);

--预测冲减定义
DELETE FROM t_mds_setoffsetting WHERE FID = 1220347167131043840;
INSERT INTO t_mds_setoffsetting(FID,FSETOFFORDERID,FPFILTER,FSFILTER_TAG,FCREATEORGID,FORGID,FMASTERID,FPFILTER_TAG,FSTATUS,FCTRLSTRATEGY,FPLANID,FNUMBER,FCREATETIME,FMODIFIERID,FENABLE,FSFILTER,FJOBID,FMODIFYTIME,FMOD,FCREATORID) VALUES (1220347167131043840,1220322184170307584,' ',' ',100000,100000,1220347167131043840,' ','C','5',' ','FN',{ts'2018-08-08  18:08:08'},1,'1',' ',' ',{ts'2018-08-08  18:08:08'},0,1); 

--预测冲减定义多语言
DELETE FROM t_mds_setoffsetting_l WHERE FPKID = '1TWJLXYR05+R';
INSERT INTO t_mds_setoffsetting_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1220347167131043840,'1TWJLXYR05+R','zh_CN','FN'); 
DELETE FROM t_mds_setoffsetting_l WHERE FPKID = '1TWJLXYR05+S';
INSERT INTO t_mds_setoffsetting_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1220347167131043840,'1TWJLXYR05+S','zh_TW','FN'); 

--预测冲减定义控制策略
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_mds_setoffsetting_u')
DELETE FROM t_mds_setoffsetting_u WHERE FDATAID = 1220347167131043840 and FUSEORGID = 100000;
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_mds_setoffsetting_u')
INSERT INTO t_mds_setoffsetting_u(FDATAID,FUSEORGID,FCREATEORGID) VALUES (1220347167131043840,100000,NULL); 

--预测冲减定义:需方取数设置
DELETE FROM t_mds_setoffsetent WHERE FENTRYID = 1220348602270877696;
INSERT INTO t_mds_setoffsetent(FID,FMANUSTRATEGY,FMANUSTRATEGYSUP,FENTRYID,FGFDATAID,FSEQ,FSXHCOPY,FXFDATAID) VALUES (1220347167131043840,' ',' ',1220348602270877696,1221567319860333568,1,0,1221566656925419520); 
DELETE FROM t_mds_setoffsetent WHERE FENTRYID = 1220348602270877697;
INSERT INTO t_mds_setoffsetent(FID,FMANUSTRATEGY,FMANUSTRATEGYSUP,FENTRYID,FGFDATAID,FSEQ,FSXHCOPY,FXFDATAID) VALUES (1220347167131043840,' ',' ',1220348602270877697,0,2,1,1221565392980297728); 

DELETE FROM t_mds_setoffsetents WHERE FENTRYID = 1220347167164598272;
INSERT INTO t_mds_setoffsetents(FID,FENTRYID,FSEQ,FSALESETID,FSXH) VALUES (1220347167131043840,1220347167164598272,1,1221566656925419520,0); 
DELETE FROM t_mds_setoffsetents WHERE FENTRYID = 1221588527217658880;
INSERT INTO t_mds_setoffsetents(FID,FENTRYID,FSEQ,FSALESETID,FSXH) VALUES (1220347167131043840,1221588527217658880,2,1221565392980297728,1); 


--预测冲减定义:供方取数设置
DELETE FROM t_mds_setoffsetentg WHERE FENTRYID = 1220347167164599298;
INSERT INTO t_mds_setoffsetentg(FID,FENTRYID,FSEQ,FPROVIDERSETID) VALUES (1220347167131043840,1220347167164599298,1,1221567319860333568); 

--需求计划方案定义
DELETE FROM t_mds_rplancal WHERE FID = 1220320898582578176;
INSERT INTO t_mds_rplancal(FTYPE,FDAYSOFWEEK,FPREDTIME,FREPEATTYPE,FAUDITORID,FAMOUNTTYPE,FPLANID,FOPENLV,FSTART,FISQUOTA,FAUDITDATE,FCREATETIME,FSETOFFVERID,FSOURCENAME,FEND,FJOBID,FSOURCETYPE,FPLANGRP,FID,FDTYPE,FPREDVERSION,FDEDUCT,FLOSEDATE,FRUNNINGLOG,FOUTLOOKPERIOD,FDATETYPE,FORGID,FSTYPE,FDAYSOFMON,FRUNNINGTYPE,FBILLSTATUS,FREPEAT,FBILLNO,FRUNNINGLOG_TAG,FCHANGEWAY,FDEDUCT_T,FMODIFIERID,FMODIFYTIME,FDEDUCT_H,FDUMMYSITEID,FMOD,FCREATORID,FCALSTATUS) VALUES (0,' ',-1,' ',1,'0',' ',0,NULL,'0',{ts'2018-08-08  18:08:08'},{ts'2018-08-08  18:08:08'},0,1220347167131043840,NULL,' ','mds_setoffsetting',0,1220320898582578176,0,1220352166984682496,'0',NULL,' ',1000.0000000000,'A',100000,'3',' ',' ','C','0','XQJHTASK-净SOP计算',' ','0',0,1,{ts'2018-08-08  18:08:08'},0,0,100.0000000000,1,'B');    

--需求计划方案定义多语言
DELETE FROM t_mds_rplancal_l WHERE FPKID = '1TWKOWJCAX=1';
INSERT INTO t_mds_rplancal_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1220320898582578176,'1TWKOWJCAX=1','zh_CN','净SOP计算'); 
DELETE FROM t_mds_rplancal_l WHERE FPKID = '1TWKOWJCAX=2';
INSERT INTO t_mds_rplancal_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1220320898582578176,'1TWKOWJCAX=2','zh_TW','淨SOP計算'); 

--周滚动设置
DELETE FROM t_mds_weekroll WHERE FID = 1221568020971801600;
INSERT INTO t_mds_weekroll(FID,FEXECSTATUS,FCREATEORGID,FORGID,FACCSTATUS,FMASTERID,FSTATUS,FCTRLSTRATEGY,FPLANID,FNUMBER,FCREATETIME,FMODIFIERID,FENABLE,FJOBID,FMODIFYTIME,FCREATORID) VALUES (1221568020971801600,'A',100000,100000,'A',1221568020971801600,'A','5',' ','ZGD',{ts'2018-08-08  18:08:08'},1,'1',' ',{ts'2018-08-08  18:08:08'},1); 

--周滚动设置多语言
DELETE FROM t_mds_weekroll_l WHERE FPKID = '1U0DQ98EAD+2';
INSERT INTO t_mds_weekroll_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1221568020971801600,'1U0DQ98EAD+2','zh_CN','周滚动设置'); 
DELETE FROM t_mds_weekroll_l WHERE FPKID = '1U0DQ98EAD+3';
INSERT INTO t_mds_weekroll_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1221568020971801600,'1U0DQ98EAD+3','zh_TW','周滾動設置'); 

--周滚动设置控制策略
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_mds_weekroll_u')
DELETE FROM t_mds_weekroll_u WHERE FDATAID = 1221568020971801600 and FUSEORGID = 100000;
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_mds_weekroll_u')
INSERT INTO t_mds_weekroll_u(FDATAID,FUSEORGID,FCREATEORGID) VALUES (1221568020971801600,100000,NULL); 

--发货取数设置
DELETE FROM t_mds_weekrollenta WHERE FENTRYID = 1221568020996967424;
INSERT INTO t_mds_weekrollenta(FID,FSETID,FENTRYID,FSEQ) VALUES (1221568020971801600,1221566656925419520,1221568020996967424,1); 
--周滚动设置：发货取数设置对应发货取数设置为 Closed Sales Order-1
DELETE FROM t_mds_weekrollenta WHERE FENTRYID = 1221568020996967424;
INSERT INTO t_mds_weekrollenta(FID,FSETID,FENTRYID,FSEQ) VALUES (1221568020971801600,1287701855035574272,1221568020996967424,1); 

--周滚动版本
DELETE FROM t_mds_weekrollentb WHERE FENTRYID = 1221568020996966402;
INSERT INTO t_mds_weekrollentb(FID,FENTRYID,FVERID,FSEQ) VALUES (1221568020971801600,1221568020996966402,1221534959907378176,1); 

