yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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
Quintiq file version 2.0
#parent: #root
Method ResetQuantitySetByOptimizer
{
  TextBody:
  [*
    // soh yee Sep-6-2015 (created)
    this.OptimizerFulfilledTargetInventoryQuantity( 0.0 ); 
    
    traverse( this, PlanningBaseSalesDemandInPeriod, sd )
    {
      sd.ResetOptimizerFulfillment(); 
    }
    
    // Example we have the following operations and we're going to set the supply qty for C to 0 (also means PT1 qty = 0).
    // A & B -> PT1 -> C
    // C & D -> PT2 -> E
    // Since supply of C = 0, reset optimizer fulfilled quantity for C and D (that belongs to same group) because supply of C is reset
    // The dependent demand in this input group will use the default factor instead of getting assigned factor from the optimizer.
    traverse( this, DependentDemand.DependentDemandInputGroup, ddgroup) //when we set the opt fulfilled qty = 0 then the optimizer should have the periodtaskop in scope because otherwise it can never set it back. 
    {
      traverse( ddgroup, PeriodTaskOperation.DependentDemandInputGroup, ddofsamegroup,
                ddofsamegroup.OperationInput().OperationInputGroup() = ddgroup.OperationInput().OperationInputGroup() )
      {
        ddofsamegroup.OptimizerFulfilledQuantity( 0.0 );
      }
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}