yanyuan
2023-08-30 eb958a9c253061d89ea524fe124b326369678557
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
Quintiq file version 2.0
#parent: #root
Method MappingForecastData (
  Strings businessTypes
)
{
  Description: 'ETL订单预测'
  TextBody:
  [*
    // yypsybs Aug-15-2023 (created)
    // 待处理数据
    listToDeal := construct( structured[MappingForecast] );
    if( isnull( businessTypes ) or businessTypes.Size() = 0 ) {
        listToDeal := selectset( this, MappingForecast, item, true );
    } else {
        listToDeal := selectset( this, MappingForecast, item, businessTypes.Find( item.BusinessType() ) <> -1 );
    }
    queryStartDate := guard( min( this, Period_MP, item, true, item.StartDate() ) - Duration::Days( 30 ), DateTime::MinDateTime() ).Date();
    queryEndDate := guard( max( this, Period_MP, item, true, item.EndDate() ), Date::MaxDate() );
    listToDeal := selectset( listToDeal, Elements, item, item.StartDate() >= queryStartDate and item.EndDate() <= queryEndDate );
    // 处理
    traverse( listToDeal, Elements, item ) {
        Forecast::CreateOrUpdate( this, 
                                  item.ProductID(), item.SalesSegmentName(), item.StockingPointID(), item.PriorityName(),
                                  item.CurrencyID(), item.UnitOfMeasureName(),
                                  item.ID(), item.StartDate(), item.EndDate(), item.Quantity(), item.Price());
    }
  *]
}