[color=green]//There are average of 10~20 per orders one day
[/color]settablesize("Waves",duniform(10,20),2); [color=green]//Set the tablesize:"Waves"[/color]
for(int i=1;i<=gettablerows("Waves");i++)
{
settablenum("Waves",i,1,duniform(27,54));
}
若按照每天8h工作时间算,分摊下来没波次到达时间:time=28800/波次吗,则有:
[color=green]//Updat repeat time
[/color]int repeat = 28800/gettablerows("Waves"); //Arrival time of orders per day
setnodenum(node("/Tools/UserEvents/Waves>2/1",model()),repeat); //Set this time in node(repeat)
[color=green]//set the UserEvent1 num 1[/color];
treenode runnum=node("/Tools/UserEvents/Waves>variables/runnum",model());
setnodenum(runnum,1);
setnodenum(node("/Tools/UserEvents/Waves>variables/repeat",model()),1);
然后:完成上述Table "Waves" 以后,根据Waves中行中的值设置"Orders"的列,并表示1波次订单数,而此时"Orders"行中的值则表示需配送的货物的数量(如有需要,列数代表不同数量的货物),关键代码如下:
[color=seagreen]//Updat Global_Tables
[/color]
settablenum("Statistics",1,1,i); [color=green]//Statistics waves in "Statistics" row1 col1
[/color] settablesize("Orders",gettablenum("Waves",i,1),2); [color=green]//Set the tablesize:"Orders"[/color]
settablenum("Statistics",1,2,gettablerows("Orders")); [color=green]//Statistics Orders in "Statistics" row1 col2
[/color]
[color=green]//Updat Order list and Statistics
[/color]
int num1 = 0; //use num1 to Statistics the number of bulkgoods
int num2 = 0; //use num2 to Statistics the number of FCL