NCImportFunc.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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.Helper
  8. {
  9. class NCImportFunc
  10. {
  11. public static string NCImport(XElement tempHeader, XElement xElement, string url)
  12. {
  13. try
  14. {
  15. tempHeader.Add(xElement);
  16. //xElement.Element("voucher").Element("voucher_head").Element("details").Add(Bodydebit(body));//表体没有记录
  17. string xmlString = DBHelper.ToXmlElementMethod(tempHeader).OuterXml;//变成xml字符串
  18. xmlString = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" + xmlString;
  19. DBHelper.WriteLog("传入参数:" + xmlString);
  20. string resultMsg = DBHelper.SendNsg(xmlString, url);//接收返回的数据
  21. DBHelper.WriteLog("返回参数:" + resultMsg);
  22. XElement xE = XElement.Parse(resultMsg);
  23. string resultcode = xE.Element("sendresult").Element("resultcode").Value;
  24. return resultMsg;//返回错误信息
  25. }
  26. catch (Exception ex)
  27. {
  28. throw ex;
  29. }
  30. }
  31. }
  32. }