Разбор сообщений EDI из строк в C #

У меня есть строка:

UNB + UNOA: 1 + 094200005560743089001003: OD + 094200005565200077SP0001: МОНТЕРИРОВАНИЕ ::::: BP2TH + 005 + TCSB'SEQ + CR + 2059433 + YV1CM5957B1574778: 602816985'ARD + 39855213 :: ЧАСТЬ NO'SDD+100705+1'UNT+9+1'UNZ+1+570180'

This string should be divided into smaller pieces that should be stored away in different variables. The text can be divided into

  1. multiple lines by using a separator text (which is a ' character) and
  2. multiple values in each row with two types of separator text (+ sign and also : character).

The text that appears above is an order, in the form of materials, of a company (customer) to another company (supplier). When the supplier received the order in the form of a text file that is loaded into a computer program, this program splits the text up into small parts and store them in different variables which will be stored in a database at a later stage.

The purpose is to create a form using C#. This form should has a text field when the user will input the text line and then a button, once the user pushes the button the text entered into the text field will be divided into small parts and each part will be stored in a different variable. Once the text is split and stored in variables, all the data should be stored in an array or in an object (a class).


All values are stored as strings. Строка состоит из:

Textpart1 Textpart2 + + + + ... Textpart2 text portion (s) '

Каждая текстовая часть состоит из следующего:

Part 1: Part2: Part 3: Part4: Part5 ... Part (n)

Таким образом, каждое значение может быть указано в форме

Text-> Text line-> text portion-> Del

Каждый текст начинается со значения, которое определяет, какая информация сохраняется в строке. Таким образом, первое значение в каждой строке вызывается для значения ключа (например, MID, SEQ, ARD и т. Д.). Прямо сейчас в каждом тексте есть только одно ключевое значение каждый раз.

Здесь Synroid textpart2 указан как Часть 1 и строка, которая имеет MID в качестве значения ключа. SynroTid указал, что textdel3 и del2.

1
задан dsolimano 3 October 2011 в 14:28
поделиться