master
rexlin 4 years ago
parent 169faace5f
commit 62a84341af
  1. 29
      ECR_N5_DLL_TestUI/MainWindow.xaml.cs
  2. 16
      n5coredll/N5Core.cs
  3. 5
      n5coredll/RetrievalResult.cs
  4. 2
      n5coredll/SaleResult.cs
  5. 5
      n5coredll/n5coredll.csproj

@ -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;
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);
@ -513,16 +519,6 @@ 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;
@ -534,7 +530,6 @@ namespace ECR_N5_DLL_TestUI
Thread th = new Thread(requestRetrievalThead);
th.Start();
}
}
else if ("HealthCheck".Equals(this.thisEvent))
{
this.requestStrByThead = "Test Function : " + currEventName;
@ -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;
}

@ -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;

@ -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;
}

@ -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() {

@ -24,9 +24,10 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<RegisterForComInterop>true</RegisterForComInterop>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
@ -34,6 +35,8 @@
<WarningLevel>4</WarningLevel>
<RegisterForComInterop>true</RegisterForComInterop>
<PlatformTarget>AnyCPU</PlatformTarget>
<GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>

Loading…
Cancel
Save