add resetAbnormal Error

This commit is contained in:
Nguyen Dinh Thuan
2024-10-22 16:09:11 +07:00
parent d31c530392
commit d0abb5cca6
3 changed files with 48 additions and 9 deletions
+22 -7
View File
@@ -77,9 +77,13 @@ namespace SafeBagDE70
CCmdRsp cCmdRsp = null;
bool bInitialized = false;
bool bOpenPort = true;
bool bIsMaintain = false;
MainWindow mainWindow = null;
Task taskCounting = null;
bool isSensorActivated = false;
bool isPrinterActivated = false;
public DepositSMUCv2()
{
InitializeComponent();
@@ -152,7 +156,10 @@ namespace SafeBagDE70
private bool InitSerialPorts()
{
var bInitDE70=InitSerialPortDE70();
var bInitSensor = InitSerialPortSensor();
if(isSensorActivated)
InitSerialPortSensor();
if (bInitDE70)
return true;
else
@@ -398,7 +405,9 @@ namespace SafeBagDE70
{
if (countSensorTimer % 10 == 0)
{
GetPrinterStatus();
if(isPrinterActivated)
GetPrinterStatus();
GetCDMStatus();
AppData.GetandExecuteCommands();
@@ -416,7 +425,9 @@ namespace SafeBagDE70
}
countSensorTimer++;
sensorTimer.IsEnabled = false;
GetSensorValue();
if (isSensorActivated)
GetSensorValue();
sensorTimer.IsEnabled = true;
}
catch (Exception ex)
@@ -1300,13 +1311,17 @@ namespace SafeBagDE70
SyncData(data2Send);//Lưu CSDL và đồng bộ
//Reset all and ready to next session
if (printerFlag == true)
if (isPrinterActivated)
{
if (double.Parse(totalValue) > 0)
PrintReceipt();
printerFlag = false;
if (printerFlag == true)
{
if (double.Parse(totalValue) > 0)
PrintReceipt();
printerFlag = false;
}
}
String strNotify = $"BẠN VỪA THỰC HIỆN NỘP TIỀN VÀO MÁY CDM:\r\n"
+ $"SỐ LƯỢNG TỜ: {totalQuantity}\r\n"