1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
using System.IO;
using System.Xml.Serialization;
namespace Settings
{
[XmlRoot(ElementName = "BARCODES")]
[Serializable]
public class BARCODES
{
[XmlElement(ElementName = "BARCODE")]
public List<string> BARCODE { get; set; }
public BARCODES()
{
}
}
[XmlRoot(ElementName = "SORTED")]
[Serializable]
public class SORTED
{
[XmlElement(ElementName = "SORT_NUMBER")]
public string SORT_NUMBER { get; set; }
[XmlElement(ElementName = "HEIGHT")]
public string HEIGHT { get; set; }
[XmlElement(ElementName = "LOGICAL_SORTING")]
public string LOGICAL_SORTING { get; set; }
public SORTED()
{
}
}
[XmlRoot(ElementName = "CONTAINER")]
[Serializable]
public class CONTAINER
{
[XmlElement(ElementName = "BARCODES")]
public BARCODES BARCODES { get; set; }
[XmlElement(ElementName = "SORTED")]
public SORTED SORTED { get; set; }
[XmlAttribute(AttributeName = "containerId")]
public string ContainerId { get; set; }
[XmlAttribute(AttributeName = "site")]
public string Site { get; set; }
[XmlAttribute(AttributeName = "siteNum")]
public string SiteNum { get; set; }
[XmlAttribute(AttributeName = "status")]
public string Status { get; set; }
[XmlAttribute(AttributeName = "containerType")]
public string ContainerType { get; set; }
[XmlAttribute(AttributeName = "wmsContainerId")]
public string WmsContainerId { get; set; }
public CONTAINER()
{
}
}
[XmlRoot(ElementName = "CONTAINER_REPORT")]
[Serializable]
public class CONTAINER_REPORT
{
[XmlElement(ElementName = "CONTAINER")]
public CONTAINER CONTAINER { get; set; }
[XmlAttribute(AttributeName = "reportId")]
public string ReportId { get; set; }
[XmlAttribute(AttributeName = "date")]
public string Date { get; set; }
public CONTAINER_REPORT()
{
}
}
[XmlRoot(ElementName = "WCS")]
[Serializable]
public class WCS
{
[XmlElement(ElementName = "CONTAINER_REPORT")]
public CONTAINER_REPORT CONTAINER_REPORT { get; set; }
[XmlAttribute(AttributeName = "reference")]
public string Reference { get; set; }
public WCS()
{
}
public void SaveFile(string fPath)
{
XmlSerializer serializer = new XmlSerializer(typeof(WCS));
using (StreamWriter Save = new StreamWriter(fPath))
{
serializer.Serialize(Save, this);
}
}
public static WCS LoadFile(string fPath)
{
XmlSerializer deserializer = new XmlSerializer(typeof(WCS));
using (StreamReader read = new StreamReader(fPath))
{
return (WCS)deserializer.Deserialize(read);
}
}
}
} |