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
Quintiq file version 2.0
#parent: #root
Method SynchronizeDisaggregatedSalesDemandInPeriod (
  Boolean isdeleteinvalid
)
{
  Description: 'Create or delete disaggregatedSDiP based on fulfillment restriction.'
  TextBody:
  [*
    // Vincent Aug-30-2016 (created)
    
    salesdemands := construct( SalesDemandBases );
    
    // get all pispips of leaf product for considered period
    traverse( this.GetLeafPISPIPs(), Elements, leafpispip )
    { 
      // Get PISPIP of all the parent product level because that is where the aggregated SDiP are tied to.
      traverse( leafpispip.GetParentsOfProductDimension(), Elements.astype( ProductInStockingPointInPeriodPlanning ), parentpispip )
      {
        // get all the non-leaf sales demands
        sds := selectset( parentpispip, SalesDemandInPeriodBase.astype(AggregatedSalesDemandInPeriod ).SalesDemand, sd, true, true );
        salesdemands := salesdemands.Union( sds );
      }
    }
    
    traverse( salesdemands, Elements, sd )
    {           
      // synchronize disaggregated sdip to create dsdip for all possible product leaf
      sd.SynchronizeDisaggregatedSalesDemandInPeriod( false ); 
    }
  *]
}