yypsybs
2023-09-07 bc2de42011e9f28a3741bc0e340a9eef53e375d1
_Main/BL/Type_MacroPlan/Method_MappingCustomerOrderData.qbl
@@ -18,16 +18,25 @@
    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.OrderDate() >= queryStartDate and item.OrderDate() <= queryEndDate, not isnull( Product_MP::FindById( this, item.ProductID() ) ) and not isnull( StockingPoint_MP::FindById( this, item.StockPointID() ) ) and not isnull( SalesSegment_MP::FindByName( this, item.SalesSegmentName() ) ) );
    totalcount := listToDeal.Size();
    info( "CustomerOrder has " + totalcount.AsQUILL() + " rows in total" );
    count := 0;
    // 处理
    traverse( listToDeal, Elements, item ) {
      count := count + 1;
      if( count - [Number](count/100) * 100 = 0 or count = totalcount ){
        info( "Now is dealing with the " + count.AsQUILL() + "CustomerOrder " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" );
        }
    //  if( not isnull( Product_MP::FindById( this, item.ProductID() ) ) ){
        info( item.ProductID().AsQUILL() );
        CustomerOrder::CreateOrUpdate( this, item.CurrencyID(), item.Customer(), item.CustomerID(), item.ID(),
                                       item.OrderDate(), item.OrderID(), item.OrderLineID(), item.Price(),
                                       item.PriorityName(), item.ProductID(),
                                       item.StockPointID(),
                                       item.SalesSegmentName(),
                                       item.Quantity(), item.UnitOfMeasureName(), item.OrderType(), item.IsAvailable());
    //    info( item.ProductID().AsQUILL() );
      CustomerOrder::CreateOrUpdate( this, item.CurrencyID(), item.Customer(), item.CustomerID(), item.ID(),
                                     item.OrderDate(), item.OrderID(), item.OrderLineID(), item.Price(),
                                     item.PriorityName(), item.ProductID(),
                                     item.StockPointID(),
                                     item.SalesSegmentName(),
                                     item.Quantity(), item.UnitOfMeasureName(), item.OrderType(), item.IsAvailable());
    //  }else{
    //    info( "invaild product: " + item.ProductID().AsQUILL() );
    //    }