dev
liuwf 1 year ago
parent 979652b300
commit dff4863f3d

@ -1604,5 +1604,26 @@
<param name="app"></param>
<param name="env"></param>
</member>
<member name="T:Aucma.Scada.Api.Controllers.ElectricalinspectionController">
<summary>
电检数据接口
</summary>
</member>
<member name="M:Aucma.Scada.Api.Controllers.ElectricalinspectionController.#ctor(Admin.Core.IService.ISys.ISysConfigService,Admin.Core.IService.ISys.ISysUserService,Admin.Core.IService.IRecordElectricalinspectionService,Admin.Core.IService.IDetailElectricalinspectionService)">
<summary>
构造方法
</summary>
<param name="SysConfigService"></param>
<param name="sysUserService"></param>
<param name="recordElectricalinspectionService"></param>
<param name="detailElectricalinspectionService"></param>
</member>
<member name="M:Aucma.Scada.Api.Controllers.ElectricalinspectionController.save(Admin.Core.Model.RecordElectricalinspection)">
<summary>
保存电检数据
</summary>
<param name="electricalinspection"></param>
<returns></returns>
</member>
</members>
</doc>

@ -54,7 +54,9 @@
</ItemGroup>
<ItemGroup>
<DesignDataWithDesignTimeCreatableTypes Include="Assets\Images\Green.png" />
<Resource Include="Assets\Images\Green.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\Images\logo.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>

