yypsybs
2023-09-09 3cb5a54def670d97301f07170fcaad213bfc54f2
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
Quintiq file version 2.0
#parent: #root
Method MappingCustomerOrderData (
  Strings businessTypes
)
{
  Description: 'ETL订单预测'
  TextBody:
  [*
    toDels := selectset( this, IOSalesDemandBase, item, item.istype( IOCustomerOrder ) );
    traverse( toDels, Elements, toDel ) {
      toDel.Delete();  
    }
    // 待处理数据
    toDealList := selectset( this, MappingCustomerOrder, item, true );
    if( not isnull( businessTypes ) and businessTypes.Size() > 0 ) {
        toDealList := selectset( toDealList, Elements, item, businessTypes.Find( item.BusinessType() ) >= 0 );
    }
    // todo 没macroPlan怎么搞
    //queryStartDate := guard( DateTime::Now() - 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( toDealList, Elements, item ) {
      this.IOSalesDemandBase( relnew, 
                              IOCustomerOrder, 
                              ID := item.ID(), 
                              CurrencyID := item.CurrencyID(), 
                              PriorityName := item.PriorityName(),
                              ProductID := item.ProductID(),
                              SalesSegmentName := item.SalesSegmentName(), 
                              StockingPointID := item.StockPointID(), 
                              UnitOfMeasureName := item.UnitOfMeasureName(),
                              CustomerID := item.CustomerID(),
                              CustomerName := item.Customer(),
                              OrderID := item.OrderID(), 
                              OrderLineID := item.OrderLineID(),
                              Price := item.Price(), 
                              Quantity := item.Quantity(), 
                              StartDate := item.OrderDate() );
                              
    }
  *]
}