lihongji
2024-06-18 597f8e8f284b7494fceabaeb2c96e4496cfd2435
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Quintiq file version 2.0
#parent: #root
StaticMethod Create (
  Routing owner,
  Date startDate,
  Date endDate,
  Real percentage,
  String suffix
)
{
  TextBody:
  [*
    // rislai Jun-14-2024 (created)
    
    verifyData := select( owner,UphillRouting,ur,ur.Type() = suffix and LocalTool::IsOverlap( ur.StartDate(),ur.EndDate(),startDate,endDate ));
    if( not isnull( verifyData )){
      error( "设置的Start和End不可与已有数据的时间区间重叠。" ); 
    }
    
    data := owner.UphillRouting( relnew,StartDate := startDate, EndDate := endDate,Percentage := percentage,Type := suffix );
    
    copy_routing := owner.Copy( suffix + startDate.Format( "Y-M2-D2") );
    
    copy_routing.Start( startDate );
    
    copy_routing.End( endDate );
    
    traverse( copy_routing,OperationForPlanningMatrix,op){
      op.Throughput( op.Throughput() * ( percentage / 100) );
    }
    
    copy_routing.CopyUphillRouting( relset, data );
  *]
}