using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; namespace HH.YiDaSyncNC.Models { class WL_SyncServiceModel { public class DataModel { public string pk_group { get; set; } public string pk_org { get; set; } public string code { get; set; } public string name { get; set; } public string ename { get; set; } public string pk_marbasclass { get; set; } public string pk_measdoc { get; set; } public string pk_mattaxes { get; set; } public string materialshortname { get; set; } public string materialspec { get; set; } public string materialtype { get; set; } public string ematerialspec { get; set; } public string pk_brand { get; set; } public string materialmnecode { get; set; } public string enablestate { get; set; } } public class ImportXml { /// /// 模板头部份 /// /// public static XElement TemplateHeade() { return new XElement(new XElement("ufinterface", new object[] { new XAttribute("sender","dingding"), new XAttribute("roottag",""), new XAttribute("replace","Y"), new XAttribute("isexchange","Y"), new XAttribute("groupcode","0"), new XAttribute("filename",""), new XAttribute("billtype","material"), new XAttribute("proc","add"), new XAttribute("account","develop") })); } /// /// 组建表头xml /// /// 表头参数 /// public static XElement Header(DataModel item, string id) { return new XElement("bill", new object[] { "", new XAttribute("id",id), new XElement("billhead", new object[] { new XElement("pk_group",item.pk_group), new XElement("pk_org",item.pk_org), //new XElement("pk_source",item.pk_source), new XElement("code",item.code), new XElement("name",item.name), new XElement("ename",item.ename), new XElement("pk_marbasclass",item.pk_marbasclass), new XElement("pk_measdoc",item.pk_measdoc), new XElement("pk_mattaxes",item.pk_mattaxes), new XElement("materialshortname",item.materialshortname), new XElement("materialspec",item.materialspec), new XElement("materialtype",item.materialtype), new XElement("ematerialspec",item.ematerialspec), new XElement("pk_brand",item.pk_brand), new XElement("materialmnecode",item.materialmnecode), new XElement("productfamily","N"), new XElement("intolerance","0"), new XElement("outtolerance","0"), new XElement("outcloselowerlimit","0"), new XElement("enablestate",item.enablestate), //new XElement("materialconvert",new object[]{ }), //new XElement("materialtaxtype",new object[]{ }), }), }); } } } }