change-成品下线,门体,箱体,条码绑定界面时间显示

dev
liuwf 1 year ago
parent 66a2337f11
commit ddba87a8d4

@ -12,6 +12,7 @@ using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Threading;
namespace Aucma.Core.BoxFoam.ViewModels namespace Aucma.Core.BoxFoam.ViewModels
{ {
@ -33,6 +34,13 @@ namespace Aucma.Core.BoxFoam.ViewModels
public MainWindowViewModel() public MainWindowViewModel()
{ {
UserContent = firstPage; UserContent = firstPage;
// 创建一个DispatcherTimer对象
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += Timer_Tick;
timer.Start();
Task.Run(() => Task.Run(() =>
{ {
init(); init();
@ -419,5 +427,36 @@ namespace Aucma.Core.BoxFoam.ViewModels
}); });
} }
#endregion #endregion
public string _currentDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
public string CurrentDateTime
{
get => _currentDateTime;
set => SetProperty(ref _currentDateTime, value);
}
public string _shiftStr = string.Empty;
public string ShiftStr
{
get => _shiftStr;
set => SetProperty(ref _shiftStr, value);
}
private void Timer_Tick(object sender, EventArgs e)
{
DateTime now = DateTime.Now;
// 判断当前是否是白班时间段
if (now.Hour >= 8 && now.Hour < 20)
{
ShiftStr = $"白班 08点-20点";
}
else
{
ShiftStr = $"夜班 20点-08点";
}
CurrentDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
} }
} }

@ -38,12 +38,17 @@
<StackPanel Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Right"> <StackPanel Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Right">
<Grid> <Grid>
<Grid.ColumnDefinitions> <!--<Grid.ColumnDefinitions>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>-->
<TextBlock Grid.Column="0" Text="白班" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/> <Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding ShiftStr}" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/>
<TextBlock Grid.Row="1" Text="{Binding CurrentDateTime}" FontSize="20" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/>
<!--<TextBlock Grid.Column="1" Text="|" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/> <!--<TextBlock Grid.Column="1" Text="|" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/>
<TextBlock Grid.Column="2" Text="SCADA" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,10,0"/>--> <TextBlock Grid.Column="2" Text="SCADA" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,10,0"/>-->
</Grid> </Grid>

@ -226,7 +226,7 @@
"EquipName": "foamMachinePlc", "EquipName": "foamMachinePlc",
"PlcType": "Siemens", "PlcType": "Siemens",
"Enabled": true, "Enabled": true,
"IP": "127.0.0.1", "IP": "10.10.93.180",
//"IP": "127.0.0.1", //"IP": "127.0.0.1",
"Port": 102 "Port": 102
} }

@ -20,6 +20,7 @@ using Microsoft.Extensions.DependencyInjection;
using Admin.Core.Model; using Admin.Core.Model;
using Admin.Core.Tasks; using Admin.Core.Tasks;
using static ICSharpCode.SharpZipLib.Zip.ExtendedUnixData; using static ICSharpCode.SharpZipLib.Zip.ExtendedUnixData;
using System.Windows.Threading;
namespace Aucma.Core.CodeBinding.ViewModels namespace Aucma.Core.CodeBinding.ViewModels
{ {
@ -40,6 +41,14 @@ namespace Aucma.Core.CodeBinding.ViewModels
{ {
UserContent = firstPage; UserContent = firstPage;
// 创建一个DispatcherTimer对象
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += Timer_Tick;
timer.Start();
Job_AllState_Quartz.RefreshStateEvent += RefreshStatus; Job_AllState_Quartz.RefreshStateEvent += RefreshStatus;
} }
@ -402,5 +411,38 @@ namespace Aucma.Core.CodeBinding.ViewModels
}); });
} }
#endregion #endregion
public string _currentDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
public string CurrentDateTime
{
get => _currentDateTime;
set => SetProperty(ref _currentDateTime, value);
}
public string _shiftStr = string.Empty;
public string ShiftStr
{
get => _shiftStr;
set => SetProperty(ref _shiftStr, value);
}
private void Timer_Tick(object sender, EventArgs e)
{
DateTime now = DateTime.Now;
// 判断当前是否是白班时间段
if (now.Hour >= 8 && now.Hour < 20)
{
ShiftStr = $"白班 08点-20点";
}
else
{
ShiftStr = $"夜班 20点-08点";
}
CurrentDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
} }
} }

@ -36,14 +36,19 @@
<StackPanel Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Right"> <StackPanel Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Right">
<Grid> <Grid>
<Grid.ColumnDefinitions> <!--<Grid.ColumnDefinitions>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>-->
<TextBlock Grid.Column="0" Text="白班" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/> <Grid.RowDefinitions>
<TextBlock Grid.Column="1" Text="|" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/> <RowDefinition Height="*"/>
<TextBlock Grid.Column="2" Text="SCADA" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,10,0"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding ShiftStr}" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/>
<TextBlock Grid.Row="1" Text="{Binding CurrentDateTime}" FontSize="20" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/>
<!--<TextBlock Grid.Column="1" Text="|" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/>
<TextBlock Grid.Column="2" Text="SCADA" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,10,0"/>-->
</Grid> </Grid>
</StackPanel> </StackPanel>
</Grid> </Grid>

