XSFP_SyncServiceModel.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  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 XSFP_SyncServiceModel
  10. {
  11. public class DataModel
  12. {
  13. public string pk_group { get; set; }
  14. public string pk_org { get; set; }
  15. public string pk_org_v { get; set; }
  16. public string ctrantypeid { get; set; }
  17. public string vtrantypecode { get; set; }
  18. public string cbiztypeid { get; set; }
  19. public string vbillcode { get; set; }
  20. public string dbilldate { get; set; }
  21. public string vprintcustname { get; set; }
  22. public string ccustbankid { get; set; }
  23. public string ccustbankaccid { get; set; }
  24. public string cdeptvid { get; set; }
  25. public string cdeptid { get; set; }
  26. public string cemployeeid { get; set; }
  27. public string corigcurrencyid { get; set; }
  28. public string cinvoicecustid { get; set; }
  29. public string cpaytermid { get; set; }
  30. public string approver { get; set; }
  31. public string taudittime { get; set; }
  32. public string billmaker { get; set; }
  33. public string dmakedate { get; set; }
  34. public string creator { get; set; }
  35. public string creationtime { get; set; }
  36. public string ntotalnum { get; set; }
  37. public string ntotalorigmny { get; set; }
  38. public List<OrderB> so_saleorder_b { get; set; }
  39. public class OrderB
  40. {
  41. public string carorgvid { get; set; }
  42. public string carorgid { get; set; }
  43. public string csendstockorgvid { get; set; }
  44. public string csendstockorgid { get; set; }
  45. public string creceivecustid { get; set; }
  46. public string crececountryid { get; set; }
  47. public string csendcountryid { get; set; }
  48. public string ctaxcountryid { get; set; }
  49. public string pk_group { get; set; }
  50. public string pk_org { get; set; }
  51. public string dbilldate { get; set; }
  52. public string crowno { get; set; }
  53. public string cprojectid { get; set; }
  54. public string cmaterialvid { get; set; }
  55. public string cmaterialid { get; set; }
  56. public string cunitid { get; set; }
  57. public string castunitid { get; set; }
  58. public string nastnum { get; set; }
  59. public string vchangerate { get; set; }
  60. public string cqtunitid { get; set; }
  61. public string nqtunitnum { get; set; }
  62. public string nnum { get; set; }
  63. public string vqtunitrate { get; set; }
  64. public string ctaxcodeid { get; set; }
  65. public string ntaxrate { get; set; }
  66. public string ccurrencyid { get; set; }
  67. public string norigtaxprice { get; set; }
  68. public string nqtorigtaxprice { get; set; }
  69. public string nqttaxprice { get; set; }
  70. public string ntaxprice { get; set; }
  71. public string nqtorigprice { get; set; }
  72. public string nqtorignetprice { get; set; }
  73. public string norigprice { get; set; }
  74. public string nprice { get; set; }
  75. public string nqtprice { get; set; }
  76. public string nqtorigtaxnetprc { get; set; }
  77. public string norigtaxnetprice { get; set; }
  78. public string nqttaxnetprice { get; set; }
  79. public string ntaxnetprice { get; set; }
  80. public string norignetprice { get; set; }
  81. public string nnetprice { get; set; }
  82. public string nqtnetprice { get; set; }
  83. public string ntax { get; set; }
  84. public string ncaltaxmny { get; set; }
  85. public string norigmny { get; set; }
  86. public string nmny { get; set; }
  87. public string norigtaxmny { get; set; }
  88. public string ntaxmny { get; set; }
  89. public string vsrctype { get; set; }
  90. public string vsrccode { get; set; }
  91. public string vsrctrantype { get; set; }
  92. public string vsrcrowno { get; set; }
  93. }
  94. }
  95. public class ImportXml
  96. {
  97. /// <summary>
  98. /// 模板头部份
  99. /// </summary>
  100. /// <returns></returns>
  101. public static XElement TemplateHeade()
  102. {
  103. return new XElement(new XElement("ufinterface", new object[]
  104. {
  105. new XAttribute("sender","dingding"),
  106. new XAttribute("roottag",""),
  107. new XAttribute("replace","Y"),
  108. new XAttribute("isexchange","Y"),
  109. new XAttribute("groupcode","0"),
  110. new XAttribute("filename",""),
  111. new XAttribute("billtype","32"),
  112. new XAttribute("account","develop")
  113. }));
  114. }
  115. /// <summary>
  116. /// 组建表头xml
  117. /// </summary>
  118. /// <param name="item">表头参数</param>
  119. /// <returns></returns>
  120. public static XElement Header(DataModel item, string id)
  121. {
  122. var so_saleorder_b = new List<XElement>();
  123. if (item.so_saleorder_b != null && item.so_saleorder_b.Count > 0)
  124. {
  125. foreach (var itemData in item.so_saleorder_b)
  126. {
  127. so_saleorder_b.Add(new XElement("item", new object[] {
  128. new XElement("carorgvid",itemData.carorgvid),
  129. new XElement("carorgid",itemData.carorgid),
  130. new XElement("csendstockorgvid",itemData.csendstockorgvid),
  131. new XElement("csendstockorgid",itemData.csendstockorgid),
  132. new XElement("creceivecustid",itemData.creceivecustid),
  133. new XElement("crececountryid",itemData.crececountryid),
  134. new XElement("csendcountryid",itemData.csendcountryid),
  135. new XElement("ctaxcountryid",itemData.ctaxcountryid),
  136. new XElement("pk_group",itemData.pk_group),
  137. new XElement("pk_org",itemData.pk_org),
  138. new XElement("dbilldate",itemData.dbilldate),
  139. new XElement("crowno",itemData.crowno),
  140. new XElement("cprojectid",itemData.cprojectid),
  141. new XElement("fbuysellflag","1"),
  142. new XElement("cmaterialvid",itemData.cmaterialvid),
  143. new XElement("cmaterialid",itemData.cmaterialid),
  144. new XElement("cunitid",itemData.cunitid),
  145. new XElement("castunitid",itemData.castunitid),
  146. new XElement("nastnum",itemData.nastnum),
  147. new XElement("vchangerate",itemData.vchangerate),
  148. new XElement("cqtunitid",itemData.cqtunitid),
  149. new XElement("nqtunitnum",itemData.nqtunitnum),
  150. new XElement("nnum",itemData.nnum),
  151. new XElement("vqtunitrate",itemData.vqtunitrate),
  152. new XElement("ctaxcodeid",itemData.ctaxcodeid),
  153. new XElement("ntaxrate",itemData.ntaxrate),
  154. new XElement("ftaxtypeflag","1"),
  155. new XElement("ccurrencyid",itemData.ccurrencyid),
  156. new XElement("nexchangerate","1"),
  157. new XElement("ndiscount","0"),
  158. new XElement("ndiscountrate","100"),
  159. new XElement("nitemdiscountrate","100"),
  160. new XElement("norigtaxprice",itemData.norigtaxprice),
  161. new XElement("nqtorigtaxprice",itemData.nqtorigtaxprice),
  162. new XElement("nqttaxprice",itemData.nqttaxprice),
  163. new XElement("ntaxprice",itemData.ntaxprice),
  164. new XElement("nqtorigprice",itemData.nqtorigprice),
  165. new XElement("nqtorignetprice",itemData.nqtorignetprice),
  166. new XElement("norigprice",itemData.norigprice),
  167. new XElement("nprice",itemData.nprice),
  168. new XElement("nqtprice",itemData.nqtprice),
  169. new XElement("nqtorigtaxnetprc",itemData.nqtorigtaxnetprc),
  170. new XElement("norigtaxnetprice",itemData.norigtaxnetprice),
  171. new XElement("nqttaxnetprice",itemData.nqttaxnetprice),
  172. new XElement("ntaxnetprice",itemData.ntaxnetprice),
  173. new XElement("norignetprice",itemData.norignetprice),
  174. new XElement("nnetprice",itemData.nnetprice),
  175. new XElement("nqtnetprice",itemData.nqtnetprice),
  176. new XElement("ntax",itemData.ntax),
  177. new XElement("ncaltaxmny",itemData.ncaltaxmny),
  178. new XElement("norigmny",itemData.norigmny),
  179. new XElement("nmny",itemData.nmny),
  180. new XElement("norigtaxmny",itemData.norigtaxmny),
  181. new XElement("ntaxmny",itemData.ntaxmny),
  182. new XElement("norigdiscount","0"),
  183. new XElement("vsrctype",itemData.vsrctype),
  184. new XElement("vsrccode",itemData.vsrccode),
  185. new XElement("vsrctrantype",itemData.vsrctrantype),
  186. new XElement("vsrcrowno",itemData.vsrcrowno),
  187. }));
  188. }
  189. }
  190. return new XElement("bill", new object[]
  191. {
  192. "",
  193. new XAttribute("id",id),
  194. new XElement("billhead", new object[]
  195. {
  196. new XElement("pk_group",item.pk_group),
  197. new XElement("pk_org",item.pk_org),
  198. new XElement("pk_org_v",item.pk_org_v),
  199. new XElement("ctrantypeid",item.ctrantypeid),
  200. new XElement("vtrantypecode",item.vtrantypecode),
  201. new XElement("cbiztypeid",item.cbiztypeid),
  202. new XElement("vbillcode",item.vbillcode),
  203. new XElement("dbilldate",item.dbilldate),
  204. new XElement("vprintcustname",item.vprintcustname),
  205. new XElement("ccustbankid",item.ccustbankid),
  206. new XElement("ccustbankaccid",item.ccustbankaccid),
  207. new XElement("cdeptvid",item.cdeptvid),
  208. new XElement("cdeptid",item.cdeptid),
  209. new XElement("cemployeeid",item.cemployeeid),
  210. new XElement("corigcurrencyid",item.corigcurrencyid),
  211. new XElement("cinvoicecustid",item.cinvoicecustid),
  212. new XElement("cpaytermid",item.cpaytermid),
  213. new XElement("fstatusflag","1"),
  214. new XElement("approver",item.approver),
  215. new XElement("taudittime",item.taudittime),
  216. new XElement("billmaker",item.billmaker),
  217. new XElement("dmakedate",item.dmakedate),
  218. new XElement("creator",item.creator),
  219. new XElement("creationtime",item.creationtime),
  220. new XElement("ntotalnum",item.ntotalnum),
  221. new XElement("ntotalorigmny",item.ntotalorigmny),
  222. new XElement("csaleinvoicebid",so_saleorder_b),
  223. }),
  224. });
  225. }
  226. }
  227. }
  228. }