DELETE FROM t_mds_algorithmdef WHERE FID = 1424597104202016768;
INSERT INTO t_mds_algorithmdef(FID,FSRCBILL,FCREATETIME,FENABLE,FMODIFIERID,FISPRESET,FMODIFYTIME,FDESTBILL,FMASTERID,FSTATUS,FCREATORID,FNUMBER) VALUES (1424597104202016768,'mds_samplerecord',{ts'2018-08-08  18:08:08'},'1',1,'1',{ts'2018-08-08  18:08:08'},'mds_probabilityresult',1424597104202016768,'C',1,'qty_prob_s'); 

--多语言
DELETE FROM t_mds_algorithmdef_l WHERE FPKID = '2G+2UQ4WA4OR';
INSERT INTO t_mds_algorithmdef_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1424597104202016768,'2G+2UQ4WA4OR','zh_CN','历史用量概率算法'); 
DELETE FROM t_mds_algorithmdef_l WHERE FPKID = '2G+2UQ4WA4OS';
INSERT INTO t_mds_algorithmdef_l(FID,FPKID,FLOCALEID,FNAME) VALUES (1424597104202016768,'2G+2UQ4WA4OS','zh_TW','曆史用量概率算法'); 

--来源单据分录数据
DELETE FROM t_mds_algorithmsrc WHERE FENTRYID = 1424597104235571203;
INSERT INTO t_mds_algorithmsrc(FID,FCALDIMENSIONSRC,FCALMETHODSRC,FCALCULATEEXCSRC,FCALDIMENSIONVALSRC,FDESCRIBESRC,FENTRYID,FSEQ,FCALCULATETEXTSRC,FFIELDNAMESRC,FCALCULATEEXCSRC_TAG,FFIELDIDSRC) VALUES (1424597104202016768,' ','1','kd.mmc.mds.common.algorithm.handle.impl.ACCountHandler',' ','飞机总架数',1424597104235571203,4,'飞机总架数','单据头.飞机总架数','kd.mmc.mds.common.algorithm.handle.impl.ACCountHandler','account'); 
DELETE FROM t_mds_algorithmsrc WHERE FENTRYID = 1424597104235571204;
INSERT INTO t_mds_algorithmsrc(FID,FCALDIMENSIONSRC,FCALMETHODSRC,FCALCULATEEXCSRC,FCALDIMENSIONVALSRC,FDESCRIBESRC,FENTRYID,FSEQ,FCALCULATETEXTSRC,FFIELDNAMESRC,FCALCULATEEXCSRC_TAG,FFIELDIDSRC) VALUES (1424597104202016768,'物料编码','1','kd.mmc.mds.common.algorithm.handle.impl.UseACCountHandler','material','使用该件号的飞机架数',1424597104235571204,5,'使用该件号的飞机架数','单据头.使用该件号的飞机架数','kd.mmc.mds.common.algorithm.handle.impl.UseACCountHandler','useaccount'); 
DELETE FROM t_mds_algorithmsrc WHERE FENTRYID = 1424597104235571205;
INSERT INTO t_mds_algorithmsrc(FID,FCALDIMENSIONSRC,FCALMETHODSRC,FCALCULATEEXCSRC,FCALDIMENSIONVALSRC,FDESCRIBESRC,FENTRYID,FSEQ,FCALCULATETEXTSRC,FFIELDNAMESRC,FCALCULATEEXCSRC_TAG,FFIELDIDSRC) VALUES (1424597104202016768,'物料编码,计量单位','1','kd.mmc.mds.common.algorithm.handle.impl.Prev12MonthCountHandler','material,unit','近12个月数量',1424597104235571205,6,'近12个月数量','单据头.使用月数','kd.mmc.mds.common.algorithm.handle.impl.Prev12MonthCountHandler','usemonthcount'); 
DELETE FROM t_mds_algorithmsrc WHERE FENTRYID = 1424597104235571200;
INSERT INTO t_mds_algorithmsrc(FID,FCALDIMENSIONSRC,FCALMETHODSRC,FCALCULATEEXCSRC,FCALDIMENSIONVALSRC,FDESCRIBESRC,FENTRYID,FSEQ,FCALCULATETEXTSRC,FFIELDNAMESRC,FCALCULATEEXCSRC_TAG,FFIELDIDSRC) VALUES (1424597104202016768,'物料编码,计量单位','0','sum(qty)','material,unit',' ',1424597104235571200,1,'sum(使用数量)','单据头.总数量','{"expression":"sum(qty)","exprTran":"sum(使用数量)","description":{"zh_CN":""},"exprDesc":"sum(使用数量)","localeExprTran":{"zh_CN":"sum(使用数量)"}}','qty'); 
DELETE FROM t_mds_algorithmsrc WHERE FENTRYID = 1424597104235571201;
INSERT INTO t_mds_algorithmsrc(FID,FCALDIMENSIONSRC,FCALMETHODSRC,FCALCULATEEXCSRC,FCALDIMENSIONVALSRC,FDESCRIBESRC,FENTRYID,FSEQ,FCALCULATETEXTSRC,FFIELDNAMESRC,FCALCULATEEXCSRC_TAG,FFIELDIDSRC) VALUES (1424597104202016768,'物料编码,计量单位','0','max(qty)','material,unit',' ',1424597104235571201,2,'max(使用数量)','单据头.最大用量','{"expression":"max(qty)","exprTran":"max(使用数量)","description":{"zh_CN":""},"exprDesc":"max(使用数量)","localeExprTran":{"zh_CN":"max(使用数量)"}}','maxqty'); 
DELETE FROM t_mds_algorithmsrc WHERE FENTRYID = 1424597104235571202;
INSERT INTO t_mds_algorithmsrc(FID,FCALDIMENSIONSRC,FCALMETHODSRC,FCALCULATEEXCSRC,FCALDIMENSIONVALSRC,FDESCRIBESRC,FENTRYID,FSEQ,FCALCULATETEXTSRC,FFIELDNAMESRC,FCALCULATEEXCSRC_TAG,FFIELDIDSRC) VALUES (1424597104202016768,'物料编码,计量单位','0','min(qty)','material,unit',' ',1424597104235571202,3,'min(使用数量)','单据头.最小用量','{"expression":"min(qty)","exprTran":"min(使用数量)","description":{"zh_CN":""},"exprDesc":"min(使用数量)","localeExprTran":{"zh_CN":"min(使用数量)"}}','minqty'); 