@ -32,17 +32,14 @@ namespace Aucma.Core.CodeBinding.ViewModels
/// <param name="Code1"></param>
public delegate Task queryList(object obj);
public static event queryList? queryListEvent;
// 显示数据库状态
private readonly ICodeBindingRecordServices? _codeBindingRecordServices;
private readonly IBaseMaterialInfoServices? _baseMaterialInfoServices;
public MainWindowViewModel()
{
_codeBindingRecordServices = App.ServiceProvider.GetService<ICodeBindingRecordServices>();
_baseMaterialInfoServices = App.ServiceProvider.GetService<IBaseMaterialInfoServices>();
RefreshMesDb();
UserContent = firstPage;
MesDbState(true);
MesDbState(false);
PlcState(true);
Scanner1State(true);
Scanner2State(true);
@ -66,7 +63,8 @@ namespace Aucma.Core.CodeBinding.ViewModels
/// <param name="sender"></param>
/// <param name="e"></param>
public void RefreshStatus(object sender, System.Timers.ElapsedEventArgs e)
{
{
RefreshMesDb();
RefreshPlc();
RefreshScanner();
@ -134,7 +132,7 @@ namespace Aucma.Core.CodeBinding.ViewModels
}
#endregion
#region 窗口操作
/// <summary>
/// 窗口操作

@ -56,10 +56,8 @@
<DockPanel Grid.Row="2" Margin="5 0 5 3">
<Border BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5" HorizontalAlignment="Stretch" VerticalAlignment="Bottom">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Height="60" Orientation="Horizontal" Margin="5 0" HorizontalAlignment="Left">
<StackPanel Grid.Row="1" Height="60" Orientation="Horizontal" Margin="5 0" HorizontalAlignment="Left">
<Button Content="实时监控" x:Name="FirstPage" Height="40" Margin="5 0" Command="{Binding SwitchPagesCommand}" CommandParameter="{Binding Name,ElementName=FirstPage}" />
<Button Content="绑定记录" x:Name="RecordPage" Height="40" Margin="5 0" Command="{Binding SwitchPagesCommand}" CommandParameter="{Binding Name,ElementName=RecordPage}" />
<Button Content="键盘" x:Name="TabTip" Height="40" Margin="5 0" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=TabTip}" />

@ -11,6 +11,8 @@ using Aucma.Core.PLc;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Threading;
using Admin.Core.Common;
using Aucma.Core.Scanner;
namespace Aucma.Core.ProductOffLine.ViewModels
{
@ -27,26 +29,55 @@ namespace Aucma.Core.ProductOffLine.ViewModels
public MainWindowViewModel()
{
UserContent = firstPage;
PlcState(false);
MesDbState(true);
PlcState(true);
Scanner1State(true);
Scanner2State(true);
init();
}
public void init()
{
// plc状态刷新定时器
// 设备状态刷新定时器
System.Timers.Timer timer = new System.Timers.Timer(1000 * 5);
timer.Elapsed += new System.Timers.ElapsedEventHandler(RefreshPlcStatus);
timer.Elapsed += new System.Timers.ElapsedEventHandler(RefreshStatus);
timer.AutoReset = true;
timer.Enabled = true;
timer.Start();
}
#region 设备状态刷新
/// <summary>
/// 设备状态刷新
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void RefreshStatus(object sender, System.Timers.ElapsedEventArgs e)
{
RefreshMesDb();
RefreshPlc();
RefreshScanner();
}
/// <summary>
/// 数据库状态刷新
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void RefreshMesDb()
{
}
/// <summary>
/// plc状态刷新
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void RefreshPlcStatus(object sender, System.Timers.ElapsedEventArgs e)
public void RefreshPlc()
{
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
if (obj != null)
@ -64,8 +95,23 @@ namespace Aucma.Core.ProductOffLine.ViewModels
{
PlcState(false);
}
}
/// <summary>
/// 扫码器状态刷新
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void RefreshScanner()
{
string ip1 = Appsettings.app("Middleware", "Scanner1", "Ip");
string ip2 = Appsettings.app("Middleware", "Scanner2", "Ip");
bool flag1 = MvCodeHelper.ConnectionStatus(ip1);
bool flag2 = MvCodeHelper.ConnectionStatus(ip2);
Scanner1State(flag1);
Scanner2State(flag2);
}
#endregion
#region 更换界面
@ -171,7 +217,60 @@ namespace Aucma.Core.ProductOffLine.ViewModels
break;
}
}
#endregion
#endregion
#region MES数据库状态
/// <summary>
/// MES数据库-文字
/// </summary>
public string _mesDbUIStatusWb;
public string MesDbUIStatusWb
{
get => _mesDbUIStatusWb;
set => SetProperty(ref _mesDbUIStatusWb, value);
}
/// <summary>
/// MES数据库-颜色
/// </summary>
public string _mesDbUIColor;
public string MesDbUIColor
{
get => _mesDbUIColor;
set => SetProperty(ref _mesDbUIColor, value);
}
/// <summary>
/// MES数据库-图标
/// </summary>
public string _mesUIIcon;
public string MesUIIcon
{
get => _mesUIIcon;
set => SetProperty(ref _mesUIIcon, value);
}
/// <summary>
/// MES数据库连接状态
/// </summary>
/// <param name="type"></param>
public void MesDbState(bool type)
{
Application.Current.Dispatcher.Invoke(() =>
{
if (type)
{
MesDbUIStatusWb = "MES数据库连接成功";
MesDbUIColor = "Green";
MesUIIcon = "Assets/Images/Green.png";
}
else
{
MesDbUIStatusWb = "MES数据库异常";
MesDbUIColor = "Red";
MesUIIcon = "Assets/Images/Red.png";
}
});
}
#endregion
#region plc 状态
/// <summary>
@ -180,8 +279,6 @@ namespace Aucma.Core.ProductOffLine.ViewModels
public string _plcUIStatus;
public string PlcUIStatusWb
{
//get { return plcUIStatusWb; }
//set { plcUIStatusWb = value; RaisePropertyChanged("PlcUIStatusWb"); }
get => _plcUIStatus;
set => SetProperty(ref _plcUIStatus, value);
}
@ -191,8 +288,6 @@ namespace Aucma.Core.ProductOffLine.ViewModels
public string _plcUIColor;
public string PlcUIColor
{
//get { return plcUIColor; }
//set { plcUIColor = value; RaisePropertyChanged("PlcUIColor"); }
get => _plcUIColor;
set => SetProperty(ref _plcUIColor, value);
}
@ -202,8 +297,6 @@ namespace Aucma.Core.ProductOffLine.ViewModels
public string _plcUIIcon;
public string PlcUIIcon
{
//get { return plcUIIcon; }
//set { plcUIIcon = value; RaisePropertyChanged("plcUIIcon"); }
get => _plcUIIcon;
set => SetProperty(ref _plcUIIcon, value);
}
@ -219,7 +312,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels
if (type)
{
PlcUIStatusWb = "PLC连接成功";
PlcUIColor = "Greed";
PlcUIColor = "Green";
PlcUIIcon = "Assets/Images/Green.png";
}
else
@ -229,7 +322,124 @@ namespace Aucma.Core.ProductOffLine.ViewModels
PlcUIIcon = "Assets/Images/Red.png";
}
});
}
#endregion
#region 扫码器1状态
/// <summary>
/// UI 展示状态-文字
/// </summary>
public string _scanner1UIStatusWb;
public string Scanner1UIStatusWb
{
//get { return plcUIStatusWb; }
//set { plcUIStatusWb = value; RaisePropertyChanged("PlcUIStatusWb"); }
get => _scanner1UIStatusWb;
set => SetProperty(ref _scanner1UIStatusWb, value);
}
/// <summary>
/// UI 展示状态-颜色
/// </summary>
public string _scanner1UIColor;
public string Scanner1UIColor
{
//get { return plcUIColor; }
//set { plcUIColor = value; RaisePropertyChanged("PlcUIColor"); }
get => _scanner1UIColor;
set => SetProperty(ref _scanner1UIColor, value);
}
/// <summary>
/// UI 展示状态-图标
/// </summary>
public string _scanner1UIIcon;
public string Scanner1UIIcon
{
//get { return plcUIIcon; }
//set { plcUIIcon = value; RaisePropertyChanged("plcUIIcon"); }
get => _scanner1UIIcon;
set => SetProperty(ref _scanner1UIIcon, value);
}
/// <summary>
/// 扫码器1连接状态-true:连接成功false:失败
/// </summary>
/// <param name="type"></param>
public void Scanner1State(bool type)
{
Application.Current.Dispatcher.Invoke(() =>
{
if (type)
{
Scanner1UIStatusWb = "扫码器1连接成功";
Scanner1UIColor = "Green";
Scanner1UIIcon = "Assets/Images/Green.png";
}
else
{
Scanner1UIStatusWb = "扫码器1状态异常";
Scanner1UIColor = "Red";
Scanner1UIIcon = "Assets/Images/Red.png";
}
});
}
#endregion
#region 扫码器2状态
/// <summary>
/// UI 展示状态-文字
/// </summary>
public string _scanner2UIStatusWb;
public string Scanner2UIStatusWb
{
//get { return plcUIStatusWb; }
//set { plcUIStatusWb = value; RaisePropertyChanged("PlcUIStatusWb"); }
get => _scanner2UIStatusWb;
set => SetProperty(ref _scanner2UIStatusWb, value);
}
/// <summary>
/// UI 展示状态-颜色
/// </summary>
public string _scanner2UIColor;
public string Scanner2UIColor
{
//get { return plcUIColor; }
//set { plcUIColor = value; RaisePropertyChanged("PlcUIColor"); }
get => _scanner2UIColor;
set => SetProperty(ref _scanner2UIColor, value);
}
/// <summary>
/// UI 展示状态-图标
/// </summary>
public string _scanner2UIIcon;
public string Scanner2UIIcon
{
//get { return plcUIIcon; }
//set { plcUIIcon = value; RaisePropertyChanged("plcUIIcon"); }
get => _scanner2UIIcon;
set => SetProperty(ref _scanner2UIIcon, value);
}
/// <summary>
/// 扫码器2连接状态-true:连接成功false:失败
/// </summary>
/// <param name="type"></param>
public void Scanner2State(bool type)
{
Application.Current.Dispatcher.Invoke(() =>
{
if (type)
{
Scanner2UIStatusWb = "扫码器2连接成功";
Scanner2UIColor = "Green";
Scanner2UIIcon = "Assets/Images/Green.png";
}
else
{
Scanner2UIStatusWb = "扫码器2状态异常";
Scanner2UIColor = "Red";
Scanner2UIIcon = "Assets/Images/Red.png";
}
});
}
#endregion

