fix Abnormal Storate

This commit is contained in:
thuannd88
2024-10-22 18:18:50 +07:00
parent 7430effcf2
commit 01e63a0f4e
4 changed files with 52 additions and 19 deletions
+15 -3
View File
@@ -101,19 +101,26 @@ namespace SafeBagDE70.Admin
private void btnSoftImportantError_Click(object sender, RoutedEventArgs e)
{
var state = AppData.GetCDMState();
if(state.IsNotesInEscrow>0||
if (state.IsNotesInEscrow>0||
state.IsNotesInRejectPocket>0||
state.IsNotesInHopper>0)
{
lblCounterStatus.Foreground = new SolidColorBrush(Colors.Red);
lblCounterStatus.Text = "Vẫn còn tiền trong máy, đề nghị lấy tiền ra khỏi các ngăn và kiểm tra tiền kẹt";
}
else
{
lblCounterStatus.Foreground = new SolidColorBrush(Colors.Green);
lblCounterStatus.Text = "Đang thực hiện Reset lỗi";
Log.Information("[ADMIN] Reset CDM Error");
var bSuccess = AppData.ResetAbnormalStorage605();
if(bSuccess)
if (bSuccess)
{
Log.Information("[ADMIN] Reset CDM AbnormalStorage successfully");
lblCounterStatus.Foreground = new SolidColorBrush(Colors.Green);
lblCounterStatus.Text = "Reset lỗi thành công";
((MainWindow)Application.Current.MainWindow).ShowWelcomeScreen();
Task.Run(() =>
@@ -124,7 +131,12 @@ namespace SafeBagDE70.Admin
lblCounterStatus.Text = "";
});
});
}
}
else
{
lblCounterStatus.Foreground = new SolidColorBrush(Colors.Red);
lblCounterStatus.Text = "Reset lỗi không thành công";
}
}
}
}
+33 -13
View File
@@ -708,15 +708,18 @@ namespace SafeBagDE70
}
public static bool ResetAbnormalStorage605()
{
var cCmdRsp = AppData.cCmdRsp;
bool bSuccess = false;
if (cCmdRsp != null)
{
Log.Information("START ABNORMAL STORAGE RESET PROC");
cCmdRsp.SendXXCmd((byte)Command.CMD_DE_SENSE);
LogCmdData();
if (cCmdRsp.recv_dat != null &&(cCmdRsp.recv_dat.dat[1] == 0x1C && cCmdRsp.recv_dat.dat[2] == 0x4C))
if (cCmdRsp.recv_dat != null &&
((cCmdRsp.recv_dat.dat[18] & 0xF0) == 0xE0))
{
//0. Check notes in escrow or not?
@@ -748,38 +751,55 @@ namespace SafeBagDE70
LogCmdData();
recvData = cCmdRsp.recv_dat;
var SR2 = recvData.dat[1];
var S2 = recvData.dat[recvData.leng - 1];
var S2 = recvData.dat[18];
if (SR2 == 0x1C && (S2==0xE2 || S2==0xE4))
{
cCmdRsp.SendXXCmd((byte)Command.CMD_DE_RESET);
LogCmdData();
Thread.Sleep(1000);
for (int i=0;i<10;i++)
{
cCmdRsp.SendXXCmd((byte)Command.CMD_DE_SENSE);
LogCmdData();
Thread.Sleep(1000);
S2 = recvData.dat[recvData.leng - 1];
if (S2 == 0xE7)
S2 = recvData.dat[18];
SR2 = recvData.dat[1];
if (SR2 == 0x07)
break;
}
Thread.Sleep(1000);
}
Thread.Sleep(2000);
cCmdRsp.SendXXCmd((byte)Command.CMD_DE_CNTSTART);
LogCmdData();
Thread.Sleep(1000);
Thread.Sleep(2000);
cCmdRsp.SendXXCmd((byte)Command.CMD_DE_STORESTART);
Thread.Sleep(2000);
LogCmdData();
if (cCmdRsp.recv_dat.dat[1] == 0x04 && cCmdRsp.recv_dat.dat[2] == 0x41)
if ((cCmdRsp.recv_dat.dat[1] == 0x07 || cCmdRsp.recv_dat.dat[1]==0x09) && cCmdRsp.recv_dat.dat[2] == 0x41)
{
bSuccess = true;
//Wait until SR2=0x04
for(int i = 0; i < 10; i++)
{
cCmdRsp.SendXXCmd((byte)Command.CMD_DE_SENSE);
LogCmdData();
Thread.Sleep(1000);
SR2 = recvData.dat[1];
if (SR2 == 0x04)
{
bSuccess = true;
}
}
}
}
else
{
}
Log.Information("END ABNORMAL STORAGE RESET PROC");
}
}
return bSuccess;
@@ -1072,7 +1092,7 @@ namespace SafeBagDE70
public int PrintingCountFromNPO = 0;//Transaction Count From Near Paper Out
public bool IsStopPrinting()
{
if (IsPrinterNearPaperOut && PrintingCountFromNPO >= 20)
if (IsPrinterNearPaperOut && PrintingCountFromNPO >= 50)
{
return true;
}
+3 -2
View File
@@ -1145,10 +1145,11 @@ namespace SafeBagDE70
Dispatcher.Invoke(() =>
{
var customerId = AppData.CurrentCustomerAccount == null ? "" : AppData.CurrentCustomerAccount.CustomerId;
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\nMÃ GD: {AppData.GetTransactionCode()} " +
$"\r\nMÁY: {Environment.MachineName}" +
$"\r\nMÃ NV: {AppData.CurrentCustomerAccount.CustomerId}";
$"\r\nMÃ NV: {customerId}";
Log.Information(str);
ShowError(str);
});
+1 -1
View File
@@ -16,7 +16,7 @@
},
"CDM": {
"MaxNotes": 9999
},
},
"Device": {
"BaseURL": "http://203.171.20.94:9103/Safebag/",
"TenantId": 5