Skip to content
Permalink
Browse files

initial

  • Loading branch information...
DXSdata committed Aug 25, 2019
1 parent 962b131 commit 74ba0b6b1b9f8ff6cbb52f8e930fe09c2e6411b4
108 README.md
@@ -1,2 +1,108 @@
# openTRANS
.NET Core / Standard implementation of XML openTRANS v2.1 format
.NET Core / Standard implementation of Fraunhofer IAO's XML openTRANS v2.1 format definitions



# Sample
See testform subproject for a working example.

Excerpt:


```CSharp
var o = new Order();
o.OrderHeader.OrderInfo.DeliveryDate.Type = DeliveryDateType.Fixed;
o.OrderHeader.OrderInfo.DeliveryDate.DeliveryStartDate = DateTime.Now.Date.AddDays(3);
o.OrderHeader.OrderInfo.DeliveryDate.DeliveryEndDate = DateTime.Now.Date.AddDays(4);
o.OrderHeader.ControlInfo.GeneratorInfo = "DXSdata openTRANS Generator";
o.OrderHeader.ControlInfo.GenerationDate = DateTime.Now;
o.OrderHeader.OrderInfo.OrderId = "123";
o.OrderHeader.OrderInfo.OrderDate = DateTime.Now.Date;
var p1 = new Party();
p1.PartyId.Value = "TestSupplier";
p1.PartyId.Type = PartyType.BuyerSpecific;
p1.PartyRole = PartyRole.Supplier;
var p2 = new Party();
p2.PartyId.Value = "MyCustomerNumberOfSupplier";
p2.PartyId.Type = PartyType.SupplierSpecific;
p2.PartyRole = PartyRole.Buyer;
p2.Address.Name = "MyCompany";
p2.Address.ContactDetails.ContactName = "MyEmployee";
p2.Address.Street = "MyStreet";
p2.Address.Zip = "MyZipCode";
p2.Address.City = "MyCity";
p2.Address.Country = "Austria";
p2.Address.Phone.Value = "+1234";
p2.Address.Phone.Value = PhoneType.Office;
p2.Address.Fax.Value = "+5678";
p2.Address.Fax.Type = PhoneType.Office;
p2.Address.Email = "me@example.com";
var p3 = new Party();
p3.PartyId.Value = "MyCustomerNumberOfSupplier";
p3.PartyId.Type = PartyType.ERPlusSpecific;
p3.PartyRole = PartyRole.Delivery;
p3.Address.Name = "MyDeliveryAddress";
p3.Address.Street = "MyDeliveryAddress";
p3.Address.Zip = "MyDeliveryAddress";
p3.Address.City = "MyDeliveryAddress";
o.OrderHeader.OrderInfo.Parties.AddRange(new[] { p1, p2, p3 });
o.OrderHeader.OrderInfo.OrderPartiesReference.BuyerIdRef.Value = "MyCustomerNumberOfSupplier";
o.OrderHeader.OrderInfo.OrderPartiesReference.BuyerIdRef.Type = PartyType.SupplierSpecific;
o.OrderHeader.OrderInfo.OrderPartiesReference.SupplierIdRef.Value = "TestSupplier";
o.OrderHeader.OrderInfo.OrderPartiesReference.SupplierIdRef.Type = PartyType.BuyerSpecific;
o.OrderHeader.OrderInfo.OrderPartiesReference.ShipmentPartiesReference.DeliveryIdRef.Value = "MyCustomerNumberOfSupplier";
o.OrderHeader.OrderInfo.OrderPartiesReference.ShipmentPartiesReference.DeliveryIdRef.Type = PartyType.SupplierSpecific;
//foreach (var pos in myOrderPositions)
{
var oi = new OrderItem();
oi.LineItemId = "001";
oi.ProductId.SupplierPid = "testnr";
oi.ProductId.BuyerPid.Value = "testnr";
oi.ProductId.DescriptionShort = "testdescription";
var features = new List<(string fname, string fval, string funit)>();
features.Add(("ColorCodeInside", "a", null));
features.Add(("ColorCodeOutside", "b", null));
features.Add(("Length", "3,12".ToString(nfi), "mm"));
features.Add(("Width", "4", "mm"));
features.Add(("Height", "6", "mm"));
foreach (var feature in features)
{
if (!string.IsNullOrWhiteSpace(feature.fval))
{
var f = new Feature();
f.FName = feature.fname;
f.FValue = feature.fval;
f.FUnit = feature.funit;
oi.ProductFeatures.Add(f);
}
}
oi.Quantity = 13;
oi.OrderUnit = "mm".
Replace("mm", OrderUnit.Millimeter).
Replace("stk", OrderUnit.Piece).
Replace("stg", OrderUnit.Piece);
oi.ProductPriceFix.PriceAmount = 14;
//oi.ProductPriceFix.AllowOrChargesFix.AllowOrCharge.Type = AllowOrChargeTypes.Allowance;
o.OrderItemList.Add(oi);
}
var ot = new XmlCreator(o).Result;
```

