/// <summary>
        /// Validate Product
        /// </summary>
        /// <param name="product">product</param>
        /// <returns>Info</returns>
        private String ValidateProduct(VAdvantage.Model.MProduct product)
        {
            //count = Util.GetValueOfInt(DB.ExecuteScalar(@"SELECT COUNT(*) FROM AD_MODULEINFO WHERE IsActive = 'Y' AND PREFIX ='VAMFG_'"));
            // JID_0690: If manufaturing Module is not downloaded validate BOM Process was not working.
            if (!product.IsBOM())
            {
                return(product.GetName() + " @NotValid@ @M_BOM_ID@");
            }
            _product = product;
            //	Check Old Product BOM Structure
            log.Config(_product.GetName());
            _products = new List <VAdvantage.Model.MProduct>();

            // Check applied if the product is of item type recipee, then bom should validate from second tab of product i.e Bill Of Material else from BOM and BM Components.
            // Change by mohit to validate the BOM if created from recipee manaement form.- 28 June 2019.
            if (Env.IsModuleInstalled("VA019_") && product.GetVA019_ItemType().Equals(VAdvantage.Model.X_M_Product.VA019_ITEMTYPE_Recipe))
            {
                if (!ValidateOldProduct(_product))
                {
                    _product.SetIsVerified(false);
                    _product.Save();
                    return(_product.GetName() + " @NotValid@");
                }
            }
            //	New Structure
            else
            {
                if (!ValidateOldProduct(_product))
                {
                    _product.SetIsVerified(false);
                    _product.Save();
                    return(_product.GetName() + " @NotValid@");
                }

                VAdvantage.Model.MBOM[] boms = VAdvantage.Model.MBOM.GetOfProduct(GetCtx(), _M_Product_ID, Get_Trx(), null);
                // if manufacturing module  exist and  BOM not contain any record against this product then not to verify Product
                // JID_0690: If manufaturing Module is not downloaded validate BOM Process was not working.
                //if (count > 0 && boms.Length == 0)
                //{
                //    _product.SetIsVerified(false);
                //    _product.Save();
                //    return _product.GetName() + " @NotValid@";
                //}

                for (int i = 0; i < boms.Length; i++)
                {
                    _products = new List <VAdvantage.Model.MProduct>();
                    if (!ValidateBOM(boms[i]))
                    {
                        _product.SetIsVerified(false);
                        _product.Save();
                        return(_product.GetName() + " " + boms[i].GetName() + " @NotValid@");
                    }
                }
            }
            //	OK
            _product.SetIsVerified(true);
            _product.Save();
            return(_product.GetName() + " @IsValid@");
        }
Example #2
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);
 }
Example #3
0
        /// <summary>
        /// Validate Product
        /// </summary>
        /// <param name="product">product</param>
        /// <returns>Info</returns>
        private String ValidateProduct(VAdvantage.Model.MProduct product)
        {
            if (!product.IsBOM())
            {
                return(product.GetName() + " @NotValid@ @M_BOM_ID@");
            }
            _product = product;
            //	Check Old Product BOM Structure
            log.Config(_product.GetName());
            _products = new List <VAdvantage.Model.MProduct>();
            if (!ValidateOldProduct(_product))
            {
                _product.SetIsVerified(false);
                _product.Save();
                return(_product.GetName() + " @NotValid@");
            }

            //	New Structure
            VAdvantage.Model.MBOM[] boms = VAdvantage.Model.MBOM.GetOfProduct(GetCtx(), _M_Product_ID, Get_Trx(), null);
            for (int i = 0; i < boms.Length; i++)
            {
                _products = new List <VAdvantage.Model.MProduct>();
                if (!ValidateBOM(boms[i]))
                {
                    _product.SetIsVerified(false);
                    _product.Save();
                    return(_product.GetName() + " " + boms[i].GetName() + " @NotValid@");
                }
            }

            //	OK
            _product.SetIsVerified(true);
            _product.Save();
            return(_product.GetName() + " @IsValid@");
        }
