hongji.li
2023-10-24 ae5ea57221f6bab29d84e8c58042a07130befcc8
_Main/BL/Type_MacroPlan/Method_DoASyncMappingActualPISPIPData.qbl
@@ -10,11 +10,21 @@
  TextBody:
  [*
    // renhao Aug-14-2023 (created)
    listtodeal := selectset( globalOTDTable,
                             Global_MappingActualProductInStockingPointInPeriod,
                             actual,
                             ( actual.ActualInventoryLevelEnd() > 0 ) and
                             ( organcodelist.Find( actual.StockingPointID().SubString( 0, 3 ) ) >= 0 ) );
    listtodeal := construct( Global_MappingActualProductInStockingPointInPeriods, constcontent );
    if ( businessTypes.Size() > 0 ) {
      businessTypeName := businessTypes.Element( 0 );
      targetGlobal_ProductCategory := select( globalOTDTable, Global_ProductCategory, tempGPC, tempGPC.BusinessTypeName() = businessTypeName );
      listtodeal := selectset( targetGlobal_ProductCategory, Global_MappingProduct_MP.Global_MAPISPIPCategory.Global_MappingActualProductInStockingPointInPeriod,
                               tempGMPIL,
                               ( tempGMPIL.ActualInventoryLevelEnd() > 0 ) and
                               ( organcodelist.Find( tempGMPIL.StockingPointID().SubString( 0, 3 ) ) >= 0 ) );
    } else {
      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" );
    
@@ -24,13 +34,13 @@
      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( globalOTDTable,Global_MappingProduct_MP,product,product.ID() = actual.ProductID() and product.KeyProduct() = nuclear,true);
      if( not isnull( product)){
      //product := select( globalOTDTable,Global_MappingProduct_MP,product,product.ID() = actual.ProductID() and product.KeyProduct() = nuclear,true);
      if( /*not isnull( product*/ guard( actual.Global_MAPISPIPCategory().KeyProduct() = nuclear, false ) ){
      if( not isnull(businessTypes)){
      
        for( i :=0 ;i < businessTypes.Size();i++ ){
          businessType := businessTypes.Element( i );
          if( product.BusinessType() = businessType and not product.IsCommon()){
          //businessType := businessTypes.Element( i );
          if( /*product.BusinessType() = businessType and not product.IsCommon()*/ not actual.Global_MAPISPIPCategory().IsCommon() ){
            ActualProductInStockingPointInPeriod::CreateOrUpdate( this,
                                                                  actual.ProductID(),
                                                                  actual.StockingPointID(),