XMD_SyncServiceModel.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Xml.Linq;
  7. namespace HH.YiDaSyncNC.Models
  8. {
  9. class XMD_SyncServiceModel
  10. {
  11. public class DataModel
  12. {
  13. public string pk_group { get; set; }
  14. public string pk_org { get; set; }
  15. public string code { get; set; }
  16. public string name { get; set; }
  17. public string pk_marbasclass { get; set; }
  18. public string pk_measdoc { get; set; }
  19. public string pk_mattaxes { get; set; }
  20. public string materialspec { get; set; }
  21. public string materialtype { get; set; }
  22. public string pk_brand { get; set; }
  23. public string enablestate { get; set; }
  24. }
  25. public class ImportXml
  26. {
  27. /// <summary>
  28. /// 模板头部份
  29. /// </summary>
  30. /// <returns></returns>
  31. public static XElement TemplateHeade()
  32. {
  33. return new XElement(new XElement("ufinterface", new object[]
  34. {
  35. new XAttribute("sender","dingding"),
  36. new XAttribute("roottag",""),
  37. new XAttribute("replace","Y"),
  38. new XAttribute("isexchange","Y"),
  39. new XAttribute("groupcode","0"),
  40. new XAttribute("filename",""),
  41. new XAttribute("billtype","material"),
  42. new XAttribute("proc","add"),
  43. new XAttribute("account","develop")
  44. }));
  45. }
  46. /// <summary>
  47. /// 组建表头xml
  48. /// </summary>
  49. /// <param name="item">表头参数</param>
  50. /// <returns></returns>
  51. public static XElement Header(DataModel item, string id)
  52. {
  53. return new XElement("bill", new object[]
  54. {
  55. "",
  56. new XAttribute("id",id),
  57. new XElement("billhead", new object[]
  58. {
  59. new XElement("pk_group",item.pk_group),
  60. new XElement("pk_org",item.pk_org),
  61. //new XElement("pk_source",item.pk_source),
  62. new XElement("code",item.code),
  63. new XElement("name",item.name),
  64. new XElement("pk_marbasclass",item.pk_marbasclass),
  65. new XElement("pk_measdoc",item.pk_measdoc),
  66. new XElement("pk_mattaxes",item.pk_mattaxes),
  67. new XElement("materialspec",item.materialspec),
  68. new XElement("materialtype",item.materialtype),
  69. new XElement("pk_brand",item.pk_brand),
  70. new XElement("productfamily","N"),
  71. new XElement("intolerance","0"),
  72. new XElement("outtolerance","0"),
  73. new XElement("outcloselowerlimit","0"),
  74. new XElement("enablestate",item.enablestate),
  75. //new XElement("materialconvert",new object[]{ }),
  76. //new XElement("materialtaxtype",new object[]{ }),
  77. }),
  78. });
  79. }
  80. }
  81. }
  82. }