diff --git a/ECR_N5_DLL_TestUI/MainWindow.xaml.cs b/ECR_N5_DLL_TestUI/MainWindow.xaml.cs index 0dfffea..52fbffd 100644 --- a/ECR_N5_DLL_TestUI/MainWindow.xaml.cs +++ b/ECR_N5_DLL_TestUI/MainWindow.xaml.cs @@ -263,15 +263,19 @@ namespace ECR_N5_DLL_TestUI private int repeatCount = 1; public void sendRepeatSubmit() { - if (n5Core == null || !n5CoreInitSuccess) + if (n5Core == null) { n5Core = n5coredll.N5Core.getInstance(); + } + //if (n5Core == null || !n5CoreInitSuccess) + //{ + n5Core = n5coredll.N5Core.getInstance(); int initResult = n5Core.initN5Core(portName, baudRate, dataBits, stopBits, parity, timeOut); if (initResult == 0) { n5CoreInitSuccess = true; } - } + //} /* if (!n5CoreInitSuccess) { @@ -301,15 +305,15 @@ namespace ECR_N5_DLL_TestUI return; } portName = this.portNameComboBox.Text; - if (n5Core == null || !n5CoreInitSuccess) + if(n5Core == null) { n5Core = n5coredll.N5Core.getInstance(); + } int initResult = n5Core.initN5Core(portName, baudRate, dataBits, stopBits, parity, timeOut); //if (initResult == 0) //{ n5CoreInitSuccess = true; //} - } if (!n5CoreInitSuccess) { this.requestStrByThead = "n5coredll init fail."; @@ -350,8 +354,10 @@ namespace ECR_N5_DLL_TestUI qrValueTextBoxValue = this.qrValueTextBox.Text; panTextBoxValue = this.panTextBox.Text; expDateTextBoxValue = this.expDateTextBox.Text; - - txnIdForSale = this.getTxnId(); + if (this.ecrTxnIdTextBox.Text == "") + txnIdForSale = this.getTxnId(); + else + txnIdForSale = this.ecrTxnIdTextBox.Text; this.requestStrByThead = "Test Function : " + currEventName + "\n txnId = " + txnIdForSale + "\n txnAmt = " + txnAmtTextBoxValue + "\n paymentAppId = " + paymentAppIdComboBoxValue + "\n qrValue = " + qrValueTextBoxValue; showResult(); addLog("txnId = " + txnIdForSale + ", txnAmt = " + txnAmtTextBoxValue + ", paymentAppId = " + paymentAppIdComboBoxValue + ",qrValue = " + qrValueTextBoxValue); @@ -514,26 +520,15 @@ namespace ECR_N5_DLL_TestUI } else if ("Retrieval".Equals(this.thisEvent)) { - if (this.ecrTxnIdTextBox.Text == null || "".Equals(this.ecrTxnIdTextBox.Text.Trim())) - { - this.requestStrByThead = "Please input parameter."; - this.jsonResultByThead = "Please input parameter."; - showResult(); - this.ecrTxnIdTextBox.Focus(); - return; - } - else - { - ecrTxnIdTextBoxValue = this.ecrTxnIdTextBox.Text; - this.requestStrByThead = "Test Function : " + currEventName + "\n ecrTxnId = " + ecrTxnIdTextBoxValue; - showResult(); - addLog("ecrTxnId = " + ecrTxnIdTextBoxValue); + ecrTxnIdTextBoxValue = this.ecrTxnIdTextBox.Text; + this.requestStrByThead = "Test Function : " + currEventName + "\n ecrTxnId = " + ecrTxnIdTextBoxValue; + showResult(); + addLog("ecrTxnId = " + ecrTxnIdTextBoxValue); - //jsonResultByThead = n5Core.requestRetrieval(ecrTxnIdTextBoxValue, 180000); - this.retrievalRequestMsg = this.requestStrByThead; - Thread th = new Thread(requestRetrievalThead); - th.Start(); - } + //jsonResultByThead = n5Core.requestRetrieval(ecrTxnIdTextBoxValue, 180000); + this.retrievalRequestMsg = this.requestStrByThead; + Thread th = new Thread(requestRetrievalThead); + th.Start(); } else if ("HealthCheck".Equals(this.thisEvent)) { @@ -779,7 +774,7 @@ namespace ECR_N5_DLL_TestUI this.qrValueTextBox.IsEnabled = true; this.panTextBox.IsEnabled = true; this.expDateTextBox.IsEnabled = true; - this.ecrTxnIdTextBox.IsEnabled = false; + this.ecrTxnIdTextBox.IsEnabled = true; this.batchIdTextBox.IsEnabled = false; this.settleDateTextBox.IsEnabled = false; } diff --git a/n5coredll/N5Core.cs b/n5coredll/N5Core.cs index 7e210cc..9b65e81 100644 --- a/n5coredll/N5Core.cs +++ b/n5coredll/N5Core.cs @@ -56,6 +56,7 @@ namespace n5coredll public int initN5Core(string pPortName, string pBaudRate, string pDataBits, string pStopBits, string pParity, string pTimeOut) { + Console.WriteLine("initN5Core==>"); if (pPortName != null && !pPortName.Equals(string.Empty)) this.portName = pPortName; else @@ -96,9 +97,12 @@ namespace n5coredll else this.timeOut = 120000; + closeSerialPort(); + Console.WriteLine("closeSerialPort done."); bool result = openSerialPort(); if (result) { + Console.WriteLine("openSerialPort done: " + result); String echoResult = sendLinkTestRequest(); if (RequestResult.toReqResultFromJsonMsg(echoResult).Status == STATUS_SUCC) return 0; @@ -1861,13 +1865,13 @@ namespace n5coredll public string requestRetrieval(string txnId, int pTimeOut) { RetrievalResult retrievalResult = null; - if (txnId == null || "".Equals(txnId.Trim())) - { - Console.WriteLine("parameter error"); - closeSerialPort(); + //if (txnId == null || "".Equals(txnId.Trim())) + //{ + // Console.WriteLine("parameter error"); + // closeSerialPort(); //return "Request failed: params error"; - return RequestResult.createRespErrJson("RETRIEVAL_RESP", ERR_STATUS_PARAM); - } + // return RequestResult.createRespErrJson("RETRIEVAL_RESP", ERR_STATUS_PARAM); + // } sendTime = 0; isSending = false; diff --git a/n5coredll/RetrievalResult.cs b/n5coredll/RetrievalResult.cs index 38cdaae..4b193e8 100644 --- a/n5coredll/RetrievalResult.cs +++ b/n5coredll/RetrievalResult.cs @@ -308,10 +308,7 @@ namespace n5coredll public static string toJsonForRetrieval(string txnId) { - if (txnId == null || "".Equals(txnId)) { - Console.WriteLine("txnId is null "); - return null; - } + string cardSaleMsg = "{\"EVENT_NAME\":\"RETRIEVAL\",\"TXN_ID\":\"" + txnId + "\"}"; return cardSaleMsg; } diff --git a/n5coredll/SaleResult.cs b/n5coredll/SaleResult.cs index 107ab85..ef30a0d 100644 --- a/n5coredll/SaleResult.cs +++ b/n5coredll/SaleResult.cs @@ -285,7 +285,7 @@ namespace n5coredll public static string toJsonForAdjust(string txnId, decimal totalAmt, decimal totalForeignAmt, PaymentApp appId) { - string cardSaleMsg = "{\"EVENT_NAME\":\"ADJUST\",\"PAYMENT_APP_ID\":\"" + ObjectUtil.getPaymentAppValue(appId) + "\",\"TXN_ID\":\"" + txnId + "\",\"TOTAL_TXN_AMT\":" + totalAmt + ",\"TOTAL_FOREIGN_AMT\":" + totalForeignAmt + "}"; + string cardSaleMsg = "{\"EVENT_NAME\":\"ADJUST\",\"PAYMENT_APP_ID\":\"" + ObjectUtil.getPaymentAppValue(appId) + "\",\"TXN_ID\":\"" + txnId + "\",\"TOTAL_TXN_AMT\":" + totalAmt + "}"; return cardSaleMsg; } private static string getTxnId() { diff --git a/n5coredll/n5coredll.csproj b/n5coredll/n5coredll.csproj index 269e558..2ea6ba0 100644 --- a/n5coredll/n5coredll.csproj +++ b/n5coredll/n5coredll.csproj @@ -24,9 +24,10 @@ AnyCPU true true + On - pdbonly + full true bin\Release\ TRACE @@ -34,6 +35,8 @@ 4 true AnyCPU + On + true true