/// <summary> /// Validate Old BOM Product structure /// </summary> /// <param name="product">product</param> /// <returns>true if valid</returns> private bool ValidateOldProduct(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()); // MProductBOM[] productsBOMs = MProductBOM.GetBOMLines(product); for (int i = 0; i < productsBOMs.Length; i++) { MProductBOM productsBOM = productsBOMs[i]; MProduct pp = new 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(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()); // MProductBOM[] productsBOMs = MProductBOM.GetBOMLines(product); // if manufacturing module not exist and Product BOM not containany record against this product thennot to verify BOM if (count <= 0 && productsBOMs.Length == 0) { return(false); } for (int i = 0; i < productsBOMs.Length; i++) { MProductBOM productsBOM = productsBOMs[i]; MProduct pp = new MProduct(GetCtx(), productsBOM.GetM_ProductBOM_ID(), Get_Trx()); if (!pp.IsBOM()) { log.Finer(pp.GetName()); } else if (!ValidateOldProduct(pp)) { return(false); } } return(true); }