check only InitDE70 to continue

This commit is contained in:
Nguyen Dinh Thuan
2024-09-17 15:51:44 +07:00
parent 0ea0f79351
commit c04d43fa63
7 changed files with 94 additions and 7 deletions
+5 -2
View File
@@ -16,7 +16,7 @@
<!-- Top Bar --> <!-- Top Bar -->
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<!-- Main Content Area --> <!-- Main Content Area -->
<RowDefinition Height="50"/> <RowDefinition Height="150"/>
<!-- Footer --> <!-- Footer -->
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@@ -86,7 +86,10 @@
<!-- Footer --> <!-- Footer -->
<StackPanel Grid.Row="2" Grid.ColumnSpan="2" Orientation="Horizontal" Background="LightGray"> <StackPanel Grid.Row="2" Grid.ColumnSpan="2" Orientation="Horizontal" Background="LightGray">
<TextBlock Text="Admin Panel" VerticalAlignment="Center" Margin="10" Foreground="White" FontSize="14"/> <TextBlock Text="Admin Panel" VerticalAlignment="Center" Margin="10" Foreground="White" FontSize="14"/>
<TextBlock x:Name="lblStatus" Text="{Binding CDMStatus}" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0" Foreground="Red" FontSize="14"/> <TextBlock x:Name="lblCDMStatus" Text="{Binding CDMStatus}" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0" Foreground="Red" FontSize="20"/>
<TextBlock x:Name="lblPrinterStatus" Text="{Binding PrinterStatus}" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0" Foreground="Red" FontSize="20"/>
<TextBlock x:Name="lblSensorStatus" Text="{Binding SensorStatus}" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0" Foreground="Red" FontSize="20"/>
<TextBlock x:Name="lblDeviceStatus" Text="{Binding DeviceStatus}" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0" Foreground="Red" FontSize="20"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
</hc:Window> </hc:Window>
+4 -1
View File
@@ -38,7 +38,10 @@ namespace SafeBagDE70.Admin
private void AdminWindow_Loaded(object sender, RoutedEventArgs e) private void AdminWindow_Loaded(object sender, RoutedEventArgs e)
{ {
lblStatus.DataContext = AppData.CDMSTATE; lblCDMStatus.DataContext = AppData.CDMSTATE;
lblDeviceStatus.DataContext = AppData.ADMINDEVICESTATUS;
lblPrinterStatus.DataContext = AppData.ADMINDEVICESTATUS;
lblSensorStatus.DataContext = AppData.ADMINDEVICESTATUS;
} }
private void LogoutButton_Click(object sender, RoutedEventArgs e) private void LogoutButton_Click(object sender, RoutedEventArgs e)
+3
View File
@@ -10,6 +10,9 @@
<setting name="RestartTime" serializeAs="String"> <setting name="RestartTime" serializeAs="String">
<value /> <value />
</setting> </setting>
<setting name="TransactionNoInDay" serializeAs="String">
<value>0</value>
</setting>
</SafeBagDE70.Properties.Settings> </SafeBagDE70.Properties.Settings>
</userSettings> </userSettings>
</configuration> </configuration>
+63 -2
View File
@@ -60,6 +60,7 @@ namespace SafeBagDE70
static AppData() static AppData()
{ {
CDMSTATE = new CDMSTATE(); CDMSTATE = new CDMSTATE();
ADMINDEVICESTATUS = new ADMINDEVICESTATUS();
//InitDeviceStatus(); //InitDeviceStatus();
} }
public static void Init() public static void Init()
@@ -148,7 +149,8 @@ namespace SafeBagDE70
return bInitUser; return bInitUser;
} }
public static CDMSTATE? CDMSTATE = null; public static CDMSTATE? CDMSTATE = null;
private static DateTime CutOffTime = new DateTime(1, 1, 1, 12, 0, 0); // 12:00 noon as cut-off time public static ADMINDEVICESTATUS? ADMINDEVICESTATUS = null;
private static DateTime CutOffTime = new DateTime(1, 1, 1, 11, 0, 0); // 11:00 a.m as cut-off time
public static string GetNumberPartFromMerchantCode(string merchantCode) public static string GetNumberPartFromMerchantCode(string merchantCode)
{ {
@@ -175,7 +177,7 @@ namespace SafeBagDE70
CurrentCustomerAccount.TransactionCount++; CurrentCustomerAccount.TransactionCount++;
} }
var transactionCount = CurrentCustomerAccount.TransactionCount; var transactionCount = CurrentCustomerAccount.TransactionCount;
string datePart = adjustedDate.ToString("yyyyMMdd"); string datePart = transactionDateTime.ToString("yyyyMMdd");
string timePart = transactionDateTime.ToString("HHmmss"); string timePart = transactionDateTime.ToString("HHmmss");
string transactionCountPart = transactionCount.ToString("D2"); // Ensure 2 digits string transactionCountPart = transactionCount.ToString("D2"); // Ensure 2 digits
@@ -413,6 +415,65 @@ namespace SafeBagDE70
AUTOEND=1, AUTOEND=1,
FULLIFSTORE=2 FULLIFSTORE=2
} }
public class ADMINDEVICESTATUS : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private string? _PrinterStatus;
public string? Printertatus
{
get
{
return _PrinterStatus;
}
set
{
if (_PrinterStatus != value)
{
_PrinterStatus = value;
OnPropertyChanged(nameof(Printertatus));
}
}
}
private string? _SensorStatus;
public string? SensorStatus
{
get
{
return _SensorStatus;
}
set
{
if (_SensorStatus != value)
{
_SensorStatus = value;
OnPropertyChanged(nameof(SensorStatus));
}
}
}
private string? _DeviceStatus;
public string? DeviceStatus
{
get
{
return _DeviceStatus;
}
set
{
if (_DeviceStatus != value)
{
_DeviceStatus = value;
OnPropertyChanged(nameof(DeviceStatus));
}
}
}
}
public class CDMSTATE : INotifyPropertyChanged public class CDMSTATE : INotifyPropertyChanged
{ {
public int IsCassetteFull = 0; public int IsCassetteFull = 0;
+3 -1
View File
@@ -148,7 +148,7 @@ namespace SafeBagDE70
{ {
var bInitDE70=InitSerialPortDE70(); var bInitDE70=InitSerialPortDE70();
var bInitSensor = InitSerialPortSensor(); var bInitSensor = InitSerialPortSensor();
if (bInitDE70 && bInitSensor) if (bInitDE70)
return true; return true;
else else
{ {
@@ -400,11 +400,13 @@ namespace SafeBagDE70
StopTimers(); StopTimers();
strPrinterMessage = "MÁY IN HẾT GIẤY! ĐỀ NGHỊ THAY GIẤY"; strPrinterMessage = "MÁY IN HẾT GIẤY! ĐỀ NGHỊ THAY GIẤY";
ShowError(strPrinterMessage); ShowError(strPrinterMessage);
AppData.ADMINDEVICESTATUS.Printertatus = strPrinterMessage;
} }
else if (status.StsNEARENDPAP) else if (status.StsNEARENDPAP)
{ {
strPrinterMessage = "MÁY IN GẦN HẾT GIẤY"; strPrinterMessage = "MÁY IN GẦN HẾT GIẤY";
AppData.DeviceStatus.PrinterStatus = (int)PrinterStatusCode.NEARPAPEROUT; AppData.DeviceStatus.PrinterStatus = (int)PrinterStatusCode.NEARPAPEROUT;
AppData.ADMINDEVICESTATUS.Printertatus = strPrinterMessage;
} }
if (AppData.DeviceStatus.PrinterStatus != prevPrinterStatus) if (AppData.DeviceStatus.PrinterStatus != prevPrinterStatus)
{ {
+12
View File
@@ -33,5 +33,17 @@ namespace SafeBagDE70.Properties {
this["RestartTime"] = value; this["RestartTime"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int TransactionNoInDay {
get {
return ((int)(this["TransactionNoInDay"]));
}
set {
this["TransactionNoInDay"] = value;
}
}
} }
} }
+3
View File
@@ -5,5 +5,8 @@
<Setting Name="RestartTime" Type="System.DateTime" Scope="User"> <Setting Name="RestartTime" Type="System.DateTime" Scope="User">
<Value Profile="(Default)" /> <Value Profile="(Default)" />
</Setting> </Setting>
<Setting Name="TransactionNoInDay" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>