IcsFromERPJob
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

353 lines
21 KiB

3 months ago
  1. using Quartz;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Configuration;
  5. using System.Data;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Net;
  9. using System.Reflection;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. namespace ICSSoft.FromERP
  13. {
  14. /// <summary>
  15. /// 管理费用明细账
  16. /// </summary>
  17. public class YERP_006 : IJob
  18. {
  19. private static object key = new object();
  20. private static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
  21. public void Execute(IJobExecutionContext context)
  22. {
  23. try
  24. {
  25. lock (key)
  26. {
  27. log.Info("开始……………………………………………………………………");
  28. Execute();
  29. log.Info("结束……………………………………………………………………");
  30. }
  31. }
  32. catch (Exception ex)
  33. {
  34. log.Error(ex.ToString());
  35. }
  36. }
  37. public async void Execute()
  38. {
  39. try
  40. {
  41. Configuration config = GetConfig();
  42. //string url = config.ConnectionStrings.ConnectionStrings["APIAddStdWorkHour"].ConnectionString.ToString();
  43. var Dates = DateTime.Now;
  44. string conStr = ICSHelper.GetConnectString();
  45. //<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:yerp="http://skch.com/YERP_006_MATN_COST">
  46. // <soapenv:Header/>
  47. // <soapenv:Body>
  48. // <yerp:YERP_006_OA1_MT>
  49. // <!--1 or more repetitions:-->
  50. // <MGMT_CST>
  51. // <YYYY>?</YYYY>
  52. // <MM>?</MM>
  53. // <DD>?</DD>
  54. // <SPTDOC_NO>?</SPTDOC_NO>
  55. // <SMR>?</SMR>
  56. // <DBTO>?</DBTO>
  57. // <CRDTO>?</CRDTO>
  58. // <DBTO_CRDTO_DVSN>?</DBTO_CRDTO_DVSN>
  59. // <BLNC>?</BLNC>
  60. // <!--Optional:-->
  61. // <OFC_OPRT_CST>?</OFC_OPRT_CST>
  62. // <!--Optional:-->
  63. // <BZTRP_CST>?</BZTRP_CST>
  64. // <!--Optional:-->
  65. // <TRSF_CST>?</TRSF_CST>
  66. // <!--Optional:-->
  67. // <BNFT_CST>?</BNFT_CST>
  68. // <!--Optional:-->
  69. // <NTTN_CST>?</NTTN_CST>
  70. // <!--Optional:-->
  71. // <SCLISRC>?</SCLISRC>
  72. // <!--Optional:-->
  73. // <DDTN>?</DDTN>
  74. // <!--Optional:-->
  75. // <NTRR_CST>?</NTRR_CST>
  76. // <!--Optional:-->
  77. // <VEHS_OPRT_CST>?</VEHS_OPRT_CST>
  78. // <!--Optional:-->
  79. // <SVC_CST>?</SVC_CST>
  80. // <!--Optional:-->
  81. // <VEHS_RNTL_CST>?</VEHS_RNTL_CST>
  82. // <!--Optional:-->
  83. // <OFC_RNTL_CST>?</OFC_RNTL_CST>
  84. // <!--Optional:-->
  85. // <PRPT_MGMT_CST>?</PRPT_MGMT_CST>
  86. // <!--Optional:-->
  87. // <WTNELCT_CST>?</WTNELCT_CST>
  88. // <!--Optional:-->
  89. // <NWK_CST>?</NWK_CST>
  90. // <!--Optional:-->
  91. // <TELE_CST>?</TELE_CST>
  92. // <!--Optional:-->
  93. // <MEET_CST>?</MEET_CST>
  94. // <!--Optional:-->
  95. // <PCL_CST>?</PCL_CST>
  96. // <!--Optional:-->
  97. // <PNCST>?</PNCST>
  98. // <!--Optional:-->
  99. // <CUN_CST>?</CUN_CST>
  100. // <!--Optional:-->
  101. // <DPRCT_CST>?</DPRCT_CST>
  102. // <!--Optional:-->
  103. // <EDU_CST>?</EDU_CST>
  104. // <!--Optional:-->
  105. // <RPR_CST>?</RPR_CST>
  106. // <!--Optional:-->
  107. // <LBPRTT_CST>?</LBPRTT_CST>
  108. // <!--Optional:-->
  109. // <BZ_PRMT_CST>?</BZ_PRMT_CST>
  110. // <!--Optional:-->
  111. // <TEST_CST>?</TEST_CST>
  112. // <!--Optional:-->
  113. // <BK_CST>?</BK_CST>
  114. // <!--Optional:-->
  115. // <RCRT_CST>?</RCRT_CST>
  116. // <!--Optional:-->
  117. // <XBT_CST>?</XBT_CST>
  118. // <!--Optional:-->
  119. // <RSNB_LOS>?</RSNB_LOS>
  120. // </MGMT_CST>
  121. // </yerp:YERP_006_OA1_MT>
  122. // </soapenv:Body>
  123. //</soapenv:Envelope>
  124. // 202404
  125. // 过滤时间为上个月
  126. string Date = Dates.ToString("yyyy");
  127. string Muoth = Dates.AddMonths(-1).ToString("MM");
  128. string Day = Dates.ToString("dd");
  129. var beginPeriod = "202403";//Date + Muoth;
  130. var endPeriod = "202406";//Date + Muoth;
  131. string sqls = @"begin transaction
  132. exec GL_Ledger @tblname=N'glfymxz',@KmCode=N'6602',@beginPeriod='{0}',@endPeriod='{1}',@bVouch=0,@bequal=1,@sum=0,@bMJ=1,@swhere=N'',@sAuth=N'',@ReportID=N'GL13',@ReportType=0,@iUnite=0
  133. select autoid,iyear YYYY,imonth MM,iday DD,csign_no SPTDOC,cDigest SMR,cDCode ODR_ACC,md DBTO_AMT,mc CRDTO_AMT,tmpme tmpme
  134. into #test from tempdb..glfymxz a
  135. select SPTDOC,MM,DD,sum(DBTO_AMT) DBTO_AMT,sum(CRDTO_AMT) CRDTO_AMT,sum(isnull(tmpme,0)) tmpme
  136. into #test2
  137. from #test a
  138. where SPTDOC is not null and DD IS NOT NULL
  139. group by SPTDOC,MM,DD
  140. order by SPTDOC
  141. update a set DBTO_AMT=b.DBTO_AMT,a.CRDTO_AMT=b.CRDTO_AMT,a.tmpme=b.tmpme from #test a
  142. left join #test2 b on a.SPTDOC=b.SPTDOC and a.MM=b.MM and a.DD=b.DD
  143. where a.sptdoc is not null
  144. select autoid,sptdoc,YYYY,MM,DD into #test3 from #test where sptdoc is not null
  145. select s.* into #test4 from (select *,ROW_NUMBER() over (partition by sptdoc+CAST(MM AS VARCHAR(255))+CAST(DD AS VARCHAR(255)) order by autoid) as group_idx from #test3)s where s.group_idx>1
  146. delete a from #test a
  147. left join #test4 b on a.autoid=b.autoid
  148. where b.autoid is not null
  149. select *,(case when (Select Sum(-tmpme) from #test where autoid<=a.autoid) =0 then '平' else (case when (Select Sum(-tmpme) from #test where autoid<=a.autoid) >0 then '贷' else '借' end) end) INVT,
  150. (case when (Select Sum(-tmpme) from #test where autoid<=a.autoid)<0 then -(Select Sum(-tmpme) from #test where autoid<=a.autoid) else (Select Sum(-tmpme) from #test where autoid<=a.autoid) end) BLNC into #test5 from #test a
  151. select cCode SBJ_CD,ccode_name SBJ_NM,imonth,iday,csign_no SPTDOC,sum(md) DBTO_AMT
  152. into #test6
  153. from tempdb..glfymxz a
  154. where csign_no is not null
  155. group by ccode_name,csign_no,cCode,imonth,iday
  156. order by csign_no,imonth,iday
  157. select DISTINCT sptdoc,imonth,iday into #test7 from #test6
  158. select *,ROW_NUMBER() over (order by sptdoc,imonth,iday) rownumber into #test8 from #test7
  159. declare @k int
  160. set @k=1
  161. while @k<=(select COUNT(*) from #test7)
  162. begin
  163. declare @i int
  164. set @i=0
  165. while @i<1
  166. begin
  167. insert into #test6 (SBJ_CD,SBJ_NM,imonth,iday,SPTDOC,DBTO_AMT)
  168. select a.ccode,a.ccode_name,(select imonth from #test8 where rownumber=@k),(select iday from #test8 where rownumber=@k),(select SPTDOC from #test8 where rownumber=@k),0
  169. from code a left join #test6 b on b.SPTDOC=(select SPTDOC from #test8 where rownumber=@k) and imonth=(select imonth from #test8 where rownumber=@k) and iday=(select iday from #test8 where rownumber=@k) and SBJ_NM=ccode_name
  170. where a.iYear=2024 and ( bclose=0 and ( ccode like N'6602%' or ccode_name like N'6602%' or ccode_engl like N'6602%' or chelp like N'6602%' )) and ccode <>'6602' and len(ccode)=6
  171. and b.SPTDOC is null
  172. set @i=@i +1
  173. end
  174. set @k=@k +1
  175. end
  176. SELECT
  177. SPTDOC,imonth,iday,
  178. SUM(CASE WHEN SBJ_CD = '660201' THEN DBTO_AMT ELSE 0 END) OFC_OPRT_CST,
  179. SUM(CASE WHEN SBJ_CD = '660202' THEN DBTO_AMT ELSE 0 END) BZTRP_CST,
  180. SUM(CASE WHEN SBJ_CD = '660203' THEN DBTO_AMT ELSE 0 END) TRSF_CST,
  181. SUM(CASE WHEN SBJ_CD = '660204' THEN DBTO_AMT ELSE 0 END) BNFT_CST,
  182. SUM(CASE WHEN SBJ_CD = '660205' THEN DBTO_AMT ELSE 0 END) NTTN_CST,
  183. SUM(CASE WHEN SBJ_CD = '660206' THEN DBTO_AMT ELSE 0 END) SCLISRC,
  184. SUM(CASE WHEN SBJ_CD = '660207' THEN DBTO_AMT ELSE 0 END) DDTN,
  185. SUM(CASE WHEN SBJ_CD = '660208' THEN DBTO_AMT ELSE 0 END) NTRR_CST,
  186. SUM(CASE WHEN SBJ_CD = '660209' THEN DBTO_AMT ELSE 0 END) VEHS_OPRT_CST,
  187. SUM(CASE WHEN SBJ_CD = '660210' THEN DBTO_AMT ELSE 0 END) SVC_CST,
  188. SUM(CASE WHEN SBJ_CD = '660211' THEN DBTO_AMT ELSE 0 END) VEHS_RNTL_CST,
  189. SUM(CASE WHEN SBJ_CD = '660212' THEN DBTO_AMT ELSE 0 END) OFC_RNTL_CST,
  190. SUM(CASE WHEN SBJ_CD = '660213' THEN DBTO_AMT ELSE 0 END) PRPT_MGMT_CST,
  191. SUM(CASE WHEN SBJ_CD = '660214' THEN DBTO_AMT ELSE 0 END) WTNELCT_CST,
  192. SUM(CASE WHEN SBJ_CD = '660215' THEN DBTO_AMT ELSE 0 END) NWK_CST,
  193. SUM(CASE WHEN SBJ_CD = '660216' THEN DBTO_AMT ELSE 0 END) TELE_CST,
  194. SUM(CASE WHEN SBJ_CD = '660217' THEN DBTO_AMT ELSE 0 END) MEET_CST,
  195. SUM(CASE WHEN SBJ_CD = '660218' THEN DBTO_AMT ELSE 0 END) PCL_CST,
  196. SUM(CASE WHEN SBJ_CD = '660219' THEN DBTO_AMT ELSE 0 END) PNCST,
  197. SUM(CASE WHEN SBJ_CD = '660220' THEN DBTO_AMT ELSE 0 END) CUN_CST,
  198. SUM(CASE WHEN SBJ_CD = '660221' THEN DBTO_AMT ELSE 0 END) DPRCT_CST,
  199. SUM(CASE WHEN SBJ_CD = '660222' THEN DBTO_AMT ELSE 0 END) EDU_CST,
  200. SUM(CASE WHEN SBJ_CD = '660223' THEN DBTO_AMT ELSE 0 END) RPR_CST,
  201. SUM(CASE WHEN SBJ_CD = '660224' THEN DBTO_AMT ELSE 0 END) LBPRTT_CST,
  202. SUM(CASE WHEN SBJ_CD = '660225' THEN DBTO_AMT ELSE 0 END) BZ_PRMT_CST,
  203. SUM(CASE WHEN SBJ_CD = '660226' THEN DBTO_AMT ELSE 0 END) TEST_CST,
  204. SUM(CASE WHEN SBJ_CD = '660227' THEN DBTO_AMT ELSE 0 END) BK_CST,
  205. SUM(CASE WHEN SBJ_CD = '660228' THEN DBTO_AMT ELSE 0 END) RCRT_CST,
  206. SUM(CASE WHEN SBJ_CD = '660229' THEN DBTO_AMT ELSE 0 END) XBT_CST,
  207. SUM(CASE WHEN SBJ_CD = '660230' THEN DBTO_AMT ELSE 0 END) RSNB_LOS
  208. into #test9
  209. FROM
  210. #test6
  211. GROUP BY
  212. SPTDOC,imonth,iday
  213. select YYYY,MM,DD,A.SPTDOC as SPTDOC_NO,SMR,DBTO_AMT DBTO,CRDTO_AMT CRDTO,INVT as DBTO_CRDTO_DVSN,BLNC,OFC_OPRT_CST,BZTRP_CST,TRSF_CST,BNFT_CST,NTTN_CST,SCLISRC,DDTN,NTRR_CST,VEHS_OPRT_CST,SVC_CST,VEHS_RNTL_CST,
  214. OFC_RNTL_CST,PRPT_MGMT_CST,WTNELCT_CST,NWK_CST,TELE_CST,MEET_CST,PCL_CST,PNCST,CUN_CST,DPRCT_CST,EDU_CST,RPR_CST,LBPRTT_CST,BZ_PRMT_CST,TEST_CST,BK_CST,RCRT_CST,XBT_CST,RSNB_LOS
  215. from #test5 a left join #test9 b on a.SPTDOC=b.SPTDOC and a.MM=b.imonth and a.DD=b.iday order by MM
  216. rollback transaction
  217. ";
  218. sqls = string.Format(sqls, beginPeriod, endPeriod);
  219. log.Info("YERP_006 sql:" + sqls);
  220. DataTable vbsdt = ICSHelper.ExecuteTable(conStr, sqls);
  221. log.Info("sql结果数量" + vbsdt.Rows.Count);
  222. if (vbsdt.Rows.Count > 0)
  223. {
  224. StringBuilder soapRequestData = new StringBuilder();
  225. soapRequestData.Append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:yerp=\"http://skch.com/YERP_006_MATN_COST\">");
  226. soapRequestData.Append("<soapenv:Header/>");
  227. soapRequestData.Append("<soapenv:Body>");
  228. soapRequestData.Append("<yerp:YERP_006_OA1_MT>");
  229. //循环数据
  230. foreach (DataRow itemRow in vbsdt.Rows)
  231. {
  232. //原循环部分 begin
  233. soapRequestData.Append("<MGMT_CST>");
  234. soapRequestData.Append(itemRow["YYYY"] != null ? "<YYYY>" + itemRow["YYYY"].ToString() + "</YYYY>" : "<YYYY>" + "</YYYY>");
  235. soapRequestData.Append(itemRow["MM"] != null ? "<MM>" + itemRow["MM"].ToString() + "</MM>" : "<MM>" + "</MM>");
  236. soapRequestData.Append(itemRow["DD"] != null ? "<DD>" + itemRow["DD"].ToString() + "</DD>" : "<DD>" + "</DD>");
  237. soapRequestData.Append(itemRow["SPTDOC_NO"] != null ? "<SPTDOC_NO>" + itemRow["SPTDOC_NO"].ToString() + "</SPTDOC_NO>" : "<SPTDOC_NO>" + "</SPTDOC_NO>");
  238. soapRequestData.Append(itemRow["SMR"] != null ? "<SMR>" + itemRow["SMR"].ToString() + "</SMR>" : "<SMR>" + "</SMR>");
  239. soapRequestData.Append(itemRow["DBTO"] != null ? "<DBTO>" + itemRow["DBTO"].ToString() + "</DBTO>" : "<DBTO>" + "</DBTO>");
  240. soapRequestData.Append(itemRow["CRDTO"] != null ? "<CRDTO>" + itemRow["CRDTO"].ToString() + "</CRDTO>" : "<CRDTO>" + "</CRDTO>");
  241. soapRequestData.Append(itemRow["DBTO_CRDTO_DVSN"] != null ? "<DBTO_CRDTO_DVSN>" + itemRow["DBTO_CRDTO_DVSN"].ToString() + "</DBTO_CRDTO_DVSN>" : "<DBTO_CRDTO_DVSN>" + "</DBTO_CRDTO_DVSN>");
  242. soapRequestData.Append(itemRow["BLNC"] != null ? "<BLNC>" + itemRow["BLNC"].ToString() + "</BLNC>" : "<BLNC>" + "</BLNC>");
  243. soapRequestData.Append(itemRow["OFC_OPRT_CST"] != null ? "<OFC_OPRT_CST>" + itemRow["OFC_OPRT_CST"].ToString() + "</OFC_OPRT_CST>" : "<OFC_OPRT_CST>" + "</OFC_OPRT_CST>");
  244. soapRequestData.Append(itemRow["BZTRP_CST"] != null ? "<BZTRP_CST>" + itemRow["BZTRP_CST"].ToString() + "</BZTRP_CST>" : "<BZTRP_CST>" + "</BZTRP_CST>");
  245. soapRequestData.Append(itemRow["TRSF_CST"] != null ? "<TRSF_CST>" + itemRow["TRSF_CST"].ToString() + "</TRSF_CST>" : "<TRSF_CST>" + "</TRSF_CST>");
  246. soapRequestData.Append(itemRow["BNFT_CST"] != null ? "<BNFT_CST>" + itemRow["BNFT_CST"].ToString() + "</BNFT_CST>" : "<BNFT_CST>" + "</BNFT_CST>");
  247. soapRequestData.Append(itemRow["NTTN_CST"] != null ? "<NTTN_CST>" + itemRow["NTTN_CST"].ToString() + "</NTTN_CST>" : "<NTTN_CST>" + "</NTTN_CST>");
  248. soapRequestData.Append(itemRow["SCLISRC"] != null ? "<SCLISRC>" + itemRow["SCLISRC"].ToString() + "</SCLISRC>" : "<SCLISRC>" + "</SCLISRC>");
  249. soapRequestData.Append(itemRow["DDTN"] != null ? "<DDTN>" + itemRow["DDTN"].ToString() + "</DDTN>" : "<DDTN>" + "</DDTN>");
  250. soapRequestData.Append(itemRow["NTRR_CST"] != null ? "<NTRR_CST>" + itemRow["NTRR_CST"].ToString() + "</NTRR_CST>" : "<NTRR_CST>" + "</NTRR_CST>");
  251. soapRequestData.Append(itemRow["VEHS_OPRT_CST"] != null ? "<VEHS_OPRT_CST>" + itemRow["VEHS_OPRT_CST"].ToString() + "</VEHS_OPRT_CST>" : "<VEHS_OPRT_CST>" + "</VEHS_OPRT_CST>");
  252. soapRequestData.Append(itemRow["SVC_CST"] != null ? "<SVC_CST>" + itemRow["SVC_CST"].ToString() + "</SVC_CST>" : "<SVC_CST>" + "</SVC_CST>");
  253. soapRequestData.Append(itemRow["VEHS_RNTL_CST"] != null ? "<VEHS_RNTL_CST>" + itemRow["VEHS_RNTL_CST"].ToString() + "</VEHS_RNTL_CST>" : "<VEHS_RNTL_CST>" + "</VEHS_RNTL_CST>");
  254. soapRequestData.Append(itemRow["OFC_RNTL_CST"] != null ? "<OFC_RNTL_CST>" + itemRow["OFC_RNTL_CST"].ToString() + "</OFC_RNTL_CST>" : "<OFC_RNTL_CST>" + "</OFC_RNTL_CST>");
  255. soapRequestData.Append(itemRow["PRPT_MGMT_CST"] != null ? "<PRPT_MGMT_CST>" + itemRow["PRPT_MGMT_CST"].ToString() + "</PRPT_MGMT_CST>" : "<PRPT_MGMT_CST>" + "</PRPT_MGMT_CST>");
  256. soapRequestData.Append(itemRow["WTNELCT_CST"] != null ? "<WTNELCT_CST>" + itemRow["WTNELCT_CST"].ToString() + "</WTNELCT_CST>" : "<WTNELCT_CST>" + "</WTNELCT_CST>");
  257. soapRequestData.Append(itemRow["NWK_CST"] != null ? "<NWK_CST>" + itemRow["NWK_CST"].ToString() + "</NWK_CST>" : "<NWK_CST>" + "</NWK_CST>");
  258. soapRequestData.Append(itemRow["TELE_CST"] != null ? "<TELE_CST>" + itemRow["TELE_CST"].ToString() + "</TELE_CST>" : "<TELE_CST>" + "</TELE_CST>");
  259. soapRequestData.Append(itemRow["MEET_CST"] != null ? "<MEET_CST>" + itemRow["MEET_CST"].ToString() + "</MEET_CST>" : "<MEET_CST>" + "</MEET_CST>");
  260. soapRequestData.Append(itemRow["PCL_CST"] != null ? "<PCL_CST>" + itemRow["PCL_CST"].ToString() + "</PCL_CST>" : "<PCL_CST>" + "</PCL_CST>");
  261. soapRequestData.Append(itemRow["PNCST"] != null ? "<PNCST>" + itemRow["PNCST"].ToString() + "</PNCST>" : "<PNCST>" + "</PNCST>");
  262. soapRequestData.Append(itemRow["CUN_CST"] != null ? "<CUN_CST>" + itemRow["CUN_CST"].ToString() + "</CUN_CST>" : "<CUN_CST>" + "</CUN_CST>");
  263. soapRequestData.Append(itemRow["DPRCT_CST"] != null ? "<DPRCT_CST>" + itemRow["DPRCT_CST"].ToString() + "</DPRCT_CST>" : "<DPRCT_CST>" + "</DPRCT_CST>");
  264. soapRequestData.Append(itemRow["EDU_CST"] != null ? "<EDU_CST>" + itemRow["EDU_CST"].ToString() + "</EDU_CST>" : "<EDU_CST>" + "</EDU_CST>");
  265. soapRequestData.Append(itemRow["RPR_CST"] != null ? "<RPR_CST>" + itemRow["RPR_CST"].ToString() + "</RPR_CST>" : "<RPR_CST>" + "</RPR_CST>");
  266. soapRequestData.Append(itemRow["LBPRTT_CST"] != null ? "<LBPRTT_CST>" + itemRow["LBPRTT_CST"].ToString() + "</LBPRTT_CST>" : "<LBPRTT_CST>" + "</LBPRTT_CST>");
  267. soapRequestData.Append(itemRow["BZ_PRMT_CST"] != null ? "<BZ_PRMT_CST>" + itemRow["BZ_PRMT_CST"].ToString() + "</BZ_PRMT_CST>" : "<BZ_PRMT_CST>" + "</BZ_PRMT_CST>");
  268. soapRequestData.Append(itemRow["TEST_CST"] != null ? "<TEST_CST>" + itemRow["TEST_CST"].ToString() + "</TEST_CST>" : "<TEST_CST>" + "</TEST_CST>");
  269. soapRequestData.Append(itemRow["BK_CST"] != null ? "<BK_CST>" + itemRow["BK_CST"].ToString() + "</BK_CST>" : "<BK_CST>" + "</BK_CST>");
  270. soapRequestData.Append(itemRow["RCRT_CST"] != null ? "<RCRT_CST>" + itemRow["RCRT_CST"].ToString() + "</RCRT_CST>" : "<RCRT_CST>" + "</RCRT_CST>");
  271. soapRequestData.Append(itemRow["XBT_CST"] != null ? "<XBT_CST>" + itemRow["XBT_CST"].ToString() + "</XBT_CST>" : "<XBT_CST>" + "</XBT_CST>");
  272. soapRequestData.Append(itemRow["RSNB_LOS"] != null ? "<RSNB_LOS>" + itemRow["RSNB_LOS"].ToString() + "</RSNB_LOS>" : "<RSNB_LOS>" + "</RSNB_LOS>");
  273. soapRequestData.Append("</MGMT_CST>");
  274. //原循环部分 end
  275. }
  276. soapRequestData.Append("</yerp:YERP_006_OA1_MT>");
  277. soapRequestData.Append("</soapenv:Body>");
  278. soapRequestData.Append("</soapenv:Envelope>");
  279. string postData = soapRequestData.ToString();
  280. log.Info("YERP_006 xmlRequest:" + postData);
  281. string statusCode;
  282. string resultContent;
  283. ServicePointManager.SecurityProtocol = (SecurityProtocolType)192 | (SecurityProtocolType)768 | (SecurityProtocolType)3072;
  284. RestOpHelper rop = new RestOpHelper();
  285. rop.Clientp12path = @"C:\Users\Administrator\Desktop\yonyou-cert\wildcard.pfx";
  286. rop.Clientp12PassWord = "Yonyou2024!";
  287. rop.Url = @"https://yerp-proxy-sap-dev.skchemicals.com/XISOAPAdapter/MessageServlet?senderParty=&senderService=YERP_D&receiverParty=&receiverService=&interface=YERP_006_OA1_SI&interfaceNamespace=http://skch.com/YERP_006_MATN_COST";
  288. rop.RequestSAP(rop.Url, 10000, postData, "IF_YERP", "Xtxc355860", out statusCode, out resultContent);
  289. log.Info("YERP_006 statusCode:" + statusCode + "\r\n" + "resultContent:" + resultContent);
  290. }
  291. }
  292. catch (Exception ex)
  293. {
  294. log.Error(ex.ToString());
  295. }
  296. }
  297. public static Configuration GetConfig()
  298. {
  299. Assembly assembly = Assembly.GetCallingAssembly();
  300. string path = string.Format("{0}.config", assembly.Location);
  301. if (!File.Exists(path))
  302. {
  303. throw new FileNotFoundException(path + "路径下的文件未找到!");
  304. }
  305. try
  306. {
  307. ExeConfigurationFileMap configFile = new ExeConfigurationFileMap();
  308. configFile.ExeConfigFilename = path;
  309. Configuration config = ConfigurationManager.OpenMappedExeConfiguration(configFile, ConfigurationUserLevel.None);
  310. return config;
  311. }
  312. catch (Exception)
  313. {
  314. throw;
  315. }
  316. }
  317. }
  318. }