máy in lỗi -> dừng

This commit is contained in:
thuannd88
2024-10-04 18:15:50 +07:00
parent 8a710a40f1
commit 61a0209269
3 changed files with 55 additions and 46 deletions
+13 -4
View File
@@ -402,8 +402,8 @@ namespace SafeBagDE70
GetCDMStatus();
AppData.GetandExecuteCommands();
AppData.DeviceStatus.Description = AppData.CDMSTATE.CDMStatus;
AppData.DeviceStatus.DeviceTime = DateTime.Now;
//AppData.DeviceStatus.DeviceTime = DateTime.Now;
APIModels.SendHealthCheck(AppData.DeviceStatus);
}
if (countSensorTimer%5==0)
@@ -435,15 +435,18 @@ namespace SafeBagDE70
{
AppData.CDMSTATE.CDMStatus = "CDM: LỖI KẾT NỐI";
AppData.DeviceStatus.CDMStatus = (int)CDMStatusCode.DISCONNECT_SERIALPORT;
AppData.DeviceStatus.Description = AppData.CDMSTATE.CDMStatus;
}
else if (AppData.cCmdRsp.recv_dat.dat[1]==0x1C)
{
AppData.CDMSTATE.CDMStatus = "CDM: LỖI INITIALIZATION ERROR";
AppData.DeviceStatus.CDMStatus = (int)CDMStatusCode.ERROR;
AppData.DeviceStatus.Description = AppData.CDMSTATE.CDMStatus;
}
else
{
AppData.DeviceStatus.CDMStatus = (int)CDMStatusCode.NORMAL;
AppData.DeviceStatus.Description = AppData.CDMSTATE.CDMStatus;
}
if (AppData.DeviceStatus.CDMStatus != prevCDMState)
{
@@ -472,9 +475,10 @@ namespace SafeBagDE70
}
private void GetPrinterStatus()
{
if(!AppData.IsInTransaction)
{
var status = printerManager.GetStatus();
var strPrinterMessage = "";
if (status != null)
@@ -505,7 +509,6 @@ namespace SafeBagDE70
else
{
AppData.UpdatePrinterStatus(false);
strPrinterMessage = "MÁY IN: OK";
AppData.DeviceStatus.PrinterStatus = (int)PrinterStatusCode.NORMAL;
AppData.ADMINDEVICESTATUS.PrinterStatus = strPrinterMessage;
@@ -519,12 +522,18 @@ namespace SafeBagDE70
}
if (AppData.DeviceStatus.PrinterStatus != prevPrinterStatus)
{
if (AppData.DeviceStatus.PrinterStatus == (int)PrinterStatusCode.ERROR)
{
StopTimers();
ShowError(strPrinterMessage);
}
Log.Information(strPrinterMessage);
AppData.DeviceStatus.Description = strPrinterMessage;
APIModels.SendEvent(AppData.DeviceStatus);
prevPrinterStatus = AppData.DeviceStatus.PrinterStatus;
}
}
}
Stopwatch watch = new Stopwatch();
private void GetSensorValue()
+1 -1
View File
@@ -12,7 +12,7 @@
<TextBlock x:Name="lblError" FontSize="30" TextWrapping="Wrap" FontWeight="Bold" Foreground="Blue" HorizontalAlignment="Center"/>
<Separator/>
<Grid Margin="10">
<Button x:Name="btnRetry" Click="btnRetry_Click" Grid.Column="0" Content="THỬ LẠI" Height="50"/>
<Button x:Name="btnRetry" Click="btnRetry_Click" Grid.Column="0" Content="THỬ LẠI" Height="50" Visibility="Collapsed"/>
</Grid>
</StackPanel>
</UserControl>
+1 -1
View File
@@ -4,7 +4,7 @@
{
"Name": "File",
"Args": {
"path": "F:\\logs\\log_.txt",
"path": "D:\\logs\\log_.txt",
"rollingInterval": "Day"
}
}