Retry lấy số tiền trong két
Hiển thị giao dịch trong log
This commit is contained in:
+12
-3
@@ -12,6 +12,7 @@ using System.Diagnostics;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.ServiceProcess;
|
using System.ServiceProcess;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@@ -267,9 +268,17 @@ namespace SafeBagDE70
|
|||||||
}
|
}
|
||||||
public static byte[] GetCassetteData()
|
public static byte[] GetCassetteData()
|
||||||
{
|
{
|
||||||
cCmdRsp.SendXXCmd((byte)Command.CMD_DE_READ_CASSETTE);
|
for(int i = 0; i < 2; i++)//Retry if failed
|
||||||
|
{
|
||||||
|
cCmdRsp.SendXXCmd((byte)Command.CMD_DE_READ_CASSETTE);
|
||||||
|
if (cCmdRsp.recv_dat.dat[0] != 0x40)
|
||||||
|
{
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
var data = cCmdRsp.recv_dat.dat;
|
var data = cCmdRsp.recv_dat.dat;
|
||||||
|
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
var recv_dat = cCmdRsp.recv_dat;
|
var recv_dat = cCmdRsp.recv_dat;
|
||||||
|
|
||||||
@@ -477,7 +486,7 @@ namespace SafeBagDE70
|
|||||||
Log.Error("GetandExecuteCommands error: "+str);
|
Log.Error("GetandExecuteCommands error: "+str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static string deviceStatusFileName = "device_status.txt";
|
static string deviceStatusFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),"device_status.txt");
|
||||||
public static void GetDeviceStatusFromFile()
|
public static void GetDeviceStatusFromFile()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -98,10 +98,16 @@ namespace SafeBagDE70
|
|||||||
string? transactionCode = null;
|
string? transactionCode = null;
|
||||||
if (AppData.IsAuthenticated)
|
if (AppData.IsAuthenticated)
|
||||||
{
|
{
|
||||||
|
|
||||||
transactionCode = AppData.GetTransactionCode();
|
transactionCode = AppData.GetTransactionCode();
|
||||||
lblUser.Content = $"Xin chào khách hàng: {AppData.CurrentCustomerAccount.Name} (Gian hàng {AppData.CurrentCustomerAccount.CustomerId})";
|
lblUser.Content = $"Xin chào khách hàng: {AppData.CurrentCustomerAccount.Name} (Gian hàng {AppData.CurrentCustomerAccount.CustomerId})";
|
||||||
lblTransactionCode.Content = $"Mã GD: {transactionCode}";
|
lblTransactionCode.Content = $"Mã GD: {transactionCode}";
|
||||||
AppData.IsInTransaction = true;
|
AppData.IsInTransaction = true;
|
||||||
|
|
||||||
|
var str = $"MÃ GD: {AppData.GetTransactionCode()} " +
|
||||||
|
$"\r\nMÁY: {Environment.MachineName}" +
|
||||||
|
$"\r\nMÃ NV: {AppData.CurrentCustomerAccount.CustomerId}";
|
||||||
|
Log.Information(str);
|
||||||
}
|
}
|
||||||
cCmdRsp = new CCmdRsp(serialPortDE70);
|
cCmdRsp = new CCmdRsp(serialPortDE70);
|
||||||
AppData.cCmdRsp = cCmdRsp;
|
AppData.cCmdRsp = cCmdRsp;
|
||||||
@@ -1040,7 +1046,7 @@ namespace SafeBagDE70
|
|||||||
var str = "BEFORE STORE [CASSETTE]" + AppData.GetNotesString(previousCassetData);
|
var str = "BEFORE STORE [CASSETTE]" + AppData.GetNotesString(previousCassetData);
|
||||||
str += "\r\nSTORED: " + GetQuantityFromSessions(sessions, true);
|
str += "\r\nSTORED: " + GetQuantityFromSessions(sessions, true);
|
||||||
str += "\r\nSTACKER: " + GetQuantityFromSessions(sessions, false);
|
str += "\r\nSTACKER: " + GetQuantityFromSessions(sessions, false);
|
||||||
|
Log.Information(str);
|
||||||
AppData.DeviceStatus.Description = str;
|
AppData.DeviceStatus.Description = str;
|
||||||
APIModels.SendEvent(AppData.DeviceStatus);
|
APIModels.SendEvent(AppData.DeviceStatus);
|
||||||
|
|
||||||
@@ -1072,13 +1078,14 @@ namespace SafeBagDE70
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.Information(str);
|
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
str = $"PHIÊN GIAO DỊCH KHÔNG HỢP LỆ (SỐ TIỀN GIAO DỊCH KHÔNG KHỚP), VUI LÒNG BÁO CÁO LẠI CHI NHÁNH" +
|
str = $"PHIÊN GIAO DỊCH KHÔNG HỢP LỆ (SỐ TIỀN GIAO DỊCH KHÔNG KHỚP), VUI LÒNG BÁO CÁO LẠI CHI NHÁNH" +
|
||||||
$"\r\n MÃ GD: {AppData.GetTransactionCode()} " +
|
$"\r\n MÃ GD: {AppData.GetTransactionCode()} " +
|
||||||
$"\r\nMÁY: {Environment.MachineName}" +
|
$"\r\nMÁY: {Environment.MachineName}" +
|
||||||
$"\r\nMÃ NV: {AppData.CurrentCustomerAccount.CustomerId}";
|
$"\r\nMÃ NV: {AppData.CurrentCustomerAccount.CustomerId}";
|
||||||
|
Log.Information(str);
|
||||||
ShowError(str);
|
ShowError(str);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user