Exemplo n.º 1
0
        /// <summary>
        /// Add BOM Line to this.
        /// Calls addBOMLines if added product is a BOM
        /// </summary>
        /// <param name="line">BOM Line</param>
        /// <param name="qty">quantity</param>
        private void AddBOMLine(Ctx ctx, MProductBOM line, Decimal qty)
        {
            // Envs.SetBusyIndicator(true);
            log.Fine(line.ToString());
            String bomType = line.GetBOMType();

            if (bomType == null)
            {
                bomType = MProductBOM.BOMTYPE_StandardPart;
            }
            //
            Decimal  lineQty = Decimal.Multiply(line.GetBOMQty(), qty);
            MProduct product = line.GetProduct();

            if (product == null)
            {
                return;
            }
            if (product.IsBOM() && product.IsVerified())
            {
                BomLines(ctx, product, lineQty);
            }
            else
            {
                //  GetDisplay(line.GetM_Product_ID(),
                //    product.GetM_Product_ID(), bomType, product.GetName(), lineQty);
            }
        }
Exemplo n.º 2
0
 /// <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);
 }
Exemplo n.º 4
0
        private void BomLines(Ctx ctx, MProduct product, Decimal qty)
        {
            lstBOMLines = new List <BOMLines>();
            MProductBOM[] bomLines = null;
            bomLines = MProductBOM.GetBOMLines(product);
            MProduct objproduct = null;

            for (int i = 0; i < bomLines.Length; i++)
            {
                AddBOMLine(ctx, bomLines[i], qty);
                objproduct = new MProduct(ctx, Util.GetValueOfInt(bomLines[i].GetM_ProductBOM_ID()), null);
                lstBOMLines.Add(new BOMLines()
                {
                    BOMType      = Util.GetValueOfString(bomLines[i].GetBOMType()),
                    BOMTypeName  = GetBOMType(Util.GetValueOfString(bomLines[i].GetBOMType())),
                    BOMQty       = Util.GetValueOfString(bomLines[i].GetBOMQty()),
                    ProductID    = Util.GetValueOfString(bomLines[i].GetM_ProductBOM_ID()),
                    ProductName  = Util.GetValueOfString(objproduct.GetName()),
                    ProductBOMID = Util.GetValueOfString(bomLines[i].GetM_Product_BOM_ID()),
                    LineNo       = Util.GetValueOfString(bomLines[i].GetLine()),
                    Description  = Util.GetValueOfString(bomLines[i].GetDescription())
                });
            }
        }