lazhen
2024-10-08 c75cd6f6eb1e06a27e28c26ca9df0324b7ed675f
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
Quintiq file version 2.0
#parent: #root
StaticMethod ArchivedData (
  InterfaceDataset interfaceDataset,
  MacroPlan macroPlan
)
{
  TextBody:
  [*
    traverse ( macroPlan, SalesDemand.astype( Forecast ), forecast, not isnull( forecast.Product_MP() ) ){
    //  factory := f.Origin().Tokenize( "-" ).Element( 0 );
      product := forecast.Product_MP();
      traverse( forecast, PlanningSalesDemandInPeriod, sdip ){
        itrcf := selectobject( interfaceDataset, InterfaceForecast, tempITRCF, tempITRCF.PartNumber() = forecast.ProductID() and tempITRCF.Date() = sdip.StartDate() );
    
        if ( not isnull( itrcf ) ) {
          itrcf.Delete();
        }
      
        interfaceDataset.InterfaceForecast( relnew, 
                                             Date       := sdip.StartDate(),
                                             Factory    := forecast.SalesSegmentName(),
                                             PartNumber := forecast.ProductID(),
                                             Quantity   := sdip.Quantity(),
                                             Generation := product.Generation(),
                                             MLBMQB     := product.MQBMLB(),
                                             Power      := product.Power(),
                                             Origin     := forecast.Origin()
                                            );
      }
    }
  *]
}