陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
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
Quintiq file version 2.0
#parent: #root
Method GeneratePlanningMatrixData () id:Method_FormSupplyPlanWebClient_GeneratePlanningMatrixData
{
  #keys: '[127710.1.1993166152]'
  Body:
  [*
    // Generate shadow planning cells
    
    if( not isnull( DataHolderProductInSPIP.Data() ) and DataHolderProductInSPIP.Data().Size() > 0 )
    {   
      DataHolderShadowGlobalParameters.Data( null( shadow[GlobalParameters_MP], owning ) );
      owner := shadow( MacroPlan.GlobalParameters_MP() );
      DataHolderShadowGlobalParameters.Data( &owner );
      
      traverse ( DataHolderMatrixEditorColumns.Data(), Elements, period )
      {        
        traverse( DataHolderMatrixEditorRows.Data(), Elements, process ) // For each ROW
        {
          pisp := DataHolderProductInStockingPoints.Data().Element( 0 );
          pispip := select( pisp, ProductInStockingPointInPeriodPlanning, p, p.Period_MP() = period )
            
          qty := sum(  process, SupplyBase.astype(  NewSupply ), ns, ns.ProductInStockingPointInPeriodPlanning() = pispip, ns.Quantity() );
          //total qty this routing has produced on the selected pispip
          if( process.istype(  Operation ) )
          {
            routing := process.astype(  Operation ).RoutingStep().Routing();                                    
            qty := sum(  routing, OperationOutput.NewSupply, ns, ns.ProductInStockingPointInPeriodPlanning() = pispip, ns.Quantity() );
          }  
    
          // Create a new shadow AccountCostInPeriod
          DataHolderShadowGlobalParameters.Data().PlanningCell( relnew,
                                                                Process_MP := process,
                                                                ProductInStockingPointInPeriodPlanning := pispip,
                                                                Quantity := qty,
                                                                InventoryQuantity := pispip.InventorySupplyQuantity() + pispip.InventoryLevelStart() );
        }
      }
    }
  *]
}