/// <summary> /// 物业2读卡 /// </summary> /// <param name="param"></param> /// <returns></returns> public PropSecQueryInfo query(PropSecQueryParam param) { PropSecQueryInfo info = null; Dictionary <String, String> parameters = new Dictionary <String, String>(); parameters.Add("trandateTime", param.trandateTime); parameters.Add("servicename", param.servicename); parameters.Add("reqsn", param.reqsn); parameters.Add("loginId", param.loginId); parameters.Add("authcode", param.authcode); parameters.Add("SC10009", param.SC10009); parameters.Add("SC10010", param.SC10010); parameters.Add("SC10007", param.ResidentialNo); parameters.Add("SC10011", param.SC10011); string jsonText = HttpHelper.getHttp(SysConfigHelper.readerNode("propSecQueryName"), parameters, null); log.Write("物业2读卡:" + jsonText); //反序列化JSON字符串,将JSON字符串转换成LIST列表 info = JsonConvert.DeserializeObject <PropSecQueryInfo>(jsonText); return(info); }
public void excute(string _9, string _10, string _11, string serviceType, string cardType) { PropSecQueryParam param = new PropSecQueryParam(); param.SC10009 = _9; param.SC10010 = _10; param.SC10011 = _11; PropSecQueryInfo info = access.query(param); StringBuilder result1 = new StringBuilder(2048); StringBuilder result2 = new StringBuilder(2048); IntPtr status = PropSwwyBLL.WF002( new StringBuilder(serviceType), //业务类型 new StringBuilder(cardType), //卡片种类 new StringBuilder("01"), //卡片版本 new StringBuilder(info.msgrsp.SC10011), //,业务步骤 new StringBuilder(""), //卡片唯一识别号 new StringBuilder(""), //物业公司编号 new StringBuilder(""), //小区编号 new StringBuilder(_9), //表具产商编号 new StringBuilder("8"), //端口号 result1, //返回说明 new StringBuilder(info.msgrsp.SC20003), //业务输入信息 result2 //业务返回信息 ); string result = Marshal.PtrToStringAnsi(status); MessageBox.Show(result); PropSecCardJson card = new PropSec().JsonToModel(result2.ToString()); //SC10007 = card.G_0806; SC10008 = card.G_1802; merchantNo = info.msgrsp.merchantNo; listViewAdd("读卡:" + "状态:" + result.ToString() + "返回说明:" + result1.ToString() + "返回信息:" + result2.ToString()); }
private void read() { try { isRead = false; try { SysBLL.Player("读取中.wav"); showInfo.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), showInfo, "正在读卡,请稍后..."); PropSecAccess access = new PropSecAccess(); PropSecQueryParam param = new PropSecQueryParam(); param.SC10009 = Payment.propSecPayParam.ManufacturerNum; param.SC10010 = Payment.propSecPayParam.CardType; param.SC10011 = "01"; param.ResidentialNo = ConfigSysParam.ResidentialNo; PropSecQueryInfo info = access.query(param); if (!"0000".Equals(info.msgrsp.retcode)) { PrintInfo(info.msgrsp.retshow); return; } StringBuilder result1 = new StringBuilder(2048); StringBuilder result2 = new StringBuilder(2048); log.Write("物业2读卡:业务类型:08,卡片种类:" + Payment.propSecPayParam.CardType + ",业务步骤:" + info.msgrsp.SC10011 + ",表具厂商编号:" + Payment.propSecPayParam.ManufacturerNum + ",输入信息:" + info.msgrsp.SC20003 + ",端口:" + SysConfigHelper.readerNode("PropSwwyName")); IntPtr status = PropSwwy.WF002( new StringBuilder("08"), //业务类型 new StringBuilder(Payment.propSecPayParam.CardType), //卡片种类 new StringBuilder("01"), //卡片版本 new StringBuilder(info.msgrsp.SC10011), //,业务步骤 new StringBuilder(""), //卡片唯一识别号 new StringBuilder(""), //物业公司编号 new StringBuilder(""), //小区编号 new StringBuilder(Payment.propSecPayParam.ManufacturerNum), //表具产商编号 new StringBuilder(SysConfigHelper.readerNode("PropSwwyName")), //端口号 result1, //返回说明 new StringBuilder(info.msgrsp.SC20003), //业务输入信息 result2 //业务返回信息 ); string result = Marshal.PtrToStringAnsi(status); log.Write("物业2读卡返回:" + result); if (!"0".Equals(result)) { PrintInfo("读取失败,请重试..."); isRead = true; return; } PropSecCardJson card = new PropSec().JsonToModel(result2.ToString()); log.Write("result2.ToString():" + result2.ToString()); Payment.propSecPayParam.propMeterInfo = access.queryMeter(ConfigSysParam.ResidentialNo, card.G_1802); log.Write("获取表具列表返回码:" + Payment.propSecPayParam.propMeterInfo.msgrsp.retcode); if (!"0000".Equals(Payment.propSecPayParam.propMeterInfo.msgrsp.retcode)) { if (Payment.propSecPayParam.propMeterInfo.msgrsp.retshow != null) { if (Payment.propSecPayParam.propMeterInfo.msgrsp.retshow.Length > 0) { showInfo.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), showInfo, Payment.propSecPayParam.propMeterInfo.msgrsp.retshow); } else { showInfo.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), showInfo, "读卡失败,请稍后再试..."); } } else { showInfo.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), showInfo, "读卡失败,请稍后再试..."); } SysBLL.Player("读物业卡2失败.wav"); return; } if (DictParam.Prop2TanAnNum.Equals(Payment.propSecPayParam.ManufacturerNum)) { log.Write("G_2015:" + card.G_2015); if (card.G_2015 != null) { if (!"0".Equals(card.G_2015)) { showInfo.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), showInfo, "请将上次的气量插入到表内再进行充值!"); return; } } else { showInfo.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), showInfo, "读卡失败,请稍后再试...."); SysBLL.Player("读物业卡2失败.wav"); return; } } Payment.propSecPayParam.SC10007 = card.G_0806; Payment.propSecPayParam.SC10008 = card.G_1802; Payment.propSecPayParam.merchantNo = info.msgrsp.merchantNo; Util.JumpUtil.jumpCommonPage("FormPropSec01_2"); return; } catch (ThreadAbortException ae) { log.Write("error:物业2读卡异常:" + ae.Message); } catch (Exception ex) { PrintInfo("读取失败,请重试..."); SysBLL.Player("读物业卡2失败.wav"); log.Write("error:FormGasGoldenCardStep02:UserControl_Loaded:" + ex.Message); return; } } catch (AccessViolationException ave) { PrintInfo("读取失败,请重试...."); //SysBLL.Player("读物业卡2失败.wav"); log.Write("error1:" + ave.Message); } catch (ThreadAbortException ae) { log.Write("error:物业2读卡异常:" + ae.Message); } catch (WtException e) { PrintInfo("读取失败,请重试...."); //SysBLL.Player("读物业卡2失败.wav"); log.Write("error:2" + e.Message); } catch (Exception e) { PrintInfo("读取失败,请重试...."); SysBLL.Player("读物业卡2失败.wav"); log.Write("error:3" + e.Message); } finally { isRead = true; } }