Exemplo n.º 1
0
        public void pay()
        {
            log.Write("--------------------交易开始--------------------");
            log.Write("----------缴费类型:物业二次");
            PayAccess payAccess = new PayAccess();
            PayParam  p         = Payment.propSecPayParam.p;
            Pay       pay       = new Pay();
            //订单结果
            PropSecOrderInfo orderinfo = Payment.propSecPayParam.orderInfo;

            //初始化参数
            payAccess.InitPayParam(ref p);
            PayBLL.payCode_terminalNo(ref p);
            try
            {
                //获取订单
                //orderInfo(ref orderinfo, p);
                //获取订单结果处理
                if (pay.orderInfoResult(orderinfo.msgrsp.retcode, orderinfo.msgrsp.retshow) == false)
                {
                    return;
                }
                //支付
                if (pay.payResult(ref p))
                {
                    bool isCarsWrite = false;
                    //写卡状态
                    WriteCardParam writeCardParam = new WriteCardParam();

                    StringBuilder result1 = new StringBuilder(2048);
                    StringBuilder result2 = new StringBuilder(2048);
                    log.Write("物业2读卡:业务类型:08,卡片种类:" + Payment.propSecPayParam.CardType + ",表具厂商编号:" + Payment.propSecPayParam.ManufacturerNum + ",业务输入信息:" + p.propSecSC20003);
                    IntPtr status = PropSwwy.WF002(
                        new StringBuilder("02"),                                       //业务类型
                        new StringBuilder(Payment.propSecPayParam.CardType),           //卡片种类
                        new StringBuilder("01"),                                       //卡片版本
                        new StringBuilder(""),                                         //,业务步骤
                        new StringBuilder(""),                                         //卡片唯一识别号
                        new StringBuilder(""),                                         //物业公司编号
                        new StringBuilder(""),                                         //小区编号
                        new StringBuilder(Payment.propSecPayParam.ManufacturerNum),    //表具产商编号
                        new StringBuilder(SysConfigHelper.readerNode("PropSwwyName")), //端口号
                        result1,                                                       //返回说明
                        new StringBuilder(p.propSecSC20003),                           //业务输入信息
                        result2                                                        //业务返回信息
                        );
                    string result = Marshal.PtrToStringAnsi(status);

                    if ("0".Equals(result))
                    {
                        //写卡成功
                        writeCardParam.write_card_status = "1";
                        isCarsWrite = true;
                    }
                    else
                    {
                        //写卡失败
                        writeCardParam.write_card_status = "3";
                        PayResultInfo payresultInfo = p.payResultInfo;
                        p.rqFlushesCode = "SC005";
                        //pay.refund(ref payresultInfo, p);
                        isCarsWrite = false;
                    }
                    //PropSecCardJson card = new PropSec().JsonToModel(result2.ToString());
                    writeCardParam.serviceType   = p.serviceType;
                    writeCardParam.rqFlushesCode = isCardTypeRq();
                    writeCardParam.shop_type     = PayAccess.isWtLkl(p.icParams);
                    writeCardParam.cloud_no      = orderinfo.msgrsp.orderNo;
                    writeCardParam.data          = pay.refundStr(p.payResultInfo, p);
                    PayResultInfo resultInfo = payAccess.WriteCardAcc(writeCardParam);
                    if (isCarsWrite)
                    {
                        log.Write("--------------------交易结束--------------------");
                        Util.JumpUtil.jumpCommonPage("FormPropSecStep08_success");
                        return;
                    }
                    else
                    {
                        log.Write("error:物业卡写卡失败");
                        FormTip.FormFailRefundShowinfo = resultInfo.msg;
                        Util.JumpUtil.jumpCommonPage("FormFailRefund");
                        return;
                    }
                }
                return;
            }
            catch (AccessViolationException ave) { log.Write("error:" + ave.Message); }
            catch (Exception ex) { log.Write("error:" + ex.Message); }
            exit("缴费失败,请稍后再试...");
            return;
        }
Exemplo n.º 2
0
 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;
     }
 }