hongji.li
2023-09-07 67ff28f43d635a3728bb7d39364a9c6f8345912b
_Main/BL/Type_MacroPlan/Method_MappingActualPISPIPData.qbl
@@ -9,12 +9,12 @@
  [*
    // renhao Aug-14-2023 (created)
    date := Date :: Today();
    listtodeal := selectset( this,MappingActualPISPIP,actual,true );
    listtodeal := selectset( this,MappingActualPISPIP,actual,not isnull( Product_MP::FindById( this, actual.ProductID() ) ) );
    totalcount := listtodeal.Size();
    info( "ActualPISPIP has " + totalcount.AsQUILL() + " rows in total" );
    
    count := 0;
    traverse( this,MappingActualPISPIP,actual){
    traverse( listtodeal,Elements,actual){
      count := count + 1;
      if( count - [Number](count/100) * 100 = 0 or count = totalcount ){
        info( "Now is dealing with the " + count.AsQUILL() + "ActualPISPIP " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" );
@@ -26,14 +26,22 @@
        for( i :=0 ;i < businessTypes.Size();i++ ){
          businessType := businessTypes.Element( i);
          if( product.BusinessType() = businessType and not product.IsCommon()){
            ActualProductInStockingPointInPeriod::Create( this,actual.ProductID(),actual.StockingPointID(),actual.Description(),actual.ActualInventoryLevelEnd(),
                                                  date,actual.ManufacturedDate(),true);
            ActualProductInStockingPointInPeriod::CreateOrUpdate( this,
                                                                  actual.ProductID(),
                                                                  actual.StockingPointID(),
                                                                  actual.Description(),
                                                                  actual.ActualInventoryLevelEnd(),
                                                                  actual.ManufacturedDate());
          }
        }
        
      }else{
        ActualProductInStockingPointInPeriod::Create( this,actual.ProductID(),actual.StockingPointID(),actual.Description(),actual.ActualInventoryLevelEnd(),
                                                  date,actual.ManufacturedDate(),true);
        ActualProductInStockingPointInPeriod::CreateOrUpdate( this,
                                                              actual.ProductID(),
                                                              actual.StockingPointID(),
                                                              actual.Description(),
                                                              actual.ActualInventoryLevelEnd(),
                                                              actual.ManufacturedDate());
      }
        
      }