@ -57,10 +57,7 @@
<DockPanel Grid.Row="2" Margin="5 0 5 3">
<Border Margin="5" BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5" HorizontalAlignment="Stretch" VerticalAlignment="Bottom">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="1" Height="50" Orientation="Horizontal" Margin="5 0" HorizontalAlignment="Left">
<Button Content="实时监控" x:Name="FirstPage" Command="{Binding SwitchPagesCommand}" CommandParameter="{Binding Name,ElementName=FirstPage}" Margin="5 0" Height="40" />
<Button Content="任务记录" x:Name="RecordPage" Margin="5 0" Height="40" Command="{Binding SwitchPagesCommand}" CommandParameter="{Binding Name,ElementName=RecordPage}" />
@ -69,7 +66,13 @@
<Button Content="最小化" x:Name="Minimized" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Minimized}" Width="100" Margin="5 0" Height="40" Background="#FF9900" BorderBrush="#FF9900" />
<Button Content="退 出" x:Name="Exit" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Exit}" Width="100" Margin="5 0" Height="40" Background="#FF0033" BorderBrush="#FF0033"/>
</StackPanel>
<StackPanel Grid.Row="2" Height="50" Orientation="Horizontal" HorizontalAlignment="Right">
<StackPanel Height="50" Orientation="Horizontal" HorizontalAlignment="Right">
<Border Width="30" Height="30" CornerRadius="15">
<Border.Background>
<ImageBrush x:Name="MesDbStatus" ImageSource="{Binding MesUIIcon}"/>
</Border.Background>
</Border>
<TextBlock x:Name="MesDbStateTxt" Text="{Binding MesDbUIStatusWb}" VerticalAlignment="Center" Foreground="{Binding MesDbUIColor}" FontSize="15" Margin="10,0"/>
<Border Width="30" Height="30" CornerRadius="15">
<Border.Background>
<ImageBrush x:Name="PlcStatus" ImageSource="{Binding PlcUIIcon}"/>
@ -78,16 +81,16 @@
<TextBlock x:Name="PLCState" Text="{Binding PlcUIStatusWb}" VerticalAlignment="Center" Foreground="{Binding PlcUIColor}" FontSize="15" Margin="10,0"/>
<Border Width="30" Height="30" CornerRadius="15">
<Border.Background>
<ImageBrush x:Name="PlcStatusImage" ImageSource="/Assets/Images/Green.png"/>
<ImageBrush x:Name="Scanner1Status" ImageSource="{Binding Scanner1UIIcon}"/>
</Border.Background>
</Border>
<TextBlock x:Name="DB" Text="数据库连接成功" VerticalAlignment="Center" Foreground="Green" FontSize="15" Margin="10,0"/>
<TextBlock x:Name="Scanner1" Text="{Binding Scanner1UIStatusWb}" VerticalAlignment="Center" Foreground="{Binding Scanner1UIColor}" FontSize="15" Margin="10,0"/>
<Border Width="30" Height="30" CornerRadius="15">
<Border.Background>
<ImageBrush x:Name="BarCodeStatus" ImageSource="/Assets/Images/Green.png"/>
<ImageBrush x:Name="BarCodeStatus" ImageSource="{Binding Scanner2UIIcon}"/>
</Border.Background>
</Border>
<TextBlock x:Name="BarCodeStatusTxt" Text="扫描器连接成功" VerticalAlignment="Center" Foreground="Green" FontSize="15" Margin="10,0"/>
<TextBlock x:Name="BarCodeStatusTxt" Text="{Binding Scanner2UIStatusWb}" VerticalAlignment="Center" Foreground="{Binding Scanner2UIColor}" FontSize="15" Margin="10,0"/>
</StackPanel>
</Grid>
</Border>

Loading…
Cancel
Save