MainForm.cs 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using PTMedicalInsurance.Common;
  11. using PTMedicalInsurance.Helper;
  12. using Newtonsoft.Json.Linq;
  13. using PTMedicalInsurance.FormSetter;
  14. using System.IO;
  15. using System.IO.Compression;
  16. using PTMedicalInsurance.Business;
  17. using Sunny.UI;
  18. using Newtonsoft.Json;
  19. using System.Collections;
  20. using PTMedicalInsurance.Variables;
  21. namespace PTMedicalInsurance.Forms.Clearings
  22. {
  23. public partial class MainForm : Form
  24. {
  25. private string txtPath;
  26. private string txtName;
  27. private string finalAchPath;
  28. private string fileDir;
  29. private UIDataGridViewFooter dgvHisSettlRecFooter = new Sunny.UI.UIDataGridViewFooter();
  30. private HisIrisServices hIS = new HisIrisServices();
  31. private MIIrisServices mIS = new MIIrisServices();
  32. JObject jo9102Rtn = new JObject();
  33. #region 初始化
  34. public MainForm()
  35. {
  36. InitializeComponent();
  37. //初始化界面
  38. InitForm();
  39. //添加转院备案
  40. AddForm(this.tpOutOfAreaClearing, new OutOfAreaClearing(this));
  41. }
  42. private void InitForm()
  43. {
  44. this.StartPosition = FormStartPosition.CenterParent;
  45. ComboxSetter cbxSetter = new ComboxSetter();
  46. cbxSetter.setCbxInterfaceDataSource(cbxInterface);
  47. cbxSetter.setCbxDictionaryDataSource(Global.inf.interfaceDr.ToString(), "insutype", cbxInsuType);
  48. cbxSetter.setCbxDictionaryDataSource(Global.inf.interfaceDr.ToString(), "clr_type", cbxClrType);
  49. GridViewSetter grdSetter = new GridViewSetter();
  50. grdSetter.SetHeaderTextOfCheck(dgvSettlSummary);
  51. cbgGroupSet.SelectAll();
  52. cbgGroupSet.SetItemCheckState(4, false);
  53. cbxValid.SelectedIndex = 1;
  54. cbReservelFlag.SelectedIndex = 2;
  55. cbConfirmFlag.SelectedIndex = 1;
  56. dpST.Text = DateTime.Now.ToString("yyyy-MM-01");
  57. dpED.Value = DateTime.Now.AddDays(1 - DateTime.Now.Day).AddMonths(1).AddDays(-1);
  58. WindowState = FormWindowState.Maximized;
  59. fileDir = Global.currentDirectory + "\\Download";
  60. this.WindowState = FormWindowState.Maximized;
  61. this.uiTabControl1.SelectedIndex = 1;
  62. }
  63. private void AddForm(TabPage tabpage, Form frm)
  64. {
  65. tabpage.Controls.Add(frm);
  66. frm.Show();
  67. }
  68. #endregion
  69. #region 非按钮事件
  70. #region 查询HIS
  71. private int queryHisSettlementInfo(out string error)
  72. {
  73. GridViewSetter grdSetter = new GridViewSetter();
  74. grdSetter.SetHeaderTextOfHisSettlRec(dgvHisSettlRec);
  75. error = "";
  76. try
  77. {
  78. DataTable dtInteface = (DataTable)cbxInterface.DataSource;
  79. int i = cbxInterface.SelectedIndex;
  80. string sqlStr = "";
  81. string conditionStr = " ";
  82. DataTable dtSettlSummary = (DataTable)dgvSettlSummary.DataSource;
  83. int iCurRow = dgvSettlSummary.CurrentRow.Index;
  84. //DataTable dtInteface = (DataTable)cbxInterface.DataSource;
  85. if (cbgGroupSet.GetItemCheckState(0))
  86. {
  87. conditionStr = conditionStr + " and Interface_Dr ='" + dtSettlSummary.Rows[iCurRow]["Interface_dr"].ToString() + "'";
  88. }
  89. //if (cbgGroupSet.GetItemCheckState(1))
  90. //{
  91. // conditionStr = conditionStr + " and InsuranceType ='" + dtSettlSummary.Rows[iCurRow]["insutype"].ToString() + "'";
  92. //}
  93. if (cbgGroupSet.GetItemCheckState(2))
  94. {
  95. conditionStr = conditionStr + " and ClearingType ='" + dtSettlSummary.Rows[iCurRow]["clr_type"].ToString() + "'";
  96. }
  97. if (cbgGroupSet.GetItemCheckState(3))
  98. {
  99. conditionStr = conditionStr + " and ClearingOrgan ='" + dtSettlSummary.Rows[iCurRow]["setl_optins"].ToString() + "'";
  100. }
  101. if (cbgGroupSet.GetItemCheckState(4))
  102. {
  103. sqlStr = sqlStr + ",BillType";
  104. conditionStr = conditionStr + " and BillType ='" + dtSettlSummary.Rows[iCurRow]["BillType"].ToString() + "'";
  105. }
  106. sqlStr = "select * " + getWhereCondition();
  107. sqlStr = sqlStr + conditionStr;
  108. JObject joSqlstr = new JObject();
  109. joSqlstr.Add("sqlStr", sqlStr);
  110. JArray jaParam = new JArray();
  111. jaParam.Add(joSqlstr);
  112. JObject joSettlQuery = new JObject();
  113. joSettlQuery.Add("params", jaParam);
  114. joSettlQuery.Add("code", "09010059");
  115. InvokeHelper invoker = new InvokeHelper();
  116. JObject joRtn = invoker.invokeInsuService(joSettlQuery.ToString(), "查询结算信息");
  117. //原来的,不匹配HIS
  118. //JArray ja = JArray.Parse(JsonHelper.getDestValue(joRtn, "result.data"));
  119. //DataTable dt = (DataTable)JsonConvert.DeserializeObject(JsonHelper.getDestValue(joRtn, "result.data"), (typeof(DataTable)));
  120. //dgvHisSettlRec.DataSource = dt;
  121. //if (dt.Rows.Count == 0)
  122. //{
  123. // error = "未查询到数据";
  124. // return -1;
  125. //}
  126. JObject joHisRtn = BatchHisRecord(joRtn);
  127. if (JsonHelper.parseIrisRtnValue(joHisRtn, out error) != 0)
  128. {
  129. error = "查询HIS结算记录出错,请联系管理员!" + error;
  130. return -1;
  131. }
  132. DataTable dt = (DataTable)JsonConvert.DeserializeObject(JsonHelper.getDestValue(joHisRtn, "result"), (typeof(DataTable)));
  133. dgvHisSettlRec.DataSource = dt;
  134. return 0;
  135. }
  136. catch (Exception ex)
  137. {
  138. error = "queryHisSettlementInfo:" + ex.Message;
  139. return -1;
  140. }
  141. }
  142. private JObject BatchHisRecord(JObject joMiRecord)
  143. {
  144. Global.writeLog("1");
  145. string errMsg;
  146. JObject joRtn = new JObject();
  147. JArray jaMiRecord = JArray.Parse(JsonHelper.getDestValue(joMiRecord, "result.data"));
  148. JArray jaInput = new JArray();
  149. foreach (JObject jo in jaMiRecord)
  150. {
  151. JObject joTmp = new JObject();
  152. string mainSettlementIDOfMutualAid = jo["MainSettlementIDOfMutualAid"].ToString();
  153. if (string.IsNullOrEmpty(mainSettlementIDOfMutualAid))
  154. {
  155. joTmp.Add("SettlementID", jo["SettlementID"].ToString());
  156. }
  157. else
  158. {
  159. joTmp.Add("SettlementID", mainSettlementIDOfMutualAid);
  160. }
  161. joTmp.Add("RecordID", jo["RecordID"].ToString());
  162. joTmp.Add("ValidFlag", jo["ValidFlag"].ToString());
  163. joTmp.Add("BillType", jo["BillType"].ToString());
  164. jaInput.Add(joTmp);
  165. }
  166. Global.writeLog("2");
  167. if (hIS.BatchHisRecord(jaInput, out errMsg) != 0)
  168. {
  169. joRtn = JsonHelper.setExceptionJson(-1, "", errMsg);
  170. return joRtn;
  171. }
  172. Global.writeLog("3");
  173. JArray jaHisRtn = JArray.Parse(JsonHelper.getDestValue(JObject.Parse(errMsg), "result"));
  174. foreach (JObject joMi in jaMiRecord)
  175. {
  176. string mainSettlementIDOfMutualAid = joMi["MainSettlementIDOfMutualAid"].ToString();
  177. foreach (JObject joHis in jaHisRtn)
  178. {
  179. if (string.IsNullOrEmpty(mainSettlementIDOfMutualAid))
  180. {
  181. if ((joMi["RecordID"].ToString() == joHis["RecordID"].ToString()) && (joMi["SettlementID"].ToString() == joHis["SettlementID"].ToString()) && (joMi["BillType"].ToString() == joHis["BillType"].ToString()))
  182. {
  183. if (!joMi.ContainsKey("Exist"))
  184. {
  185. joMi.Add("Exist", joHis["Exist"].ToString());
  186. }
  187. if (!joMi.ContainsKey("status"))
  188. {
  189. joMi.Add("status", joHis["status"].ToString());
  190. }
  191. }
  192. }
  193. else
  194. {
  195. if ((joMi["RecordID"].ToString() == joHis["RecordID"].ToString()) && (joMi["MainSettlementIDOfMutualAid"].ToString() == joHis["SettlementID"].ToString()) && (joMi["BillType"].ToString() == joHis["BillType"].ToString()))
  196. {
  197. if (!joMi.ContainsKey("Exist"))
  198. {
  199. joMi.Add("Exist", joHis["Exist"].ToString());
  200. }
  201. if (!joMi.ContainsKey("status"))
  202. {
  203. joMi.Add("status", joHis["status"].ToString());
  204. }
  205. }
  206. }
  207. }
  208. }
  209. joRtn.Add("errorCode", 0);
  210. joRtn.Add("result", jaMiRecord);
  211. return joRtn;
  212. }
  213. private string getWhereCondition()
  214. {
  215. string sqlStr = "";
  216. sqlStr = sqlStr + " FROM BS_MedInsuSettlement WHERE Hospital_Dr=" + Global.inf.hospitalDr;
  217. sqlStr = sqlStr + " and OccurTime>'" + dpST.Text + " 00:00:00'";
  218. sqlStr = sqlStr + " and OccurTime<'" + dpED.Text + " 23:59:59'";
  219. sqlStr = sqlStr + " and (left(InsuranceAreaCode,2)='44')";
  220. DataTable dtInteface = (DataTable)cbxInterface.DataSource;
  221. int i = cbxInterface.SelectedIndex;
  222. if (cbxInterface.Text != "")
  223. {
  224. sqlStr = sqlStr + " and Interface_Dr =" + dtInteface.Rows[i]["ID"].ToString();
  225. }
  226. if (cbxInsuType.Text != "")
  227. {
  228. sqlStr = sqlStr + " and InsuranceType ='" + cbxInsuType.SelectedValue + "'";
  229. }
  230. if (cbxClrType.Text != "")
  231. {
  232. sqlStr = sqlStr + " and ClearingType ='" + cbxClrType.SelectedValue + "'";
  233. }
  234. if (tbSettlOption.Text != "")
  235. {
  236. sqlStr = sqlStr + " and ClearingOrgan ='" + tbSettlOption.Text + "'";
  237. }
  238. //ValidFlag=1 and BillType=1 表示正常结算记录 ValidFlag=0 and BillType=-1 表示退费记录 ValidFlag=0表示无效记录
  239. if (cbxValid.SelectedIndex != 0)
  240. {
  241. if (cbxValid.SelectedIndex == 1)
  242. sqlStr = sqlStr + " and ValidFlag =1 and BillType=1";
  243. else
  244. sqlStr = sqlStr + " and ValidFlag =0 and BillType=-1";
  245. }
  246. //确认标志
  247. if (cbConfirmFlag.SelectedIndex != 0)
  248. {
  249. if (cbConfirmFlag.SelectedIndex == 1)
  250. sqlStr = sqlStr + " and ((ConfirmFlag = 1 and AdmType = 3) or (AdmType in ('1','2'))) ";
  251. else
  252. sqlStr = sqlStr + " and ConfirmFlag <> 1";
  253. }
  254. // ReversalFlag = 1 表示数据已冲正,ReversalFlag =0 表示 正常未冲正数据
  255. if (cbReservelFlag.SelectedIndex != 0)
  256. {
  257. if (cbReservelFlag.SelectedIndex == 1)
  258. sqlStr = sqlStr + " and ReversalFlag =1 ";
  259. else
  260. sqlStr = sqlStr + " and ReversalFlag <> 1 ";
  261. }
  262. return sqlStr;
  263. }
  264. #endregion
  265. #region 对明细账
  266. public static void writeToTxt(string content, string filePath, string fileName)
  267. {
  268. //创建文件夹,文件夹名称与TXT同名
  269. string finalPath = filePath + "\\" + fileName;
  270. if (!Directory.Exists(finalPath))
  271. {
  272. DirectoryInfo dirInfo = Directory.CreateDirectory(finalPath);
  273. }
  274. //判断文件夹中是否存在txt
  275. string finalFileName = finalPath + "\\" + fileName + ".txt";
  276. if (!File.Exists(finalFileName))
  277. {
  278. FileStream fs1 = File.Create(finalFileName);
  279. fs1.Close();
  280. }
  281. FileStream fs = new FileStream(finalFileName, FileMode.Append, FileAccess.Write);
  282. StreamWriter sw = new StreamWriter(fs);
  283. sw.WriteLine(content);
  284. sw.Close();
  285. fs.Close();
  286. }
  287. /// <summary>
  288. /// 读文件到byte[]
  289. /// </summary>
  290. /// <param name="fileName">硬盘文件路径</param>
  291. /// <returns></returns>
  292. public static byte[] ReadFileToByte(string fileName)
  293. {
  294. FileStream pFileStream = null;
  295. byte[] pReadByte = new byte[0];
  296. try
  297. {
  298. pFileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
  299. BinaryReader r = new BinaryReader(pFileStream);
  300. r.BaseStream.Seek(0, SeekOrigin.Begin); //将文件指针设置到文件开
  301. pReadByte = r.ReadBytes((int)r.BaseStream.Length);
  302. return pReadByte;
  303. }
  304. catch
  305. {
  306. return pReadByte;
  307. }
  308. finally
  309. {
  310. if (pFileStream != null)
  311. pFileStream.Close();
  312. }
  313. }
  314. /// <summary>
  315. ///单字节转有符号整数
  316. /// </summary>
  317. /// <param name="data"></param>
  318. /// <returns></returns>
  319. public string byteArrayToDecString(byte[] data)
  320. {
  321. StringBuilder builder = new StringBuilder();
  322. for (int i = 0; i < data.Length; i++)
  323. {
  324. builder.Append((sbyte)data[i] + ",");
  325. }
  326. return builder.ToString().Trim();
  327. }
  328. private int HISDetailDataExport(string filePath, string fileName)
  329. {
  330. try
  331. {
  332. DataTable dt = (DataTable)dgvHisSettlRec.DataSource;
  333. string content = "";
  334. for (int i = 0; i < dt.Rows.Count; i++)
  335. {
  336. string flag = "";
  337. if (dt.Rows[i]["ValidFlag"].ToString() == "-1")
  338. {
  339. flag = "1";
  340. }
  341. else
  342. {
  343. flag = "0";
  344. }
  345. content = "\r\n"
  346. + dt.Rows[i]["SettlementID"].ToString() + "\t"
  347. + dt.Rows[i]["MdtrtID"].ToString() + "\t"
  348. + dt.Rows[i]["PersonnelNO"].ToString() + "\t"
  349. + dt.Rows[i]["Sumamt"].ToString() + "\t"
  350. + dt.Rows[i]["FundPaySumamt"].ToString() + "\t"
  351. + dt.Rows[i]["AccountPaySumamt"].ToString() + "\t"
  352. + flag
  353. + content;
  354. }
  355. string finalContent = content.Remove(0, 2);
  356. writeToTxt(finalContent, filePath, fileName);
  357. return 0;
  358. }
  359. catch (Exception ex)
  360. {
  361. MessageBox.Show(ex.Message);
  362. return -1;
  363. }
  364. }
  365. private int exportAndCompress(out string zipPath)
  366. {
  367. zipPath = "";
  368. try
  369. {
  370. //导出TXT
  371. string fileName = DateTime.Now.ToString("yyyyMMddHHmmssffff");
  372. string filePath = Global.currentDirectory + "\\Download";
  373. HISDetailDataExport(filePath, fileName);
  374. //压缩
  375. string finalDirPath = filePath + "\\" + fileName;//同名文件夹
  376. zipPath = finalDirPath + ".zip";
  377. System.IO.Compression.ZipFile.CreateFromDirectory(finalDirPath, zipPath);
  378. return 0;
  379. }
  380. catch (Exception ex)
  381. {
  382. zipPath = "exportAndCompress:" + ex.Message;
  383. return -1;
  384. }
  385. }
  386. /// <summary>
  387. /// 上传ZIP文件转字节流再转换为有符号10进制数组后上传
  388. /// </summary>
  389. /// <param name="zipPath"></param>
  390. /// <param name="file_qury_no"></param>
  391. /// <returns></returns>
  392. private int uploadFileToCenter(string zipPath, out string file_qury_no)
  393. {
  394. string outParam = "";
  395. try
  396. {
  397. byte[] bArray = ReadFileToByte(zipPath);
  398. string str = "[" + byteArrayToDecString(bArray) + "]";
  399. JObject joTmp = new JObject();
  400. joTmp.Add("in", JArray.Parse(str));
  401. joTmp.Add("filename", txtName + ".zip");
  402. joTmp.Add("fixmedins_code", Global.inf.hospitalNO);
  403. JObject joFsUploadIn = new JObject();
  404. joFsUploadIn.Add("fsUploadIn", joTmp);
  405. InvokeHelper invoker = new InvokeHelper();
  406. JObject jo9101Rtn = invoker.invokeCenterService(TradeEnum.FileUpload, joFsUploadIn);
  407. if (JsonHelper.parseCenterReturnJson(jo9101Rtn, out outParam) != 0)
  408. {
  409. file_qury_no = outParam;
  410. return -1;
  411. }
  412. else
  413. {
  414. file_qury_no = JsonHelper.getDestValue(jo9101Rtn, "output.file_qury_no");
  415. return 0;
  416. }
  417. }
  418. catch (Exception ex)
  419. {
  420. file_qury_no = "uploadFileToCenter:" + ex.Message;
  421. return -1;
  422. }
  423. }
  424. private int checkDetail(string file_qury_no, out string outParam, out string fileName)
  425. {
  426. fileName = "";
  427. try
  428. {
  429. DataTable dt = (DataTable)dgvSettlSummary.DataSource;
  430. int i = dgvSettlSummary.CurrentRow.Index;
  431. dynamic joCheck = new JObject();
  432. joCheck.file_qury_no = file_qury_no.Replace(@"\\", @"\");
  433. joCheck.clr_type = dt.Rows[i]["clr_type"].ToString();
  434. joCheck.setl_optins = dt.Rows[i]["setl_optins"].ToString();
  435. joCheck.stmt_begndate = dpST.Value.ToString("yyyy-MM-dd HH:mm:ss");
  436. joCheck.stmt_enddate = dpED.Value.ToString("yyyy-MM-dd HH:mm:ss");
  437. joCheck.medfee_sumamt = dt.Rows[i]["medfee_sumamt"].ToString();
  438. joCheck.fund_pay_sumamt = dt.Rows[i]["fund_pay_sumamt"].ToString();
  439. joCheck.cash_payamt = dt.Rows[i]["cash_payamt"].ToString();
  440. joCheck.fixmedins_setl_cnt = dt.Rows[i]["fixmedins_setl_cnt"].ToString();
  441. JObject joData = new JObject();
  442. joData.Add("data", joCheck);
  443. InvokeHelper invoker = new InvokeHelper();
  444. JObject jo3202Rtn = invoker.invokeCenterService(TradeEnum.FeeDetailCheck, joData);
  445. if (JsonHelper.parseCenterReturnJson(jo3202Rtn, out outParam) != 0)
  446. {
  447. return -1;
  448. }
  449. else
  450. {
  451. outParam = JsonHelper.getDestValue(jo3202Rtn, "output.fileinfo.file_qury_no");
  452. fileName = JsonHelper.getDestValue(jo3202Rtn, "output.fileinfo.filename");
  453. return 0;
  454. }
  455. }
  456. catch (Exception ex)
  457. {
  458. outParam = "checkDetail:" + ex.Message;
  459. return -1;
  460. }
  461. }
  462. private int downloadZIP(string file_qury_no, string fileName, out string outParam)
  463. {
  464. outParam = "";
  465. try
  466. {
  467. JObject joTmp = new JObject();
  468. joTmp = new JObject();
  469. joTmp.Add("file_qury_no", file_qury_no.Replace(@"\\", @"\"));
  470. joTmp.Add("filename", fileName);
  471. joTmp.Add("fixmedins_code", Global.inf.hospitalNO);
  472. JObject joFsDownloadIn = new JObject();
  473. joFsDownloadIn.Add("fsDownloadIn", joTmp);
  474. InvokeHelper invoker = new InvokeHelper();
  475. JObject jo9102Rtn = invoker.DownloadCenterFile(JsonHelper.setCenterInpar("9102", joFsDownloadIn).ToString());
  476. string error = "";
  477. if (JsonHelper.parseIrisRtnValue(jo9102Rtn, out error) != 0)
  478. {
  479. outParam = error;
  480. return -1;
  481. }
  482. else
  483. {
  484. outParam = JsonHelper.getDestValue(jo9102Rtn, "filePath");
  485. return 0;
  486. }
  487. }
  488. catch (Exception ex)
  489. {
  490. outParam = "downloadZIP:" + ex.Message;
  491. return -1;
  492. }
  493. }
  494. private int importToDgvCenterSetlRec(string fileName, string zipFilePath, out string outParam)
  495. {
  496. outParam = "";
  497. try
  498. {
  499. string dir = fileName.Substring(1, fileName.Length - 4);
  500. //解压缩
  501. string txtFileDir = System.Environment.CurrentDirectory + "\\Download\\" + dir;
  502. string txtFilePath = zipFilePath.Substring(0, zipFilePath.Length - 4);
  503. if (File.Exists(txtFilePath))
  504. {
  505. File.Delete(txtFilePath);
  506. }
  507. if (!Directory.Exists(txtFileDir))
  508. {
  509. Directory.CreateDirectory(txtFileDir);
  510. }
  511. ZipFile.ExtractToDirectory(zipFilePath, txtFileDir);
  512. //导入文件
  513. GridViewSetter grd = new GridViewSetter();
  514. grd.SetHeaderTextOfDgvCenterSetlRec(dgvCenterSettlRec);
  515. //txtFileDir = txtFileDir;//E:\GHSF\SCYBDownLoad\result.txt
  516. string[] lines = System.IO.File.ReadAllLines(txtFileDir + "\\result.txt");
  517. DataTable dt = new DataTable();
  518. dt.Columns.Add("sn", typeof(int));
  519. dt.Columns.Add("psn_no", typeof(string));
  520. dt.Columns.Add("mdtrt_id", typeof(string));
  521. dt.Columns.Add("setl_id", typeof(string));
  522. dt.Columns.Add("msgid", typeof(string));
  523. dt.Columns.Add("stmt_rslt", typeof(string));
  524. dt.Columns.Add("refd_setl_flag", typeof(string));
  525. dt.Columns.Add("memo", typeof(string));
  526. dt.Columns.Add("medfee_sumamt", typeof(string));
  527. dt.Columns.Add("fund_pay_sumamt", typeof(string));
  528. dt.Columns.Add("acct_pay", typeof(string));
  529. //foreach (string line in lines)
  530. for (int i = 0; i < lines.Length; i++)
  531. {
  532. string[] strs = (lines[i] + "\t").Split('\t');
  533. DataRow dr = dt.NewRow();
  534. //Global.inf.writeLog(lines[i].ToString());
  535. //Global.inf.writeLog(strs.Length.ToString());
  536. dr["sn"] = i + 1;
  537. dr["psn_no"] = strs[0];
  538. dr["mdtrt_id"] = strs[1];
  539. dr["setl_id"] = strs[2];
  540. dr["msgid"] = strs[3];
  541. dr["stmt_rslt"] = strs[4];
  542. dr["refd_setl_flag"] = strs[5];
  543. dr["memo"] = strs[6];
  544. dr["medfee_sumamt"] = strs[7];
  545. dr["fund_pay_sumamt"] = strs[8];
  546. dr["acct_pay"] = strs[9];
  547. //dr["Field2"] = strs[2];
  548. dt.Rows.Add(dr);
  549. }
  550. dgvCenterSettlRec.DataSource = dt;
  551. return 0;
  552. }
  553. catch (Exception ex)
  554. {
  555. outParam = "importToDgvCenterSetlRec:" + ex.Message;
  556. return -1;
  557. }
  558. }
  559. private int CheckDetail_Single(out string outParam)
  560. {
  561. outParam = "";
  562. //先签到
  563. CenterBusiness cBus = new CenterBusiness();
  564. JObject jo9001Rtn = new JObject();
  565. cBus.signIn(out jo9001Rtn);
  566. try
  567. {
  568. //导出并压缩
  569. if (exportAndCompress(out outParam) != 0)
  570. {
  571. return -1;
  572. }
  573. string zipPath = outParam;
  574. //上传给中心,
  575. if (uploadFileToCenter(zipPath, out outParam) != 0)
  576. {
  577. return -1;
  578. }
  579. string file_query_no = outParam;
  580. string fileName = "";
  581. //3202明细对账 输出查询号和文件名
  582. if (checkDetail(file_query_no, out outParam, out fileName) != 0)
  583. {
  584. return -1;
  585. }
  586. file_query_no = outParam;
  587. Global.writeLog("checkDetail:" + outParam + "///" + fileName);
  588. //下载 获取 查询号和文件名后 下载
  589. if (downloadZIP(file_query_no, fileName, out outParam) != 0)
  590. {
  591. return -1;
  592. }
  593. zipPath = outParam;
  594. Global.writeLog("downloadZIP:" + outParam);
  595. //导入DGV
  596. if (importToDgvCenterSetlRec(fileName, zipPath, out outParam) != 0)
  597. {
  598. return -1;
  599. }
  600. Global.writeLog("importToDgvCenterSetlRec:" + outParam);
  601. return 0;
  602. }
  603. catch (Exception ex)
  604. {
  605. outParam = "CheckDetail_Single:" + ex.Message;
  606. return -1;
  607. }
  608. }
  609. #endregion
  610. #region 对账
  611. /// <summary>
  612. /// 单条对总账【本地】
  613. /// </summary>
  614. /// <param name="error"></param>
  615. /// <returns></returns>
  616. private int Check_Single(out string error)
  617. {
  618. error = ""; string setlOptins = "";
  619. DataTable dt = (DataTable)dgvSettlSummary.DataSource;
  620. int i = dgvSettlSummary.CurrentRow.Index;
  621. dynamic joCheck = new JObject();
  622. joCheck.insutype = dt.Rows[i]["insutype"].ToString(); //险种类型
  623. joCheck.clr_type = dt.Rows[i]["clr_type"].ToString(); //清算类别
  624. //if (tbSettlOption.Text != "")
  625. //{
  626. // joCheck.setl_optins = tbSettlOption.Text; //dt.Rows[i]["setl_optins"].ToString(); //结算经办机构
  627. // setlOptins = tbSettlOption.Text;
  628. //}
  629. //else
  630. //{
  631. joCheck.setl_optins = dt.Rows[i]["setl_optins"].ToString(); //结算经办机构
  632. setlOptins = dt.Rows[i]["setl_optins"].ToString();
  633. //}
  634. joCheck.medfee_sumamt = dt.Rows[i]["medfee_sumamt"].ToString(); //医疗费总额
  635. joCheck.fund_pay_sumamt = dt.Rows[i]["fund_pay_sumamt"].ToString(); //基金支付总额
  636. joCheck.acct_pay = dt.Rows[i]["acct_pay"].ToString(); //个人账户支付金额
  637. joCheck.fixmedins_setl_cnt = dt.Rows[i]["fixmedins_setl_cnt"].ToString(); //定点医药机构结算笔数
  638. joCheck.stmt_begndate = dpST.Value.ToString("yyyy-MM-dd 00:00:00"); //对账开始日期
  639. joCheck.stmt_enddate = dpED.Value.ToString("yyyy-MM-dd 23:59:59"); //对账结束日期
  640. JObject joData = new JObject();
  641. joData.Add("data", joCheck);
  642. //上传给中心
  643. //先签到
  644. CenterBusiness cBus = new CenterBusiness();
  645. JObject jo9001Rtn = new JObject();
  646. cBus.signIn(out jo9001Rtn);
  647. Global.pat.insuplc_admdvs = setlOptins;
  648. InvokeHelper invoker = new InvokeHelper();
  649. JObject joRtn = invoker.invokeCenterService(TradeEnum.FeeSummaryCheck, joData);
  650. if (JsonHelper.parseCenterReturnJson(joRtn, out error) != 0)
  651. {
  652. return -1;
  653. }
  654. else
  655. {
  656. if (JsonHelper.getDestValue(joRtn, "output.stmtinfo.stmt_rslt") != "0")
  657. {
  658. error = JsonHelper.getDestValue(joRtn, "output.stmtinfo.stmt_rslt_dscr");
  659. return -1;
  660. }
  661. else
  662. {
  663. return 0;
  664. }
  665. }
  666. }
  667. #endregion
  668. #region 智能比对
  669. private int compareDataGridView(string value, string colName, Sunny.UI.UIDataGridView dgv)
  670. {
  671. try
  672. {
  673. for (int i = 0; i < dgv.RowCount; i++)
  674. {
  675. if (dgv.Rows[i].Cells[colName].Value.ToString() == value)
  676. {
  677. return 0;
  678. }
  679. }
  680. return -1;
  681. }
  682. catch (Exception ex)
  683. {
  684. MessageBox.Show("compareDataGridView" + ex.Message);
  685. return -1;
  686. }
  687. }
  688. #endregion
  689. #endregion
  690. #region 按钮事件
  691. private void Btn_Query_Click(object sender, EventArgs e)
  692. {
  693. DataTable dtInteface = (DataTable)cbxInterface.DataSource;
  694. int i = cbxInterface.SelectedIndex;
  695. //乘以单据类型后,IRIS会返回整数,关键不知道SQL里咋转换为浮点数
  696. //string sqlStr = "SELECT SUM(BillType*Sumamt) AS medfee_sumamt,count(*) AS fixmedins_setl_cnt,SUM(BillType*PersonCashPay) AS cash_payamt, ";
  697. //sqlStr = sqlStr + " SUM(BillType*AccountPaySumamt) AS acct_pay,SUM(BillType*FundPaySumamt) AS fund_pay_sumamt ";
  698. //对账时个人账户=个人账户+共济账户
  699. string sqlStr = "SELECT SUM(BillType*Sumamt) AS medfee_sumamt,count(*) AS fixmedins_setl_cnt,SUM(BillType*PersonCashPay) AS cash_payamt, ";
  700. sqlStr = sqlStr + " SUM(billType*(AccountPaySumamt+AccountMutualAidAmount)) AS acct_pay,SUM(BillType*FundPaySumamt) AS fund_pay_sumamt ";
  701. //sqlStr = sqlStr + " Interface_dr,clearingWay AS clr_way,clearingType AS clr_type ";
  702. // 增加先行自付金额、医疗救助基金、公务员医疗补助、个人账户共济支付、企业补充、职工大额
  703. sqlStr += ",Sum(BillType*PreSelfPayAmount) as PreSelfPayAmount,sum(BillType*MedicalAssistPay) as MedicalAssistPay,sum(BillType*CivilserviceAllowancePay) as CivilserviceAllowancePay,"
  704. + "sum(BillType*AccountMutualAidAmount) as AccountMutualAidAmount ,sum(BillType*LargeExpensesSupplementPay) as LargeExpensesSupplementPay,"
  705. + "sum(BillType*EnterpriseSupplementPay) as EnterpriseSupplementPay ";
  706. string conditionStr = " Group By";
  707. if (cbgGroupSet.GetItemCheckState(0))
  708. {
  709. sqlStr = sqlStr + ",Interface_Dr";
  710. conditionStr = conditionStr + " Interface_Dr,";
  711. }
  712. if (cbgGroupSet.GetItemCheckState(1))
  713. {
  714. sqlStr = sqlStr + ",InsuranceType as insutype";
  715. conditionStr = conditionStr + " InsuranceType,";
  716. }
  717. if (cbgGroupSet.GetItemCheckState(2))
  718. {
  719. sqlStr = sqlStr + ",ClearingType as clr_type";
  720. conditionStr = conditionStr + " ClearingType,";
  721. }
  722. if (cbgGroupSet.GetItemCheckState(3))
  723. {
  724. sqlStr = sqlStr + ",ClearingOrgan as setl_optins";
  725. conditionStr = conditionStr + " ClearingOrgan,";
  726. }
  727. if (cbgGroupSet.GetItemCheckState(4))
  728. {
  729. sqlStr = sqlStr + ",BillType";
  730. conditionStr = conditionStr + " BillType,";
  731. }
  732. sqlStr = sqlStr + getWhereCondition();
  733. conditionStr = conditionStr.Remove(conditionStr.Length - 1, 1);
  734. sqlStr = sqlStr + conditionStr;
  735. JObject joSqlstr = new JObject();
  736. //MessageBox.Show(sqlStr);
  737. joSqlstr.Add("sqlStr", sqlStr);
  738. JArray jaParam = new JArray();
  739. jaParam.Add(joSqlstr);
  740. JObject joSettlQuery = new JObject();
  741. joSettlQuery.Add("params", jaParam);
  742. joSettlQuery.Add("code", "09010061");
  743. InvokeHelper invoker = new InvokeHelper();
  744. JObject joRtn = invoker.invokeInsuService(joSettlQuery.ToString(), "查询汇总结算信息");
  745. DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
  746. dgvSettlSummary.DataSource = dt;
  747. //初始化HIS结算明细View数据
  748. dgvHisSettlRec.DataSource = null;
  749. }
  750. private void btBatchCheck_Click(object sender, EventArgs e)
  751. {
  752. string errMsg = "";
  753. bool success = true;
  754. for (int i = 0; i < dgvSettlSummary.RowCount; i++)
  755. {
  756. dgvSettlSummary.CurrentCell = dgvSettlSummary.Rows[i].Cells[0];
  757. if (Check_Single(out errMsg) != 0)
  758. {
  759. dgvSettlSummary.Rows[i].DefaultCellStyle.BackColor = Color.Red;
  760. rtbCheckLog.AppendText("第" + (i + 1).ToString() + "条对账失败!" + errMsg + "\r\n");
  761. success = false;
  762. }
  763. }
  764. if (success)
  765. {
  766. MessageBox.Show("批量对账全部成功!");
  767. }
  768. else
  769. {
  770. MessageBox.Show("部分对账失败,请查看对账结果!");
  771. }
  772. }
  773. private void tsmCheck_Single_Click(object sender, EventArgs e)
  774. {
  775. string error = "";
  776. if (Check_Single(out error) != 0)
  777. {
  778. MessageBox.Show("对总账失败:" + error);
  779. }
  780. else
  781. {
  782. if (dgvHisSettlRec.SelectedIndex != -1)
  783. {
  784. dgvHisSettlRec.Rows[dgvHisSettlRec.SelectedIndex].DefaultCellStyle.BackColor = Color.White;
  785. }
  786. MessageBox.Show("对总账成功");
  787. }
  788. }
  789. private void tsmCheckDetail_Single_Click(object sender, EventArgs e)
  790. {
  791. //HIS明细
  792. string error;
  793. if (queryHisSettlementInfo(out error) != 0)
  794. {
  795. MessageBox.Show(error);
  796. }
  797. //中心明细
  798. if (CheckDetail_Single(out error) != 0)
  799. {
  800. MessageBox.Show(error);
  801. }
  802. }
  803. private void tsmCheck_Batch_Click(object sender, EventArgs e)
  804. {
  805. btBatchCheck_Click(sender, e);
  806. }
  807. private void tsmCheckDetail_Batch_Click(object sender, EventArgs e)
  808. {
  809. }
  810. private void tsmHisRecord_Click(object sender, EventArgs e)
  811. {
  812. string error;
  813. if (queryHisSettlementInfo(out error) != 0)
  814. {
  815. MessageBox.Show(error);
  816. }
  817. }
  818. private void tsmAICheck_Click(object sender, EventArgs e)
  819. {
  820. for (int i = 0; i < dgvHisSettlRec.RowCount; i++)
  821. {
  822. string value = dgvHisSettlRec.Rows[i].Cells["SettlementID"].Value.ToString();
  823. string colName = "setl_id";
  824. if (compareDataGridView(value, colName, dgvCenterSettlRec) != 0)
  825. {
  826. dgvHisSettlRec.Rows[i].DefaultCellStyle.BackColor = Color.Red;
  827. rtbCheckDetailLog.AppendText("HIS结算ID:" + value + "在中心明细中未找到数据!" + "\r\n");
  828. }
  829. }
  830. for (int i = 0; i < dgvCenterSettlRec.RowCount; i++)
  831. {
  832. string value = dgvCenterSettlRec.Rows[i].Cells["setl_id"].Value.ToString();
  833. string colName = "SettlementID";
  834. if (compareDataGridView(value, colName, dgvHisSettlRec) != 0)
  835. {
  836. dgvCenterSettlRec.Rows[i].DefaultCellStyle.BackColor = Color.Red;
  837. rtbCheckDetailLog.AppendText("中心结算ID:" + value + "在HIS明细中未找到数据!" + "\r\n");
  838. }
  839. }
  840. }
  841. private void tsmExport_Click(object sender, EventArgs e)
  842. {
  843. txtName = DateTime.Now.ToString("yyyyMMddHHmmssffff");
  844. txtPath = Global.currentDirectory + "\\Download";
  845. if (HISDetailDataExport(txtPath, txtName) != 0)
  846. {
  847. MessageBox.Show("导出TXT失败!");
  848. }
  849. else
  850. {
  851. MessageBox.Show("导出TXT成功!");
  852. }
  853. }
  854. private void tsmCompress_Click(object sender, EventArgs e)
  855. {
  856. string finalDirPath = txtPath + "\\" + txtName;
  857. finalAchPath = finalDirPath + ".zip";
  858. System.IO.Compression.ZipFile.CreateFromDirectory(finalDirPath, finalAchPath);
  859. MessageBox.Show("将TXT压缩为ZIP成功!");
  860. }
  861. private void tsmZIPToSDec_Click(object sender, EventArgs e)
  862. {
  863. byte[] bArray = ReadFileToByte(finalAchPath);
  864. string str = byteArrayToDecString(bArray);
  865. Global.writeLog(str);
  866. MessageBox.Show("ZIP转为有符号整数成功!");
  867. }
  868. private void tsmUploadZIP_Click(object sender, EventArgs e)
  869. {
  870. string outParam = "";
  871. byte[] bArray = ReadFileToByte(finalAchPath);
  872. string str = "[" + byteArrayToDecString(bArray) + "]";
  873. JObject joTmp = new JObject();
  874. joTmp.Add("in", JArray.Parse(str));
  875. joTmp.Add("filename", txtName + ".zip");
  876. Global.inf.fileName = txtName + ".zip";
  877. //joTmp.Add("filename", finalAchPath.Replace("\\",@"\"));
  878. joTmp.Add("fixmedins_code", Global.inf.hospitalNO);
  879. JObject joFsUploadIn = new JObject();
  880. joFsUploadIn.Add("fsUploadIn", joTmp);
  881. InvokeHelper invoker = new InvokeHelper();
  882. JObject jo9101Rtn = invoker.invokeCenterService(TradeEnum.FileUpload, joFsUploadIn);
  883. if (JsonHelper.parseCenterRtnValue(jo9101Rtn, out outParam) != 0)
  884. {
  885. outParam = JsonHelper.setExceptionJson(-1, "【9101】文件上传失败", outParam).ToString();
  886. return;
  887. }
  888. else
  889. {
  890. MessageBox.Show("【9101】文件上传成功");
  891. }
  892. }
  893. private void tsm3202_Click(object sender, EventArgs e)
  894. {
  895. if (string.IsNullOrEmpty(Global.inf.areaCode))
  896. {
  897. MessageBox.Show("请先签到!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  898. return;
  899. }
  900. string outParam = "";
  901. DataTable dt = (DataTable)dgvSettlSummary.DataSource;
  902. int i = dgvSettlSummary.CurrentRow.Index;
  903. dynamic joCheck = new JObject();
  904. joCheck.file_qury_no = JObject.Parse(fileDir);
  905. joCheck.clr_type = dt.Rows[i]["clr_type"].ToString();
  906. joCheck.setl_optins = dt.Rows[i]["setl_optins"].ToString();
  907. joCheck.stmt_begndate = dpST.Value.ToString("yyyy-MM-dd HH:mm:ss");
  908. joCheck.stmt_enddate = dpED.Value.ToString("yyyy-MM-dd HH:mm:ss");
  909. joCheck.medfee_sumamt = dt.Rows[i]["medfee_sumamt"].ToString();
  910. joCheck.fund_pay_sumamt = dt.Rows[i]["fund_pay_sumamt"].ToString();
  911. joCheck.cash_payamt = dt.Rows[i]["cash_payamt"].ToString();
  912. joCheck.fixmedins_setl_cnt = dt.Rows[i]["fixmedins_setl_cnt"].ToString();
  913. JObject joData = new JObject();
  914. joData.Add("data", joCheck);
  915. InvokeHelper invoker = new InvokeHelper();
  916. JObject jo3202Rtn = invoker.invokeCenterService(TradeEnum.FeeDetailCheck, joData);
  917. if (JsonHelper.parseCenterRtnValue(jo3202Rtn, out outParam) != 0)
  918. {
  919. outParam = JsonHelper.setExceptionJson(-1, "【3202】医保明细对账失败", outParam).ToString();
  920. MessageBox.Show(outParam);
  921. return;
  922. }
  923. else
  924. {
  925. MessageBox.Show("【3202】医保明细对账成功");
  926. }
  927. }
  928. private void tsmDownload_Click(object sender, EventArgs e)
  929. {
  930. string outParam = "";
  931. JObject joTmp = new JObject();
  932. joTmp.Add("file_qury_no", JObject.Parse(fileDir.Replace(@"\\", @"\")));
  933. joTmp.Add("filename", txtName + ".zip");
  934. joTmp.Add("fixmedins_code", Global.inf.hospitalNO);
  935. JObject joFsDownloadIn = new JObject();
  936. joFsDownloadIn.Add("fsDownloadIn", joTmp);
  937. InvokeHelper invoker = new InvokeHelper();
  938. jo9102Rtn = invoker.invokeCenterService(TradeEnum.FileDownload, joFsDownloadIn);
  939. if (JsonHelper.parseCenterRtnValue(jo9102Rtn, out outParam) != 0)
  940. {
  941. outParam = JsonHelper.setExceptionJson(-1, "【9102】文件下载失败", outParam).ToString();
  942. MessageBox.Show(outParam);
  943. return;
  944. }
  945. else
  946. {
  947. MessageBox.Show("【9102】文件下载成功");
  948. }
  949. }
  950. private void tsmUnCompress_Click(object sender, EventArgs e)
  951. {
  952. //解压缩
  953. string zipFilePath = jo9102Rtn["filePath"].ToString();
  954. string txtFileDir = System.Environment.CurrentDirectory + "\\Download";
  955. //string txtFilePath = txtFileDir + "\\" + filename.Substring(0, filename.Length - 4);
  956. string txtFilePath = txtFileDir;
  957. if (File.Exists(txtFilePath))
  958. {
  959. File.Delete(txtFilePath);
  960. }
  961. ZipFile.ExtractToDirectory(zipFilePath, txtFileDir);
  962. }
  963. private void tsmImport_Click(object sender, EventArgs e)
  964. {
  965. GridViewSetter grd = new GridViewSetter();
  966. grd.SetHeaderTextOfDgvCenterSetlRec(dgvCenterSettlRec);
  967. string txtFileDir = fileDir;//E:\GHSF\SCYBDownLoad\result.txt
  968. string[] lines = System.IO.File.ReadAllLines(txtFileDir);
  969. Global.writeLog(lines.ToString());
  970. DataTable dt = new DataTable();
  971. dt.Columns.Add("sn", typeof(int));
  972. dt.Columns.Add("psn_no", typeof(string));
  973. dt.Columns.Add("mdtrt_id", typeof(string));
  974. dt.Columns.Add("setl_id", typeof(string));
  975. dt.Columns.Add("msgid", typeof(string));
  976. dt.Columns.Add("stmt_rslt", typeof(string));
  977. dt.Columns.Add("refd_setl_flag", typeof(string));
  978. dt.Columns.Add("memo", typeof(string));
  979. dt.Columns.Add("medfee_sumamt", typeof(string));
  980. dt.Columns.Add("fund_pay_sumamt", typeof(string));
  981. dt.Columns.Add("acct_pay", typeof(string));
  982. //foreach (string line in lines)
  983. for (int i = 0; i < lines.Length; i++)
  984. {
  985. string[] strs = (lines[i] + "\t").Split('\t');
  986. DataRow dr = dt.NewRow();
  987. //Global.inf.writeLog(lines[i].ToString());
  988. //Global.inf.writeLog(strs.Length.ToString());
  989. dr["sn"] = i;
  990. dr["psn_no"] = strs[0];
  991. dr["mdtrt_id"] = strs[1];
  992. dr["setl_id"] = strs[2];
  993. dr["msgid"] = strs[3];
  994. dr["stmt_rslt"] = strs[4];
  995. dr["refd_setl_flag"] = strs[5];
  996. dr["memo"] = strs[6];
  997. dr["medfee_sumamt"] = strs[7];
  998. dr["fund_pay_sumamt"] = strs[8];
  999. dr["acct_pay"] = strs[9];
  1000. //dr["Field2"] = strs[2];
  1001. dt.Rows.Add(dr);
  1002. }
  1003. dgvCenterSettlRec.DataSource = dt;
  1004. }
  1005. private void tsmHandCheck_Click(object sender, EventArgs e)
  1006. {
  1007. JObject joData = JObject.Parse(rtbCheckDetailLog.Text);
  1008. InvokeHelper invoker = new InvokeHelper();
  1009. JObject joRtn = invoker.invokeCenterService(TradeEnum.FeeSummaryCheck, joData);
  1010. }
  1011. private void btClose_Click(object sender, EventArgs e)
  1012. {
  1013. Close();
  1014. }
  1015. #endregion
  1016. private void dgvHisSettlRec_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
  1017. {
  1018. int j = e.RowIndex;
  1019. string validFlag = dgvHisSettlRec.Rows[j].Cells["ValidFlag"].Value.ToString();
  1020. string recordID = dgvHisSettlRec.Rows[j].Cells["RecordID"].Value.ToString();
  1021. string exist = dgvHisSettlRec.Rows[j].Cells["Exist"].Value.ToString();
  1022. //N 正常;A 作废;S 红冲;TP 预结算;BS 已红冲
  1023. string status = dgvHisSettlRec.Rows[j].Cells["status"].Value.ToString();
  1024. if ((validFlag == "1") && (status != "N"))
  1025. {
  1026. dgvHisSettlRec.Rows[j].DefaultCellStyle.BackColor = Color.Red;
  1027. }
  1028. if (exist != "存在")
  1029. {
  1030. if (recordID == "")
  1031. {
  1032. dgvHisSettlRec.Rows[j].DefaultCellStyle.BackColor = Color.Orange;
  1033. }
  1034. else
  1035. {
  1036. dgvHisSettlRec.Rows[j].DefaultCellStyle.BackColor = Color.Yellow;
  1037. }
  1038. }
  1039. }
  1040. private void dgvCenterSettlRec_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
  1041. {
  1042. int i = e.RowIndex;
  1043. string stmt_rslt = dgvCenterSettlRec.Rows[i].Cells["stmt_rslt"].Value.ToString();
  1044. if (stmt_rslt == "101")
  1045. {
  1046. dgvCenterSettlRec.Rows[i].DefaultCellStyle.BackColor = Color.Yellow;
  1047. }
  1048. if (stmt_rslt == "102")
  1049. {
  1050. dgvCenterSettlRec.Rows[i].DefaultCellStyle.BackColor = Color.Yellow;
  1051. }
  1052. if (stmt_rslt == "103")
  1053. {
  1054. dgvCenterSettlRec.Rows[i].DefaultCellStyle.BackColor = Color.Orange;
  1055. }
  1056. }
  1057. }
  1058. }