Bonjour,
Je rencontre une anomalie lors de la création d'un client via les Objets Métiers V6, cependant je n'ai pas de détails sur l'origine de l'erreur, dans la documentation il ne semble pas y avoir d'indication des champs a renseigner obligatoirement dans les Objets Métiers, ci dessous quelques exemples:
13/01/2023 09:52[DEBUG] - Tiers en cours de création: MDLZ ZA
13/01/2023 09:52[DEBUG] - client.CT_NUM: MDLZZA
13/01/2023 09:52[DEBUG] - client.CT_Intitule: Mondelez South Africa (Proprietary) Limited
13/01/2023 09:52[DEBUG] - client.CT_Adresse: 6 Woodmead Estate
13/01/2023 09:52[DEBUG] - client.CT_Complement: 1 Woodmead Drive
13/01/2023 09:52[DEBUG] - client.CT_CodePostal: 2191
13/01/2023 09:52[DEBUG] - client.CT_Ville: SANDTON
13/01/2023 09:52[DEBUG] - Pays ISO: ZAF
13/01/2023 09:52[DEBUG] - client.CT_Pays: Afrique du Sud
13/01/2023 09:52[DEBUG] - Problème de l'importation du tiers MDLZ ZA Sage: L'instruction a été arrêtée. at Objets100cLib.IBOClient3.Write()
Ou
13/01/2023 09:52[DEBUG] - Tiers en cours de création: STAR KAY
13/01/2023 09:52[DEBUG] - client.CT_NUM: STARKAY
13/01/2023 09:52[DEBUG] - client.CT_Intitule: STAR KAY WHITE
13/01/2023 09:52[DEBUG] - client.CT_Adresse: 100 Brenner Drive
13/01/2023 09:52[DEBUG] - client.CT_Complement: Congers
13/01/2023 09:52[DEBUG] - client.CT_CodePostal: 10920
13/01/2023 09:52[DEBUG] - client.CT_Ville: NY
13/01/2023 09:52[DEBUG] - Pays ISO: USA
13/01/2023 09:52[DEBUG] - client.CT_Pays: États-Unis
13/01/2023 09:52[DEBUG] - Problème de l'importation du tiers STAR KAY Sage: L'instruction a été arrêtée. at Objets100cLib.IBOClient3.Write()
Sur certaines informations j'ai des caractères spéciaux qui pourraient expliques l'anomalie:
13/01/2023 09:52[DEBUG] - Tiers en cours de création: NESTLE IT
13/01/2023 09:52[DEBUG] - client.CT_NUM: NESTLEIT
13/01/2023 09:52[DEBUG] - client.CT_Intitule: Nestl� Italiana S.P.A
13/01/2023 09:52[DEBUG] - client.CT_Adresse: Viale S. Sisto, 207
13/01/2023 09:52[DEBUG] - client.CT_Complement: Stabilimento Perugina
13/01/2023 09:52[DEBUG] - client.CT_CodePostal: 06132
13/01/2023 09:52[DEBUG] - client.CT_Ville: ITALIA
13/01/2023 09:52[DEBUG] - Pays ISO: ITA
13/01/2023 09:52[DEBUG] - client.CT_Pays: Italie
13/01/2023 09:52[DEBUG] - Problème de l'importation du tiers NESTLE IT Sage: L'instruction a été arrêtée. at Objets100cLib.IBOClient3.Write()
Ci dessous la portion de code incriminée, la ligne d'erreur remontée par le catch est celle ci: processClient.WriteDefault(); j'ai tenté une version avec processClient.Write(); mais le problème reste le même
try { IBOTiers3 om_Tiers = null; if (!oCpta.FactoryTiers.ExistNumero(client.CT_Num)) { _logger.InputLog("Tiers en cours de création: " + client.CT_Num, 2); _logger.InputLog("client.CT_NUM: " + client.CT_Num.Replace(" ", ""), 2); _logger.InputLog("client.CT_Intitule: " + client.CT_Intitule, 2); _logger.InputLog("client.CT_Adresse: " + client.CT_Adresse, 2); _logger.InputLog("client.CT_Complement: " + client.CT_Complement, 2); _logger.InputLog("client.CT_CodePostal: " + client.CT_CodePostal, 2); _logger.InputLog("client.CT_Ville: " + client.CT_Ville, 2); _logger.InputLog("Pays ISO: " + client.CT_Pays, 2); String NomPays = countryCodesMapping[client.CT_Pays]; _logger.InputLog("client.CT_Pays: " + NomPays, 2); IBOClient3 processClient = (IBOClient3)oCpta.FactoryClient.Create(); //processClient.SetDefault(); if (!string.IsNullOrEmpty(client.CT_Num)) { if (client.CT_Num.Length > 17) { //CT_NUM processClient.CT_Num = client.CT_Num.Substring(0, 17).Replace(" ",""); //CT_CLASSEMENT processClient.CT_Classement = client.CT_Num.Substring(0, 17); } else { //CT_NUM processClient.CT_Num = client.CT_Num.Replace(" ", ""); //CT_CLASSEMENT processClient.CT_Classement = client.CT_Num; } } //CT_INTITULE if (!string.IsNullOrEmpty(client.CT_Intitule)) { if (client.CT_Intitule.Length > 69) { processClient.CT_Intitule = client.CT_Intitule.Substring(0, 69); } else { processClient.CT_Intitule = client.CT_Intitule.Replace(".", ""); } } //CT_ADRESSE if (!string.IsNullOrEmpty(client.CT_Adresse)) { if (client.CT_Adresse.Length > 35) { processClient.Adresse.Adresse = client.CT_Adresse.Substring(0, 35); } else { processClient.Adresse.Adresse = client.CT_Adresse; } } //CT_COMPLEMENT if (!string.IsNullOrEmpty(client.CT_Complement)) { if (client.CT_Complement.Length > 35) { processClient.Adresse.Complement = client.CT_Complement.Substring(0, 35); } else { processClient.Adresse.Complement = client.CT_Complement; } } //CT_COMPLEMENT if (!string.IsNullOrEmpty(client.CT_CodePostal)) { if (client.CT_CodePostal.Length > 9) { processClient.Adresse.CodePostal = client.CT_CodePostal.Substring(0, 9); } else { processClient.Adresse.CodePostal = client.CT_CodePostal; } } //CT_VILLE if (!string.IsNullOrEmpty(client.CT_Ville)) { if (client.CT_Ville.Length > 35) { processClient.Adresse.Ville = client.CT_Ville.Substring(0, 35).Trim(); } else { processClient.Adresse.Ville = client.CT_Ville.Trim(); } } //CT_VILLE if (!string.IsNullOrEmpty(client.CT_Pays)) { if (NomPays.Length > 35) { processClient.Adresse.Pays = NomPays.Substring(0, 35); } else { processClient.Adresse.Pays = NomPays; } } //CompteGPrinc IBOCompteG3 NouveauComtpeG = (IBOCompteG3)oCpta.FactoryCompteG.ReadNumero("411000"); processClient.CompteGPrinc = NouveauComtpeG; processClient.WriteDefault(); processClient.InfoLibre["N_APPRODIX"] = client.CT_Num; processClient.Write(); err = false; } else { _logger.InputLog("Le tiers: " + client.CT_Num +" existe déjà, il ne sera pas importé", 2); err = true; } } catch (Exception e) { _logger.InputLog("Problème de l'importation du tiers " + client.CT_Num + " Sage: " + e.Message + e.StackTrace + e.Source, 2); err = true; }
J'ai le même type de code sur une version 7 des Objets Métiers sans rencontrer ce problème
Est ce que quelqu'un aurait rencontré le même problème ?
Merci d'avance
Bonne journée