You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the file EdiSerializer.cs line 136, I needed to remove the "else" because I needed to go this loop line 136 to deserialised a segment "UNG" for a fonctional group.
if(reader.IsStartGroup){
TryCreateContainer(reader, stack, EdiStructureType.Group);}elseif(reader.IsEndGroup){while(stack.Peek().StructureType > EdiStructureType.Group){
stack.Pop();}value= stack.Peek().Instance;}if(reader.TokenType == EdiToken.SegmentName){while(true){if(TryCreateContainer(reader, stack, EdiStructureType.SegmentGroup)|| TryCreateContainer(reader, stack, EdiStructureType.Segment)|| implicitSegments.Contains(reader.Value)||!AutoEndSegmentGroups){break;}
stack.Pop();if(stack.Count ==0){thrownew EdiException("Unable to deserialize segment {0}. No matching property found on stack.".FormatWith(
reader.Culture,
reader.Value));}}}elseif(reader.TokenType == EdiToken.ElementStart){
TryCreateContainer(reader, stack, EdiStructureType.Element);}
Here is the description of my classes :
// En-tête d'interchange[EdiSegment,EdiPath("UNB")]publicclassSegment_UNB{// S001 : IDENTIFIANT DE SYNTAXE[EdiValue("X(4)", Path ="UNB/0/0", Mandatory =true)]publicstringS001_0001_1_IdentifiantSyntaxe{get;set;}[EdiValue("9(1)", Path ="UNB/0/1", Mandatory =true)]publicintS001_0002_1_NumeroVersionSyntaxe{get;set;}// S002 : EMETTEUR DE L'INTERCHANGE[EdiValue("X(35)", Path ="UNB/1/0", Mandatory =true)]publicstringS002_0004_1_IdentificationEmetteur{get;set;}[EdiValue("X(4)", Path ="UNB/1/1", Mandatory =true)]publicstringS002_0007_1_QualifiantIdentification{get;set;}[EdiValue("X(14)", Path ="UNB/1/2", Mandatory =false)]publicstringS002_0008_1_AdresseAcheminementRetour{get;set;}// S003 : RECEPTEUR DE L'INTERCHANGE[EdiValue("X(35)", Path ="UNB/2/0", Mandatory =true)]publicstringS003_0010_1_IdentificationDestinataire{get;set;}[EdiValue("X(4)", Path ="UNB/2/1", Mandatory =true)]publicstringS003_0007_1_QualifiantIdentification{get;set;}[EdiValue("X(14)", Path ="UNB/2/2", Mandatory =false)]publicstringS003_0014_1_AdresseAcheminement{get;set;}// S004 : DATE ET HEURE DE PREPARATION[EdiValue("9(6)", Path ="UNB/3/0", Format ="yyMMdd", Description ="Date de préparation")]publicDateTimeS004_0017_1_DatePreparation{get;set;}[EdiValue("9(4)", Path ="UNB/3/1", Format ="HHmm", Description ="Heure de préparation")]publicDateTimeS004_0019_1_HeurePreparation{get;set;}// 0020 : REFERENCE DE CONTROLE DE L’INTERCHANGE[EdiValue("X(14)", Path ="UNB/4/0", Mandatory =true)]publicstring_0020_1_ReferenceControleInterchange{get;set;}// S005 : REFERENCE DESTINATAIRE / MOT DE PASSE // 0026 : REFERENCE APPLICATION// 0029 : CODE DE PRIORITE POUR LE TRAITEMENT// 0031 : DEMANDE D’ACCUSE DE RECEPTION// 0032 : IDENTIFICATION DE L’ACCORD D’INTERCHANGE[EdiValue("X(35)", Path ="UNB/9/0", Mandatory =true)]publicstring_0032_1_IdentificationAccordInterchange{get;set;}// 0035 : INDICATEUR DE TEST[EdiValue("9(1)", Path ="UNB/10/0", Mandatory =false)]publicint_0035_1_IndicateurTest{get;set;}}// En-tête de groupe fonctionnel[EdiSegment,EdiPath("UNG")]publicclassSegment_UNG{// 0038 : INDENTIFICATION DU GROUPE FONCTIONNEL[EdiValue("X(6)", Path ="UNG/0/0", Mandatory =true)]publicstring_0038_1_IdentificationGouprFonctionnel{get;set;}// S006 : IDENTIF. DE L’EMETTEUR DE L’APPLICATION[EdiValue("X(35)", Path ="UNG/1/0", Mandatory =true)]publicstringS006_0040_1_IdentificationEmetteur{get;set;}// S007 : IDENTIF. DU DESTINATAIRE DE L’APPLICATION[EdiValue("X(35)", Path ="UNG/2/0", Mandatory =true)]publicstringS007_0044_1_IdentificationDestinataire{get;set;}// S004 : DATE ET HEURE DE PREPARATION[EdiValue("9(6)", Path ="UNG/3/0", Format ="yyMMdd", Description ="Date de préparation")]publicDateTimeS004_0017_1_DatePreparation{get;set;}[EdiValue("9(4)", Path ="UNG/3/1", Format ="HHmm", Description ="Heure de préparation")]publicDateTimeS004_0019_1_HeurePreparation{get;set;}// 0048 : N° DE REFERENCE DU GROUPE FONCTIONNEL[EdiValue("X(14)", Path ="UNG/4/0", Mandatory =true)]publicstring_0048_1_ReferenceGroupeFonctionnel{get;set;}// 0051 : AGENCE DE CONTROLE[EdiValue("X(2)", Path ="UNG/5/0", Mandatory =true)]publicstring_0051_1_AgenceControle{get;set;}// S008 : VERSION DU MESSAGE[EdiValue("X(3)", Path ="UNG/6/0", Mandatory =true)]publicstringS008_0052_1_NumeroVersionMessage{get;set;}[EdiValue("X(3)", Path ="UNG/6/1", Mandatory =true)]publicstringS008_0054_1_NumeroRevisionMessage{get;set;}[EdiValue("X(6)", Path ="UNG/6/2", Mandatory =true)]publicstringS008_0057_1_CodeAttibueParAssociation{get;set;}}// En-tête de message[EdiSegment,EdiPath("UNH")]publicclassSegment_UNH{// 0062 : NUMERO DE REFERENCE DU MESSAGE[EdiValue("X(14)", Path ="UNH/0/0", Mandatory =true)]publicstring_0062_1_NumeroReferenceMessage{get;set;}// S009 : IDENTIFIANT DU MESSAGE[EdiValue("X(6)", Path ="UNH/1/0", Mandatory =true)]publicstringS009_0065_1_IdentifiantTypeMessage{get;set;}[EdiValue("X(3)", Path ="UNH/1/1", Mandatory =true)]publicstringS009_0052_1_NumeroVersionTypeMessage{get;set;}[EdiValue("X(3)", Path ="UNH/1/2", Mandatory =true)]publicstringS009_0054_1_NumeroRevisionMessage{get;set;}[EdiValue("X(2)", Path ="UNH/1/3", Mandatory =true)]publicstringS009_0051_1_AgenceControle{get;set;}[EdiValue("X(6)", Path ="UNH/1/4", Mandatory =false)]publicstringS009_0057_1_CodeAttribueParAssociation{get;set;}// 0068 : REFERENCE COMMUNE D'ACCES[EdiValue("X(35)", Path ="UNH/2/0", Mandatory =false)]publicstring_0068_1_ReferenceCommuneAcces{get;set;}}// Debut du message[EdiSegment,EdiPath("BGM")]publicclassSegment_BGM{// C002 : NOM DU DOCUMENT OU MESSAGE[EdiValue("X(3)", Path ="BGM/0/0", Mandatory =true)]publicstringC002_1001_1_NomDocumentOuMessage{get;set;}[EdiValue("X(17)", Path ="BGM/0/1", Mandatory =true)]publicstringC002_1131_1_QltListeCodes{get;set;}[EdiValue("X(3)", Path ="BGM/0/2", Mandatory =true)]publicstringC002_3055_1_OrgResponbsableListeCodes{get;set;}[EdiValue("X(35)", Path ="BGM/0/3", Mandatory =false)]publicstringC002_1000_1_NomDocumentOuMessage2{get;set;}// C106 : IDENTIFICATION DU DOCUMENT OU MESSAGE[EdiValue("X(35)", Path ="BGM/1/0", Mandatory =false)]publicstringC106_1004_1_NumeroDocumentOuMessage{get;set;}}// Fin de message[EdiSegment,EdiPath("UNT")]publicclassSegment_UNT{// 0074 : NOMBRE DE SEGMENTS DANS LE MESSAGE[EdiValue("9(6)", Path ="UNT/0/0", Mandatory =true)]publicint_0074_1_NombreSegmentsDansMessage{get;set;}// 0062 : NUMÉRO DE RÉFÉRENCE DU MESSAGE[EdiValue("X(14)", Path ="UNT/1/0", Mandatory =true)]publicstring_0062_1_NumeroReferenceMessage{get;set;}}// Fin de groupe fonctionnel[EdiSegment,EdiPath("UNE")]publicclassSegment_UNE{// 0060 : NOMBRE DE MESSAGES[EdiValue("9(6)", Path ="UNE/0/0", Mandatory =true)]publicint_0060_1_NombreMessage{get;set;}// 0048 : N° DE REFERENCE DU GROUPE FONCTIONNEL[EdiValue("X(14)", Path ="UNE/1/0", Mandatory =true)]publicstring_0048_1_NumeroReferenceGroupeFonctionnel{get;set;}}// Fin d'interchange[EdiSegment,EdiPath("UNZ")]publicclassSegment_UNZ{// 0036 : COMPTEUR DE CONTROLE DE L’INTERCHANGE[EdiValue("X(1)", Path ="UNZ/0/0", Mandatory =true)]publicint_0036_1_CompteurControleInterchange{get;set;}// 0020 : REFERENCE DE CONTROLE DE L’INTERCHANGE[EdiValue("X(14)", Path ="UNZ/1/0", Mandatory =true)]publicstring_0020_1_ReferenceControleInterchange{get;set;}}
If I don't remove "else" line 136 in EdiSerializer.cs, when I execute the following code, my segment UNG and UNE are not deserialized :
staticvoidMain(string[]args){EdiPaiementfichierEdiPaiementFluxCva_1329DEF=new EdiPaiement();IEdiGrammargrammaire= EdiGrammar.NewEdiFact();
grammaire.SetAdvice('+','+',':','\'','?',' ',',');EdiSerializerserializer=new EdiSerializer {AutoEndSegmentGroups=true};fichierEdiPaiementFluxCva_1329DEF= serializer.Deserialize<EdiPaiement>(new StreamReader(@"E:\Perso\Recherches pour EDI WEB\test4.edi"), grammaire);
Console.WriteLine("Fichier EDI lu !");}
thanks for pointing this out! I don't know how I missed this since I have fixed it in the past for the message headers and trailers. Anyway a new version is on its way to nuget v1.9.3 wait for a couple of minutes in order for it to show up.
Hello,
In the file EdiSerializer.cs line 136, I needed to remove the "else" because I needed to go this loop line 136 to deserialised a segment "UNG" for a fonctional group.
Here is the description of my classes :
If I don't remove "else" line 136 in EdiSerializer.cs, when I execute the following code, my segment UNG and UNE are not deserialized :
Here is my file EDIFACT :
The text was updated successfully, but these errors were encountered: