Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method MappingActualPISPIPData ( 
 | 
  Strings businessTypes, 
 | 
  GlobalOTDTable globalOTDTable, 
 | 
  Boolean nuclear, 
 | 
  Strings organcodelist 
 | 
) 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    // renhao Aug-14-2023 (created) 
 | 
    listtodeal := selectset( globalOTDTable, 
 | 
                             Global_MappingActualProductInStockingPointInPeriod, 
 | 
                             actual, 
 | 
                             ( actual.ActualInventoryLevelEnd() > 0 ) and  
 | 
                             ( organcodelist.Find( actual.StockingPointID().SubString( 0, 3 ) ) >= 0 ) ); 
 | 
    totalcount := listtodeal.Size(); 
 | 
    info( "ActualPISPIP has " + totalcount.AsQUILL() + " rows in total" ); 
 | 
     
 | 
    count := 0; 
 | 
    traverse( listtodeal,Elements,actual){ 
 | 
      count := count + 1; 
 | 
      if( count - [Number](count/1000) * 1000 = 0 or count = totalcount ){ 
 | 
        info( "Now is dealing with the " + count.AsQUILL() + "ActualPISPIP " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" ); 
 | 
        } 
 | 
      product := select( this,MappingProduct,product,product.ID() = actual.ProductID() and product.KeyProduct() = nuclear,true); 
 | 
      if( not isnull( product)){ 
 | 
      if( not isnull(businessTypes)){ 
 | 
       
 | 
        for( i :=0 ;i < businessTypes.Size();i++ ){ 
 | 
          businessType := businessTypes.Element( i ); 
 | 
          if( product.BusinessType() = businessType and not product.IsCommon()){ 
 | 
            ActualProductInStockingPointInPeriod::CreateOrUpdate( this, 
 | 
                                                                  actual.ProductID(), 
 | 
                                                                  actual.StockingPointID(), 
 | 
                                                                  actual.Description(), 
 | 
                                                                  actual.ActualInventoryLevelEnd(), 
 | 
                                                                  actual.ManufacturedDate()); 
 | 
          } 
 | 
        } 
 | 
         
 | 
      }else{ 
 | 
        ActualProductInStockingPointInPeriod::CreateOrUpdate( this, 
 | 
                                                              actual.ProductID(), 
 | 
                                                              actual.StockingPointID(), 
 | 
                                                              actual.Description(), 
 | 
                                                              actual.ActualInventoryLevelEnd(), 
 | 
                                                              actual.ManufacturedDate()); 
 | 
      } 
 | 
         
 | 
      } 
 | 
    } 
 | 
  *] 
 | 
} 
 |