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
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
Method CheckOptimizerPuzzle (
  LibOpt_Task task
)
{
  TextBody:
  [*
    if ( this.DebugMode() ) 
    {
      debuginfo( '=== Start checking optimizer sub puzzle ===' ); 
      macroplan := this.MacroPlan(); 
      EPSILON := 1e-6; 
      traverse( macroplan, Unit, unit, not unit.IsInOptimizerPuzzle() ) 
      {
        traverse( unit, UnitPeriod, up ) 
        {
          diffup := up.DebugSubPuzzleQuantityToProcessPrior() - up.QuantityToProcess();  
          if ( abs ( diffup ) >= EPSILON )
          {
            msg := unit.Name() + [String] up.Start() + [String] up.Unit().IsInOptimizerPuzzle() +  'qty process diff=' + [String]  diffup;
            debuginfo( msg ); 
            task.Log( 'SUBPUZZLECHECK' + msg ); 
          }
        }
      }
      
      traverse( macroplan, StockingPoint_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriodPlanning, pispip ) 
      {
        if ( not pispip.ProductInStockingPoint_MP().Product_MP().IsInOptimizerPuzzle()
             or not pispip.ProductInStockingPoint_MP().StockingPoint_MP().isInOptimizerPuzzle() ) 
        {
          diffpispip := pispip.DebugSubPuzzleInventoryEndPrior() - pispip.InventoryLevelEnd(); 
          if ( abs(  diffpispip ) >= EPSILON ) 
          {
            msg := 'pispip inv end diff' + pispip.ProductInStockingPoint_MP().Name() + [String] pispip.Start() +  'diff = ' + [String] diffpispip +  
                        'prod:' + [String] pispip.ProductInStockingPoint_MP().Product_MP().IsInOptimizerPuzzle() + 
                        'sp:' + [String] pispip.ProductInStockingPoint_MP().StockingPoint_MP().isInOptimizerPuzzle(); 
            debuginfo( msg ); 
            task.Log( 'SUBPUZZLECHECK' + msg );               
          }
        }
      }
      debuginfo( '=== Finished checking optimizer sub puzzle ===' ); 
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}