Example #4
0
 protected override bool AfterDelete(bool success)
 {
     // when we delete BOM, then set IsVerified False on Product
     VAdvantage.Model.MProduct product = new VAdvantage.Model.MProduct(GetCtx(), GetM_Product_ID(), Get_Trx());
     product.SetIsVerified(false);
     if (!product.Save())
     {
         log.SaveError("Error", "Verified not updated on Product : " + product.GetValue());
     }
     return(true);
 }
Example #5
0
 /// <summary>
 /// Set Movement Qty - enforce UOM
 /// </summary>
 /// <param name="movementQty">qty</param>
 public new void SetMovementQty(Decimal?movementQty)
 {
     if (movementQty != null)
     {
         VAdvantage.Model.MProduct product = GetProduct();
         if (product != null)
         {
             int precision = product.GetUOMPrecision();
             movementQty = Decimal.Round(movementQty.Value, precision, MidpointRounding.AwayFromZero);
         }
     }
     base.SetMovementQty(movementQty);
 }
Example #6
0
        }       //	beforeSave

        protected override bool AfterSave(bool newRecord, bool success)
        {
            //set verified on Product as False when we change BOMType AND BOMUse
            if (newRecord || Is_ValueChanged("BOMType") || Is_ValueChanged("BOMUse") || Is_ValueChanged("IsActive"))
            {
                VAdvantage.Model.MProduct product = new VAdvantage.Model.MProduct(GetCtx(), GetM_Product_ID(), Get_Trx());
                product.SetIsVerified(false);
                if (!product.Save())
                {
                    log.SaveError("Error", "Verified not updated on Product : " + product.GetValue());
                }
            }
            return(true);
        }
Example #7
0
 /// <summary>
 /// Validate BOM
 /// </summary>
 /// <param name="bom">bom</param>
 /// <returns>true if valid</returns>
 private bool ValidateBOM(VAdvantage.Model.MBOM bom)
 {
     VAdvantage.Model.MBOMProduct[] BOMproducts = VAdvantage.Model.MBOMProduct.GetOfBOM(bom);
     for (int i = 0; i < BOMproducts.Length; i++)
     {
         VAdvantage.Model.MBOMProduct BOMproduct = BOMproducts[i];
         VAdvantage.Model.MProduct    pp         = new VAdvantage.Model.MProduct(GetCtx(), BOMproduct.GetM_BOMProduct_ID(), Get_Trx());
         if (pp.IsBOM())
         {
             return(ValidateProduct(pp, bom.GetBOMType(), bom.GetBOMUse()));
         }
     }
     return(true);
 }
Example #8
0
        /// <summary>
        /// Validate Product
        /// </summary>
        /// <param name="product">product</param>
        /// <returns>Info</returns>
        private String ValidateProduct(VAdvantage.Model.MProduct product)
        {
            count = Util.GetValueOfInt(DB.ExecuteScalar(@"SELECT COUNT(*) FROM AD_MODULEINFO WHERE IsActive = 'Y' AND PREFIX ='VAMFG_'"));

            if (!product.IsBOM())
            {
                return(product.GetName() + " @NotValid@ @M_BOM_ID@");
            }
            _product = product;
            //	Check Old Product BOM Structure
            log.Config(_product.GetName());
            _products = new List <VAdvantage.Model.MProduct>();
            if (!ValidateOldProduct(_product))
            {
                _product.SetIsVerified(false);
                _product.Save();
                return(_product.GetName() + " @NotValid@");
            }

            //	New Structure
            VAdvantage.Model.MBOM[] boms = VAdvantage.Model.MBOM.GetOfProduct(GetCtx(), _M_Product_ID, Get_Trx(), null);
            // if manufacturing module  exist and  BOM not contain any record against this product then not to verify Product
            if (count > 0 && boms.Length == 0)
            {
                _product.SetIsVerified(false);
                _product.Save();
                return(_product.GetName() + " @NotValid@");
            }
            for (int i = 0; i < boms.Length; i++)
            {
                _products = new List <VAdvantage.Model.MProduct>();
                if (!ValidateBOM(boms[i]))
                {
                    _product.SetIsVerified(false);
                    _product.Save();
                    return(_product.GetName() + " " + boms[i].GetName() + " @NotValid@");
                }
            }

            //	OK
            _product.SetIsVerified(true);
            _product.Save();
            return(_product.GetName() + " @IsValid@");
        }
