EDI edifabric x12 813格式序列/排列问题

时间:2016-08-22 15:25:13

标签: c# edi x12 edifabric

无法切换"税务信息和金额"和#34; Form Group"。 " Form Group"应该先来:

以下是我在TIA之前首先在EDI指南表组上的表格组和TIA的功能,但是一代TIA总是排在第一位。

     public void FGS_FormGroupSummary(G_TFS g_tfs, string assignedId)
     {
         if (g_tfs.G_FGS == null)
         {
             g_tfs.G_FGS = new List<G_FGS>();
         }
         G_FGS formGroup = new G_FGS();
         formGroup.S_FGS = new S_FGS();
         formGroup.S_FGS.D_350_1 = assignedId;
         g_tfs.G_FGS.Add(formGroup);
     }
     public void TIA_TaxInformationAndAmount2(G_TFS g_tfs, string taxInfoCode, string monetaryAmount, string quantity)
     {
         //Tax Information and Amount Segment
         G_TIA tia = new G_TIA();
         g_tfs.G_TIA = new List<G_TIA>();
         tia.S_TIA_2 = new S_TIA_2();

         tia.S_TIA_2.C_C037_2 = new C_C037_2();
         tia.S_TIA_2.C_C001_2 = new C_C001_2();

         tia.S_TIA_2.C_C037_2.D_817_1 = taxInfoCode;                //"5003" = Total Due In Dollars
         tia.S_TIA_2.D_782_2 = monetaryAmount;
         tia.S_TIA_2.D_380_4 = quantity;                            //Quantity
         tia.S_TIA_2.C_C001_2.D_355_1 = X12_ID_355.GA;              //"GA" = Gallons
         g_tfs.G_TIA.Add(tia);
     }

下面的图片是调用上述函数的代码,你可以看到我在TIA之前首先调用Form Group

Code posted as image. Sorry screen-reader users, the person who posted this question doesn't care about you.

2 个答案:

答案 0 :(得分:1)

生成遵循类定义的顺序。这是什么交易集和版本?如果你需要这两个交换,那么你需要在类定义中交换它们。

答案 1 :(得分:1)

在813的类定义中更改:

    [Serializable]
    [XmlType(AnonymousType=true, Namespace="www.edifabric.com/x12")]
    [XmlRoot(Namespace="www.edifabric.com/x12", IsNullable=false)]
    public class G_TFS {
    [XmlElement(Order=0)]
    public S_TFS S_TFS {get; set;}
    [XmlElement("S_REF_2",Order=1)]
    public List<S_REF_2> S_REF_2 {get; set;}
    [XmlElement("S_DTM_2",Order=2)]
    public List<S_DTM_2> S_DTM_2 {get; set;}
    [XmlElement("S_MSG",Order=3)]
    public List<S_MSG> S_MSG {get; set;}
    [XmlElement("G_N1_2",Order=4)]
    public List<G_N1_2> G_N1_2 {get; set;}
    [XmlElement("G_TIA",Order=5)]
    public List<G_TIA> G_TIA {get; set;}
    [XmlElement("G_FGS",Order=6)]
    public List<G_FGS> G_FGS {get; set;}
    }

到此:

    [Serializable]
    [XmlType(AnonymousType=true, Namespace="www.edifabric.com/x12")]
    [XmlRoot(Namespace="www.edifabric.com/x12", IsNullable=false)]
    public class G_TFS {
    [XmlElement(Order=0)]
    public S_TFS S_TFS {get; set;}
    [XmlElement("S_REF_2",Order=1)]
    public List<S_REF_2> S_REF_2 {get; set;}
    [XmlElement("S_DTM_2",Order=2)]
    public List<S_DTM_2> S_DTM_2 {get; set;}
    [XmlElement("S_MSG",Order=3)]
    public List<S_MSG> S_MSG {get; set;}
    [XmlElement("G_N1_2",Order=4)]
    public List<G_N1_2> G_N1_2 {get; set;}        
    [XmlElement("G_FGS",Order=5)]
    public List<G_FGS> G_FGS {get; set;}
    [XmlElement("G_TIA",Order=6)]
    public List<G_TIA> G_TIA {get; set;}
    }