@ -11,6 +11,7 @@ using Admin.Core.Common;
using Aucma.Core.Scanner; using Aucma.Core.Scanner;
using System.Linq; using System.Linq;
using Aucma.Core.HwPLc; using Aucma.Core.HwPLc;
using System.Windows.Threading;
namespace Aucma.Core.DoorFoam.ViewModels namespace Aucma.Core.DoorFoam.ViewModels
{ {
@ -24,6 +25,13 @@ namespace Aucma.Core.DoorFoam.ViewModels
public MainWindowViewModel() public MainWindowViewModel()
{ {
UserContent = firstPage; UserContent = firstPage;
// 创建一个DispatcherTimer对象
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += Timer_Tick;
timer.Start();
init(); init();
} }
public void init() public void init()
@ -432,5 +440,38 @@ namespace Aucma.Core.DoorFoam.ViewModels
}); });
} }
#endregion #endregion
public string _currentDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
public string CurrentDateTime
{
get => _currentDateTime;
set => SetProperty(ref _currentDateTime, value);
}
public string _shiftStr = string.Empty;
public string ShiftStr
{
get => _shiftStr;
set => SetProperty(ref _shiftStr, value);
}
private void Timer_Tick(object sender, EventArgs e)
{
DateTime now = DateTime.Now;
// 判断当前是否是白班时间段
if (now.Hour >= 8 && now.Hour < 20)
{
ShiftStr = $"白班 08点-20点";
}
else
{
ShiftStr = $"夜班 20点-08点";
}
CurrentDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
} }
} }

@ -41,14 +41,19 @@
<StackPanel Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Right"> <StackPanel Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Right">
<Grid> <Grid>
<Grid.ColumnDefinitions> <!--<Grid.ColumnDefinitions>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>-->
<TextBlock Grid.Column="0" Text="白班" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/> <Grid.RowDefinitions>
<TextBlock Grid.Column="1" Text="|" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/> <RowDefinition Height="*"/>
<TextBlock Grid.Column="2" Text="SCADA" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,10,0"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding ShiftStr}" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/>
<TextBlock Grid.Row="1" Text="{Binding CurrentDateTime}" FontSize="20" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/>
<!--<TextBlock Grid.Column="1" Text="|" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/>
<TextBlock Grid.Column="2" Text="SCADA" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,10,0"/>-->
</Grid> </Grid>
</StackPanel> </StackPanel>
</Grid> </Grid>

@ -28,6 +28,12 @@ namespace Aucma.Core.ProductOffLine.ViewModels
public MainWindowViewModel() public MainWindowViewModel()
{ {
UserContent = firstPage; UserContent = firstPage;
// 创建一个DispatcherTimer对象
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += Timer_Tick;
timer.Start();
Job_AllState_Quartz.RefreshStateEvent += RefreshStatus; Job_AllState_Quartz.RefreshStateEvent += RefreshStatus;
} }
@ -425,6 +431,42 @@ namespace Aucma.Core.ProductOffLine.ViewModels
} }
}); });
} }
public string _currentDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
public string CurrentDateTime
{
get => _currentDateTime;
set => SetProperty(ref _currentDateTime, value);
}
public string _shiftStr = string.Empty;
public string ShiftStr
{
get => _shiftStr;
set => SetProperty(ref _shiftStr, value);
}
private void Timer_Tick(object sender, EventArgs e)
{
DateTime now = DateTime.Now;
// 判断当前是否是白班时间段
if (now.Hour >= 8 && now.Hour < 20)
{
ShiftStr = $"白班 08点-20点";
}
else
{
ShiftStr = $"夜班 20点-08点";
}
CurrentDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
#endregion #endregion

@ -36,14 +36,19 @@
</DockPanel> </DockPanel>
<StackPanel Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Right"> <StackPanel Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Right">
<Grid> <Grid>
<Grid.ColumnDefinitions> <!--<Grid.ColumnDefinitions>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>-->
<TextBlock Grid.Column="0" Text="白班" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/> <Grid.RowDefinitions>
<TextBlock Grid.Column="1" Text="|" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/> <RowDefinition Height="*"/>
<TextBlock Grid.Column="2" Text="SCADA" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,10,0"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding ShiftStr}" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/>
<TextBlock Grid.Row="1" Text="{Binding CurrentDateTime}" FontSize="20" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/>
<!--<TextBlock Grid.Column="1" Text="|" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/>
<TextBlock Grid.Column="2" Text="SCADA" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,10,0"/>-->
</Grid> </Grid>
</StackPanel> </StackPanel>
</Grid> </Grid>

Loading…
Cancel
Save