Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EdiCondition not working to RFF+CR #257

Open
sukleinkauf opened this issue Apr 10, 2024 · 1 comment
Open

EdiCondition not working to RFF+CR #257

sukleinkauf opened this issue Apr 10, 2024 · 1 comment
Labels

Comments

@sukleinkauf
Copy link

sukleinkauf commented Apr 10, 2024

Thank you for putting in the work and making this library available.

I am trying to parse an EDIFACT 01B file and I am having troubles in constructing my custom classes to read an EDIFACT file.
I am trying to map the RFF+CR with no success. I am brand new on EDIFACT, so possible I am doing something wrong here.

LIN+00010++000000000060325004:IN'
IMD+++:::VALVE,TEST,FULLPORT,1IN,SS,FLG'
QTY+21:9.000'
DTM+50:20240422:102'
DTM+2:20240422:102'
MOA+203:81'
GIN+BN+FG125'
PRI+INF'
CUX+2:AUD:9'
RFF+CR:S/F, P4, TEST'
RFF+AEU:TEST_Exw W AUS-S/F'
RFF+WS:MAIN'
PAC+++EA'
TDT+20++G4'
LIN+00020++000000000060367095:IN'
IMD+++:::VALVE,GATE,KNIFE,200MM,CS,WAFER'
QTY+21:11.000'
DTM+50:20240819:102'
DTM+2:20240819:102'
MOA+203:44'
GIN+BN+200NB ANSI150'
PRI+INF'
CUX+2:AUD:9'
RFF+CR:TEST,TEST,s/f,p4'
RFF+AEU:Test_Exw W AUS-S/F'
RFF+WS:MAIN'
PAC+++EA'
TDT+20++G4'

My code:

      [EdiSegment, EdiSegmentGroup("LIN", SequenceEnd = "TDT")]
      public class LineItem
      {
          [EdiValue("X(1)", Path = "LIN/0/0")]
          public string LineNumber { get; set; }

          [EdiValue("9(3)", Path = "QTY/0/1")]
          public string Qty { get; set; }

          [EdiValue("9(3)", Path = "LIN/1/0")]
          public string Code { get; set; }

          [EdiValue("9(3)", Path = "LIN/2/0")]
          public string Unit { get; set; }

          [EdiValue("9(3)", Path = "LIN/2/1")]
          public string Type { get; set; }

          [EdiCondition("2", Path = "DTM/0/0")]
          public Date ActualDeliveryData { get; set; } //ATA

          [EdiCondition("50", Path = "DTM/0/0")]
          public Date ExpectedShipDate { get; set; } //ETD

          public PriceDetails Prices { get; set; }

          [EdiValue("X(256)", Path = "IMD/2/3")]
          public string ItemDescription { get; set; }

          [EdiCondition("CR", Path = "RFF/0")]
          public Reference OtherReferences { get; set; }


      }

Thank you

@cleftheris
Copy link
Contributor

cleftheris commented Jun 3, 2024

Hi @sukleinkauf it seems to me you are using the simple version of defining a segment group. The one with sequence end would not work well in your scenario (actually its not recommended for most cases). It usually works for simplistic quick deserialization scenarios. These usually map only few component values flat on the segment group class (In your case that would be LIN).

That said you should go with the explicit declaration of the SegmentGroups attribute by specifying all segment tags involved in the group on the same level (Segment groups can also be nested).

Check these other questions regarding segment groups #214

Also you can find interesting examples in the tests project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants