- Dừng máy khi phát hiện lỗi

- Log thông tin khi đăng nhập
This commit is contained in:
Nguyen Dinh Thuan
2024-10-04 16:47:50 +07:00
parent ac6074c9bf
commit 8a710a40f1
5 changed files with 45 additions and 16 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ namespace SafeBagDE70
StateMachineConfig = new StateMachineConfig();
configuration.GetSection("StateMachine").Bind(StateMachineConfig);
Log.Information("START APP");
Log.Information("START APP version: "+AppData.CurrentVersion);
}
catch (Exception ex)
{
+1 -4
View File
@@ -975,10 +975,6 @@ namespace SafeBagDE70
RecvDat=recv_data;
if (AppData.cCmdRsp != null) {
CDMStatus = RequestTime.ToString("yyyy/MM/dd HH:mm:ss ") + GetSRStatus();
if (recv_data.leng > 18)
{
}
}
}
private string? _CDMStatus;
@@ -1055,5 +1051,6 @@ namespace SafeBagDE70
{
NORMAL = 0,
DISCONNECT_SERIALPORT=1,
ERROR = 3,
}
}
+1
View File
@@ -6,6 +6,7 @@
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<ApplicationIcon>icon\logo.ico</ApplicationIcon>
<Version>1.1.0</Version>
</PropertyGroup>
<ItemGroup>
+25 -4
View File
@@ -396,8 +396,6 @@ namespace SafeBagDE70
sensorTimer.IsEnabled = false;
try
{
if (countSensorTimer % 10 == 0)
{
GetPrinterStatus();
@@ -435,17 +433,40 @@ namespace SafeBagDE70
AppData.GetCDMState();
if (AppData.cCmdRsp==null || AppData.cCmdRsp.cmd_result == SendStatus.SEND_DAT_ERR || AppData.cCmdRsp.cmd_result == SendStatus.SEND_ERR)
{
AppData.CDMSTATE.CDMStatus = "CDM: LỖI";
AppData.CDMSTATE.CDMStatus = "CDM: LỖI KẾT NỐI";
AppData.DeviceStatus.CDMStatus = (int)CDMStatusCode.DISCONNECT_SERIALPORT;
}
else if (AppData.cCmdRsp.recv_dat.dat[1]==0x1C)
{
AppData.CDMSTATE.CDMStatus = "CDM: LỖI INITIALIZATION ERROR";
AppData.DeviceStatus.CDMStatus = (int)CDMStatusCode.ERROR;
}
else
{
AppData.DeviceStatus.CDMStatus = (int)CDMStatusCode.NORMAL;
}
if (AppData.DeviceStatus.CDMStatus != prevCDMState)
{
prevCDMState = AppData.DeviceStatus.CDMStatus;
APIModels.SendEvent(AppData.DeviceStatus);
if (AppData.DeviceStatus.CDMStatus==(int)CDMStatusCode.ERROR||
AppData.DeviceStatus.CDMStatus == (int)CDMStatusCode.DISCONNECT_SERIALPORT)
{
Log.Error(AppData.CDMSTATE.CDMStatus);
StopTimers();
ShowError(AppData.CDMSTATE.CDMStatus);
}
else
{
if(AppData.DeviceStatus.CDMStatus== (int)CDMStatusCode.NORMAL&&
( prevCDMState == (int)CDMStatusCode.ERROR ||
prevCDMState == (int)CDMStatusCode.DISCONNECT_SERIALPORT))
{
mainWindow.ShowWelcomeScreen();
}
}
prevCDMState = AppData.DeviceStatus.CDMStatus;
}
}
}
+17 -7
View File
@@ -66,7 +66,7 @@ namespace SafeBagDE70
}
private void LoginButton_Click(object sender, RoutedEventArgs e)
{
Log.Information("Login sử dụng PINCODE");
string pin = PinCodeBox.Text;
if (ValidatePin(pin))
@@ -89,10 +89,14 @@ namespace SafeBagDE70
((MainWindow)Application.Current.MainWindow).ShowDepositScreen();
//DialogResult = true;
//this.Close();
var str = "Login Pincode thành công";
Log.Information(str);
}
else
{
lblPincodeError.Content = "PINCODE không đúng, vui lòng thử lại";
var str = "PINCODE không đúng, vui lòng thử lại";
Log.Information(str);
lblPincodeError.Content =str ;
}
}
}
@@ -187,6 +191,8 @@ namespace SafeBagDE70
}
private void OnBarcodeEvent(short eventType, ref string pscanData)
{
var str = "Login QRCODE thành công";
Log.Information(str);
string xmlString = pscanData;
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlString);
@@ -216,10 +222,14 @@ namespace SafeBagDE70
AppData.CurrentCustomerAccount = cca;
AppData.CreateNewTransactionCode();
((MainWindow)Application.Current.MainWindow).ShowDepositScreen();
str = "Login QRCode thành công";
Log.Information(str);
}
else
{
lblQRcodeError.Content = "QRCODE không đúng, vui lòng thử lại";
str = "QRCODE không đúng, vui lòng thử lại";
Log.Information(str);
lblQRcodeError.Content = str;
}
}
@@ -266,10 +276,10 @@ namespace SafeBagDE70
}
else
{
this.Dispatcher.Invoke(() =>
{
lblQRcodeError.Content = "CRC is invalid.";
});
//this.Dispatcher.Invoke(() =>
//{
// lblQRcodeError.Content = "CRC is invalid.";
//});
}