Пример #1
0
        private void ExecLocalToDistant(Model.Local.Article Article, Model.Prestashop.PsProduct Product, Model.Local.ArticleRepository ArticleRepository, Model.Prestashop.PsProductRepository ProductRepository, Boolean isProduct)
        {
            try
            {
                if (isProduct)
                {
                    Model.Local.CatalogRepository CatalogRepository = new Model.Local.CatalogRepository();
                    Model.Local.Catalog           Catalog           = CatalogRepository.ReadId(Article.Cat_Id);

                    if (Catalog.Pre_Id != null && new Model.Prestashop.PsCategoryRepository().ExistId((int)Catalog.Pre_Id))
                    {
                        Product.IDCategoryDefault = Convert.ToUInt32(Catalog.Pre_Id);

                        ProductRepository.Save();

                        this.AssignCatalogProduct(Article, Product, ArticleRepository);

                        // <JG> 17/12/2012
                        this.ExecShopProduct(Product);
                    }
                }
            }
            catch (Exception ex)
            {
                Core.Error.SendMailError(ex.ToString());
            }
        }
Пример #2
0
        //<YH> 23/08/2012
        private void ExecLocalToDistant(Model.Local.Article Article)
        {
            try
            {
                Model.Prestashop.PsAttachmentRepository PsAttachmentRepository = new Model.Prestashop.PsAttachmentRepository();
                Model.Prestashop.PsAttachment           PsAttachment;

                Model.Prestashop.PsAttachmentLangRepository PsAttachmentLangRepository = new Model.Prestashop.PsAttachmentLangRepository();
                Model.Prestashop.PsAttachmentLang           PsAttachmentLang;

                Model.Prestashop.PsProductAttachmentRepository PsProductAttachmentRepository = new Model.Prestashop.PsProductAttachmentRepository();
                Model.Prestashop.PsProductAttachment           PsProductAttachment;

                Boolean isAttachmentLang = false;

                String FTP      = Core.Global.GetConfig().ConfigFTPIP;
                String User     = Core.Global.GetConfig().ConfigFTPUser;
                String Password = Core.Global.GetConfig().ConfigFTPPassword;

                Model.Local.AttachmentRepository AttachmentRepository = new Model.Local.AttachmentRepository();
                List <Model.Local.Attachment>    ListAttachment       = AttachmentRepository.ListArticle(Article.Art_Id);
                foreach (Model.Local.Attachment Attachment in ListAttachment)
                {
                    try
                    {
                        if (Attachment.Pre_Id == null)
                        {
                            String PathAttachment = Path.Combine(Global.GetConfig().Folders.RootAttachment, Attachment.Att_File);
                            if (System.IO.File.Exists(PathAttachment))
                            {
                                #region infos document joint
                                PsAttachment          = new Model.Prestashop.PsAttachment();
                                PsAttachment.File     = Attachment.Att_File;
                                PsAttachment.FileName = Attachment.Att_FileName;
                                PsAttachment.Mime     = Attachment.Att_Mime;
                                PsAttachmentRepository.Add(PsAttachment);

                                isAttachmentLang = false;
                                PsAttachmentLang = new Model.Prestashop.PsAttachmentLang();
                                if (PsAttachmentLangRepository.ExistAttachmentLang(PsAttachment.IDAttachment, Core.Global.Lang))
                                {
                                    PsAttachmentLang = PsAttachmentLangRepository.ReadAttachmentLang(PsAttachment.IDAttachment, Core.Global.Lang);
                                    isAttachmentLang = true;
                                }
                                PsAttachmentLang.Name        = Attachment.Att_Name;
                                PsAttachmentLang.Description = Attachment.Att_Description;
                                if (isAttachmentLang == true)
                                {
                                    PsAttachmentLangRepository.Save();
                                }
                                else
                                {
                                    PsAttachmentLang.IDAttachment = PsAttachment.IDAttachment;
                                    PsAttachmentLang.IDLang       = Core.Global.Lang;
                                    PsAttachmentLangRepository.Add(PsAttachmentLang);
                                }
                                #endregion

                                // <JG> 24/05/2013 ajout insertion autres langues actives si non renseignées
                                #region Multi-langues
                                try
                                {
                                    Model.Prestashop.PsLangRepository PsLangRepository = new Model.Prestashop.PsLangRepository();
                                    foreach (Model.Prestashop.PsLang PsLang in PsLangRepository.ListActive(1, Global.CurrentShop.IDShop))
                                    {
                                        if (!PsAttachmentLangRepository.ExistAttachmentLang(PsAttachment.IDAttachment, PsLang.IDLang))
                                        {
                                            PsAttachmentLang = new Model.Prestashop.PsAttachmentLang()
                                            {
                                                IDAttachment = PsAttachment.IDAttachment,
                                                IDLang       = PsLang.IDLang,
                                                Name         = Attachment.Att_Name,
                                                Description  = Attachment.Att_Description
                                            };
                                            PsAttachmentLangRepository.Add(PsAttachmentLang);
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Core.Error.SendMailError(ex.ToString());
                                }
                                #endregion

                                // affectation au produit
                                PsProductAttachment = new Model.Prestashop.PsProductAttachment();
                                if (PsProductAttachmentRepository.ExistProductAttachment(Convert.ToUInt32(Article.Pre_Id), PsAttachment.IDAttachment) == false)
                                {
                                    PsProductAttachment.IDProduct    = Convert.ToUInt32(Article.Pre_Id);
                                    PsProductAttachment.IDAttachment = PsAttachment.IDAttachment;
                                    PsProductAttachmentRepository.Add(PsProductAttachment);
                                }

                                try
                                {
                                    #region upload

                                    string ftpfullpath           = FTP + "/download/" + Attachment.Att_File;
                                    System.Net.FtpWebRequest ftp = (System.Net.FtpWebRequest)System.Net.FtpWebRequest.Create(ftpfullpath);
                                    ftp.Credentials = new System.Net.NetworkCredential(User, Password);
                                    //userid and password for the ftp server to given

                                    ftp.UseBinary = true;
                                    ftp.Method    = System.Net.WebRequestMethods.Ftp.UploadFile;
                                    System.IO.FileStream fs = System.IO.File.OpenRead(PathAttachment);
                                    byte[] buffer           = new byte[fs.Length];
                                    fs.Read(buffer, 0, buffer.Length);
                                    fs.Close();
                                    System.IO.Stream ftpstream = ftp.GetRequestStream();
                                    ftpstream.Write(buffer, 0, buffer.Length);
                                    ftpstream.Close();
                                    ftp.Abort();

                                    #endregion

                                    #region update Product field cache_as_attachements

                                    Model.Prestashop.PsProductRepository PsProductRepository = new Model.Prestashop.PsProductRepository();
                                    Model.Prestashop.PsProduct           PsProduct           = PsProductRepository.ReadId(PsProductAttachment.IDProduct);
                                    if (PsProduct.CacheHasAttachments == 0)
                                    {
                                        PsProduct.CacheHasAttachments = (sbyte)1;
                                        PsProductRepository.Save();
                                    }

                                    #endregion

                                    Attachment.Pre_Id = Convert.ToInt32(PsAttachment.IDAttachment);
                                    AttachmentRepository.Save();
                                }
                                catch (Exception ex)
                                {
                                    Core.Error.SendMailError("[UPLOAD FTP DOCUMENT]<br />" + ex.ToString());
                                    PsProductAttachmentRepository.Delete(PsProductAttachmentRepository.ListAttachment(PsAttachment.IDAttachment));
                                    PsAttachmentLangRepository.Delete(PsAttachmentLangRepository.ListAttachment(PsAttachment.IDAttachment));
                                    PsAttachmentRepository.Delete(PsAttachment);
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Core.Error.SendMailError("[SYNCHRO DOCUMENT ARTICLE]<br />" + ex.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                Core.Error.SendMailError(ex.ToString());
            }
        }
Пример #3
0
        private void ExecLocalToDistant(Model.Local.Article Article, Model.Prestashop.PsProduct Product, Model.Prestashop.PsProductRepository PsProductRepository,
                                        out List <string> log_chrono)
        {
            log_chrono = new List <string>();
            try
            {
                if (Article.TypeArticle == Model.Local.Article.enum_TypeArticle.ArticleComposition)
                {
                    if (Core.UpdateVersion.License.Option2)
                    {
                        Product.Price    = 0;
                        Product.Quantity = 0;
                        SynchronisationArticle.WriteStockAvailableProduct(Product);
                        ExecCompositionArticle(Article, Product);
                    }
                }
                else
                {
                    Model.Sage.F_ARTICLERepository F_ARTICLERepository = new Model.Sage.F_ARTICLERepository();
                    if (F_ARTICLERepository.ExistArticle(Article.Sag_Id))
                    {
                        Model.Sage.F_ARTICLE F_ARTICLE = F_ARTICLERepository.ReadArticle(Article.Sag_Id);
                        SynchronisationArticle.ReadQuantity(F_ARTICLE, Product);

                        #region Stock pack limité par composés
                        if (Article.Art_Pack == true || F_ARTICLE.AR_Nomencl == (short)ABSTRACTION_SAGE.F_ARTICLE.Obj._Enum_AR_Nomencl.Commerciale_Composant ||
                            F_ARTICLE.AR_Nomencl == (short)ABSTRACTION_SAGE.F_ARTICLE.Obj._Enum_AR_Nomencl.Commerciale_Compose)                                        // pour que les articles en nomenclature soient pris en compte
                        {
                            Model.Sage.F_NOMENCLATRepository F_NOMENCLATRepository = new Model.Sage.F_NOMENCLATRepository();
                            List <Model.Sage.F_NOMENCLAT>    ListF_NOMENCLAT       = F_NOMENCLATRepository.ListRef(F_ARTICLE.AR_Ref);
                            Model.Sage.F_ARTICLE             F_ARTICLENOMENCLAT;
                            Int32 QuantityPack = 0;
                            foreach (Model.Sage.F_NOMENCLAT F_NOMENCLAT in ListF_NOMENCLAT)
                            {
                                if (F_ARTICLERepository.ExistReference(F_NOMENCLAT.NO_RefDet))
                                {
                                    F_ARTICLENOMENCLAT = F_ARTICLERepository.ReadReference(F_NOMENCLAT.NO_RefDet);
                                    if (F_ARTICLENOMENCLAT.AR_SuiviStock != (short)ABSTRACTION_SAGE.F_ARTICLE.Obj._Enum_AR_SuiviStock.Aucun)                                                            // pour ne pas prendre en compte les articles non suivi en stock
                                    {
                                        Int32 CurrentQuantity = SynchronisationArticle.ReadQuantityPack(F_ARTICLENOMENCLAT, F_NOMENCLAT.NO_Qte.Value);
                                        if (Core.Global.GetConfig().ArticleStockNegatifZero&& CurrentQuantity < 0)
                                        {
                                            CurrentQuantity = 0;
                                        }
                                        if (CurrentQuantity < QuantityPack)
                                        {
                                            QuantityPack = CurrentQuantity;
                                        }
                                        else if (QuantityPack == 0)
                                        {
                                            QuantityPack = CurrentQuantity;
                                            // <AM> 14/08/2014 Si un des articles composant n'a pas de stock on sort de la fonction pour que l'article parent ai un stock à 0
                                            if (CurrentQuantity == 0)
                                            {
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                            Product.Quantity = QuantityPack;
                        }
                        #endregion

                        int CatComptaArticle      = Core.Global.GetConfig().ConfigArticleCatComptable;
                        Model.Sage.F_TAXE TaxeTVA = SynchronisationArticle.ReadTaxe(F_ARTICLE, Product, CatComptaArticle);
                        Model.Sage.F_TAXE TaxeEco = SynchronisationArticle.ReadEcoTaxe(F_ARTICLE, Product, TaxeTVA, CatComptaArticle);
                        // <JG> 03/06/2016
                        if (Article.Art_SyncPrice)
                        {
                            SynchronisationArticle.ReadPrice(F_ARTICLE, Product, TaxeTVA);
                        }

                        if (Core.Global.GetConfig().MajPoidsSynchroStock)
                        {
                            SynchronisationArticle.ReadWeight(F_ARTICLE, Product);
                        }

                        if (Core.Global.GetConfig().ArticleDateDispoInfoLibreActif)
                        {
                            SynchronisationArticle.ReadDateDispo(Product, F_ARTICLE);
                        }

                        PsProductRepository.Save();
                        PsProductRepository.WriteDate(Product.IDProduct);

                        // <JG> 05/11/2013 déplacement pour application taxes et pdt spécifiques sur nouvelles déclinaisons
                        this.ExecAttribute(Article, Product, TaxeTVA, PsProductRepository);
                        this.ExecConditioning(Article, Product, TaxeTVA, PsProductRepository);

                        // <JG> 03/06/2016
                        if (Article.Art_SyncPrice)
                        {
                            List <string> log;
                            SynchronisationArticle.ExecSpecificPrice(F_ARTICLE, Product, Article, null, TaxeTVA, TaxeEco, out log);
                            if (log != null && log.Count > 0)
                            {
                                log_chrono.AddRange(log);
                            }
                        }

                        // <JG> 17/12/2012
                        SynchronisationArticle.ExecShopProduct(Product);

                        SynchronisationArticle.WriteStockAvailableProduct(Product);
                    }
                }
            }
            catch (Exception ex)
            {
                Core.Error.SendMailError(ex.ToString());
            }
        }
Пример #4
0
        private void ExecConditioning(Model.Local.Article Article, Model.Prestashop.PsProduct PsProduct, Model.Sage.F_TAXE TaxeTVA, Model.Prestashop.PsProductRepository PsProductRepository)
        {
            try
            {
                Model.Sage.F_ARTICLERepository F_ARTICLERepository = new Model.Sage.F_ARTICLERepository();
                if (F_ARTICLERepository.ExistArticle(Article.Sag_Id))
                {
                    Model.Sage.F_ARTICLE F_ARTICLE = F_ARTICLERepository.ReadArticle(Article.Sag_Id);

                    Model.Local.ConditioningGroupRepository     ConditioningGroupRepository = new Model.Local.ConditioningGroupRepository();
                    Model.Prestashop.PsAttributeGroupRepository PsAttributeGroupRepository  = new Model.Prestashop.PsAttributeGroupRepository();

                    Boolean isProductAttribute;

                    if (F_ARTICLE.AR_Condition != null && F_ARTICLE.AR_Condition != 0 &&
                        ConditioningGroupRepository.ExistSage((int)F_ARTICLE.AR_Condition) &&
                        PsAttributeGroupRepository.ExistAttributeGroup((uint)ConditioningGroupRepository.ReadSage((int)F_ARTICLE.AR_Condition).Pre_Id))
                    {
                        Model.Local.ConditioningArticleRepository ConditioningArticleRepository = new Model.Local.ConditioningArticleRepository();
                        List <Model.Local.ConditioningArticle>    ListConditioningArticle       = ConditioningArticleRepository.ListArticleSync(Article.Art_Id, true);

                        Model.Prestashop.PsProductAttributeRepository PsProductAttributeRepository = new Model.Prestashop.PsProductAttributeRepository();
                        Model.Prestashop.PsProductAttribute           PsProductAttribute;
                        int stockmaxunity = 0;
                        foreach (Model.Local.ConditioningArticle ConditioningArticle in ListConditioningArticle)
                        {
                            if (ConditioningArticle.EnumereF_CONDITION != null)
                            {
                                PsProductAttribute = new Model.Prestashop.PsProductAttribute();
                                isProductAttribute = false;
                                if (ConditioningArticle.Pre_Id != null && ConditioningArticle.Pre_Id != 0)
                                {
                                    if (PsProductAttributeRepository.ExistProductAttribute((UInt32)ConditioningArticle.Pre_Id))
                                    {
                                        PsProductAttribute = PsProductAttributeRepository.ReadProductAttribute((UInt32)ConditioningArticle.Pre_Id);
                                        isProductAttribute = true;
                                    }
                                }

                                if (Core.Global.GetConfig().MajPoidsSynchroStock)
                                {
                                    SynchronisationArticle.ReadWeightConditioning(PsProduct, PsProductAttribute, ConditioningArticle.EnumereF_CONDITION);
                                }

                                SynchronisationArticle.ReadQuantityConditioning(PsProductAttribute, F_ARTICLE, ConditioningArticle.EnumereF_CONDITION);

                                if (Core.Global.GetConfig().LimiteStockConditionnement&& PsProductAttribute.Quantity >= stockmaxunity)
                                {
                                    stockmaxunity      = PsProductAttribute.Quantity;
                                    PsProduct.Quantity = stockmaxunity;
                                    PsProductRepository.Save();
                                }

                                // <JG> 03/06/2016
                                if (Article.Art_SyncPrice)
                                {
                                    SynchronisationArticle.ReadPriceConditioning(PsProduct, PsProductAttribute, F_ARTICLE, ConditioningArticle.EnumereF_CONDITION, TaxeTVA);
                                }

                                //PsProductAttribute.DefaultOn = (ConditioningArticle.ConArt_Default) ? (byte)1 : (byte)0;
                                if (isProductAttribute == true)
                                {
                                    PsProductAttributeRepository.Save();
                                    SynchronisationArticle.ExecShopProductAttribute(PsProductAttribute);

                                    SynchronisationArticle.WriteStockAvailableProductAttribute(PsProduct, PsProductAttribute);
                                }
                            }
                        }
                        PsProductAttributeRepository.WriteDate(PsProduct.IDProduct);
                    }
                }
            }
            catch (Exception ex)
            {
                Core.Error.SendMailError(ex.ToString());
            }
        }
Пример #5
0
        private void ExecAttribute(Model.Local.Article Article, Model.Prestashop.PsProduct PsProduct, Model.Sage.F_TAXE TaxeTVA, Model.Prestashop.PsProductRepository PsProductRepository)
        {
            try
            {
                Model.Sage.F_ARTICLERepository F_ARTICLERepository = new Model.Sage.F_ARTICLERepository();
                if (F_ARTICLERepository.ExistArticle(Article.Sag_Id))
                {
                    Model.Sage.F_ARTICLE F_ARTICLE = F_ARTICLERepository.ReadArticle(Article.Sag_Id);

                    Model.Local.AttributeGroupRepository        AttributeGroupRepository   = new Model.Local.AttributeGroupRepository();
                    Model.Prestashop.PsAttributeGroupRepository PsAttributeGroupRepository = new Model.Prestashop.PsAttributeGroupRepository();

                    Boolean isProductAttribute;

                    if (F_ARTICLE.AR_Gamme1 != null && F_ARTICLE.AR_Gamme1 != 0 &&
                        AttributeGroupRepository.ExistSage((int)F_ARTICLE.AR_Gamme1) &&
                        PsAttributeGroupRepository.ExistAttributeGroup((uint)AttributeGroupRepository.ReadSage((int)F_ARTICLE.AR_Gamme1).Pre_Id) &&
                        ((F_ARTICLE.AR_Gamme2 == null || F_ARTICLE.AR_Gamme2 == 0) ||
                         (AttributeGroupRepository.ExistSage((int)F_ARTICLE.AR_Gamme2) &&
                          PsAttributeGroupRepository.ExistAttributeGroup((uint)AttributeGroupRepository.ReadSage((int)F_ARTICLE.AR_Gamme2).Pre_Id))))
                    {
                        Model.Local.AttributeArticleRepository AttributeArticleRepository = new Model.Local.AttributeArticleRepository();
                        List <Model.Local.AttributeArticle>    ListAttributeArticle       = AttributeArticleRepository.ListArticleSync(Article.Art_Id, true);

                        Model.Prestashop.PsProductAttributeRepository PsProductAttributeRepository = new Model.Prestashop.PsProductAttributeRepository();
                        Model.Prestashop.PsProductAttribute           PsProductAttribute;

                        int CumulStockGammes = 0;
                        foreach (Model.Local.AttributeArticle AttributeArticle in ListAttributeArticle)
                        {
                            if (AttributeArticle.EnumereF_ARTENUMREF != null)
                            {
                                PsProductAttribute = new Model.Prestashop.PsProductAttribute();
                                isProductAttribute = false;

                                if (AttributeArticle.Pre_Id != null && AttributeArticle.Pre_Id != 0)
                                {
                                    if (PsProductAttributeRepository.ExistProductAttribute((UInt32)AttributeArticle.Pre_Id))
                                    {
                                        PsProductAttribute = PsProductAttributeRepository.ReadProductAttribute((UInt32)AttributeArticle.Pre_Id);
                                        isProductAttribute = true;
                                    }
                                }

                                if (isProductAttribute == true)
                                {
                                    if (Core.Global.GetConfig().MajPoidsSynchroStock)
                                    {
                                        SynchronisationArticle.ReadWeightAttribute(PsProduct, PsProductAttribute, F_ARTICLE, AttributeArticle.EnumereGamme1);
                                    }

                                    SynchronisationArticle.ReadQuantityAttribute(PsProductAttribute, F_ARTICLE, AttributeArticle.EnumereGamme1, AttributeArticle.EnumereGamme2);
                                    CumulStockGammes += PsProductAttribute.Quantity;

                                    // <JG> 03/06/2016
                                    if (Article.Art_SyncPrice)
                                    {
                                        SynchronisationArticle.ReadPriceAttribute(PsProduct, PsProductAttribute, F_ARTICLE, AttributeArticle.EnumereGamme1, AttributeArticle.EnumereGamme2, TaxeTVA);
                                    }

                                    PsProductAttributeRepository.Save();
                                    SynchronisationArticle.ExecShopProductAttribute(PsProductAttribute);

                                    SynchronisationArticle.WriteStockAvailableProductAttribute(PsProduct, PsProductAttribute);
                                }
                            }
                        }
                        if (PsProduct.Quantity != CumulStockGammes)
                        {
                            PsProduct.Quantity = CumulStockGammes;
                            PsProductRepository.Save();
                        }
                        PsProductAttributeRepository.WriteDate(PsProduct.IDProduct);
                    }
                }
            }
            catch (Exception ex)
            {
                Core.Error.SendMailError(ex.ToString());
            }
        }
Пример #6
0
        private void ExecLocalToDistant(Model.Local.Article Article, Model.Prestashop.PsProduct Product, Model.Prestashop.PsProductRepository PsProductRepository)
        {
            try
            {
                if (Article.TypeArticle == Model.Local.Article.enum_TypeArticle.ArticleComposition)
                {
                    if (Core.UpdateVersion.License.Option2)
                    {
                        Product.Quantity = 0;
                        SynchronisationArticle.WriteStockAvailableProduct(Product);
                        ExecCompositionArticle(Article, Product);
                    }
                }
                else
                {
                    Model.Sage.F_ARTICLERepository F_ARTICLERepository = new Model.Sage.F_ARTICLERepository();
                    if (F_ARTICLERepository.ExistArticle(Article.Sag_Id))
                    {
                        Model.Sage.F_ARTICLE F_ARTICLE = F_ARTICLERepository.ReadArticle(Article.Sag_Id);
                        SynchronisationArticle.ReadQuantity(F_ARTICLE, Product);

                        #region Stock pack limité par composés
                        if (Article.Art_Pack == true || F_ARTICLE.AR_Nomencl == (short)ABSTRACTION_SAGE.F_ARTICLE.Obj._Enum_AR_Nomencl.Commerciale_Composant ||
                            F_ARTICLE.AR_Nomencl == (short)ABSTRACTION_SAGE.F_ARTICLE.Obj._Enum_AR_Nomencl.Commerciale_Compose)                                        // pour que les articles en nomenclature soient pris en compte
                        {
                            Model.Sage.F_NOMENCLATRepository F_NOMENCLATRepository = new Model.Sage.F_NOMENCLATRepository();
                            List <Model.Sage.F_NOMENCLAT>    ListF_NOMENCLAT       = F_NOMENCLATRepository.ListRef(F_ARTICLE.AR_Ref);
                            Model.Sage.F_ARTICLE             F_ARTICLENOMENCLAT;
                            Int32 QuantityPack = 0;
                            foreach (Model.Sage.F_NOMENCLAT F_NOMENCLAT in ListF_NOMENCLAT)
                            {
                                if (F_ARTICLERepository.ExistReference(F_NOMENCLAT.NO_RefDet))
                                {
                                    F_ARTICLENOMENCLAT = F_ARTICLERepository.ReadReference(F_NOMENCLAT.NO_RefDet);
                                    if (F_ARTICLENOMENCLAT.AR_SuiviStock != (short)ABSTRACTION_SAGE.F_ARTICLE.Obj._Enum_AR_SuiviStock.Aucun)                                            // pour ne pas prendre en compte les articles non suivi en stock
                                    {
                                        Int32 CurrentQuantity = SynchronisationArticle.ReadQuantityPack(F_ARTICLENOMENCLAT, F_NOMENCLAT.NO_Qte.Value);
                                        if (Core.Global.GetConfig().ArticleStockNegatifZero&& CurrentQuantity < 0)
                                        {
                                            CurrentQuantity = 0;
                                        }
                                        if (CurrentQuantity < QuantityPack)
                                        {
                                            QuantityPack = CurrentQuantity;
                                            // <AM> 14/08/2014 Si un des articles composant n'a pas de stock on sort de la fonction pour que l'article parent ai un stock à 0
                                            if (CurrentQuantity == 0)
                                            {
                                                break;
                                            }
                                        }
                                        else if (QuantityPack == 0)
                                        {
                                            QuantityPack = CurrentQuantity;
                                            // <AM> 14/08/2014 Si un des articles composant n'a pas de stock on sort de la fonction pour que l'article parent ai un stock à 0
                                            if (CurrentQuantity == 0)
                                            {
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                            Product.Quantity = QuantityPack;
                        }
                        #endregion

                        // <JG> 29/10/2012 ajout synchronisation des stocks seule
                        //SynchronisationArticle.ReadEcoTaxe(F_ARTICLE, Product);
                        //SynchronisationArticle.ReadPrice(F_ARTICLE, Product);

                        if (Core.Global.GetConfig().MajPoidsSynchroStock)
                        {
                            SynchronisationArticle.ReadWeight(F_ARTICLE, Product);
                        }

                        if (Core.Global.GetConfig().ArticleDateDispoInfoLibreActif)
                        {
                            SynchronisationArticle.ReadDateDispo(Product, F_ARTICLE);
                        }

                        PsProductRepository.Save();
                        PsProductRepository.WriteDate(Product.IDProduct);

                        this.ExecAttribute(Article, Product, PsProductRepository);
                        this.ExecConditioning(Article, Product, PsProductRepository);

                        //SynchronisationArticle.ExecSpecificPrice(F_ARTICLE, Product);

                        // <JG> 17/12/2012
                        SynchronisationArticle.ExecShopProduct(Product);

                        SynchronisationArticle.WriteStockAvailableProduct(Product);
                    }
                }
            }
            catch (Exception ex)
            {
                Core.Error.SendMailError(ex.ToString());
            }
        }