yypsybs
2023-09-09 3cb5a54def670d97301f07170fcaad213bfc54f2
_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl
@@ -7,53 +7,53 @@
{
  TextBody:
  [*
    // renhao Aug-14-2023 (created)
    listtodeal := selectset( this,MappingExternalSupply,externalSupply,
                             not isnull( StockingPoint_MP::FindById( this, externalSupply.StockingPointID() ) ) and not isnull( Product_MP::FindById( this, externalSupply.ProductID() ) ) );
    totalcount := listtodeal.Size();
    info( "ExternalSupply has " + totalcount.AsQUILL() + " rows in total" );
    count := 0;
    traverse( listtodeal,Elements,externalSupply){
      count := count + 1;
      if( count - [Number](count/100) * 100 = 0 or count = totalcount ){
        info( "Now is dealing with the " + count.AsQUILL() + "ExternalSupply " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" );
        }
      product := select( this,MappingProduct,product,product.ID() = externalSupply.ProductID() and product.KeyProduct() = nuclear,true);
      if( not isnull( product)){
        productMP :=  select( this,Product_MP,productMP,productMP.ID() = externalSupply.ProductID() ,true);
        stockingpoint := select( this,StockingPoint_MP,st,st.ID() = externalSupply.StockingPointID(),true);
        if( not isnull(businessTypes)){
          for( i :=0 ;i < businessTypes.Size();i++ ){
            businessType := businessTypes.Element( i);
            if( product.BusinessType() = businessType and not product.IsCommon()){
              InventorySupply::CreateOrUpdate( externalSupply.ID(),
                                               productMP,
                                               stockingpoint,
                                               externalSupply.Date(),
                                               externalSupply.ManufacturedDate(),
                                               externalSupply.UserQuantity(),"在途在制");
            }
          }
        }else{
        if( not isnull( stockingpoint) and not isnull( productMP)){
          InventorySupply::CreateOrUpdate( externalSupply.ID(),
                                           productMP,
                                           stockingpoint,
                                           externalSupply.Date(),
                                           externalSupply.ManufacturedDate(),
                                           externalSupply.UserQuantity(),"在途在制");
        }
        }
      }else{
        info( "Invaild product" );
        }
    }
    //// renhao Aug-14-2023 (created)
    //
    //listtodeal := selectset( this,MappingExternalSupply,externalSupply,
    //                         not isnull( StockingPoint_MP::FindById( this, externalSupply.StockingPointID() ) ) and not isnull( Product_MP::FindById( this, externalSupply.ProductID() ) ) );
    //totalcount := listtodeal.Size();
    //info( "ExternalSupply has " + totalcount.AsQUILL() + " rows in total" );
    //
    //count := 0;
    //traverse( listtodeal,Elements,externalSupply){
    //  count := count + 1;
    //  if( count - [Number](count/100) * 100 = 0 or count = totalcount ){
    //    info( "Now is dealing with the " + count.AsQUILL() + "ExternalSupply " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" );
    //    }
    //  product := select( this,MappingProduct,product,product.ID() = externalSupply.ProductID() and product.KeyProduct() = nuclear,true);
    //
    //  if( not isnull( product)){
    //    productMP :=  select( this,Product_MP,productMP,productMP.ID() = externalSupply.ProductID() ,true);
    //    stockingpoint := select( this,StockingPoint_MP,st,st.ID() = externalSupply.StockingPointID(),true);
    //    if( not isnull(businessTypes)){
    //
    //      for( i :=0 ;i < businessTypes.Size();i++ ){
    //        businessType := businessTypes.Element( i);
    //        if( product.BusinessType() = businessType and not product.IsCommon()){
    //          InventorySupply::CreateOrUpdate( externalSupply.ID(),
    //                                           productMP,
    //                                           stockingpoint,
    //                                           externalSupply.Date(),
    //                                           externalSupply.ManufacturedDate(),
    //                                           externalSupply.UserQuantity(),"在途在制");
    //        }
    //      }
    //
    //    }else{
    //    if( not isnull( stockingpoint) and not isnull( productMP)){
    //      InventorySupply::CreateOrUpdate( externalSupply.ID(),
    //                                       productMP,
    //                                       stockingpoint,
    //                                       externalSupply.Date(),
    //                                       externalSupply.ManufacturedDate(),
    //                                       externalSupply.UserQuantity(),"在途在制");
    //    }
    //
    //    }
    //
    //  }else{
    //    info( "Invaild product" );
    //    }
    //}
  *]
}