--目标单据分录数据
DELETE FROM t_mds_algorithmdest WHERE FENTRYID = 1424597104235458562;
INSERT INTO t_mds_algorithmdest(FID,FFIELDIDDEST,FCALCULATEEXCDEST_TAG,FCALMETHODDEST,FFIELDNAMEDEST,FCALDIMENSIONDEST,FENTRYID,FDESCRIBEDEST,FSEQ,FCALCULATETEXTDEST,FCALCULATEEXCDEST,FCALDIMENSIONVALDEST) VALUES (1424597104202016768,'avgqty','{"expression":"qty /  useaccount ","exprTran":"总数量 /  使用该件号的飞机架数 ","description":{"zh_CN":""},"exprDesc":"总数量 /  使用该件号的飞机架数 ","localeExprTran":{"zh_CN":"总数量 /  使用该件号的飞机架数 "}}','0','单据头.平均用量',' ',1424597104235458562,' ',1,'总数量 /  使用该件号的飞机架数 ','qty /  useaccount ',' '); 
DELETE FROM t_mds_algorithmdest WHERE FENTRYID = 1424597104235458563;
INSERT INTO t_mds_algorithmdest(FID,FFIELDIDDEST,FCALCULATEEXCDEST_TAG,FCALMETHODDEST,FFIELDNAMEDEST,FCALDIMENSIONDEST,FENTRYID,FDESCRIBEDEST,FSEQ,FCALCULATETEXTDEST,FCALCULATEEXCDEST,FCALDIMENSIONVALDEST) VALUES (1424597104202016768,'useprobability','{"expression":"useaccount /  account ","exprTran":"使用该件号的飞机架数 /  飞机总架数 ","description":{"zh_CN":""},"exprDesc":"使用该件号的飞机架数 /  飞机总架数 ","localeExprTran":{"zh_CN":"使用该件号的飞机架数 /  飞机总架数 "}}','0','单据头.概率',' ',1424597104235458563,' ',2,'使用该件号的飞机架数 /  飞机总架数 ','useaccount /  account ',' '); 
DELETE FROM t_mds_algorithmdest WHERE FENTRYID = 1424597104235458564;
INSERT INTO t_mds_algorithmdest(FID,FFIELDIDDEST,FCALCULATEEXCDEST_TAG,FCALMETHODDEST,FFIELDNAMEDEST,FCALDIMENSIONDEST,FENTRYID,FDESCRIBEDEST,FSEQ,FCALCULATETEXTDEST,FCALCULATEEXCDEST,FCALDIMENSIONVALDEST) VALUES (1424597104202016768,'suggestqty','{"expression":"avgqty *  useprobability","exprTran":"平均用量 *  概率","description":{"zh_CN":""},"localeExprTran":{"zh_CN":"平均用量 *  概率"},"exprDesc":"平均用量 *  概率"}','0','单据头.建议数量',' ',1424597104235458564,' ',3,'平均用量 *  概率','avgqty *  useprobability',' '); 
DELETE FROM t_mds_algorithmdest WHERE FENTRYID = 1424597104235458565;
INSERT INTO t_mds_algorithmdest(FID,FFIELDIDDEST,FCALCULATEEXCDEST_TAG,FCALMETHODDEST,FFIELDNAMEDEST,FCALDIMENSIONDEST,FENTRYID,FDESCRIBEDEST,FSEQ,FCALCULATETEXTDEST,FCALCULATEEXCDEST,FCALDIMENSIONVALDEST) VALUES (1424597104202016768,'level','{"expression":"case when usemonthcount >= 1 and usemonthcount <=4  then ''Low'' when usemonthcount >= 5 and usemonthcount <=8  then ''Medium'' when usemonthcount >= 9 and usemonthcount <=12  then ''High'' else ''no movement'' end","exprTran":"case when usemonthcount >= 1 and usemonthcount <=4  then ''Low'' when usemonthcount >= 5 and usemonthcount <=8  then ''Medium'' when usemonthcount >= 9 and usemonthcount <=12  then ''High'' else ''no movement'' end","description":{"zh_CN":""},"exprDesc":"case when usemonthcount >= 1 and usemonthcount <=4  then ''Low'' when usemonthcount >= 5 and usemonthcount <=8  then ''Medium'' when usemonthcount >= 9 and usemonthcount <=12  then ''High'' else ''no movement'' end","localeExprTran":{"zh_CN":"case when usemonthcount >= 1 and usemonthcount <=4  then ''Low'' when usemonthcount >= 5 and usemonthcount <=8  then ''Medium'' when usemonthcount >= 9 and usemonthcount <=12  then ''High'' else ''no movement'' end"}}','0','单据头.频率等级',' ',1424597104235458565,' ',4,'case when usemonthcount >= 1 and usemonthcount <=4  then ''Low'' when usemonthcount >= 5 and usemonthcount <=8  then ''Medium'' when usemonthcount >= 9 and usemonthcount <=12  then ''High'' else ''no movement'' end','case when usemonthcount >= 1 and usemonthcount <=4  then ''Low'' when usemonthcount >= 5 and usemonthcount <=8  then ''Medium'' when usemonthcount >= 9 and usemonthcount <=12  then ''High'' else ''no movement'' end',' '); 