# Links
- Website https://www.dxsdata.com/2019/08/opentrans-for-net-core/
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2036
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "openTRANS", "openTRANS\openTRANS.csproj", "{81C3C0B9-070A-4A66-9D0A-1EA620EEF215}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testform", "testform\testform.csproj", "{0397DD7B-5660-4B3F-BC7D-77FF915DA70E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{81C3C0B9-070A-4A66-9D0A-1EA620EEF215}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{81C3C0B9-070A-4A66-9D0A-1EA620EEF215}.Debug|Any CPU.Build.0 = Debug|Any CPU
{81C3C0B9-070A-4A66-9D0A-1EA620EEF215}.Release|Any CPU.ActiveCfg = Release|Any CPU
{81C3C0B9-070A-4A66-9D0A-1EA620EEF215}.Release|Any CPU.Build.0 = Release|Any CPU
{0397DD7B-5660-4B3F-BC7D-77FF915DA70E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0397DD7B-5660-4B3F-BC7D-77FF915DA70E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0397DD7B-5660-4B3F-BC7D-77FF915DA70E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0397DD7B-5660-4B3F-BC7D-77FF915DA70E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {205A4F8F-95D4-4961-A977-FECF6CC3B8A0}
EndGlobalSection
EndGlobal
@@ -0,0 +1,106 @@

using System.Xml.Serialization;

namespace openTRANS
{
public static class Common
{
public static class Namespace
{
public const string xsi = "http://www.w3.org/2001/XMLSchema-instance";
public const string bmecat = "http://www.bmecat.org/bmecat/2005";
public const string xmime = "http://www.w3.org/2005/05/xmlmime";
public const string xsig = "http://www.w3.org/2000/09/xmldsig#";
}

public static class PartyType
{
public const string BuyerSpecific = "buyer_specific";
public const string CustomerSpecific = "customer_specific,";
public const string DUNS = "duns";
public const string ILN = "iln";
public const string GLN = "gln";
public const string PartySpecific = "party_specific";
public const string SupplierSpecific = "supplier_specific";

/// <summary>
/// Not in OT Standard; for custom use
/// </summary>
public const string ERPlusSpecific = "erplus_specific";
}

public static class PartyRole
{
public const string Buyer = "buyer";
public const string CentralRegulator = "central_regulator";
public const string Customer = "customer";
public const string Deliverer = "deliverer";
public const string Delivery = "delivery";
public const string DocumentCreator = "document_creator";
public const string FinalDelivery = "final_delivery";
public const string Intermediary = "intermediary";
public const string InvoiceIssuer = "invoice_issuer";
public const string InvoiceRecipient = "invoice_recipient";
public const string IppOperator = "ipp_operator";
public const string Manufacturer = "manufacturer";
public const string Marketplace = "marketplace";
public const string Payer = "payer";
public const string Remittee = "remittee";
public const string StandardizationBody = "standardization_body";
public const string Supplier = "supplier";
public const string TrustedThirdParty = "trustedthirdparty";
public const string Other = "other";
}

public static class OrderUnit
{
public const string Centimeter = "CMT";
public const string Piece = "C62";
public const string Kilogram = "KGM";
public const string Liter = "LTR";
public const string Millimeter = "MMT";
public const string Meter = "MTR";
public const string PackOf2 = "OP";
public const string Packet = "PA";
}

public static class AllowOrChargeTypes //exceptional plural to differ from AllowOrChargeType class
{
public const string Allowance = "allowance";
public const string Surcharge = "surcharge";
}

public static class AllowOrChargeTypeType
{
public const string ProjectBonus = "project_bonus";
public const string OverPackaging = "overpackaging";
public const string Rebate = "rebate";
public const string Recycling = "recycling";
public const string SmallOrder = "small_order";
public const string SpecialWorkTimes = "special_work_times";
public const string Toll = "toll";
}

public static class PhoneType
{
public const string Mobile = "mobile";
public const string Office = "office";
public const string Private = "private";
}

public static class DeliveryDateType
{
public const string Optional = "optional";
public const string Fixed = "fixed";
}

public class TypedItem
{
[XmlText]
public string Value;

[XmlAttribute("type")]
public string Type;
}
}
}

0 comments on commit 74ba0b6

Please sign in to comment.
You can’t perform that action at this time.