protected override void OnEnter() { base.OnEnter(); entity = (GetBusinessEntity() as DHRQPaymentEntity); //GetElementById("btnReturn").Style = "display: none"; //GetElementById("btnHome").Style = "display: none"; setComponnents("ComComponnents", true, false, false); GetElementById("Message1").InnerText = "正在写燃气卡,请稍后... ..."; int res = WriteCardDeal(); if (res == 0) { //写卡成功,打印凭条 if (ReceiptPrinter.ExistError()) { StartActivity("德化燃气成功界面"); } //StartActivity("德化燃气正在写燃气卡"); else { StartActivity("德化燃气正在打印"); } //StartActivity("正在打印"); } else { //写卡出错,发起冲正 //if (SyncTransaction(new CReverser_DHRQPaymentPay()) == TransResult.E_RECV_FAIL) //{ // ShowMessageAndGotoMain("交易失败!|交易超时,请重试"); // return; //} if (res == -1) { Log.Error("写卡出错|程序出错"); } else { string strRes = entity.GetGasCardReaderRes(res); Log.Error("写卡出错|" + strRes); } ShowMessageAndGotoMain("写卡出错|请联系燃气公司客服人员"); } }
private int ReadCardDeal() { try { #if DEBUG int resDebug = 0; entity.cardinfo.cardNo = "02063838"; entity.cardinfo.cardType = "1"; entity.cardinfo.gasCount = "1"; entity.cardinfo.iccSpare = "0"; entity.cardinfo.icErroy = ""; entity.cardinfo.icNum = "1"; return(resDebug); #endif int res = GasCardReader.ReadGasCard(ref entity.cardinfo); //int res = 0; getDeMsg(); if (res == 0) { return(0); } else { if (res == -1) { ShowMessageAndGoBack("读卡出错|程序出错"); } else { string strRes = entity.GetGasCardReaderRes(res); ShowMessageAndGoBack("读卡出错|错误码:" + res + "\r\n错误信息:" + strRes); } return(-1); } } catch (Exception ex) { Log.Error("[BeingReadGasCardDeal][ReadCardDeal] error ", ex); return(-1); } }