renhao
2023-09-13 9e6cd153724264ff955d7e398c395db7a33f7e0d
_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl
@@ -9,8 +9,9 @@
  [*
    // renhao Aug-14-2023 (created)
    
    listtodeal := selectset( this,MappingExternalSupply,externalSupply, true );
    listtodeal := selectset( this,MappingExternalSupply,externalSupply, externalSupply.UserQuantity()>0 );
    totalcount := listtodeal.Size();
    description := "在途在制";
    info( "ExternalSupply has " + totalcount.AsQUILL() + " rows in total" );
    
    count := 0;
@@ -19,10 +20,11 @@
      if( count - [Number](count/1000) * 1000 = 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);
      product := select( this,MappingProduct,product,product.ID() = externalSupply.ProductID(),true);
      
      if( not isnull( product)){
        productMP :=  select( this,Product_MP,productMP,productMP.ID() = externalSupply.ProductID() ,true);
        productMP :=  Product_MP :: FindProductTypeIndex( externalSupply.ProductID());
        stockingpoint := select( this,StockingPoint_MP,st,st.ID() = externalSupply.StockingPointID(),true);
        if( not isnull(businessTypes)){
        
@@ -34,25 +36,25 @@
                                               stockingpoint,
                                               externalSupply.Date(),
                                               externalSupply.ManufacturedDate(),
                                               externalSupply.UserQuantity(),"在途在制");
                                               externalSupply.UserQuantity(),description);
            }
          }
          
        }else{
        if( not isnull( stockingpoint) and not isnull( productMP)){
          InventorySupply::CreateOrUpdate( externalSupply.ID(),
          if( not isnull( stockingpoint) and not isnull( productMP)){
            InventorySupply::CreateOrUpdate( externalSupply.ID(),
                                           productMP,
                                           stockingpoint,
                                           externalSupply.Date(),
                                           externalSupply.ManufacturedDate(),
                                           externalSupply.UserQuantity(),"在途在制");
        }
                                           externalSupply.UserQuantity(),description);
          }
      
        }
        
      }else{
        info( "Invaild product" );
        }
      }
    }
  *]
}