yypsybs
2023-10-17 8e333dbbfcb870feacf5a0996b5afe47bb9562a9
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
Quintiq file version 2.0
#parent: #root
StaticMethod CreateOrUpdate (
  const Operation op,
  GlobalOTDSOP parent
) as ManufactureLTProcessSection
{
  TextBody:
  [*
    // yypsybs Aug-25-2023 (created)
    orgCode := "";
    productId := "";
    processStep := "";
    sequence := "";
    line := "";
    // routingId = OrgCode_ProductID
    routingIdSplit := op.RoutingID().Tokenize( "_" );
    if( routingIdSplit.Size() = 2 ) {
        orgCode := routingIdSplit.Element( 0 );
        productId := routingIdSplit.Element( 1 );
    }
    // routingStepName = ProcessStep_Sequence
    routingStepNameSplit := op.RoutingStepName().Tokenize( "_" );
    if( routingStepNameSplit.Size() = 2 ) {
        processStep := routingStepNameSplit.Element( 0 );
        sequence := routingStepNameSplit.Element( 1 );
    }
    // operationName = OegCode_ProcessStep_Line
    operationNameSplit := op.Name().Tokenize( "_" );
    if( operationNameSplit.Size() = 3 ) {
        line := operationNameSplit.Element( 2 );
    }
    child := null( ManufactureLTProcessSection );
    //if( orgCode <> "" and productId <> "" and processStep <> "" and sequence <> "" ) {
      ltParent := ManufactureLTImputation::CreateOrUpdate( parent, orgCode, productId, "" );
      info( "DaysAsReal : " + [String]op.UserLeadTime().DaysAsReal() );
      child := ManufactureLTProcessSection::CreateOrUpdate( ltParent, processStep, false, sequence, line, op.UserLeadTime().DaysAsReal(), 0.0, "" );
    //} else {
    //  info( "skip operation" );
    //}
    return child;
  *]
}