chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Quintiq file version 2.0
#parent: #root
StaticMethod Create (
  MPSync mpsync,
  String processname,
  const LibDEC_3DSProcessOperation op,
  Number sequencenr
)
{
  Description: 'Create routing step recursively from a single routing step from 3dspace.'
  TextBody:
  [*
    //yl todo check with qinyi
    // Create routing step
    IORoutingStep::FindCreate( mpsync,op.Name(), processname, sequencenr );
    sequencenr := sequencenr + 1;
    
    
    // Create operation
    unit := select( op, CanUseResource, e, true );
    unitid := guard( unit.GenericResourceId(), '' );
    
    IOOperation::FindCreate( mpsync, op.ID(), op.Name(), processname, op.Name(), unitid, 3600 / op.EstimatedTime().TotalInSeconds() );
    
    // Create input and output
    sp := select( mpsync, IOStockingPoint_MP, sp, true );
    traverse( op, Input, in )
    {
      IOOperationBOM::FindCreate( mpsync, in.ProcessOperationId(), in.ProductId(), sp.ID(), true /*isinput*/, in.Quantity() );
    }
    
    if( op.ToOperationTimeConstraint( relsize ) = 0 )
    {
      IOOperationBOM::FindCreate( mpsync, op.ID(), op.Process().OutputProductId(), sp.ID(), false /*isinput*/, 1.0 /*quantity*/ );
    }
    
    // Create operation link
    // Operation link
    traverse( op, ToOperationTimeConstraint, opflow )
    {
      IOOperationLink::FindCreate( mpsync,opflow.FromOperationId(), opflow.ToOperationId() );
        
      // Recursively create routing step
      toOP := opflow.ToOperation();
      IORoutingStep::Create( mpsync, processname, toOP, sequencenr );
    }
  *]
}