Beispiel #1
0
 /// <summary>
 /// Validate Old BOM Product structure
 /// </summary>
 /// <param name="product">product</param>
 /// <returns>true if valid</returns>
 private bool ValidateOldProduct(VAdvantage.Model.MProduct product)
 {
     if (!product.IsBOM())
     {
         return(true);
     }
     //
     if (_products.Contains(product))
     {
         log.Warning(_product.GetName() + " recursively includes " + product.GetName());
         return(false);
     }
     _products.Add(product);
     log.Fine(product.GetName());
     //
     VAdvantage.Model.MProductBOM[] productsBOMs = VAdvantage.Model.MProductBOM.GetBOMLines(product);
     for (int i = 0; i < productsBOMs.Length; i++)
     {
         VAdvantage.Model.MProductBOM productsBOM = productsBOMs[i];
         VAdvantage.Model.MProduct    pp          = new VAdvantage.Model.MProduct(GetCtx(), productsBOM.GetM_ProductBOM_ID(), Get_Trx());
         if (!pp.IsBOM())
         {
             log.Finer(pp.GetName());
         }
         else if (!ValidateOldProduct(pp))
         {
             return(false);
         }
     }
     return(true);
 }
 /// <summary>
 /// Validate Old BOM Product structure
 /// </summary>
 /// <param name="product">product</param>
 /// <returns>true if valid</returns>
 private bool ValidateOldProduct(VAdvantage.Model.MProduct product)
 {
     //count = Util.GetValueOfInt(DB.ExecuteScalar(@"SELECT COUNT(*) FROM AD_MODULEINFO WHERE IsActive = 'Y' AND PREFIX ='VAMFG_'"));
     if (!product.IsBOM())
     {
         return(true);
     }
     //
     if (_products.Contains(product))
     {
         log.Warning(_product.GetName() + " recursively includes " + product.GetName());
         return(false);
     }
     _products.Add(product);
     log.Fine(product.GetName());
     //
     VAdvantage.Model.MProductBOM[] productsBOMs = VAdvantage.Model.MProductBOM.GetBOMLines(product);
     // if manufacturing module not exist and Product BOM not containany record against this product thennot to verify BOM
     // JID_0690: If manufaturing Module is not downloaded validate BOM Process was not working.
     //if (count <= 0 && productsBOMs.Length == 0)
     //{
     //    return false;
     //}
     for (int i = 0; i < productsBOMs.Length; i++)
     {
         VAdvantage.Model.MProductBOM productsBOM = productsBOMs[i];
         VAdvantage.Model.MProduct    pp          = new VAdvantage.Model.MProduct(GetCtx(), productsBOM.GetM_ProductBOM_ID(), Get_Trx());
         if (!pp.IsBOM())
         {
             log.Finer(pp.GetName());
         }
         else if (!ValidateOldProduct(pp))
         {
             return(false);
         }
     }
     return(true);
 }