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.

921 lines
60 KiB

3 months ago
3 months ago
2 months ago
2 months ago
3 months ago
2 months ago
2 months ago
3 months ago
3 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
3 months ago
2 months ago
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. //<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:yerp="http://skch.com/YERP_006_MATN_COST">
  125. // <soapenv:Header/>
  126. // <soapenv:Body>
  127. // <yerp:YERP_006_OA1_MT>
  128. // <MGMT_CST>
  129. // <Created_Year>?</Created_Year>
  130. // <Created_Month>?</Created_Month>
  131. // <SMR>?</SMR>
  132. // <DBTO>?</DBTO>
  133. // </MGMT_CST>
  134. // </yerp:YERP_006_OA1_MT>
  135. // </soapenv:Body>
  136. //</soapenv:Envelope>
  137. // 202404
  138. // 过滤时间为上个月
  139. string Date = Dates.ToString("yyyy");
  140. string beginMuoth = Dates.AddMonths(-1).ToString("MM");
  141. string endMuoth = Dates.AddMonths(-1).ToString("MM");
  142. var beginPeriod = Date + beginMuoth;// "202407";//Date + beginMuoth
  143. var endPeriod = Date + endMuoth;// "202407";//Date + endMuoth;
  144. #region 004上海
  145. string sql04s = @"
  146. begin transaction
  147. exec GL_Ledger @tblname=N'zyywsrmxz',@KmCode=N'6601',@beginPeriod='{0}',@endPeriod='{1}',@bVouch=0,@bequal=1,@sum=0,@bMJ=1,@swhere=N'',@sAuth=N'',@ReportID=N'GL13',@ReportType=0,@iUnite=0
  148. select autoid,iyear YYYY,imonth MM,iday DD,csign_no SPTDOC,cDigest SMR,cDCode ODR_ACC,md DBTO_AMT,mc CRDTO_AMT,tmpme tmpme
  149. into #test from tempdb..zyywsrmxz a
  150. select YYYY,SPTDOC,MM,DD,sum(DBTO_AMT) DBTO_AMT,sum(CRDTO_AMT) CRDTO_AMT,sum(isnull(tmpme,0)) tmpme
  151. into #test2
  152. from #test a
  153. where SPTDOC is not null and DD IS NOT NULL
  154. group by SPTDOC,YYYY,MM,DD
  155. order by SPTDOC
  156. update a set DBTO_AMT=b.DBTO_AMT,a.CRDTO_AMT=b.CRDTO_AMT,a.tmpme=b.tmpme from #test a
  157. left join #test2 b on a.SPTDOC=b.SPTDOC and a.MM=b.MM and a.DD=b.DD
  158. where a.sptdoc is not null
  159. select autoid,sptdoc,YYYY,MM,DD into #test3 from #test where sptdoc is not null
  160. 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
  161. delete a from #test a
  162. left join #test4 b on a.autoid=b.autoid
  163. where b.autoid is not null
  164. 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,
  165. (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
  166. select cCode SBJ_CD,ccode_name SBJ_NM,imonth,iday,csign_no SPTDOC,sum(md) DBTO_AMT
  167. into #test6
  168. from tempdb..zyywsrmxz a
  169. where csign_no is not null
  170. group by ccode_name,csign_no,cCode,imonth,iday
  171. order by csign_no,imonth,iday
  172. select DISTINCT sptdoc,imonth,iday into #test7 from #test6
  173. select *,ROW_NUMBER() over (order by sptdoc,imonth,iday) rownumber into #test8 from #test7
  174. declare @k int
  175. set @k=1
  176. while @k<=(select COUNT(*) from #test7)
  177. begin
  178. declare @i int
  179. set @i=0
  180. while @i<1
  181. begin
  182. insert into #test6 (SBJ_CD,SBJ_NM,imonth,iday,SPTDOC,DBTO_AMT)
  183. 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
  184. 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
  185. where a.iYear=2024 and ( bclose=0 and ( ccode like N'6601%' or ccode_name like N'6601%' or ccode_engl like N'6601%' or chelp like N'6601%' )) and ccode <>'6601' and b.SPTDOC is null
  186. set @i=@i +1
  187. end
  188. set @k=@k +1
  189. end
  190. SELECT
  191. SPTDOC,imonth,iday,
  192. SUM(CASE WHEN SBJ_CD = '660101' THEN DBTO_AMT ELSE 0 END) WH_CST,
  193. SUM(CASE WHEN SBJ_CD = '660102' THEN DBTO_AMT ELSE 0 END) TRNSF_CST,
  194. SUM(CASE WHEN SBJ_CD = '660103' THEN DBTO_AMT ELSE 0 END) XBT_CST,
  195. SUM(CASE WHEN SBJ_CD = '660104' THEN DBTO_AMT ELSE 0 END) NLD_CST,
  196. SUM(CASE WHEN SBJ_CD = '660105' THEN DBTO_AMT ELSE 0 END) SMPL_CST,
  197. SUM(CASE WHEN SBJ_CD = '660106' THEN DBTO_AMT ELSE 0 END) TRNSF_AGNC_CST,
  198. SUM(CASE WHEN SBJ_CD = '660107' THEN DBTO_AMT ELSE 0 END) ADTV,
  199. SUM(CASE WHEN SBJ_CD = '660108' THEN DBTO_AMT ELSE 0 END) NCLSN_CST,
  200. SUM(CASE WHEN SBJ_CD = '660109' THEN DBTO_AMT ELSE 0 END) SVC_CST
  201. into #test9
  202. FROM
  203. #test6
  204. GROUP BY
  205. SPTDOC,imonth,iday
  206. select YYYY,MM,DD,A.SPTDOC as SPTDOC_NO,SMR,DBTO_AMT DBTO,CRDTO_AMT CRDTO,INVT,BLNC,WH_CST,TRNSF_CST,XBT_CST,NLD_CST,SMPL_CST,TRNSF_AGNC_CST,ADTV,NCLSN_CST,SVC_CST from #test5 a left join #test9 b on a.SPTDOC=b.SPTDOC and a.MM=b.imonth and a.DD=b.iday
  207. rollback transaction
  208. ";
  209. sql04s = string.Format(sql04s, beginPeriod, endPeriod);
  210. log.Info("YERP_006_004查询 sql:" + sql04s);
  211. DataTable vbs04dt = ICSHelper.ExecuteTable(conStr, sql04s);
  212. log.Info("YERP_006_004查询 sql结果数量" + vbs04dt.Rows.Count);
  213. // 所得税
  214. // if exists(select 1 from tempdb..sysobjects with(nolock) where name='tmpuf_63Code' and xtype='u')
  215. //drop table tempdb..tmpuf_63Code
  216. //select bbank,bcash,bCashItem,bcDefine1,bcDefine10,bcDefine11,bcDefine12,bcDefine13,bcDefine14,bcDefine15
  217. //,bcDefine16,bcDefine2,bcDefine3,bcDefine4,bcDefine5,bcDefine6,bcDefine7,bcDefine8,bcDefine9,bclose,bcus
  218. //,bd_c,bdept,be,bend,bexchange,bGCJS,bitem,bparacc,bpardiff,bperson,bproperty,br,bReport,bsup,bused
  219. //,cass_item,cbook_type,cbook_type_engl,cclass,cclass_engl,cclassany,cclassany_engl,ccode,ccode_engl
  220. //,ccode_name,cexch_name,cgather,chelp,cmeasure,cother,cUserDefineType,dbegin,dend,dModifyDate
  221. //,igrade,iotherused,itrans,iViewItem,iyear
  222. //into tempdb..tmpuf_63Code from code with(nolock) where 1=1 and iyear=2024
  223. // exec GL_Ledger @tblname=N'tmpuf_63',@KmCode=N'6801',@beginPeriod=202406,@endPeriod=202406,@bVouch=0,@bequal=0,@sum=0,@bMJ=0,@swhere=N'',@sAuth=N'',@ReportID=N'GL13',@ReportType=0,@iUnite=0
  224. // select iyear,imonth,iday,csign_no,cdigest,cdcode,iprice,cexch_flat,nd_s,md_f,md,nc_s,mc_f,mc,
  225. // cfx,ne_s,ipriceavg,me_f,nfrattz,me,cPerson_id,ccus_id,cDept_id,cItem_id,csettle,cn_id,cBill,
  226. // ccheck,csup_id,cDefine1,cDefine2,cDefine3,cDefine4,cDefine5,cDefine6,cDefine7,cDefine8,cDefine9,
  227. // cDefine10,cDefine11,cDefine12,cDefine13,cDefine14,cDefine15,cDefine16,coutsysname,
  228. // inid,ibook,mark,tmpme,tmpme_f,tmpne_s,cexch_name ,bshowexch
  229. // from tempdb..tmpuf_63 a
  230. #endregion
  231. string sqls = @"begin transaction
  232. 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
  233. select autoid,iyear YYYY,imonth MM,iday DD,csign_no SPTDOC,cDigest SMR,cDCode ODR_ACC,md DBTO_AMT,mc CRDTO_AMT,tmpme tmpme
  234. into #test from tempdb..glfymxz a
  235. select SPTDOC,MM,DD,sum(DBTO_AMT) DBTO_AMT,sum(CRDTO_AMT) CRDTO_AMT,sum(isnull(tmpme,0)) tmpme
  236. into #test2
  237. from #test a
  238. where SPTDOC is not null and DD IS NOT NULL
  239. group by SPTDOC,MM,DD
  240. order by SPTDOC
  241. update a set DBTO_AMT=b.DBTO_AMT,a.CRDTO_AMT=b.CRDTO_AMT,a.tmpme=b.tmpme from #test a
  242. left join #test2 b on a.SPTDOC=b.SPTDOC and a.MM=b.MM and a.DD=b.DD
  243. where a.sptdoc is not null
  244. select autoid,sptdoc,YYYY,MM,DD into #test3 from #test where sptdoc is not null
  245. 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
  246. delete a from #test a
  247. left join #test4 b on a.autoid=b.autoid
  248. where b.autoid is not null
  249. 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,
  250. (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
  251. select cCode SBJ_CD,ccode_name SBJ_NM,imonth,iday,csign_no SPTDOC,sum(md) DBTO_AMT
  252. into #test6
  253. from tempdb..glfymxz a
  254. where csign_no is not null
  255. group by ccode_name,csign_no,cCode,imonth,iday
  256. order by csign_no,imonth,iday
  257. select DISTINCT sptdoc,imonth,iday into #test7 from #test6
  258. select *,ROW_NUMBER() over (order by sptdoc,imonth,iday) rownumber into #test8 from #test7
  259. declare @k int
  260. set @k=1
  261. while @k<=(select COUNT(*) from #test7)
  262. begin
  263. declare @i int
  264. set @i=0
  265. while @i<1
  266. begin
  267. insert into #test6 (SBJ_CD,SBJ_NM,imonth,iday,SPTDOC,DBTO_AMT)
  268. 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
  269. 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
  270. 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
  271. and b.SPTDOC is null
  272. set @i=@i +1
  273. end
  274. set @k=@k +1
  275. end
  276. SELECT
  277. SPTDOC,imonth,iday,
  278. SUM(CASE WHEN SBJ_CD = '660201' THEN DBTO_AMT ELSE 0 END) OFC_OPRT_CST,
  279. SUM(CASE WHEN SBJ_CD = '660202' THEN DBTO_AMT ELSE 0 END) BZTRP_CST,
  280. SUM(CASE WHEN SBJ_CD = '660203' THEN DBTO_AMT ELSE 0 END) TRSF_CST,
  281. SUM(CASE WHEN SBJ_CD = '660204' THEN DBTO_AMT ELSE 0 END) BNFT_CST,
  282. SUM(CASE WHEN SBJ_CD = '660205' THEN DBTO_AMT ELSE 0 END) NTTN_CST,
  283. SUM(CASE WHEN SBJ_CD = '660206' THEN DBTO_AMT ELSE 0 END) SCLISRC,
  284. SUM(CASE WHEN SBJ_CD = '660207' THEN DBTO_AMT ELSE 0 END) DDTN,
  285. SUM(CASE WHEN SBJ_CD = '660208' THEN DBTO_AMT ELSE 0 END) NTRR_CST,
  286. SUM(CASE WHEN SBJ_CD = '660209' THEN DBTO_AMT ELSE 0 END) VEHS_OPRT_CST,
  287. SUM(CASE WHEN SBJ_CD = '660210' THEN DBTO_AMT ELSE 0 END) SVC_CST,
  288. SUM(CASE WHEN SBJ_CD = '660211' THEN DBTO_AMT ELSE 0 END) VEHS_RNTL_CST,
  289. SUM(CASE WHEN SBJ_CD = '660212' THEN DBTO_AMT ELSE 0 END) OFC_RNTL_CST,
  290. SUM(CASE WHEN SBJ_CD = '660213' THEN DBTO_AMT ELSE 0 END) PRPT_MGMT_CST,
  291. SUM(CASE WHEN SBJ_CD = '660214' THEN DBTO_AMT ELSE 0 END) WTNELCT_CST,
  292. SUM(CASE WHEN SBJ_CD = '660215' THEN DBTO_AMT ELSE 0 END) NWK_CST,
  293. SUM(CASE WHEN SBJ_CD = '660216' THEN DBTO_AMT ELSE 0 END) TELE_CST,
  294. SUM(CASE WHEN SBJ_CD = '660217' THEN DBTO_AMT ELSE 0 END) MEET_CST,
  295. SUM(CASE WHEN SBJ_CD = '660218' THEN DBTO_AMT ELSE 0 END) PCL_CST,
  296. SUM(CASE WHEN SBJ_CD = '660219' THEN DBTO_AMT ELSE 0 END) PNCST,
  297. SUM(CASE WHEN SBJ_CD = '660220' THEN DBTO_AMT ELSE 0 END) CUN_CST,
  298. SUM(CASE WHEN SBJ_CD = '660221' THEN DBTO_AMT ELSE 0 END) DPRCT_CST,
  299. SUM(CASE WHEN SBJ_CD = '660222' THEN DBTO_AMT ELSE 0 END) EDU_CST,
  300. SUM(CASE WHEN SBJ_CD = '660223' THEN DBTO_AMT ELSE 0 END) RPR_CST,
  301. SUM(CASE WHEN SBJ_CD = '660224' THEN DBTO_AMT ELSE 0 END) LBPRTT_CST,
  302. SUM(CASE WHEN SBJ_CD = '660225' THEN DBTO_AMT ELSE 0 END) BZ_PRMT_CST,
  303. SUM(CASE WHEN SBJ_CD = '660226' THEN DBTO_AMT ELSE 0 END) TEST_CST,
  304. SUM(CASE WHEN SBJ_CD = '660227' THEN DBTO_AMT ELSE 0 END) BK_CST,
  305. SUM(CASE WHEN SBJ_CD = '660228' THEN DBTO_AMT ELSE 0 END) RCRT_CST,
  306. SUM(CASE WHEN SBJ_CD = '660229' THEN DBTO_AMT ELSE 0 END) XBT_CST,
  307. SUM(CASE WHEN SBJ_CD = '660230' THEN DBTO_AMT ELSE 0 END) RSNB_LOS
  308. into #test9
  309. FROM
  310. #test6
  311. GROUP BY
  312. SPTDOC,imonth,iday
  313. -- ,A.SPTDOC as SPTDOC_NO,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,
  314. --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
  315. --select YYYY as Created_Year,MM as Created_Month,YYYY,MM,SMR,DBTO_AMT DBTO
  316. --from #test5 a left join #test9 b on a.SPTDOC=b.SPTDOC and a.MM=b.imonth and a.DD=b.iday
  317. --where SMR =''
  318. --order by MM
  319. --if exists(select 1 from tempdb..sysobjects with(nolock) where name='tmpuf_63Code' and xtype='u')
  320. --drop table tempdb..tmpuf_63Code
  321. --select bbank,bcash,bCashItem,bcDefine1,bcDefine10,bcDefine11,bcDefine12,bcDefine13,bcDefine14,bcDefine15
  322. --,bcDefine16,bcDefine2,bcDefine3,bcDefine4,bcDefine5,bcDefine6,bcDefine7,bcDefine8,bcDefine9,bclose,bcus
  323. --,bd_c,bdept,be,bend,bexchange,bGCJS,bitem,bparacc,bpardiff,bperson,bproperty,br,bReport,bsup,bused
  324. --,cass_item,cbook_type,cbook_type_engl,cclass,cclass_engl,cclassany,cclassany_engl,ccode,ccode_engl
  325. --,ccode_name,cexch_name,cgather,chelp,cmeasure,cother,cUserDefineType,dbegin,dend,dModifyDate
  326. --,igrade,iotherused,itrans,iViewItem,iyear
  327. --into tempdb..tmpuf_63Code from code with(nolock) where 1=1 and iyear={2}
  328. -- exec GL_Ledger @tblname=N'tmpuf_63',@KmCode=N'6801',@beginPeriod={3},@endPeriod={4},@bVouch=0,@bequal=0,@sum=0,@bMJ=0,@swhere=N'',@sAuth=N'',@ReportID=N'GL13',@ReportType=0,@iUnite=0
  329. select A.SPTDOC as SPTDOC_NO,YYYY as Created_Year,MM as Created_Month,YYYY,MM,SMR,DBTO_AMT DBTO -- + ISNULL(c.tmpme,0)
  330. from #test5 a
  331. left join #test9 b on a.SPTDOC=b.SPTDOC and a.MM=b.imonth and a.DD=b.iday
  332. --left join tempdb..tmpuf_63 c on a.YYYY = c.iyear and a.MM = c.imonth and c.cdcode = '(2221)'
  333. where SMR =''
  334. order by MM
  335. rollback transaction
  336. ";
  337. sqls = string.Format(sqls, beginPeriod, endPeriod, Date, beginPeriod, endPeriod);
  338. log.Info("YERP_006 sql:" + sqls);
  339. DataTable vbsdt = ICSHelper.ExecuteTable(conStr, sqls);
  340. log.Info("sql结果数量" + vbsdt.Rows.Count);
  341. //广州服务器
  342. string conStrgz = ICSHelper.GetConfigString("SysConnectionString_gz");
  343. if (string.IsNullOrEmpty(conStrgz))
  344. {
  345. log.Info("YERP_006_gz conStr未找到。");
  346. return;
  347. }
  348. #region 004广州
  349. string sqlsgz04 = @"
  350. begin transaction
  351. exec GL_Ledger @tblname=N'zyywsrmxz',@KmCode=N'5601',@beginPeriod='{0}',@endPeriod='{1}',@bVouch=0,@bequal=1,@sum=0,@bMJ=1,@swhere=N'',@sAuth=N'',@ReportID=N'GL13',@ReportType=0,@iUnite=0
  352. select autoid,iyear YYYY,imonth MM,iday DD,csign_no SPTDOC,cDigest SMR,cDCode ODR_ACC,md DBTO_AMT,mc CRDTO_AMT,tmpme tmpme
  353. into #test from tempdb..zyywsrmxz a
  354. select YYYY,SPTDOC,MM,DD,sum(DBTO_AMT) DBTO_AMT,sum(CRDTO_AMT) CRDTO_AMT,sum(isnull(tmpme,0)) tmpme
  355. into #test2
  356. from #test a
  357. where SPTDOC is not null and DD IS NOT NULL
  358. group by SPTDOC,YYYY,MM,DD
  359. order by SPTDOC
  360. update a set DBTO_AMT=b.DBTO_AMT,a.CRDTO_AMT=b.CRDTO_AMT,a.tmpme=b.tmpme from #test a
  361. left join #test2 b on a.SPTDOC=b.SPTDOC and a.MM=b.MM and a.DD=b.DD
  362. where a.sptdoc is not null
  363. select autoid,sptdoc,YYYY,MM,DD into #test3 from #test where sptdoc is not null
  364. 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
  365. delete a from #test a
  366. left join #test4 b on a.autoid=b.autoid
  367. where b.autoid is not null
  368. 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,
  369. (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
  370. select cCode SBJ_CD,ccode_name SBJ_NM,imonth,iday,csign_no SPTDOC,sum(md) DBTO_AMT
  371. into #test6
  372. from tempdb..zyywsrmxz a
  373. where csign_no is not null
  374. group by ccode_name,csign_no,cCode,imonth,iday
  375. order by csign_no,imonth,iday
  376. select DISTINCT sptdoc,imonth,iday into #test7 from #test6
  377. select *,ROW_NUMBER() over (order by sptdoc,imonth,iday) rownumber into #test8 from #test7
  378. declare @k int
  379. set @k=1
  380. while @k<=(select COUNT(*) from #test7)
  381. begin
  382. declare @i int
  383. set @i=0
  384. while @i<1
  385. begin
  386. insert into #test6 (SBJ_CD,SBJ_NM,imonth,iday,SPTDOC,DBTO_AMT)
  387. 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
  388. 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
  389. where a.iYear=2024 and ( bclose=0 and ( ccode like N'6601%' or ccode_name like N'6601%' or ccode_engl like N'6601%' or chelp like N'6601%' )) and ccode <>'6601' and b.SPTDOC is null
  390. set @i=@i +1
  391. end
  392. set @k=@k +1
  393. end
  394. SELECT
  395. SPTDOC,imonth,iday,
  396. SUM(CASE WHEN SBJ_CD = '660101' THEN DBTO_AMT ELSE 0 END) WH_CST,
  397. SUM(CASE WHEN SBJ_CD = '660102' THEN DBTO_AMT ELSE 0 END) TRNSF_CST,
  398. SUM(CASE WHEN SBJ_CD = '660103' THEN DBTO_AMT ELSE 0 END) XBT_CST,
  399. SUM(CASE WHEN SBJ_CD = '660104' THEN DBTO_AMT ELSE 0 END) NLD_CST,
  400. SUM(CASE WHEN SBJ_CD = '660105' THEN DBTO_AMT ELSE 0 END) SMPL_CST,
  401. SUM(CASE WHEN SBJ_CD = '660106' THEN DBTO_AMT ELSE 0 END) TRNSF_AGNC_CST,
  402. SUM(CASE WHEN SBJ_CD = '660107' THEN DBTO_AMT ELSE 0 END) ADTV,
  403. SUM(CASE WHEN SBJ_CD = '660108' THEN DBTO_AMT ELSE 0 END) NCLSN_CST,
  404. SUM(CASE WHEN SBJ_CD = '660109' THEN DBTO_AMT ELSE 0 END) SVC_CST
  405. into #test9
  406. FROM
  407. #test6
  408. GROUP BY
  409. SPTDOC,imonth,iday
  410. select YYYY,MM,DD,A.SPTDOC as SPTDOC_NO,SMR,DBTO_AMT DBTO,CRDTO_AMT CRDTO,INVT,BLNC,WH_CST,TRNSF_CST,XBT_CST,NLD_CST,SMPL_CST,TRNSF_AGNC_CST,ADTV,NCLSN_CST,SVC_CST from #test5 a left join #test9 b on a.SPTDOC=b.SPTDOC and a.MM=b.imonth and a.DD=b.iday
  411. rollback transaction
  412. ";
  413. sqlsgz04 = string.Format(sqlsgz04, beginPeriod, endPeriod);
  414. log.Info("YERP_006_004查询 sql:" + sqlsgz04);
  415. DataTable vbsgz04dt = ICSHelper.ExecuteTable(conStr, sqlsgz04);
  416. log.Info("YERP_006_004查询 sql结果数量" + vbsgz04dt.Rows.Count);
  417. #endregion
  418. //广州 006
  419. string sqlsgz = @"begin transaction
  420. exec GL_Ledger @tblname=N'glfymxz',@KmCode=N'5602',@beginPeriod='{0}',@endPeriod='{1}',@bVouch=0,@bequal=1,@sum=0,@bMJ=1,@swhere=N'',@sAuth=N'',@ReportID=N'GL13',@ReportType=0,@iUnite=0
  421. select autoid,iyear YYYY,imonth MM,iday DD,csign_no SPTDOC,cDigest SMR,cDCode ODR_ACC,md DBTO_AMT,mc CRDTO_AMT,tmpme tmpme
  422. into #test from tempdb..glfymxz a
  423. select SPTDOC,MM,DD,sum(DBTO_AMT) DBTO_AMT,sum(CRDTO_AMT) CRDTO_AMT,sum(isnull(tmpme,0)) tmpme
  424. into #test2
  425. from #test a
  426. where SPTDOC is not null and DD IS NOT NULL
  427. group by SPTDOC,MM,DD
  428. order by SPTDOC
  429. update a set DBTO_AMT=b.DBTO_AMT,a.CRDTO_AMT=b.CRDTO_AMT,a.tmpme=b.tmpme from #test a
  430. left join #test2 b on a.SPTDOC=b.SPTDOC and a.MM=b.MM and a.DD=b.DD
  431. where a.sptdoc is not null
  432. select autoid,sptdoc,YYYY,MM,DD into #test3 from #test where sptdoc is not null
  433. 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
  434. delete a from #test a
  435. left join #test4 b on a.autoid=b.autoid
  436. where b.autoid is not null
  437. 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,
  438. (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
  439. select cCode SBJ_CD,ccode_name SBJ_NM,imonth,iday,csign_no SPTDOC,sum(md) DBTO_AMT
  440. into #test6
  441. from tempdb..glfymxz a
  442. where csign_no is not null
  443. group by ccode_name,csign_no,cCode,imonth,iday
  444. order by csign_no,imonth,iday
  445. select DISTINCT sptdoc,imonth,iday into #test7 from #test6
  446. select *,ROW_NUMBER() over (order by sptdoc,imonth,iday) rownumber into #test8 from #test7
  447. declare @k int
  448. set @k=1
  449. while @k<=(select COUNT(*) from #test7)
  450. begin
  451. declare @i int
  452. set @i=0
  453. while @i<1
  454. begin
  455. insert into #test6 (SBJ_CD,SBJ_NM,imonth,iday,SPTDOC,DBTO_AMT)
  456. 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
  457. 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
  458. where a.iYear=2024 and ( bclose=0 and ( ccode like N'5602%' or ccode_name like N'5602%' or ccode_engl like N'5602%' or chelp like N'5602%' )) and ccode <>'5602' and len(ccode)=6
  459. and b.SPTDOC is null
  460. set @i=@i +1
  461. end
  462. set @k=@k +1
  463. end
  464. SELECT
  465. SPTDOC,imonth,iday,
  466. SUM(CASE WHEN SBJ_CD = '560201' THEN DBTO_AMT ELSE 0 END) OFC_OPRT_CST,
  467. SUM(CASE WHEN SBJ_CD = '560202' THEN DBTO_AMT ELSE 0 END) BZTRP_CST,
  468. SUM(CASE WHEN SBJ_CD = '560203' THEN DBTO_AMT ELSE 0 END) TRSF_CST,
  469. SUM(CASE WHEN SBJ_CD = '560204' THEN DBTO_AMT ELSE 0 END) BNFT_CST,
  470. SUM(CASE WHEN SBJ_CD = '560205' THEN DBTO_AMT ELSE 0 END) NTTN_CST,
  471. SUM(CASE WHEN SBJ_CD = '560206' THEN DBTO_AMT ELSE 0 END) SCLISRC,
  472. SUM(CASE WHEN SBJ_CD = '560207' THEN DBTO_AMT ELSE 0 END) DDTN,
  473. SUM(CASE WHEN SBJ_CD = '560208' THEN DBTO_AMT ELSE 0 END) NTRR_CST,
  474. SUM(CASE WHEN SBJ_CD = '560209' THEN DBTO_AMT ELSE 0 END) VEHS_OPRT_CST,
  475. SUM(CASE WHEN SBJ_CD = '560210' THEN DBTO_AMT ELSE 0 END) SVC_CST,
  476. SUM(CASE WHEN SBJ_CD = '560211' THEN DBTO_AMT ELSE 0 END) VEHS_RNTL_CST,
  477. SUM(CASE WHEN SBJ_CD = '560212' THEN DBTO_AMT ELSE 0 END) OFC_RNTL_CST,
  478. SUM(CASE WHEN SBJ_CD = '560213' THEN DBTO_AMT ELSE 0 END) PRPT_MGMT_CST,
  479. SUM(CASE WHEN SBJ_CD = '560214' THEN DBTO_AMT ELSE 0 END) WTNELCT_CST,
  480. SUM(CASE WHEN SBJ_CD = '560215' THEN DBTO_AMT ELSE 0 END) NWK_CST,
  481. SUM(CASE WHEN SBJ_CD = '560216' THEN DBTO_AMT ELSE 0 END) TELE_CST,
  482. SUM(CASE WHEN SBJ_CD = '560217' THEN DBTO_AMT ELSE 0 END) MEET_CST,
  483. SUM(CASE WHEN SBJ_CD = '560218' THEN DBTO_AMT ELSE 0 END) PCL_CST,
  484. SUM(CASE WHEN SBJ_CD = '560219' THEN DBTO_AMT ELSE 0 END) PNCST,
  485. SUM(CASE WHEN SBJ_CD = '560220' THEN DBTO_AMT ELSE 0 END) CUN_CST,
  486. SUM(CASE WHEN SBJ_CD = '560221' THEN DBTO_AMT ELSE 0 END) DPRCT_CST,
  487. SUM(CASE WHEN SBJ_CD = '560222' THEN DBTO_AMT ELSE 0 END) EDU_CST,
  488. SUM(CASE WHEN SBJ_CD = '560223' THEN DBTO_AMT ELSE 0 END) RPR_CST,
  489. SUM(CASE WHEN SBJ_CD = '560224' THEN DBTO_AMT ELSE 0 END) LBPRTT_CST,
  490. SUM(CASE WHEN SBJ_CD = '560225' THEN DBTO_AMT ELSE 0 END) BZ_PRMT_CST,
  491. SUM(CASE WHEN SBJ_CD = '560226' THEN DBTO_AMT ELSE 0 END) TEST_CST,
  492. SUM(CASE WHEN SBJ_CD = '560227' THEN DBTO_AMT ELSE 0 END) BK_CST,
  493. SUM(CASE WHEN SBJ_CD = '560228' THEN DBTO_AMT ELSE 0 END) RCRT_CST,
  494. SUM(CASE WHEN SBJ_CD = '560229' THEN DBTO_AMT ELSE 0 END) XBT_CST,
  495. SUM(CASE WHEN SBJ_CD = '560230' THEN DBTO_AMT ELSE 0 END) RSNB_LOS
  496. into #test9
  497. FROM
  498. #test6
  499. GROUP BY
  500. SPTDOC,imonth,iday
  501. -- ,A.SPTDOC as SPTDOC_NO,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,
  502. --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
  503. --select YYYY as Created_Year,MM as Created_Month,YYYY,MM,SMR,DBTO_AMT DBTO
  504. --from #test5 a left join #test9 b on a.SPTDOC=b.SPTDOC and a.MM=b.imonth and a.DD=b.iday
  505. --where SMR =''
  506. --order by MM
  507. --if exists(select 1 from tempdb..sysobjects with(nolock) where name='tmpuf_63Code' and xtype='u')
  508. --drop table tempdb..tmpuf_63Code
  509. --select bbank,bcash,bCashItem,bcDefine1,bcDefine10,bcDefine11,bcDefine12,bcDefine13,bcDefine14,bcDefine15
  510. --,bcDefine16,bcDefine2,bcDefine3,bcDefine4,bcDefine5,bcDefine6,bcDefine7,bcDefine8,bcDefine9,bclose,bcus
  511. --,bd_c,bdept,be,bend,bexchange,bGCJS,bitem,bparacc,bpardiff,bperson,bproperty,br,bReport,bsup,bused
  512. --,cass_item,cbook_type,cbook_type_engl,cclass,cclass_engl,cclassany,cclassany_engl,ccode,ccode_engl
  513. --,ccode_name,cexch_name,cgather,chelp,cmeasure,cother,cUserDefineType,dbegin,dend,dModifyDate
  514. --,igrade,iotherused,itrans,iViewItem,iyear
  515. --into tempdb..tmpuf_63Code from code with(nolock) where 1=1 and iyear={2}
  516. -- exec GL_Ledger @tblname=N'tmpuf_63',@KmCode=N'5801',@beginPeriod={3},@endPeriod={4},@bVouch=0,@bequal=0,@sum=0,@bMJ=0,@swhere=N'',@sAuth=N'',@ReportID=N'GL13',@ReportType=0,@iUnite=0
  517. select A.SPTDOC as SPTDOC_NO,YYYY as Created_Year,MM as Created_Month,YYYY,MM,SMR,DBTO_AMT DBTO -- + ISNULL(c.tmpme,0)
  518. from #test5 a
  519. left join #test9 b on a.SPTDOC=b.SPTDOC and a.MM=b.imonth and a.DD=b.iday
  520. --left join tempdb..tmpuf_63 c on a.YYYY = c.iyear and a.MM = c.imonth and c.cdcode = '(2221)'
  521. where SMR =''
  522. order by MM
  523. rollback transaction
  524. ";
  525. sqlsgz = string.Format(sqlsgz, beginPeriod, endPeriod, Date, beginPeriod, endPeriod);
  526. log.Info("YERP_006_gz sql:" + sqlsgz);
  527. DataTable vbsdtgz = ICSHelper.ExecuteTable(conStrgz, sqlsgz);
  528. log.Info("YERP_006_gz sql结果数量" + vbsdtgz.Rows.Count);
  529. var itemIndex = 0;
  530. var itemgzIndex = 0;
  531. if (vbsdt.Rows.Count + vbsdtgz.Rows.Count > 0)
  532. {
  533. var datarows = new List<TempDatas>();
  534. StringBuilder soapRequestData = new StringBuilder();
  535. soapRequestData.Append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:yerp=\"http://skch.com/YERP_006_MATN_COST\">");
  536. soapRequestData.Append("<soapenv:Header/>");
  537. soapRequestData.Append("<soapenv:Body>");
  538. soapRequestData.Append("<yerp:YERP_006_OA1_MT>");
  539. //循环行数据
  540. if (vbsdt.Rows.Count > 0)
  541. {
  542. foreach (DataRow itemRow in vbsdt.Rows)
  543. {
  544. //原循环部分 begin
  545. soapRequestData.Append("<MGMT_CST>");
  546. soapRequestData.Append(itemRow["Created_Year"] != null ? "<Created_Year>" + itemRow["Created_Year"].ToString() + "</Created_Year>" : "<Created_Year>" + "</Created_Year>");
  547. soapRequestData.Append(itemRow["Created_Month"] != null ? "<Created_Month>" + itemRow["Created_Month"].ToString() + "</Created_Month>" : "<Created_Month>" + "</Created_Month>");
  548. //soapRequestData.Append(itemRow["DD"] != null ? "<DD>" + itemRow["DD"].ToString() + "</DD>" : "<DD>" + "</DD>");
  549. //soapRequestData.Append(itemRow["SPTDOC_NO"] != null ? "<SPTDOC_NO>" + itemRow["SPTDOC_NO"].ToString() + "</SPTDOC_NO>" : "<SPTDOC_NO>" + "</SPTDOC_NO>");
  550. soapRequestData.Append(itemRow["SMR"] != null ? "<SMR>" + 100 + "</SMR>" : "<SMR>" + "</SMR>");
  551. soapRequestData.Append(itemRow["DBTO"] != null ? "<DBTO>" + itemRow["DBTO"].ToString() + "</DBTO>" : "<DBTO>" + "</DBTO>");
  552. //soapRequestData.Append(itemRow["INCOME_TAX"] != null ? "<INCOME_TAX>" + itemRow["INCOME_TAX"].ToString() + "</INCOME_TAX>" : "<INCOME_TAX>" + "</INCOME_TAX>");
  553. //soapRequestData.Append(itemRow["CRDTO"] != null ? "<CRDTO>" + itemRow["CRDTO"].ToString() + "</CRDTO>" : "<CRDTO>" + "</CRDTO>");
  554. //soapRequestData.Append(itemRow["DBTO_CRDTO_DVSN"] != null ? "<DBTO_CRDTO_DVSN>" + itemRow["DBTO_CRDTO_DVSN"].ToString() + "</DBTO_CRDTO_DVSN>" : "<DBTO_CRDTO_DVSN>" + "</DBTO_CRDTO_DVSN>");
  555. //soapRequestData.Append(itemRow["BLNC"] != null ? "<BLNC>" + itemRow["BLNC"].ToString() + "</BLNC>" : "<BLNC>" + "</BLNC>");
  556. //soapRequestData.Append(itemRow["OFC_OPRT_CST"] != null ? "<OFC_OPRT_CST>" + itemRow["OFC_OPRT_CST"].ToString() + "</OFC_OPRT_CST>" : "<OFC_OPRT_CST>" + "</OFC_OPRT_CST>");
  557. //soapRequestData.Append(itemRow["BZTRP_CST"] != null ? "<BZTRP_CST>" + itemRow["BZTRP_CST"].ToString() + "</BZTRP_CST>" : "<BZTRP_CST>" + "</BZTRP_CST>");
  558. //soapRequestData.Append(itemRow["TRSF_CST"] != null ? "<TRSF_CST>" + itemRow["TRSF_CST"].ToString() + "</TRSF_CST>" : "<TRSF_CST>" + "</TRSF_CST>");
  559. //soapRequestData.Append(itemRow["BNFT_CST"] != null ? "<BNFT_CST>" + itemRow["BNFT_CST"].ToString() + "</BNFT_CST>" : "<BNFT_CST>" + "</BNFT_CST>");
  560. //soapRequestData.Append(itemRow["NTTN_CST"] != null ? "<NTTN_CST>" + itemRow["NTTN_CST"].ToString() + "</NTTN_CST>" : "<NTTN_CST>" + "</NTTN_CST>");
  561. //soapRequestData.Append(itemRow["SCLISRC"] != null ? "<SCLISRC>" + itemRow["SCLISRC"].ToString() + "</SCLISRC>" : "<SCLISRC>" + "</SCLISRC>");
  562. //soapRequestData.Append(itemRow["DDTN"] != null ? "<DDTN>" + itemRow["DDTN"].ToString() + "</DDTN>" : "<DDTN>" + "</DDTN>");
  563. //soapRequestData.Append(itemRow["NTRR_CST"] != null ? "<NTRR_CST>" + itemRow["NTRR_CST"].ToString() + "</NTRR_CST>" : "<NTRR_CST>" + "</NTRR_CST>");
  564. //soapRequestData.Append(itemRow["VEHS_OPRT_CST"] != null ? "<VEHS_OPRT_CST>" + itemRow["VEHS_OPRT_CST"].ToString() + "</VEHS_OPRT_CST>" : "<VEHS_OPRT_CST>" + "</VEHS_OPRT_CST>");
  565. //soapRequestData.Append(itemRow["SVC_CST"] != null ? "<SVC_CST>" + itemRow["SVC_CST"].ToString() + "</SVC_CST>" : "<SVC_CST>" + "</SVC_CST>");
  566. //soapRequestData.Append(itemRow["VEHS_RNTL_CST"] != null ? "<VEHS_RNTL_CST>" + itemRow["VEHS_RNTL_CST"].ToString() + "</VEHS_RNTL_CST>" : "<VEHS_RNTL_CST>" + "</VEHS_RNTL_CST>");
  567. //soapRequestData.Append(itemRow["OFC_RNTL_CST"] != null ? "<OFC_RNTL_CST>" + itemRow["OFC_RNTL_CST"].ToString() + "</OFC_RNTL_CST>" : "<OFC_RNTL_CST>" + "</OFC_RNTL_CST>");
  568. //soapRequestData.Append(itemRow["PRPT_MGMT_CST"] != null ? "<PRPT_MGMT_CST>" + itemRow["PRPT_MGMT_CST"].ToString() + "</PRPT_MGMT_CST>" : "<PRPT_MGMT_CST>" + "</PRPT_MGMT_CST>");
  569. //soapRequestData.Append(itemRow["WTNELCT_CST"] != null ? "<WTNELCT_CST>" + itemRow["WTNELCT_CST"].ToString() + "</WTNELCT_CST>" : "<WTNELCT_CST>" + "</WTNELCT_CST>");
  570. //soapRequestData.Append(itemRow["NWK_CST"] != null ? "<NWK_CST>" + itemRow["NWK_CST"].ToString() + "</NWK_CST>" : "<NWK_CST>" + "</NWK_CST>");
  571. //soapRequestData.Append(itemRow["TELE_CST"] != null ? "<TELE_CST>" + itemRow["TELE_CST"].ToString() + "</TELE_CST>" : "<TELE_CST>" + "</TELE_CST>");
  572. //soapRequestData.Append(itemRow["MEET_CST"] != null ? "<MEET_CST>" + itemRow["MEET_CST"].ToString() + "</MEET_CST>" : "<MEET_CST>" + "</MEET_CST>");
  573. //soapRequestData.Append(itemRow["PCL_CST"] != null ? "<PCL_CST>" + itemRow["PCL_CST"].ToString() + "</PCL_CST>" : "<PCL_CST>" + "</PCL_CST>");
  574. //soapRequestData.Append(itemRow["PNCST"] != null ? "<PNCST>" + itemRow["PNCST"].ToString() + "</PNCST>" : "<PNCST>" + "</PNCST>");
  575. //soapRequestData.Append(itemRow["CUN_CST"] != null ? "<CUN_CST>" + itemRow["CUN_CST"].ToString() + "</CUN_CST>" : "<CUN_CST>" + "</CUN_CST>");
  576. //soapRequestData.Append(itemRow["DPRCT_CST"] != null ? "<DPRCT_CST>" + itemRow["DPRCT_CST"].ToString() + "</DPRCT_CST>" : "<DPRCT_CST>" + "</DPRCT_CST>");
  577. //soapRequestData.Append(itemRow["EDU_CST"] != null ? "<EDU_CST>" + itemRow["EDU_CST"].ToString() + "</EDU_CST>" : "<EDU_CST>" + "</EDU_CST>");
  578. //soapRequestData.Append(itemRow["RPR_CST"] != null ? "<RPR_CST>" + itemRow["RPR_CST"].ToString() + "</RPR_CST>" : "<RPR_CST>" + "</RPR_CST>");
  579. //soapRequestData.Append(itemRow["LBPRTT_CST"] != null ? "<LBPRTT_CST>" + itemRow["LBPRTT_CST"].ToString() + "</LBPRTT_CST>" : "<LBPRTT_CST>" + "</LBPRTT_CST>");
  580. //soapRequestData.Append(itemRow["BZ_PRMT_CST"] != null ? "<BZ_PRMT_CST>" + itemRow["BZ_PRMT_CST"].ToString() + "</BZ_PRMT_CST>" : "<BZ_PRMT_CST>" + "</BZ_PRMT_CST>");
  581. //soapRequestData.Append(itemRow["TEST_CST"] != null ? "<TEST_CST>" + itemRow["TEST_CST"].ToString() + "</TEST_CST>" : "<TEST_CST>" + "</TEST_CST>");
  582. //soapRequestData.Append(itemRow["BK_CST"] != null ? "<BK_CST>" + itemRow["BK_CST"].ToString() + "</BK_CST>" : "<BK_CST>" + "</BK_CST>");
  583. //soapRequestData.Append(itemRow["RCRT_CST"] != null ? "<RCRT_CST>" + itemRow["RCRT_CST"].ToString() + "</RCRT_CST>" : "<RCRT_CST>" + "</RCRT_CST>");
  584. //soapRequestData.Append(itemRow["XBT_CST"] != null ? "<XBT_CST>" + itemRow["XBT_CST"].ToString() + "</XBT_CST>" : "<XBT_CST>" + "</XBT_CST>");
  585. //soapRequestData.Append(itemRow["RSNB_LOS"] != null ? "<RSNB_LOS>" + itemRow["RSNB_LOS"].ToString() + "</RSNB_LOS>" : "<RSNB_LOS>" + "</RSNB_LOS>");
  586. #region 004字段
  587. // 根据年月日凭证号关联SMPL_CST
  588. if (vbs04dt.Rows.Count > 0 && !string.IsNullOrEmpty(itemRow["SPTDOC_NO"].ToString()))
  589. {
  590. var SMPL_CST = vbs04dt.Select("YYYY='" + itemRow["YYYY"].ToString() + "' and MM='" + itemRow["MM"].ToString() + "' and DD='" + itemRow["DD"].ToString() + "' and SPTDOC_NO='" + itemRow["SPTDOC_NO"].ToString() + "'");
  591. if (SMPL_CST.Length > 0)
  592. {
  593. var vbs04row = SMPL_CST.FirstOrDefault();
  594. soapRequestData.Append(vbs04row["SMPL_CST"] != null ? "<SMPL_CST>" + vbs04row["SMPL_CST"].ToString() + "</SMPL_CST>" : "<SMPL_CST>" + "</SMPL_CST>");
  595. var datatemp = new TempDatas
  596. {
  597. YYYY = itemRow["YYYY"].ToString(),
  598. MM = itemRow["MM"].ToString(),
  599. DD = itemRow["DD"].ToString(),
  600. SPTDOC_NO = itemRow["SPTDOC_NO"].ToString(),
  601. };
  602. datarows.Add(datatemp);
  603. }
  604. }
  605. #endregion
  606. soapRequestData.Append("</MGMT_CST>");
  607. //原循环部分 end
  608. itemIndex++;
  609. }
  610. #region 004
  611. log.Info("原本006数据已录入" + soapRequestData.Length + "条。");
  612. log.Info("datarows关联到" + datarows.Count + "条。");
  613. // 若有未关联的数据,拼接在数据后面
  614. if (vbs04dt.Rows.Count > 0)
  615. {
  616. foreach (DataRow item in vbs04dt.Rows)
  617. {
  618. if (datarows.Count > 0)
  619. {
  620. var exists = datarows.Any(q => q.YYYY == item["YYYY"].ToString() && q.MM == item["MM"].ToString() && q.DD == item["DD"].ToString() && q.SPTDOC_NO == item["SPTDOC_NO"].ToString());
  621. log.Info("有关联数据" + datarows.Count + "条,过滤后exists结果为" + exists + "。");
  622. if (!exists)
  623. {
  624. soapRequestData.Append("<MGMT_CST>");
  625. soapRequestData.Append(item["YYYY"] != null ? "<Created_Year>" + item["YYYY"].ToString() + "</Created_Year>" : "<Created_Year>" + "</Created_Year>");
  626. soapRequestData.Append(item["MM"] != null ? "<Created_Month>" + item["MM"].ToString() + "</Created_Month>" : "<Created_Month>" + "</Created_Month>");
  627. //soapRequestData.Append(item["SPTDOC_NO"] != null ? "<SPTDOC_NO>" + item["SPTDOC_NO"].ToString() + "</SPTDOC_NO>" : "<SPTDOC_NO>" + "</SPTDOC_NO>");
  628. soapRequestData.Append("<SMR>" + 100 + "</SMR>");
  629. soapRequestData.Append(item["SMPL_CST"] != null ? "<SMPL_CST>" + item["SMPL_CST"].ToString() + "</SMPL_CST>" : "<SMPL_CST>" + "</SMPL_CST>");
  630. soapRequestData.Append("</MGMT_CST>");
  631. }
  632. }
  633. else
  634. {
  635. soapRequestData.Append("<MGMT_CST>");
  636. soapRequestData.Append(item["YYYY"] != null ? "<Created_Year>" + item["YYYY"].ToString() + "</Created_Year>" : "<Created_Year>" + "</Created_Year>");
  637. soapRequestData.Append(item["MM"] != null ? "<Created_Month>" + item["MM"].ToString() + "</Created_Month>" : "<Created_Month>" + "</Created_Month>");
  638. soapRequestData.Append("<SMR>" + 100 + "</SMR>");
  639. //soapRequestData.Append(item["SPTDOC_NO"] != null ? "<SPTDOC_NO>" + item["SPTDOC_NO"].ToString() + "</SPTDOC_NO>" : "<SPTDOC_NO>" + "</SPTDOC_NO>");
  640. soapRequestData.Append(item["SMPL_CST"] != null ? "<SMPL_CST>" + item["SMPL_CST"].ToString() + "</SMPL_CST>" : "<SMPL_CST>" + "</SMPL_CST>");
  641. soapRequestData.Append("</MGMT_CST>");
  642. }
  643. itemIndex++;
  644. }
  645. }
  646. #endregion
  647. log.Info("006上海数据录入" + itemIndex + "条。");
  648. }
  649. if (vbsdtgz.Rows.Count > 0)
  650. {
  651. //循环数据
  652. foreach (DataRow itemRow in vbsdtgz.Rows)
  653. {
  654. //原循环部分 begin
  655. soapRequestData.Append("<MGMT_CST>");
  656. soapRequestData.Append(itemRow["Created_Year"] != null ? "<Created_Year>" + itemRow["Created_Year"].ToString() + "</Created_Year>" : "<Created_Year>" + "</Created_Year>");
  657. soapRequestData.Append(itemRow["Created_Month"] != null ? "<Created_Month>" + itemRow["Created_Month"].ToString() + "</Created_Month>" : "<Created_Month>" + "</Created_Month>");
  658. //soapRequestData.Append(itemRow["DD"] != null ? "<DD>" + itemRow["DD"].ToString() + "</DD>" : "<DD>" + "</DD>");
  659. //soapRequestData.Append(itemRow["SPTDOC_NO"] != null ? "<SPTDOC_NO>" + itemRow["SPTDOC_NO"].ToString() + "</SPTDOC_NO>" : "<SPTDOC_NO>" + "</SPTDOC_NO>");
  660. soapRequestData.Append(itemRow["SMR"] != null ? "<SMR>" + 200 + "</SMR>" : "<SMR>" + "</SMR>");
  661. soapRequestData.Append(itemRow["DBTO"] != null ? "<DBTO>" + itemRow["DBTO"].ToString() + "</DBTO>" : "<DBTO>" + "</DBTO>");
  662. //soapRequestData.Append(itemRow["INCOME_TAX"] != null ? "<INCOME_TAX>" + itemRow["INCOME_TAX"].ToString() + "</INCOME_TAX>" : "<INCOME_TAX>" + "</INCOME_TAX>");
  663. //soapRequestData.Append(itemRow["CRDTO"] != null ? "<CRDTO>" + itemRow["CRDTO"].ToString() + "</CRDTO>" : "<CRDTO>" + "</CRDTO>");
  664. //soapRequestData.Append(itemRow["DBTO_CRDTO_DVSN"] != null ? "<DBTO_CRDTO_DVSN>" + itemRow["DBTO_CRDTO_DVSN"].ToString() + "</DBTO_CRDTO_DVSN>" : "<DBTO_CRDTO_DVSN>" + "</DBTO_CRDTO_DVSN>");
  665. //soapRequestData.Append(itemRow["BLNC"] != null ? "<BLNC>" + itemRow["BLNC"].ToString() + "</BLNC>" : "<BLNC>" + "</BLNC>");
  666. //soapRequestData.Append(itemRow["OFC_OPRT_CST"] != null ? "<OFC_OPRT_CST>" + itemRow["OFC_OPRT_CST"].ToString() + "</OFC_OPRT_CST>" : "<OFC_OPRT_CST>" + "</OFC_OPRT_CST>");
  667. //soapRequestData.Append(itemRow["BZTRP_CST"] != null ? "<BZTRP_CST>" + itemRow["BZTRP_CST"].ToString() + "</BZTRP_CST>" : "<BZTRP_CST>" + "</BZTRP_CST>");
  668. //soapRequestData.Append(itemRow["TRSF_CST"] != null ? "<TRSF_CST>" + itemRow["TRSF_CST"].ToString() + "</TRSF_CST>" : "<TRSF_CST>" + "</TRSF_CST>");
  669. //soapRequestData.Append(itemRow["BNFT_CST"] != null ? "<BNFT_CST>" + itemRow["BNFT_CST"].ToString() + "</BNFT_CST>" : "<BNFT_CST>" + "</BNFT_CST>");
  670. //soapRequestData.Append(itemRow["NTTN_CST"] != null ? "<NTTN_CST>" + itemRow["NTTN_CST"].ToString() + "</NTTN_CST>" : "<NTTN_CST>" + "</NTTN_CST>");
  671. //soapRequestData.Append(itemRow["SCLISRC"] != null ? "<SCLISRC>" + itemRow["SCLISRC"].ToString() + "</SCLISRC>" : "<SCLISRC>" + "</SCLISRC>");
  672. //soapRequestData.Append(itemRow["DDTN"] != null ? "<DDTN>" + itemRow["DDTN"].ToString() + "</DDTN>" : "<DDTN>" + "</DDTN>");
  673. //soapRequestData.Append(itemRow["NTRR_CST"] != null ? "<NTRR_CST>" + itemRow["NTRR_CST"].ToString() + "</NTRR_CST>" : "<NTRR_CST>" + "</NTRR_CST>");
  674. //soapRequestData.Append(itemRow["VEHS_OPRT_CST"] != null ? "<VEHS_OPRT_CST>" + itemRow["VEHS_OPRT_CST"].ToString() + "</VEHS_OPRT_CST>" : "<VEHS_OPRT_CST>" + "</VEHS_OPRT_CST>");
  675. //soapRequestData.Append(itemRow["SVC_CST"] != null ? "<SVC_CST>" + itemRow["SVC_CST"].ToString() + "</SVC_CST>" : "<SVC_CST>" + "</SVC_CST>");
  676. //soapRequestData.Append(itemRow["VEHS_RNTL_CST"] != null ? "<VEHS_RNTL_CST>" + itemRow["VEHS_RNTL_CST"].ToString() + "</VEHS_RNTL_CST>" : "<VEHS_RNTL_CST>" + "</VEHS_RNTL_CST>");
  677. //soapRequestData.Append(itemRow["OFC_RNTL_CST"] != null ? "<OFC_RNTL_CST>" + itemRow["OFC_RNTL_CST"].ToString() + "</OFC_RNTL_CST>" : "<OFC_RNTL_CST>" + "</OFC_RNTL_CST>");
  678. //soapRequestData.Append(itemRow["PRPT_MGMT_CST"] != null ? "<PRPT_MGMT_CST>" + itemRow["PRPT_MGMT_CST"].ToString() + "</PRPT_MGMT_CST>" : "<PRPT_MGMT_CST>" + "</PRPT_MGMT_CST>");
  679. //soapRequestData.Append(itemRow["WTNELCT_CST"] != null ? "<WTNELCT_CST>" + itemRow["WTNELCT_CST"].ToString() + "</WTNELCT_CST>" : "<WTNELCT_CST>" + "</WTNELCT_CST>");
  680. //soapRequestData.Append(itemRow["NWK_CST"] != null ? "<NWK_CST>" + itemRow["NWK_CST"].ToString() + "</NWK_CST>" : "<NWK_CST>" + "</NWK_CST>");
  681. //soapRequestData.Append(itemRow["TELE_CST"] != null ? "<TELE_CST>" + itemRow["TELE_CST"].ToString() + "</TELE_CST>" : "<TELE_CST>" + "</TELE_CST>");
  682. //soapRequestData.Append(itemRow["MEET_CST"] != null ? "<MEET_CST>" + itemRow["MEET_CST"].ToString() + "</MEET_CST>" : "<MEET_CST>" + "</MEET_CST>");
  683. //soapRequestData.Append(itemRow["PCL_CST"] != null ? "<PCL_CST>" + itemRow["PCL_CST"].ToString() + "</PCL_CST>" : "<PCL_CST>" + "</PCL_CST>");
  684. //soapRequestData.Append(itemRow["PNCST"] != null ? "<PNCST>" + itemRow["PNCST"].ToString() + "</PNCST>" : "<PNCST>" + "</PNCST>");
  685. //soapRequestData.Append(itemRow["CUN_CST"] != null ? "<CUN_CST>" + itemRow["CUN_CST"].ToString() + "</CUN_CST>" : "<CUN_CST>" + "</CUN_CST>");
  686. //soapRequestData.Append(itemRow["DPRCT_CST"] != null ? "<DPRCT_CST>" + itemRow["DPRCT_CST"].ToString() + "</DPRCT_CST>" : "<DPRCT_CST>" + "</DPRCT_CST>");
  687. //soapRequestData.Append(itemRow["EDU_CST"] != null ? "<EDU_CST>" + itemRow["EDU_CST"].ToString() + "</EDU_CST>" : "<EDU_CST>" + "</EDU_CST>");
  688. //soapRequestData.Append(itemRow["RPR_CST"] != null ? "<RPR_CST>" + itemRow["RPR_CST"].ToString() + "</RPR_CST>" : "<RPR_CST>" + "</RPR_CST>");
  689. //soapRequestData.Append(itemRow["LBPRTT_CST"] != null ? "<LBPRTT_CST>" + itemRow["LBPRTT_CST"].ToString() + "</LBPRTT_CST>" : "<LBPRTT_CST>" + "</LBPRTT_CST>");
  690. //soapRequestData.Append(itemRow["BZ_PRMT_CST"] != null ? "<BZ_PRMT_CST>" + itemRow["BZ_PRMT_CST"].ToString() + "</BZ_PRMT_CST>" : "<BZ_PRMT_CST>" + "</BZ_PRMT_CST>");
  691. //soapRequestData.Append(itemRow["TEST_CST"] != null ? "<TEST_CST>" + itemRow["TEST_CST"].ToString() + "</TEST_CST>" : "<TEST_CST>" + "</TEST_CST>");
  692. //soapRequestData.Append(itemRow["BK_CST"] != null ? "<BK_CST>" + itemRow["BK_CST"].ToString() + "</BK_CST>" : "<BK_CST>" + "</BK_CST>");
  693. //soapRequestData.Append(itemRow["RCRT_CST"] != null ? "<RCRT_CST>" + itemRow["RCRT_CST"].ToString() + "</RCRT_CST>" : "<RCRT_CST>" + "</RCRT_CST>");
  694. //soapRequestData.Append(itemRow["XBT_CST"] != null ? "<XBT_CST>" + itemRow["XBT_CST"].ToString() + "</XBT_CST>" : "<XBT_CST>" + "</XBT_CST>");
  695. //soapRequestData.Append(itemRow["RSNB_LOS"] != null ? "<RSNB_LOS>" + itemRow["RSNB_LOS"].ToString() + "</RSNB_LOS>" : "<RSNB_LOS>" + "</RSNB_LOS>");
  696. #region 004字段
  697. // 根据年月日凭证号关联SMPL_CST
  698. if (vbsgz04dt.Rows.Count > 0 && !string.IsNullOrEmpty(itemRow["SPTDOC_NO"].ToString()))
  699. {
  700. var SMPL_CST = vbsgz04dt.Select("YYYY='" + itemRow["YYYY"].ToString() + "' and MM='" + itemRow["MM"].ToString() + "' and DD='" + itemRow["DD"].ToString() + "' and SPTDOC_NO='" + itemRow["SPTDOC_NO"].ToString() + "'");
  701. if (SMPL_CST.Length > 0)
  702. {
  703. var vbs04row = SMPL_CST.FirstOrDefault();
  704. soapRequestData.Append(vbs04row["SMPL_CST"] != null ? "<SMPL_CST>" + vbs04row["SMPL_CST"].ToString() + "</SMPL_CST>" : "<SMPL_CST>" + "</SMPL_CST>");
  705. var datatemp = new TempDatas
  706. {
  707. YYYY = itemRow["YYYY"].ToString(),
  708. MM = itemRow["MM"].ToString(),
  709. DD = itemRow["DD"].ToString(),
  710. SPTDOC_NO = itemRow["SPTDOC_NO"].ToString(),
  711. };
  712. datarows.Add(datatemp);
  713. }
  714. }
  715. #endregion
  716. soapRequestData.Append("</MGMT_CST>");
  717. //原循环部分 end
  718. itemgzIndex++;
  719. }
  720. log.Info("原本006gz数据已录入" + soapRequestData.Length + "条。");
  721. log.Info("datarows关联到" + datarows.Count + "条。");
  722. #region 004广州
  723. // 若有未关联的数据,拼接在数据后面
  724. if (vbsgz04dt.Rows.Count > 0)
  725. {
  726. foreach (DataRow item in vbsgz04dt.Rows)
  727. {
  728. if (datarows.Count > 0)
  729. {
  730. var exists = datarows.Any(q => q.YYYY == item["YYYY"].ToString() && q.MM == item["MM"].ToString() && q.DD == item["DD"].ToString() && q.SPTDOC_NO == item["SPTDOC_NO"].ToString());
  731. log.Info("有关联数据" + datarows.Count + "条,过滤后exists结果为" + exists + "。");
  732. if (!exists)
  733. {
  734. soapRequestData.Append("<MGMT_CST>");
  735. soapRequestData.Append(item["YYYY"] != null ? "<Created_Year>" + item["YYYY"].ToString() + "</Created_Year>" : "<Created_Year>" + "</Created_Year>");
  736. soapRequestData.Append(item["MM"] != null ? "<Created_Month>" + item["MM"].ToString() + "</Created_Month>" : "<Created_Month>" + "</Created_Month>");
  737. soapRequestData.Append("<SMR>" + 200 + "</SMR>");
  738. //soapRequestData.Append(item["SPTDOC_NO"] != null ? "<SPTDOC_NO>" + item["SPTDOC_NO"].ToString() + "</SPTDOC_NO>" : "<SPTDOC_NO>" + "</SPTDOC_NO>");
  739. soapRequestData.Append(item["SMPL_CST"] != null ? "<SMPL_CST>" + item["SMPL_CST"].ToString() + "</SMPL_CST>" : "<SMPL_CST>" + "</SMPL_CST>");
  740. soapRequestData.Append("</MGMT_CST>");
  741. }
  742. }
  743. else
  744. {
  745. soapRequestData.Append("<MGMT_CST>");
  746. soapRequestData.Append(item["YYYY"] != null ? "<Created_Year>" + item["YYYY"].ToString() + "</Created_Year>" : "<Created_Year>" + "</Created_Year>");
  747. soapRequestData.Append(item["MM"] != null ? "<Created_Month>" + item["MM"].ToString() + "</Created_Month>" : "<Created_Month>" + "</Created_Month>");
  748. soapRequestData.Append("<SMR>" + 200 + "</SMR>");
  749. //soapRequestData.Append(item["SPTDOC_NO"] != null ? "<SPTDOC_NO>" + item["SPTDOC_NO"].ToString() + "</SPTDOC_NO>" : "<SPTDOC_NO>" + "</SPTDOC_NO>");
  750. soapRequestData.Append(item["SMPL_CST"] != null ? "<SMPL_CST>" + item["SMPL_CST"].ToString() + "</SMPL_CST>" : "<SMPL_CST>" + "</SMPL_CST>");
  751. soapRequestData.Append("</MGMT_CST>");
  752. }
  753. itemgzIndex++;
  754. }
  755. }
  756. log.Info("006广州数据录入" + itemgzIndex + "条。");
  757. #endregion
  758. }
  759. log.Info("006最终数据录入" + itemgzIndex + itemIndex + "条。");
  760. soapRequestData.Append("</yerp:YERP_006_OA1_MT>");
  761. soapRequestData.Append("</soapenv:Body>");
  762. soapRequestData.Append("</soapenv:Envelope>");
  763. string postData = soapRequestData.ToString();
  764. log.Info("YERP_006 xmlRequest:" + postData);
  765. string statusCode;
  766. string resultContent;
  767. ServicePointManager.SecurityProtocol = (SecurityProtocolType)192 | (SecurityProtocolType)768 | (SecurityProtocolType)3072;
  768. RestOpHelper rop = new RestOpHelper();
  769. rop.Clientp12path = @"C:\Users\Administrator\Desktop\yonyou-cert\wildcard.pfx";
  770. rop.Clientp12PassWord = "Yonyou2024!";
  771. rop.Url = @"https://yerp-proxy-sap-prod.skchemicals.com/XISOAPAdapter/MessageServlet?senderParty=&senderService=YERP_P&receiverParty=&receiverService=&interface=YERP_006_OA1_SI&interfaceNamespace=http://skch.com/YERP_006_MATN_COST";
  772. rop.RequestSAP(rop.Url, 10000, postData, "IF_YERP", "Kfiw282082", out statusCode, out resultContent);
  773. log.Info("YERP_006 statusCode:" + statusCode + "\r\n" + "resultContent:" + resultContent);
  774. }
  775. }
  776. catch (Exception ex)
  777. {
  778. log.Error(ex.ToString());
  779. }
  780. }
  781. public static Configuration GetConfig()
  782. {
  783. Assembly assembly = Assembly.GetCallingAssembly();
  784. string path = string.Format("{0}.config", assembly.Location);
  785. if (!File.Exists(path))
  786. {
  787. throw new FileNotFoundException(path + "路径下的文件未找到!");
  788. }
  789. try
  790. {
  791. ExeConfigurationFileMap configFile = new ExeConfigurationFileMap();
  792. configFile.ExeConfigFilename = path;
  793. Configuration config = ConfigurationManager.OpenMappedExeConfiguration(configFile, ConfigurationUserLevel.None);
  794. return config;
  795. }
  796. catch (Exception)
  797. {
  798. throw;
  799. }
  800. }
  801. }
  802. public class TempDatas
  803. {
  804. public string YYYY { get; set; }
  805. public string MM { get; set; }
  806. public string DD { get; set; }
  807. public string SPTDOC_NO { get; set; }
  808. }
  809. }