Example #9
0
 /// <summary>
 /// Validate BOM
 /// </summary>
 /// <param name="bom">bom</param>
 /// <returns>true if valid</returns>
 private bool ValidateBOM(VAdvantage.Model.MBOM bom)
 {
     count = Util.GetValueOfInt(DB.ExecuteScalar(@"SELECT COUNT(*) FROM AD_MODULEINFO WHERE IsActive = 'Y' AND PREFIX ='VAMFG_'"));
     VAdvantage.Model.MBOMProduct[] BOMproducts = VAdvantage.Model.MBOMProduct.GetOfBOM(bom);
     // if manufacturing module  exist and  BOM Componet not contain any record against this BOM then not to verify Product
     if (count > 0 && BOMproducts.Length == 0)
     {
         return(false);
     }
     for (int i = 0; i < BOMproducts.Length; i++)
     {
         VAdvantage.Model.MBOMProduct BOMproduct = BOMproducts[i];
         VAdvantage.Model.MProduct    pp         = new VAdvantage.Model.MProduct(GetCtx(), BOMproduct.GetM_BOMProduct_ID(), Get_Trx());
         if (pp.IsBOM())
         {
             return(ValidateProduct(pp, bom.GetBOMType(), bom.GetBOMUse()));
         }
     }
     return(true);
 }
        /// <summary>
        /// Validate Product
        /// </summary>
        /// <param name="product">product</param>
        /// <param name="BOMType"></param>
        /// <param name="BOMUse"></param>
        /// <returns>true if valid</returns>
        private bool ValidateProduct(VAdvantage.Model.MProduct product, String BOMType, String BOMUse)
        {
            if (!product.IsBOM())
            {
                return(true);
            }
            //
            String restriction = "BOMType='" + BOMType + "' AND BOMUse='" + BOMUse + "'";

            VAdvantage.Model.MBOM[] boms = VAdvantage.Model.MBOM.GetOfProduct(GetCtx(), _M_Product_ID, Get_Trx(),
                                                                              restriction);
            //VAdvantage.Model.MBOM[] boms = VAdvantage.Model.MBOM.GetOfProduct(GetCtx(), product.GetM_Product_ID(), Get_Trx(), restriction);
            if (boms.Length != 1)
            {
                log.Warning(restriction + " - Length=" + boms.Length);
                return(false);
            }
            if (_products.Contains(product))
            {
                log.Warning(_product.GetName() + " recursively includes " + product.GetName());
                return(false);
            }
            _products.Add(product);
            log.Fine(product.GetName());
            //
            VAdvantage.Model.MBOM          bom         = boms[0];
            VAdvantage.Model.MBOMProduct[] BOMproducts = VAdvantage.Model.MBOMProduct.GetOfBOM(bom);
            for (int i = 0; i < BOMproducts.Length; i++)
            {
                VAdvantage.Model.MBOMProduct BOMproduct = BOMproducts[i];
                VAdvantage.Model.MProduct    pp         = new VAdvantage.Model.MProduct(GetCtx(), BOMproduct.GetM_BOMProduct_ID(), Get_Trx());
                //VAdvantage.Model.MProduct pp = new VAdvantage.Model.MProduct(GetCtx(), BOMproduct.GetM_ProductBOM_ID(), Get_Trx());
                if (pp.IsBOM())
                {
                    return(ValidateProduct(pp, bom.GetBOMType(), bom.GetBOMUse()));
                }
            }
            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);
 }
        /// <summary>
        /// Validate BOM
        /// </summary>
        /// <param name="bom">bom</param>
        /// <returns>true if valid</returns>
        private bool ValidateBOM(VAdvantage.Model.MBOM bom)
        {
            //count = Util.GetValueOfInt(DB.ExecuteScalar(@"SELECT COUNT(*) FROM AD_MODULEINFO WHERE IsActive = 'Y' AND PREFIX ='VAMFG_'"));
            VAdvantage.Model.MBOMProduct[] BOMproducts = VAdvantage.Model.MBOMProduct.GetOfBOM(bom);
            // if manufacturing module  exist and  BOM Componet not contain any record against this BOM then not to verify Product
            //if (count > 0 && BOMproducts.Length == 0)
            // JID_0690: If manufaturing Module is not downloaded validate BOM Process was not working.
            if (BOMproducts.Length == 0)
            {
                return(false);
            }

            for (int i = 0; i < BOMproducts.Length; i++)
            {
                VAdvantage.Model.MBOMProduct BOMproduct = BOMproducts[i];
                //VAdvantage.Model.MProduct pp = new VAdvantage.Model.MProduct(GetCtx(), BOMproduct.GetM_BOMProduct_ID(), Get_Trx());
                VAdvantage.Model.MProduct pp = new VAdvantage.Model.MProduct(GetCtx(), BOMproduct.GetM_ProductBOM_ID(), Get_Trx());

                if (pp.IsBOM() && BOMproduct.GetM_ProductBOMVersion_ID() > 0)
                {
                    //return ValidateProduct(pp, bom.GetBOMType(), bom.GetBOMUse());
                    if (_products.Contains(pp))
                    {
                        log.Warning(_product.GetName() + " recursively includes " + pp.GetName());
                        return(false);
                    }
                    _products.Add(pp);

                    if (!pp.IsVerified())
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Example #13
0
        /// <summary>
        /// Before Save
        /// </summary>
        /// <param name="newRecord">new</param>
        /// <returns>true</returns>
        protected override Boolean BeforeSave(Boolean newRecord)
        {
            // By vikas
            // Get Old Value of AttributeSetInstance_ID
            _mvlOldAttId = Util.GetValueOfInt(Get_ValueOld("M_AttributeSetInstance_ID"));

            //	Set Line No
            if (GetLine() == 0)
            {
                String sql = "SELECT COALESCE(MAX(Line),0)+10 AS DefaultValue FROM M_MovementLine WHERE M_Movement_ID=" + GetM_Movement_ID();
                int    ii  = DB.GetSQLValue(Get_TrxName(), sql);
                SetLine(ii);
            }

            // Check Locator For Header Warehouse
            MMovement mov = new MMovement(GetCtx(), GetM_Movement_ID(), Get_TrxName());

            VAdvantage.Model.MLocator      loc   = new VAdvantage.Model.MLocator(GetCtx(), GetM_Locator_ID(), Get_TrxName());
            Tuple <string, string, string> aInfo = null;

            if (Env.HasModulePrefix("DTD001_", out aInfo))
            {
                if (mov.GetDTD001_MWarehouseSource_ID() == loc.GetM_Warehouse_ID())
                {
                }
                else
                {
                    String sql = "SELECT M_Locator_ID FROM M_Locator WHERE M_Warehouse_ID=" + mov.GetDTD001_MWarehouseSource_ID() + " AND IsDefault = 'Y'";
                    int    ii  = DB.GetSQLValue(Get_TrxName(), sql);
                    SetM_Locator_ID(ii);
                }
            }

            if (GetM_Locator_ID() == GetM_LocatorTo_ID())
            {
                log.SaveError("Error", Msg.ParseTranslation(GetCtx(), "'From @M_Locator_ID@' and '@M_LocatorTo_ID@' cannot be same."));//change message according to requirement
                return(false);
            }

            if (Env.Signum(GetMovementQty()) == 0 && Util.GetValueOfInt(GetTargetQty()) == 0)
            {
                log.SaveError("FillMandatory", Msg.GetElement(GetCtx(), "MovementQty"));
                return(false);
            }
            //Amit
            Tuple <String, String, String> mInfo = null;

            if (Env.HasModulePrefix("DTD001_", out mInfo))
            {
                if (!newRecord && Util.GetValueOfInt(Get_ValueOld("M_Product_ID")) != GetM_Product_ID())
                {
                    log.SaveError("Message", Msg.GetMsg(GetCtx(), "DTD001_ProdNotChanged"));
                    return(false);
                }
                if (!newRecord && Util.GetValueOfInt(Get_ValueOld("M_Locator_ID")) != GetM_Locator_ID())
                {
                    log.SaveError("Message", Msg.GetMsg(GetCtx(), "DTD001_LocatorNotChanged"));
                    return(false);
                }
                if (!newRecord && Util.GetValueOfInt(Get_ValueOld("M_RequisitionLine_ID")) != GetM_RequisitionLine_ID())
                {
                    log.SaveError("Message", Msg.GetMsg(GetCtx(), "DTD001_ReqNotChanged"));
                    return(false);
                }
            }
            if (Util.GetValueOfInt(DB.ExecuteScalar("SELECT COUNT(AD_MODULEINFO_ID) FROM AD_MODULEINFO WHERE PREFIX='VA203_'", null, null)) > 0)
            {
                if (GetM_RequisitionLine_ID() > 0)
                {
                    VAdvantage.Model.MRequisitionLine reqline = new VAdvantage.Model.MRequisitionLine(GetCtx(), GetM_RequisitionLine_ID(), null);
                    if (GetM_AttributeSetInstance_ID() != reqline.GetM_AttributeSetInstance_ID())
                    {
                        log.SaveError("Message", Msg.GetMsg(GetCtx(), "VA203_AttributeInstanceMustBeSame"));
                        return(false);
                    }
                }
            }
            // IF Doc Status = InProgress then No record Save
            MMovement move = new MMovement(GetCtx(), GetM_Movement_ID(), null);

            if (newRecord && move.GetDocStatus() == "IP")
            {
                log.SaveError("Message", Msg.GetMsg(GetCtx(), "DTD001_CannotCreate"));
                return(false);
            }

            //	Qty Precision
            if (newRecord || Is_ValueChanged("QtyEntered"))
            {
                SetMovementQty(GetMovementQty());
            }
            int    M_Warehouse_ID = 0; VAdvantage.Model.MWarehouse wh = null;
            string qry = "select m_warehouse_id from m_locator where m_locator_id=" + GetM_Locator_ID();

            M_Warehouse_ID = Util.GetValueOfInt(DB.ExecuteScalar(qry));

            wh  = VAdvantage.Model.MWarehouse.Get(GetCtx(), M_Warehouse_ID);
            qry = "SELECT NVL(SUM(NVL(QtyOnHand,0)),0) AS QtyOnHand FROM M_Storage where m_locator_id=" + GetM_Locator_ID() + " and m_product_id=" + GetM_Product_ID();
            if (GetM_AttributeSetInstance_ID() != 0)
            {
                qry += " AND M_AttributeSetInstance_ID=" + GetM_AttributeSetInstance_ID();
            }
            OnHandQty = Convert.ToDecimal(DB.ExecuteScalar(qry));
            // when record is in completed & closed & Reversed stage - then no need to check qty availablity in warehouse
            if (wh.IsDisallowNegativeInv() == true && (!(move.GetDocStatus() == "CO" || move.GetDocStatus() == "CL" || move.GetDocStatus() == "RE")))
            {
                if (GetDescription() != "RC")
                {
                    if (GetMovementQty() < 0)
                    {
                        log.SaveError("Error", Msg.GetMsg(GetCtx(), "Qty Available " + OnHandQty));
                        //ShowMessage.Info("Qty Available " + OnHandQty, true, null, null);
                        return(false);
                    }
                    else if ((OnHandQty - GetMovementQty()) < 0)
                    {
                        log.SaveError("Error", Msg.GetMsg(GetCtx(), "Qty Available " + OnHandQty));
                        //ShowMessage.Info("Qty Available " + OnHandQty, true, null, null);
                        return(false);
                    }
                }
            }
            if (Env.HasModulePrefix("DTD001_", out mInfo))
            {
                qry = "SELECT   NVL(SUM(NVL(QtyOnHand,0)- qtyreserved),0) AS QtyAvailable  FROM M_Storage where m_locator_id=" + GetM_Locator_ID() + " and m_product_id=" + GetM_Product_ID();
                if (GetM_AttributeSetInstance_ID() != 0)
                {
                    qry += " AND M_AttributeSetInstance_ID=" + GetM_AttributeSetInstance_ID();
                }
                qtyAvailable = Convert.ToDecimal(DB.ExecuteScalar(qry));
                qtyReserved  = Util.GetValueOfDecimal(Get_ValueOld("MovementQty"));
                if (wh.IsDisallowNegativeInv() == true)
                {
                    if ((qtyAvailable < (GetMovementQty() - qtyReserved)))
                    {
                        log.SaveError("Message", Msg.GetElement(GetCtx(), "DTD001_QtyNotAvailable"));
                        return(false);
                    }
                }
            }
            //	Mandatory Instance
            if (GetM_AttributeSetInstanceTo_ID() == 0)
            {
                if (GetM_AttributeSetInstance_ID() != 0)        //	Set to from
                {
                    SetM_AttributeSetInstanceTo_ID(GetM_AttributeSetInstance_ID());
                }
                else
                {
                    if (Env.HasModulePrefix("DTD001_", out mInfo))
                    {
                        VAdvantage.Model.MProduct product = GetProduct();
                        if (product != null &&
                            product.GetM_AttributeSet_ID() != 0)
                        {
                            //MAttributeSet mas = MAttributeSet.Get(GetCtx(), product.GetM_AttributeSet_ID());
                            //if (mas.IsInstanceAttribute()
                            //    && (mas.IsMandatory() || mas.IsMandatoryAlways()))
                            //{
                            //    log.SaveError("FillMandatory", Msg.GetElement(GetCtx(), "M_AttributeSetInstanceTo_ID"));
                            //    return false;
                            //}

                            // Code Addeded by Bharat as Discussed with Mukesh Sir
                            if (String.IsNullOrEmpty(GetDTD001_AttributeNumber()))
                            {
                                return(true);
                            }
                            else
                            {
                                if (GetDTD001_AttributeNumber() == "" || GetDTD001_AttributeNumber() == null)
                                {
                                    log.SaveError("FillMandatory", Msg.GetElement(GetCtx(), "DTD001_AttributeNumber"));

                                    return(false);
                                }
                            }
                        }
                        else
                        {
                            if (product != null)
                            {
                                if (product.GetM_AttributeSet_ID() == 0 && (GetDTD001_AttributeNumber() == "" || GetDTD001_AttributeNumber() == null))
                                {
                                    return(true);
                                }
                                else
                                {
                                    //log.SaveError("FillMandatory", Msg.GetElement(GetCtx(), "DTD001_AttributeNumber"));
                                    //ShowMessage.Info("a", true, "Product is not of Attribute Type", null);
                                    log.SaveError("Product is not of Attribute Type", Msg.GetElement(GetCtx(), "DTD001_AttributeNumber"));
                                    return(false);
                                }

                                //Check No Of Attributes Are Equal To Quantity Or Less Than

                                int Count = CountAttributes(GetDTD001_AttributeNumber());
                                if (Count != GetMovementQty())
                                {
                                    if (Count > GetMovementQty())
                                    {
                                        log.SaveError("Error", Msg.GetMsg(GetCtx(), "DTD001_MovementAttrbtGreater"));
                                        return(false);
                                    }
                                    else
                                    {
                                        log.SaveError("Error", Msg.GetMsg(GetCtx(), "DTD001_MovementAttrbtLess"));
                                        return(false);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        VAdvantage.Model.MProduct product = GetProduct();
                        if (product != null &&
                            product.GetM_AttributeSet_ID() != 0)
                        {
                            VAdvantage.Model.MAttributeSet mas = VAdvantage.Model.MAttributeSet.Get(GetCtx(), product.GetM_AttributeSet_ID());
                            if (mas.IsInstanceAttribute() &&
                                (mas.IsMandatory() || mas.IsMandatoryAlways()))
                            {
                                log.SaveError("FillMandatory", Msg.GetElement(GetCtx(), "M_AttributeSetInstanceTo_ID"));
                                return(false);
                            }
                        }
                    }
                }
            }   //	ASI

            return(true);
        }