FKYF_SyncServiceModel.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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. public class FKYF_SyncServiceModel
  10. {
  11. #region 凭证数据模型
  12. /// <summary>
  13. /// 凭证模型
  14. /// </summary>
  15. public class DataModel
  16. {
  17. /// <summary>
  18. /// 头部
  19. /// </summary>
  20. public class voucher_header
  21. {
  22. /// <summary>
  23. /// 应付财务组织
  24. /// </summary>
  25. public string pk_org { get; set; }
  26. /// <summary>
  27. /// 创建时间
  28. /// </summary>
  29. public string creationtime { get; set; }
  30. /// <summary>
  31. /// 创建人
  32. /// </summary>
  33. public string creator { get; set; }
  34. /// <summary>
  35. /// 单据日期
  36. /// </summary>
  37. public string billdate { get; set; }
  38. /// <summary>
  39. /// 制单人
  40. /// </summary>
  41. public string billmaker { get; set; }
  42. /// <summary>
  43. /// 单据号
  44. /// </summary>
  45. public string billno { get; set; }
  46. /// <summary>
  47. /// 原币金额
  48. /// </summary>
  49. public string money { get; set; }
  50. /// <summary>
  51. /// 组织本币金额
  52. /// </summary>
  53. public string local_money { get; set; }
  54. /// <summary>
  55. /// 单据会计年度
  56. /// </summary>
  57. public string billyear { get; set; }
  58. /// <summary>
  59. /// 单据会计期间
  60. /// </summary>
  61. public string billperiod { get; set; }
  62. /// <summary>
  63. /// 采购部门
  64. /// </summary>
  65. public string pu_deptid { get; set; }
  66. /// <summary>
  67. /// 采购业务员
  68. /// </summary>
  69. public string pu_psndoc { get; set; }
  70. /// <summary>
  71. /// 采购组织
  72. /// </summary>
  73. public string pu_org { get; set; }
  74. }
  75. /// <summary>
  76. /// 明细分录
  77. /// </summary>
  78. public class voucher_body
  79. {
  80. /// <summary>
  81. /// 应付财务组织
  82. /// </summary>
  83. public string pk_org { get; set; }
  84. /// <summary>
  85. /// 财务组织
  86. /// </summary>
  87. public string pk_fiorg { get; set; }
  88. /// <summary>
  89. /// 采购部门
  90. /// </summary>
  91. public string pu_deptid { get; set; }
  92. /// <summary>
  93. /// 采购组织
  94. /// </summary>
  95. public string pu_org { get; set; }
  96. /// <summary>
  97. /// 结算财务组织
  98. /// </summary>
  99. public string sett_org { get; set; }
  100. /// <summary>
  101. /// 物料
  102. /// </summary>
  103. public string material { get; set; }
  104. /// <summary>
  105. /// 供应商
  106. /// </summary>
  107. public string supplier { get; set; }
  108. /// <summary>
  109. /// 单据日期
  110. /// </summary>
  111. public string billdate { get; set; }
  112. /// <summary>
  113. /// 起算日期
  114. /// </summary>
  115. public string busidate { get; set; }
  116. /// <summary>
  117. /// 收支项目
  118. /// </summary>
  119. public string pk_subjcode { get; set; }
  120. /// <summary>
  121. /// 科目
  122. /// </summary>
  123. public string subjcode { get; set; }
  124. /// <summary>
  125. /// 单据分录号
  126. /// </summary>
  127. public string rowno { get; set; }
  128. /// <summary>
  129. /// 部门
  130. /// </summary>
  131. public string pk_deptid { get; set; }
  132. /// <summary>
  133. /// 业务员
  134. /// </summary>
  135. public string pk_psndoc { get; set; }
  136. /// <summary>
  137. /// 贷方数量
  138. /// </summary>
  139. public string quantity_cr { get; set; }
  140. /// <summary>
  141. /// 组织本币金额(贷方)
  142. /// </summary>
  143. public string local_money_cr { get; set; }
  144. /// <summary>
  145. /// 贷方原币金额
  146. /// </summary>
  147. public string money_cr { get; set; }
  148. /// <summary>
  149. /// 税额
  150. /// </summary>
  151. public string local_tax_cr { get; set; }
  152. /// <summary>
  153. /// 贷方原币无税金额
  154. /// </summary>
  155. public string notax_cr { get; set; }
  156. /// <summary>
  157. /// 组织本币无税金额(贷方)
  158. /// </summary>
  159. public string local_notax_cr { get; set; }
  160. /// <summary>
  161. /// 单价 无税
  162. /// </summary>
  163. public string price { get; set; }
  164. /// <summary>
  165. /// 含税单价
  166. /// </summary>
  167. public string taxprice { get; set; }
  168. /// <summary>
  169. /// 税率
  170. /// </summary>
  171. public string taxrate { get; set; }
  172. /// <summary>
  173. /// 订单供应商
  174. /// </summary>
  175. public string ordercubasdoc { get; set; }
  176. /// <summary>
  177. /// 发票号
  178. /// </summary>
  179. public string invoiceno { get; set; }
  180. /// <summary>
  181. /// 计税金额
  182. /// </summary>
  183. public string caltaxmny { get; set; }
  184. }
  185. }
  186. #endregion
  187. public class ImportXml_应付单
  188. {
  189. public static XElement TemplateHeade(DataModel.voucher_header item)
  190. {
  191. return new XElement(new XElement("ufinterface", new object[]
  192. {
  193. new XAttribute("billtype","F1"),
  194. new XAttribute("sender","dingding"),
  195. new XAttribute("receiver",""),
  196. new XAttribute("roottag",""),
  197. new XAttribute("replace","N"),
  198. new XAttribute("orgcode",""),
  199. new XAttribute("isexchange",""),
  200. new XAttribute("groupcode","0"),
  201. new XAttribute("filename",""),
  202. new XAttribute("businessunitcode","develop"),
  203. new XAttribute("account","develop")
  204. }));
  205. }
  206. /// <summary>
  207. /// 组建表头xml
  208. /// </summary>
  209. /// <param name="item">表头参数</param>
  210. /// <returns></returns>
  211. public static XElement Header(DataModel.voucher_header item)
  212. {
  213. return new XElement("bill", new object[]
  214. {
  215. "",
  216. new XElement("billhead", new object[]
  217. {
  218. new XElement("pk_group","0"),
  219. new XElement("pk_org",item.pk_org),
  220. new XElement("pk_fiorg",item.pk_org),
  221. new XElement("sett_org",item.pk_org),
  222. new XElement("creationtime",item.creationtime),
  223. new XElement("creator",item.creator),
  224. new XElement("billno",item.billno),
  225. new XElement("billdate",item.billdate),
  226. new XElement("billmaker",item.billmaker),
  227. new XElement("money",item.money),
  228. new XElement("local_money",item.local_money),
  229. new XElement("billyear",item.billyear),
  230. new XElement("billperiod",item.billperiod),
  231. new XElement("pu_deptid",item.pu_deptid),
  232. new XElement("pu_psndoc",item.pu_psndoc),
  233. new XElement("pu_org",item.pu_org),
  234. new XElement("isreded","N"),
  235. new XElement("pk_billtype","F1"),
  236. new XElement("pk_tradetype","D1"),
  237. new XElement("billclass","yf"),
  238. new XElement("accessorynum","0"),
  239. new XElement("isflowbill","N"),
  240. new XElement("isinit","N"),
  241. new XElement("syscode","1"),
  242. new XElement("src_syscode","1"),
  243. new XElement("billstatus","1"),
  244. new XElement("grouplocal","0.00000000"),
  245. new XElement("globallocal","0.00000000"),
  246. new XElement("grouprate","0.00000000"),
  247. new XElement("globalrate","0.00000000"),
  248. new XElement("rate","0.00000000"),
  249. new XElement("ispuadjust","N"),
  250. new XElement("coordflag","0"),
  251. new XElement("pk_currtype","CNY"),
  252. new XElement("bodys","")
  253. }),
  254. });
  255. }
  256. /// <summary>
  257. /// 组建表体xml
  258. /// </summary>
  259. /// <param name="items">表体</param>
  260. /// <returns></returns>
  261. public static List<XElement> Body(List<DataModel.voucher_body> items)
  262. {
  263. List<XElement> list = new List<XElement>();
  264. foreach (DataModel.voucher_body current in items)
  265. {
  266. XElement item = new XElement("item", new object[]
  267. {
  268. new XElement("pk_org",current.pk_org),
  269. new XElement("pk_fiorg",current.pk_fiorg),
  270. new XElement("pu_deptid",current.pu_deptid),
  271. new XElement("pu_org",current.pu_org),
  272. new XElement("material",current.material),
  273. new XElement("sett_org",current.sett_org),
  274. new XElement("supplier",current.supplier),
  275. new XElement("supplier",current.billdate),
  276. new XElement("busidate",current.busidate),
  277. new XElement("pk_subjcode",current.pk_subjcode),
  278. new XElement("rowno",current.rowno),
  279. new XElement("pk_deptid",current.pk_deptid),
  280. new XElement("pk_psndoc",current.pk_psndoc),
  281. new XElement("quantity_cr",current.quantity_cr),
  282. new XElement("local_money_cr",current.local_money_cr),
  283. new XElement("money_cr",current.money_cr),
  284. new XElement("notax_cr",current.notax_cr),
  285. new XElement("local_notax_cr",current.local_notax_cr),
  286. new XElement("price",current.price),
  287. new XElement("taxprice",current.taxprice),
  288. new XElement("taxrate",current.taxrate),
  289. new XElement("ordercubasdoc",current.ordercubasdoc),
  290. new XElement("invoiceno",current.invoiceno),
  291. new XElement("caltaxmny",current.caltaxmny),
  292. new XElement("local_tax_cr",current.local_tax_cr),
  293. new XElement("subjcode",current.subjcode),
  294. new XElement("coordflag","0"),
  295. new XElement("pk_group","0"),
  296. new XElement("direction","0"),
  297. new XElement("rowtype","0"),
  298. new XElement("pk_billtype","F1"),
  299. new XElement("billclass","yf"),
  300. new XElement("pk_tradetype","D1"),
  301. new XElement("objtype","1"),
  302. new XElement("pk_currtype","CNY"),
  303. new XElement("rate","1"),
  304. new XElement("money_bal","0"),
  305. new XElement("local_money_bal","0"),
  306. new XElement("quantity_bal","0"),
  307. new XElement("taxtype","0"),
  308. new XElement("buysellflag","2"),
  309. new XElement("grouprate","0.00000000"),
  310. new XElement("globalrate","0.00000000"),
  311. new XElement("groupcrebit","0.00000000"),
  312. new XElement("globalcrebit","0.00000000"),
  313. new XElement("groupbalance","0.00000000"),
  314. new XElement("globalbalance","0.00000000"),
  315. new XElement("groupnotax_cre","0.00000000"),
  316. new XElement("globalnotax_cre","0.00000000"),
  317. new XElement("occupationmny","0.00000000"),
  318. });
  319. list.Add(item);
  320. }
  321. return list;
  322. }
  323. }
  324. }
  325. }