@@ -0,0 +1,25 @@ | |||||
namespace BPASmartClient.AGV.Enums | |||||
{ | |||||
/// <summary> | |||||
/// AGV移动任务枚举 | |||||
/// </summary> | |||||
public enum AGVMove | |||||
{ | |||||
/// <summary> | |||||
/// 任务完成 | |||||
/// </summary> | |||||
DONE, | |||||
/// <summary> | |||||
/// 任务取消 | |||||
/// </summary> | |||||
CANCEL, | |||||
/// <summary> | |||||
/// 任务异常取消 | |||||
/// </summary> | |||||
ABNORMAL_CANCEL, | |||||
/// <summary> | |||||
/// 任务异常完成 | |||||
/// </summary> | |||||
ABNORMAL_COMPLETED | |||||
} | |||||
} |
@@ -0,0 +1,36 @@ | |||||
namespace BPASmartClient.AGV.Enums | |||||
/// <summary> | |||||
/// 纯料箱任务枚举 | |||||
/// </summary> | |||||
public enum BinTask | |||||
{ | |||||
/// <summary> | |||||
/// 开始移动(仅单插臂或单夹报,2.8.1后) | |||||
/// </summary> | |||||
MOVE_BEGIN, | |||||
/// <summary> | |||||
/// 到站 | |||||
/// </summary> | |||||
ENTER_STATION, | |||||
/// <summary> | |||||
/// 任务完成 | |||||
/// </summary> | |||||
DONE, | |||||
/// <summary> | |||||
/// 取料完成 | |||||
/// </summary> | |||||
LOAD_COMPLETED, | |||||
/// <summary> | |||||
/// 放料完成 | |||||
/// </summary> | |||||
UNLOAD_COMPLETED, | |||||
/// <summary> | |||||
/// 任务异常取消 | |||||
/// </summary> | |||||
ABNORMAL_CANCEL, | |||||
/// <summary> | |||||
/// 任务异常完成 | |||||
/// </summary> | |||||
ABNORMAL_COMPLETED, | |||||
} | |||||
} |
@@ -0,0 +1,32 @@ | |||||
namespace BPASmartClient.AGV.Enums | |||||
/// <summary> | |||||
/// 货位到货位/点到点辊筒料箱搬运任务枚举 | |||||
/// </summary> | |||||
public enum CTC | |||||
{ | |||||
/// <summary> | |||||
/// 正在上料 | |||||
/// </summary> | |||||
ROLLER_LOAD_DOING, | |||||
/// <summary> | |||||
/// 上料完成 | |||||
/// </summary> | |||||
ROLLER_LOAD_FINISH, | |||||
/// <summary> | |||||
/// 正在下料 | |||||
/// </summary> | |||||
ROLLER_UNLOAD_DOING, | |||||
/// <summary> | |||||
/// 下料完成 | |||||
/// </summary> | |||||
DONE, | |||||
/// <summary> | |||||
/// 任务异常取消 | |||||
/// </summary> | |||||
ABNORMAL_CANCEL, | |||||
/// <summary> | |||||
/// 任务异常完成 | |||||
/// </summary> | |||||
ABNORMAL_COMPLETED, | |||||
} | |||||
} |
@@ -0,0 +1,20 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.AGV.Enums | |||||
{ | |||||
public enum JobType | |||||
{ | |||||
/// <summary> | |||||
/// 货位到货位搬运 | |||||
/// </summary> | |||||
SLOT_ROLLER_MOVE, | |||||
/// <summary> | |||||
/// 点到点搬运 | |||||
/// </summary> | |||||
POINT_ROLLER_MOVE | |||||
} | |||||
} |
@@ -0,0 +1,29 @@ | |||||
namespace BPASmartClient.AGV.Enums | |||||
{ | |||||
/// <summary> | |||||
/// QuickPick任务枚举 | |||||
/// </summary> | |||||
public enum QuickPickTask | |||||
{ | |||||
/// <summary> | |||||
/// 到站 | |||||
/// </summary> | |||||
ENTER_STATION, | |||||
/// <summary> | |||||
/// 任务完成 | |||||
/// </summary> | |||||
DONE, | |||||
/// <summary> | |||||
/// 任务取消 | |||||
/// </summary> | |||||
CANCEL, | |||||
/// <summary> | |||||
/// 离站 | |||||
/// </summary> | |||||
LEAVE_STATION, | |||||
/// <summary> | |||||
/// 回滚(有其他任务,当前任务可不执行) | |||||
/// </summary> | |||||
ROLLBACK | |||||
} | |||||
} |
@@ -0,0 +1,37 @@ | |||||
namespace BPASmartClient.AGV.Enums | |||||
{ | |||||
/// <summary> | |||||
/// 货架/货位/点到点货架搬运任务枚举 | |||||
/// </summary> | |||||
public enum STC | |||||
{ | |||||
/// <summary> | |||||
/// //顶升完成 | |||||
/// </summary> | |||||
LIFT_UP_DONE, | |||||
/// <summary> | |||||
/// 开始移动 | |||||
/// </summary> | |||||
MOVE_BEGIN, | |||||
/// <summary> | |||||
/// 放下完成 | |||||
/// </summary> | |||||
PUT_DOWN_DONE, | |||||
/// <summary> | |||||
/// 任务完成 | |||||
/// </summary> | |||||
DONE, | |||||
/// <summary> | |||||
/// 任务取消 | |||||
/// </summary> | |||||
CANCEL, | |||||
/// <summary> | |||||
/// 任务异常取消 | |||||
/// </summary> | |||||
ABNORMAL_CANCEL, | |||||
/// <summary> | |||||
/// 任务异常完成 | |||||
/// </summary> | |||||
ABNORMAL_COMPLETED, | |||||
} | |||||
} |
@@ -0,0 +1,13 @@ | |||||
namespace BPASmartClient.AGV.Enums | |||||
{ | |||||
/// <summary> | |||||
/// 小皮带任务枚举 | |||||
/// </summary> | |||||
public enum SmallBelt | |||||
{ | |||||
/// <summary> | |||||
/// 任务完成 | |||||
/// </summary> | |||||
DONE | |||||
} | |||||
} |
@@ -0,0 +1,23 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.AGV.Feedback | |||||
{ | |||||
public class JobData | |||||
{ | |||||
public string agvCode { get; set; } | |||||
public string containerCode { get; set; } | |||||
public string startPointCode { get; set; } | |||||
public string startSlotCode { get; set; } | |||||
public string targetPointCode { get; set; } | |||||
public string targetSlotCode { get; set; } | |||||
public bool loadInteractive { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,22 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.AGV.Feedback | |||||
{ | |||||
public class @event | |||||
{ | |||||
public string robotJobId { get; set; } | |||||
public int warehouseId { get; set; } | |||||
public string jobId { get; set; } | |||||
public string state { get; set; } | |||||
public string jobType { get; set; } | |||||
public JobData jobData { get; set; } = new JobData(); | |||||
} | |||||
} |
@@ -1,9 +1,13 @@ | |||||
<Project Sdk="Microsoft.NET.Sdk"> | |||||
<Project Sdk="Microsoft.NET.Sdk.Web"> | |||||
<PropertyGroup> | <PropertyGroup> | ||||
<TargetFramework>net6.0</TargetFramework> | <TargetFramework>net6.0</TargetFramework> | ||||
<ImplicitUsings>enable</ImplicitUsings> | |||||
<Nullable>enable</Nullable> | <Nullable>enable</Nullable> | ||||
<ImplicitUsings>enable</ImplicitUsings> | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | |||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" /> | |||||
</ItemGroup> | |||||
</Project> | </Project> |
@@ -0,0 +1,16 @@ | |||||
using Microsoft.AspNetCore.Mvc; | |||||
namespace BPASmartClient.AgvApi.Controllers | |||||
{ | |||||
[ApiController] | |||||
[Route("apicallback/quicktron/[Controller]")] | |||||
public class AgvStatusController : ControllerBase | |||||
{ | |||||
[HttpPost("AgvCallback")] | |||||
public string AgvCallback(Sign sign) | |||||
{ | |||||
return "SUCCESS"; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,33 @@ | |||||
using Microsoft.AspNetCore.Mvc; | |||||
namespace BPASmartClient.AgvApi.Controllers | |||||
{ | |||||
[ApiController] | |||||
[Route("[controller]")] | |||||
public class WeatherForecastController : ControllerBase | |||||
{ | |||||
private static readonly string[] Summaries = new[] | |||||
{ | |||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" | |||||
}; | |||||
private readonly ILogger<WeatherForecastController> _logger; | |||||
public WeatherForecastController(ILogger<WeatherForecastController> logger) | |||||
{ | |||||
_logger = logger; | |||||
} | |||||
[HttpGet(Name = "GetWeatherForecast")] | |||||
public IEnumerable<WeatherForecast> Get() | |||||
{ | |||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast | |||||
{ | |||||
Date = DateTime.Now.AddDays(index), | |||||
TemperatureC = Random.Shared.Next(-20, 55), | |||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)] | |||||
}) | |||||
.ToArray(); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,29 @@ | |||||
using Microsoft.AspNetCore.SignalR; | |||||
namespace BPASmartClient.AgvApi | |||||
{ | |||||
public class PersonHub : Hub | |||||
{ | |||||
public override Task OnConnectedAsync() | |||||
{ | |||||
Console.WriteLine($"{Context.ConnectionId}:= 连接成功"); | |||||
return base.OnConnectedAsync(); | |||||
} | |||||
public override Task OnDisconnectedAsync(Exception? exception) | |||||
{ | |||||
Console.WriteLine($"{Context.ConnectionId}:= 断开连接"); | |||||
return base.OnDisconnectedAsync(exception); | |||||
} | |||||
/// <summary> | |||||
/// 接收客户端发来的信息,并向客户端发送信息 | |||||
/// </summary> | |||||
/// <param name="str"></param> | |||||
/// <returns></returns> | |||||
public Task Send(string str) | |||||
{ | |||||
return Clients.Caller.SendAsync("SendMessage", str); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,36 @@ | |||||
using BPASmartClient.AgvApi; | |||||
var builder = WebApplication.CreateBuilder(args); | |||||
// Add services to the container. | |||||
builder.Services.AddControllers(); | |||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle | |||||
builder.Services.AddEndpointsApiExplorer(); | |||||
builder.Services.AddSwaggerGen(); | |||||
builder.Services.AddSignalR(); | |||||
var app = builder.Build(); | |||||
// Configure the HTTP request pipeline. | |||||
if (app.Environment.IsDevelopment()) | |||||
{ | |||||
app.UseSwagger(); | |||||
app.UseSwaggerUI(); | |||||
} | |||||
app.Use(async (context, next) => | |||||
{ | |||||
context.Request.Headers["appKey"] = "0123456789abcdef"; | |||||
context.Response.Headers["appSecret"] = "0123456789abcdef"; | |||||
context.Response.Headers["requestId"] = "5f643ece-dc53-4d55-8e5f-d1e2dfd6a6d0"; | |||||
context.Response.Headers["timestamp"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); | |||||
context.Response.Headers["version"] = "2.8"; | |||||
await next(); | |||||
}); | |||||
app.UseAuthorization(); | |||||
app.MapControllers(); | |||||
app.MapHub<PersonHub>("/personhub"); | |||||
app.Run(); |
@@ -0,0 +1,31 @@ | |||||
{ | |||||
"$schema": "https://json.schemastore.org/launchsettings.json", | |||||
"iisSettings": { | |||||
"windowsAuthentication": false, | |||||
"anonymousAuthentication": true, | |||||
"iisExpress": { | |||||
"applicationUrl": "http://localhost:38659", | |||||
"sslPort": 0 | |||||
} | |||||
}, | |||||
"profiles": { | |||||
"BPASmartClient.AgvApi": { | |||||
"commandName": "Project", | |||||
"dotnetRunMessages": true, | |||||
"launchBrowser": true, | |||||
"launchUrl": "swagger", | |||||
"applicationUrl": "http://localhost:5175", | |||||
"environmentVariables": { | |||||
"ASPNETCORE_ENVIRONMENT": "Development" | |||||
} | |||||
}, | |||||
"IIS Express": { | |||||
"commandName": "IISExpress", | |||||
"launchBrowser": true, | |||||
"launchUrl": "swagger", | |||||
"environmentVariables": { | |||||
"ASPNETCORE_ENVIRONMENT": "Development" | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,10 @@ | |||||
namespace BPASmartClient.AgvApi | |||||
{ | |||||
public class Sign | |||||
{ | |||||
public int a { get; set; } | |||||
public int b { get; set; } | |||||
public string c { get; set; } | |||||
public string d { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,13 @@ | |||||
namespace BPASmartClient.AgvApi | |||||
{ | |||||
public class WeatherForecast | |||||
{ | |||||
public DateTime Date { get; set; } | |||||
public int TemperatureC { get; set; } | |||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); | |||||
public string? Summary { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,8 @@ | |||||
{ | |||||
"Logging": { | |||||
"LogLevel": { | |||||
"Default": "Information", | |||||
"Microsoft.AspNetCore": "Warning" | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,9 @@ | |||||
{ | |||||
"Logging": { | |||||
"LogLevel": { | |||||
"Default": "Information", | |||||
"Microsoft.AspNetCore": "Warning" | |||||
} | |||||
}, | |||||
"AllowedHosts": "*" | |||||
} |
@@ -42,6 +42,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||||
Date = DateTime.Now.ToString("yyyy-MM-dd"), | Date = DateTime.Now.ToString("yyyy-MM-dd"), | ||||
Time = DateTime.Now.ToString("HH:mm:ss"), | Time = DateTime.Now.ToString("HH:mm:ss"), | ||||
Permission = Global.userInfo.permission.ToString(), | Permission = Global.userInfo.permission.ToString(), | ||||
UserName = Global.userInfo.UserName, | |||||
LogInfo = info | LogInfo = info | ||||
}; | }; | ||||
Sqlite<UserLog>.GetInstance.Base.Add(userLog); | Sqlite<UserLog>.GetInstance.Base.Add(userLog); | ||||
@@ -31,6 +31,8 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||||
public string Time { get; set; } | public string Time { get; set; } | ||||
public string UserName { get; set; } | |||||
public string LogInfo { get; set; } | public string LogInfo { get; set; } | ||||
} | } | ||||
@@ -234,11 +234,11 @@ | |||||
Grid.Row="1" | Grid.Row="1" | ||||
Height="40" | Height="40" | ||||
Margin="20,0" | Margin="20,0" | ||||
TabIndex="1" | |||||
BorderBrush="#009DFF" | BorderBrush="#009DFF" | ||||
FontSize="16" | FontSize="16" | ||||
Foreground="#aadddddd" | Foreground="#aadddddd" | ||||
Style="{DynamicResource UserTextBoxStyle}" | Style="{DynamicResource UserTextBoxStyle}" | ||||
TabIndex="1" | |||||
Text="{Binding UserName}" /> | Text="{Binding UserName}" /> | ||||
<PasswordBox | <PasswordBox | ||||
@@ -246,14 +246,14 @@ | |||||
Grid.Row="2" | Grid.Row="2" | ||||
Height="40" | Height="40" | ||||
Margin="20,0" | Margin="20,0" | ||||
TabIndex="2" | |||||
common:PasswordHelper.Attach="True" | common:PasswordHelper.Attach="True" | ||||
common:PasswordHelper.Password="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" | common:PasswordHelper.Password="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" | ||||
BorderBrush="#009DFF" | BorderBrush="#009DFF" | ||||
FontSize="16" | FontSize="16" | ||||
Foreground="#aadddddd" | Foreground="#aadddddd" | ||||
PasswordChanged="PasswordBox_PasswordChanged" | PasswordChanged="PasswordBox_PasswordChanged" | ||||
Style="{DynamicResource PasswordBoxStyle}" /> | |||||
Style="{DynamicResource PasswordBoxStyle}" | |||||
TabIndex="2" /> | |||||
<TextBlock | <TextBlock | ||||
Name="markText" | Name="markText" | ||||
@@ -289,10 +289,10 @@ | |||||
Background="#009DFF" | Background="#009DFF" | ||||
BorderThickness="0" | BorderThickness="0" | ||||
Command="{Binding LoginCommand}" | Command="{Binding LoginCommand}" | ||||
TabIndex="3" | |||||
Content="登 录" | Content="登 录" | ||||
FontSize="20" | FontSize="20" | ||||
Foreground="White" /> | |||||
Foreground="White" | |||||
TabIndex="3" /> | |||||
</Grid> | </Grid> | ||||
@@ -9,6 +9,7 @@ | |||||
Title="MainView" | Title="MainView" | ||||
Width="1200" | Width="1200" | ||||
Height="700" | Height="700" | ||||
Topmost="False" | |||||
AllowsTransparency="True" | AllowsTransparency="True" | ||||
Background="{x:Null}" | Background="{x:Null}" | ||||
WindowStartupLocation="CenterScreen" | WindowStartupLocation="CenterScreen" | ||||
@@ -5,6 +5,7 @@ | |||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||||
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View" | xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View" | ||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls" | |||||
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel" | xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel" | ||||
d:DesignHeight="450" | d:DesignHeight="450" | ||||
d:DesignWidth="800" | d:DesignWidth="800" | ||||
@@ -51,7 +52,7 @@ | |||||
<Setter Property="HorizontalAlignment" Value="Center" /> | <Setter Property="HorizontalAlignment" Value="Center" /> | ||||
<Setter Property="VerticalAlignment" Value="Center" /> | <Setter Property="VerticalAlignment" Value="Center" /> | ||||
<Setter Property="Background" Value="Transparent" /> | <Setter Property="Background" Value="Transparent" /> | ||||
<Setter Property="Foreground" Value="Red" /> | |||||
<Setter Property="Foreground" Value="#20FDFA" /> | |||||
<Setter Property="FontSize" Value="14" /> | <Setter Property="FontSize" Value="14" /> | ||||
</Style> | </Style> | ||||
@@ -84,6 +85,76 @@ | |||||
</ControlTemplate.Triggers> | </ControlTemplate.Triggers> | ||||
</ControlTemplate> | </ControlTemplate> | ||||
<!--#region 用户输入框样式--> | |||||
<Style x:Key="SearchTextBoxStyle" TargetType="TextBox"> | |||||
<Setter Property="Background" Value="Transparent" /> | |||||
<Setter Property="CaretBrush" Value="#009DFF" /> | |||||
<Setter Property="Template"> | |||||
<Setter.Value> | |||||
<ControlTemplate TargetType="TextBox"> | |||||
<Border | |||||
x:Name="border" | |||||
Background="{TemplateBinding Background}" | |||||
BorderBrush="{TemplateBinding BorderBrush}" | |||||
BorderThickness="{TemplateBinding BorderThickness}" | |||||
CornerRadius="0" | |||||
SnapsToDevicePixels="true"> | |||||
<Grid> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="40" /> | |||||
<ColumnDefinition /> | |||||
</Grid.ColumnDefinitions> | |||||
<TextBlock | |||||
x:Name="PasswordTextBlock" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
FontFamily="../../Fonts/#iconfont" | |||||
FontSize="16" | |||||
Foreground="{TemplateBinding BorderBrush}" | |||||
Text="" /> | |||||
<TextBlock | |||||
Name="markText" | |||||
Grid.Column="1" | |||||
Margin="10,0" | |||||
HorizontalAlignment="Left" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="#88009dff" | |||||
Text="请输入账号名称" | |||||
Visibility="Collapsed" /> | |||||
<ScrollViewer | |||||
x:Name="PART_ContentHost" | |||||
Grid.Column="1" | |||||
MinHeight="20" | |||||
VerticalAlignment="Center" | |||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||||
</Grid> | |||||
</Border> | |||||
<ControlTemplate.Triggers> | |||||
<Trigger Property="IsEnabled" Value="false"> | |||||
<Setter TargetName="border" Property="Opacity" Value="0.56" /> | |||||
</Trigger> | |||||
<Trigger Property="IsMouseOver" Value="true"> | |||||
<Setter TargetName="border" Property="BorderBrush" Value="#FF7EB4EA" /> | |||||
</Trigger> | |||||
<Trigger Property="IsKeyboardFocused" Value="true"> | |||||
<Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" /> | |||||
</Trigger> | |||||
<DataTrigger Binding="{Binding Path=Text, RelativeSource={RelativeSource Mode=self}}" Value=""> | |||||
<Setter TargetName="markText" Property="Visibility" Value="Visible" /> | |||||
</DataTrigger> | |||||
</ControlTemplate.Triggers> | |||||
</ControlTemplate> | |||||
</Setter.Value> | |||||
</Setter> | |||||
</Style> | |||||
<!--#endregion--> | |||||
</ResourceDictionary> | </ResourceDictionary> | ||||
</ResourceDictionary.MergedDictionaries> | </ResourceDictionary.MergedDictionaries> | ||||
</ResourceDictionary> | </ResourceDictionary> | ||||
@@ -100,6 +171,17 @@ | |||||
HorizontalAlignment="Right" | HorizontalAlignment="Right" | ||||
Orientation="Horizontal"> | Orientation="Horizontal"> | ||||
<TextBox | |||||
Width="200" | |||||
Margin="20,0" | |||||
BorderBrush="#009DFF" | |||||
FontSize="16" | |||||
Foreground="#aadddddd" | |||||
Style="{DynamicResource SearchTextBoxStyle}" | |||||
TabIndex="1" | |||||
Text="{Binding SearchUser}" | |||||
Visibility="{Binding IsVisibility}" /> | |||||
<DatePicker | <DatePicker | ||||
Background="Transparent" | Background="Transparent" | ||||
BorderBrush="#aa3aa7f3" | BorderBrush="#aa3aa7f3" | ||||
@@ -160,9 +242,10 @@ | |||||
<!--#region 表格标题栏设置--> | <!--#region 表格标题栏设置--> | ||||
<Grid Grid.Row="1" Background="#dd2AB2E7"> | <Grid Grid.Row="1" Background="#dd2AB2E7"> | ||||
<Grid.ColumnDefinitions> | <Grid.ColumnDefinitions> | ||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.3*" /> | |||||
<ColumnDefinition Width="0.3*" /> | |||||
<ColumnDefinition Width="0.3*" /> | |||||
<ColumnDefinition Width="0.3*" /> | |||||
<ColumnDefinition /> | <ColumnDefinition /> | ||||
</Grid.ColumnDefinitions> | </Grid.ColumnDefinitions> | ||||
@@ -201,13 +284,21 @@ | |||||
VerticalAlignment="Center" | VerticalAlignment="Center" | ||||
FontSize="16" | FontSize="16" | ||||
Foreground="{StaticResource TitleFontColor}" | Foreground="{StaticResource TitleFontColor}" | ||||
Text="消息日志" /> | |||||
Text="用户名" /> | |||||
<Border | <Border | ||||
BorderBrush="{StaticResource TitleBorderColor}" | BorderBrush="{StaticResource TitleBorderColor}" | ||||
BorderThickness="1,0,1,0" | BorderThickness="1,0,1,0" | ||||
Cursor="SizeWE" /> | Cursor="SizeWE" /> | ||||
</Grid> | </Grid> | ||||
<TextBlock | |||||
Grid.Column="4" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="{StaticResource TitleFontColor}" | |||||
Text="消息日志" /> | |||||
</Grid> | </Grid> | ||||
<!--#endregion--> | <!--#endregion--> | ||||
@@ -224,9 +315,10 @@ | |||||
<DataTemplate> | <DataTemplate> | ||||
<Grid x:Name="gr" Height="30"> | <Grid x:Name="gr" Height="30"> | ||||
<Grid.ColumnDefinitions> | <Grid.ColumnDefinitions> | ||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.3*" /> | |||||
<ColumnDefinition Width="0.3*" /> | |||||
<ColumnDefinition Width="0.3*" /> | |||||
<ColumnDefinition Width="0.3*" /> | |||||
<ColumnDefinition /> | <ColumnDefinition /> | ||||
</Grid.ColumnDefinitions> | </Grid.ColumnDefinitions> | ||||
@@ -250,10 +342,17 @@ | |||||
Margin="10,0,0,0" | Margin="10,0,0,0" | ||||
HorizontalAlignment="Left" | HorizontalAlignment="Left" | ||||
Style="{StaticResource DataTextBlockStyle}" | Style="{StaticResource DataTextBlockStyle}" | ||||
Text="{Binding LogInfo}" /> | |||||
Text="{Binding UserName}" /> | |||||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | <Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | ||||
</Grid> | </Grid> | ||||
<TextBlock | |||||
Grid.Column="4" | |||||
Margin="10,0,0,0" | |||||
HorizontalAlignment="Left" | |||||
Style="{StaticResource DataTextBlockStyle}" | |||||
Text="{Binding LogInfo}" /> | |||||
<Border | <Border | ||||
Grid.ColumnSpan="6" | Grid.ColumnSpan="6" | ||||
BorderBrush="{StaticResource BorderSolid}" | BorderBrush="{StaticResource BorderSolid}" | ||||
@@ -278,9 +377,10 @@ | |||||
<DataTemplate> | <DataTemplate> | ||||
<Grid x:Name="gr" Height="30"> | <Grid x:Name="gr" Height="30"> | ||||
<Grid.ColumnDefinitions> | <Grid.ColumnDefinitions> | ||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.7*" /> | |||||
<ColumnDefinition Width="0.3*" /> | |||||
<ColumnDefinition Width="0.3*" /> | |||||
<ColumnDefinition Width="0.3*" /> | |||||
<ColumnDefinition Width="0.3*" /> | |||||
<ColumnDefinition /> | <ColumnDefinition /> | ||||
</Grid.ColumnDefinitions> | </Grid.ColumnDefinitions> | ||||
@@ -304,10 +404,17 @@ | |||||
Margin="10,0,0,0" | Margin="10,0,0,0" | ||||
HorizontalAlignment="Left" | HorizontalAlignment="Left" | ||||
Style="{StaticResource DataTextBlockStyle}" | Style="{StaticResource DataTextBlockStyle}" | ||||
Text="{Binding LogInfo}" /> | |||||
Text="{Binding UserName}" /> | |||||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | <Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | ||||
</Grid> | </Grid> | ||||
<TextBlock | |||||
Grid.Column="4" | |||||
Margin="10,0,0,0" | |||||
HorizontalAlignment="Left" | |||||
Style="{StaticResource DataTextBlockStyle}" | |||||
Text="{Binding LogInfo}" /> | |||||
<Border | <Border | ||||
Grid.ColumnSpan="6" | Grid.ColumnSpan="6" | ||||
BorderBrush="{StaticResource BorderSolid}" | BorderBrush="{StaticResource BorderSolid}" | ||||
@@ -49,10 +49,12 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||||
{ | { | ||||
var lists = Sqlite<UserLog>.GetInstance.GetData(); | var lists = Sqlite<UserLog>.GetInstance.GetData(); | ||||
var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList(); | var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList(); | ||||
if (res != null) | |||||
var result = res.Where(p => p.UserName == SearchUser && SearchUser != null && SearchUser.Length > 0).ToList(); | |||||
var logs = result != null && SearchUser?.Length > 0 ? result : res; | |||||
if (logs != null) | |||||
{ | { | ||||
HistoryUserLog.Clear(); | HistoryUserLog.Clear(); | ||||
foreach (var item in res) | |||||
foreach (var item in logs) | |||||
{ | { | ||||
HistoryUserLog.Add(item); | HistoryUserLog.Add(item); | ||||
} | } | ||||
@@ -64,10 +66,11 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||||
private void GetHistoryUserLog() | private void GetHistoryUserLog() | ||||
{ | { | ||||
var data = Sqlite<UserLog>.GetInstance.GetData(); | var data = Sqlite<UserLog>.GetInstance.GetData(); | ||||
if (data != null) | |||||
var res = data.Where(p => p.UserName == Global.userInfo.UserName).ToList(); | |||||
if (res != null) | |||||
{ | { | ||||
HistoryUserLog.Clear(); | HistoryUserLog.Clear(); | ||||
foreach (var item in data) | |||||
foreach (var item in res) | |||||
{ | { | ||||
int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days; | int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days; | ||||
if (day == 0) | if (day == 0) | ||||
@@ -118,6 +121,11 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||||
public DateTime EndDateTime { get { return _mEndDateTime; } set { _mEndDateTime = value; OnPropertyChanged(); } } | public DateTime EndDateTime { get { return _mEndDateTime; } set { _mEndDateTime = value; OnPropertyChanged(); } } | ||||
private DateTime _mEndDateTime = DateTime.Now; | private DateTime _mEndDateTime = DateTime.Now; | ||||
public string SearchUser { get { return _mSearchUser; } set { _mSearchUser = value; OnPropertyChanged(); } } | |||||
private string _mSearchUser; | |||||
public ObservableCollection<UserLog> HistoryUserLog { get; set; } = new ObservableCollection<UserLog>(); | public ObservableCollection<UserLog> HistoryUserLog { get; set; } = new ObservableCollection<UserLog>(); | ||||
public ObservableCollection<UserLog> UserLogs { get; set; } | public ObservableCollection<UserLog> UserLogs { get; set; } | ||||
@@ -432,7 +432,7 @@ | |||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> | <Setter Property="HorizontalContentAlignment" Value="Stretch" /> | ||||
<!-- Set CalendarStyle to DatePickerCalendarStyle. --> | <!-- Set CalendarStyle to DatePickerCalendarStyle. --> | ||||
<Setter Property="CalendarStyle" Value="{DynamicResource DatePickerCalendarStyle}" /> | <Setter Property="CalendarStyle" Value="{DynamicResource DatePickerCalendarStyle}" /> | ||||
<Setter Property="Width" Value="200" /> | |||||
<Setter Property="Width" Value="130" /> | |||||
<Setter Property="FontSize" Value="12" /> | <Setter Property="FontSize" Value="12" /> | ||||
<!--<Setter Property="Height" Value="30" />--> | <!--<Setter Property="Height" Value="30" />--> | ||||
<Setter Property="Template"> | <Setter Property="Template"> | ||||
@@ -0,0 +1,36 @@ | |||||
<UserControl | |||||
x:Class="BPASmartClient.CustomResource.UserControls.WatermarkText" | |||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||||
xmlns:local="clr-namespace:BPASmartClient.CustomResource.UserControls" | |||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||||
d:DesignHeight="30" | |||||
d:DesignWidth="100" | |||||
mc:Ignorable="d"> | |||||
<Border | |||||
Background="{Binding WTBackground}" | |||||
BorderBrush="{Binding Stroke}" | |||||
BorderThickness="{Binding StrokeThickness}" | |||||
CornerRadius="{Binding WTCornerRadius}"> | |||||
<Grid> | |||||
<TextBox | |||||
Name="Maintb" | |||||
Margin="5,0,0,0" | |||||
Background="Transparent" | |||||
BorderThickness="0" | |||||
Text="{Binding Text}" /> | |||||
<TextBlock | |||||
Name="Subtb" | |||||
Margin="5,0,0,0" | |||||
HorizontalAlignment="Left" | |||||
VerticalAlignment="Center" | |||||
Background="Transparent" | |||||
Foreground="{Binding SubForeground}" | |||||
IsHitTestVisible="False" | |||||
Text="{Binding SubText}" /> | |||||
</Grid> | |||||
</Border> | |||||
</UserControl> |
@@ -0,0 +1,121 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using System.Windows; | |||||
using System.Windows.Controls; | |||||
using System.Windows.Data; | |||||
using System.Windows.Documents; | |||||
using System.Windows.Input; | |||||
using System.Windows.Media; | |||||
using System.Windows.Media.Imaging; | |||||
using System.Windows.Navigation; | |||||
using System.Windows.Shapes; | |||||
using Microsoft.Windows; | |||||
namespace BPASmartClient.CustomResource.UserControls | |||||
{ | |||||
/// <summary> | |||||
/// WatermarkText.xaml 的交互逻辑 | |||||
/// </summary> | |||||
public partial class WatermarkText : UserControl | |||||
{ | |||||
public WatermarkText() | |||||
{ | |||||
InitializeComponent(); | |||||
Maintb.TextChanged += Maintb_TextChanged; | |||||
} | |||||
private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | |||||
{ | |||||
(d as WatermarkText)?.Refresh(); | |||||
} | |||||
private void Refresh() | |||||
{ | |||||
//this.Maintb.Text = Text; | |||||
//this.Subtb.Text = SubText; | |||||
//this.Maintb.Background = WTBackground; | |||||
} | |||||
public string Text | |||||
{ | |||||
get { return (string)GetValue(TextProperty); } | |||||
set { SetValue(TextProperty, value); } | |||||
} | |||||
public static readonly DependencyProperty TextProperty = | |||||
DependencyProperty.Register("Text", typeof(string), typeof(WatermarkText), | |||||
new PropertyMetadata(string.Empty, new PropertyChangedCallback(OnPropertyChanged))); | |||||
public string SubText | |||||
{ | |||||
get { return (string)GetValue(SubTextProperty); } | |||||
set { SetValue(SubTextProperty, value); } | |||||
} | |||||
public static readonly DependencyProperty SubTextProperty = | |||||
DependencyProperty.Register("SubText", typeof(string), typeof(WatermarkText), | |||||
new PropertyMetadata(string.Empty, new PropertyChangedCallback(OnPropertyChanged))); | |||||
public Brush WTBackground | |||||
{ | |||||
get { return (Brush)GetValue(WTBackgroundProperty); } | |||||
set { SetValue(WTBackgroundProperty, value); } | |||||
} | |||||
public static readonly DependencyProperty WTBackgroundProperty = | |||||
DependencyProperty.Register("WTBackground", typeof(Brush), typeof(WatermarkText), | |||||
new PropertyMetadata(default(Brush), new PropertyChangedCallback(OnPropertyChanged))); | |||||
public int StrokeThickness | |||||
{ | |||||
get { return (int)GetValue(StrokeThicknessProperty); } | |||||
set { SetValue(StrokeThicknessProperty, value); } | |||||
} | |||||
public static readonly DependencyProperty StrokeThicknessProperty = | |||||
DependencyProperty.Register("StrokeThickness", typeof(int), typeof(WatermarkText), | |||||
new PropertyMetadata(0, new PropertyChangedCallback(OnPropertyChanged))); | |||||
public Brush Stroke | |||||
{ | |||||
get { return (Brush)GetValue(StrokeProperty); } | |||||
set { SetValue(StrokeProperty, value); } | |||||
} | |||||
public static readonly DependencyProperty StrokeProperty = | |||||
DependencyProperty.Register("Stroke", typeof(Brush), typeof(WatermarkText), | |||||
new PropertyMetadata(default(Brush), new PropertyChangedCallback(OnPropertyChanged))); | |||||
public CornerRadius WTCornerRadius | |||||
{ | |||||
get { return (CornerRadius)GetValue(WTCornerRadiusProperty); } | |||||
set { SetValue(WTCornerRadiusProperty, value); } | |||||
} | |||||
public static readonly DependencyProperty WTCornerRadiusProperty = | |||||
DependencyProperty.Register("WTCornerRadius", typeof(CornerRadius), typeof(WatermarkText), | |||||
new PropertyMetadata(new CornerRadius(0), new PropertyChangedCallback(OnPropertyChanged))); | |||||
public Brush SubForeground | |||||
{ | |||||
get { return (Brush)GetValue(SubForegroundProperty); } | |||||
set { SetValue(SubForegroundProperty, value); } | |||||
} | |||||
public static readonly DependencyProperty SubForegroundProperty = | |||||
DependencyProperty.Register("SubForeground", typeof(Brush), typeof(WatermarkText), | |||||
new PropertyMetadata(default(Brush), new PropertyChangedCallback(OnPropertyChanged))); | |||||
private void Maintb_TextChanged(object sender, TextChangedEventArgs e) | |||||
{ | |||||
if (Maintb.Text.Trim().Length > 0) | |||||
Subtb.Visibility = Visibility.Collapsed; | |||||
else | |||||
Subtb.Visibility = Visibility.Visible; | |||||
} | |||||
} | |||||
} |
@@ -1,7 +0,0 @@ | |||||
namespace ClassLibrary1 | |||||
{ | |||||
public class Class1 | |||||
{ | |||||
} | |||||
} |
@@ -25,10 +25,4 @@ | |||||
<ProjectReference Include="..\BPASmartClient.Modbus\BPASmartClient.Modbus.csproj" /> | <ProjectReference Include="..\BPASmartClient.Modbus\BPASmartClient.Modbus.csproj" /> | ||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | |||||
<Page Update="View\AdminstratorsView.xaml"> | |||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||||
</Page> | |||||
</ItemGroup> | |||||
</Project> | </Project> |
@@ -1,180 +0,0 @@ | |||||
<UserControl | |||||
x:Class="BPASmartClient.DosingSystem.View.AdminstratorsView" | |||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||||
xmlns:helper="clr-namespace:BPASmartClient.DosingSystem.View.Helper" | |||||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||||
xmlns:uc="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||||
d:DesignHeight="600" | |||||
d:DesignWidth="800" | |||||
Loaded="UserControl_Loaded" | |||||
mc:Ignorable="d"> | |||||
<UserControl.DataContext> | |||||
<vm:AdminstratorsViewModel /> | |||||
</UserControl.DataContext> | |||||
<UserControl.Resources> | |||||
<Style x:Key="TxLogin" TargetType="TextBlock"> | |||||
<Setter Property="FontSize" Value="20" /> | |||||
<Setter Property="Foreground" Value="#ddd" /> | |||||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||||
<Setter Property="VerticalAlignment" Value="Center" /> | |||||
</Style> | |||||
</UserControl.Resources> | |||||
<Grid> | |||||
<!--<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="7*" /> | |||||
<ColumnDefinition Width="10*" /> | |||||
</Grid.ColumnDefinitions>--> | |||||
<!--<Grid.RowDefinitions> | |||||
<RowDefinition Height="5*" /> | |||||
<RowDefinition Height="5*" /> | |||||
<RowDefinition Height="5*" /> | |||||
<RowDefinition Height="4*" /> | |||||
<RowDefinition Height="8*" /> | |||||
<RowDefinition Height="20*" /> | |||||
</Grid.RowDefinitions>--> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition /> | |||||
<RowDefinition /> | |||||
</Grid.RowDefinitions> | |||||
<!--#region 登录--> | |||||
<Grid> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="0.7*"/> | |||||
<ColumnDefinition /> | |||||
</Grid.ColumnDefinitions> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition /> | |||||
<RowDefinition /> | |||||
<RowDefinition /> | |||||
<RowDefinition /> | |||||
<RowDefinition /> | |||||
</Grid.RowDefinitions> | |||||
<TextBlock | |||||
HorizontalAlignment="Right" | |||||
VerticalAlignment="Center" | |||||
Foreground="#feffff" | |||||
Style="{StaticResource TxLogin}" | |||||
Text="权限:" /> | |||||
<ComboBox | |||||
Grid.Column="1" | |||||
Width="230" | |||||
HorizontalAlignment="Left" | |||||
VerticalAlignment="Center" | |||||
BorderBrush="#FF074B92" | |||||
BorderThickness="1" | |||||
FontFamily="楷体" | |||||
FontSize="20" | |||||
Foreground="#FF2AB2E7" | |||||
IsEditable="False" | |||||
ItemsSource="{Binding permission}" | |||||
Style="{StaticResource ComboBoxStyle}" | |||||
Text="{Binding SelectText}" /> | |||||
<TextBlock | |||||
Grid.Row="1" | |||||
HorizontalAlignment="Right" | |||||
VerticalAlignment="Center" | |||||
Foreground="#feffff" | |||||
Style="{StaticResource TxLogin}" | |||||
Text="账号:" /> | |||||
<TextBox | |||||
x:Name="tbx_admin" | |||||
Grid.Row="1" | |||||
Grid.Column="1" | |||||
Width="230" | |||||
Height="28" | |||||
HorizontalAlignment="Left" | |||||
VerticalAlignment="Center" | |||||
HorizontalContentAlignment="Center" | |||||
VerticalContentAlignment="Top" | |||||
Background="Transparent" | |||||
BorderBrush="White" | |||||
BorderThickness="0,0,0,1" | |||||
FontSize="20" | |||||
Foreground="#F8F8FF" | |||||
GotFocus="TextBox_GotFocus" | |||||
Text="{Binding Admin, Mode=TwoWay}" /> | |||||
<TextBlock | |||||
Grid.Row="2" | |||||
HorizontalAlignment="Right" | |||||
VerticalAlignment="Center" | |||||
Foreground="#feffff" | |||||
Style="{StaticResource TxLogin}" | |||||
Text="密码:" /> | |||||
<PasswordBox | |||||
x:Name="password" | |||||
Grid.Row="2" | |||||
Grid.Column="1" | |||||
Width="230" | |||||
HorizontalAlignment="Left" | |||||
VerticalAlignment="Center" | |||||
HorizontalContentAlignment="Center" | |||||
VerticalContentAlignment="Top" | |||||
helper:PasswordBoxHelper.PasswordContent="{Binding Password, Mode=TwoWay}" | |||||
Background="Transparent" | |||||
BorderBrush="White" | |||||
BorderThickness="0,0,0,1" | |||||
CaretBrush="White" | |||||
FontSize="16" | |||||
Foreground="#F8F8FF" | |||||
GotFocus="Password_GotFocus" /> | |||||
<TextBlock | |||||
Grid.Row="3" | |||||
Grid.ColumnSpan="2" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
FontFamily="楷体" | |||||
FontSize="16" | |||||
Foreground="#FFE2415C" | |||||
Text="{Binding ErrorMessage}" | |||||
TextWrapping="Wrap" /> | |||||
<Button | |||||
Grid.Row="4" | |||||
Grid.ColumnSpan="2" | |||||
Width="120" | |||||
Height="40" | |||||
VerticalAlignment="Center" | |||||
Background="Transparent" | |||||
BorderBrush="#ff19b7ec" | |||||
BorderThickness="2" | |||||
Command="{Binding AdminLoginCommand}" | |||||
Content="登 录" | |||||
FontSize="28" | |||||
Foreground="#9934F7F7" | |||||
IsDefault="True" /> | |||||
</Grid> | |||||
<!--#endregion--> | |||||
<!--#region 密码修改--> | |||||
<Grid> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition /> | |||||
</Grid.ColumnDefinitions> | |||||
</Grid> | |||||
<!--#endregion--> | |||||
<uc:UserKeyBoard | |||||
x:Name="myKeyboard" | |||||
Grid.Row="5" | |||||
Grid.ColumnSpan="2" | |||||
Margin="100,10,100,50" | |||||
Focusable="False" /> | |||||
</Grid> | |||||
</UserControl> |
@@ -1,91 +0,0 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using System.Windows; | |||||
using System.Windows.Controls; | |||||
using System.Windows.Data; | |||||
using System.Windows.Documents; | |||||
using System.Windows.Input; | |||||
using System.Windows.Media; | |||||
using System.Windows.Media.Imaging; | |||||
using System.Windows.Navigation; | |||||
using System.Windows.Shapes; | |||||
using static BPASmartClient.CustomResource.UserControls.UserKeyBoard; | |||||
namespace BPASmartClient.DosingSystem.View | |||||
{ | |||||
/// <summary> | |||||
/// AdministratorsView.xaml 的交互逻辑 | |||||
/// </summary> | |||||
public partial class AdminstratorsView : UserControl | |||||
{ | |||||
public AdminstratorsView() | |||||
{ | |||||
InitializeComponent(); | |||||
} | |||||
private void UserControl_Loaded(object sender, RoutedEventArgs e) | |||||
{ | |||||
this.tbx_admin.Focus(); | |||||
} | |||||
private void MyKeyDown_Admin(object _key) | |||||
{ | |||||
EKeyitem key = EKeyitem.A; | |||||
if (_key.GetType() == typeof(EKeyitem)) key = (EKeyitem)_key; | |||||
switch (key) | |||||
{ | |||||
case EKeyitem.DEL: | |||||
if (tbx_admin.Text.Length > 0) | |||||
{ | |||||
tbx_admin.Text = tbx_admin.Text.Substring(0, tbx_admin.Text.Length - 1); | |||||
} | |||||
break; | |||||
case EKeyitem.AC: | |||||
tbx_admin.Text = string.Empty; | |||||
break; | |||||
case EKeyitem.OK: | |||||
break; | |||||
default: | |||||
tbx_admin.Text += _key.ToString(); | |||||
break; | |||||
} | |||||
this.tbx_admin.Focus(); | |||||
} | |||||
private void MyKeyDown_Password(object _key) | |||||
{ | |||||
EKeyitem key = EKeyitem.A; | |||||
if (_key.GetType() == typeof(EKeyitem)) key = (EKeyitem)_key; | |||||
switch (key) | |||||
{ | |||||
case EKeyitem.DEL: | |||||
if (password.Password.Length > 0) | |||||
{ | |||||
password.Password = password.Password.Substring(0, password.Password.Length - 1); | |||||
} | |||||
break; | |||||
case EKeyitem.AC: | |||||
password.Password = string.Empty; | |||||
break; | |||||
case EKeyitem.OK: | |||||
break; | |||||
default: | |||||
password.Password += _key.ToString(); | |||||
break; | |||||
} | |||||
} | |||||
private void TextBox_GotFocus(object sender, RoutedEventArgs e) | |||||
{ | |||||
myKeyboard.MyKeyDown = MyKeyDown_Admin; | |||||
} | |||||
private void Password_GotFocus(object sender, RoutedEventArgs e) | |||||
{ | |||||
myKeyboard.MyKeyDown = MyKeyDown_Password; | |||||
} | |||||
} | |||||
} |
@@ -1,40 +0,0 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using System.Windows; | |||||
using System.Windows.Controls; | |||||
namespace BPASmartClient.DosingSystem.View.Helper | |||||
{ | |||||
/// <summary> | |||||
/// 为PasswordBox控件的Password增加绑定功能 | |||||
/// </summary> | |||||
public static class PasswordBoxHelper | |||||
{ | |||||
public static string GetPasswordContent(DependencyObject obj) => (string)obj.GetValue(PasswordContentProperty); | |||||
public static void SetPasswordContent(DependencyObject obj, string value) => obj.SetValue(PasswordContentProperty, value); | |||||
public static readonly DependencyProperty PasswordContentProperty = | |||||
DependencyProperty.RegisterAttached("PasswordContent", typeof(string), typeof(PasswordBoxHelper), | |||||
new PropertyMetadata(string.Empty, OnPasswordContentPropertyChanged)); | |||||
private static void OnPasswordContentPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | |||||
{ | |||||
var box = d as PasswordBox; | |||||
box.PasswordChanged -= OnPasswordChanged; | |||||
var password = (string)e.NewValue; | |||||
if (box != null && box.Password != password) | |||||
box.Password = password; | |||||
box.PasswordChanged += OnPasswordChanged; | |||||
} | |||||
private static void OnPasswordChanged(object sender, RoutedEventArgs e) | |||||
{ | |||||
var box = sender as PasswordBox; | |||||
SetPasswordContent(box, box.Password); | |||||
} | |||||
} | |||||
} |
@@ -1,49 +0,0 @@ | |||||
using BPASmartClient.Helper; | |||||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using System.Collections.ObjectModel; | |||||
namespace BPASmartClient.DosingSystem.ViewModel | |||||
{ | |||||
public class AdminstratorsViewModel : ObservableObject | |||||
{ | |||||
public string Admin { get { return _admin; } set { _admin = value; OnPropertyChanged(); } } | |||||
private string _admin; | |||||
public string Password { get { return _password; } set { _password = value; OnPropertyChanged(); } } | |||||
private string _password; | |||||
public string ErrorMessage { get { return _errorMessage; } set { _errorMessage = value; OnPropertyChanged(); } } | |||||
private string _errorMessage; | |||||
public string SelectText { get { return _mSelectText; } set { _mSelectText = value; OnPropertyChanged(); } } | |||||
private string _mSelectText; | |||||
public RelayCommand AdminLoginCommand { get; set; } | |||||
public ObservableCollection<string> permission { get; set; } = new ObservableCollection<string>(); | |||||
public AdminstratorsViewModel() | |||||
{ | |||||
AdminLoginCommand = new RelayCommand(() => | |||||
{ | |||||
var rest = ActionManage.GetInstance.SendResult("LoginBPASmartClient.DosingSystem", $"{Admin}-={Password}-={SelectText}"); | |||||
if (rest != null && rest is string str) | |||||
{ | |||||
ErrorMessage = str; | |||||
} | |||||
}); | |||||
permission.Add("管理员"); | |||||
permission.Add("操作员"); | |||||
permission.Add("观察员"); | |||||
permission.Add("技术员"); | |||||
SelectText = permission[0]; | |||||
} | |||||
} | |||||
} |
@@ -24,23 +24,18 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
Recipes = Json<LocaPar>.Data.Recipes; | Recipes = Json<LocaPar>.Data.Recipes; | ||||
StartCommand = new RelayCommand<object>((o) => | StartCommand = new RelayCommand<object>((o) => | ||||
{ | { | ||||
if (o != null && o is string deviceName) | |||||
{ | |||||
//Task.Run(new Action(() => | |||||
//{ | |||||
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == deviceName); | |||||
if (index >= 0 && index < Recipes.Count) | |||||
{ | |||||
Recipes.ElementAt(index).IsEnable = false; | |||||
//foreach (var item in Recipes.ElementAt(index).RawMaterials) | |||||
//{ | |||||
// DeviceInquire.GetInstance.GetDevice(item.DeviceIp)?.Start(item.RawMaterialWeight);//启动写入 | |||||
//} | |||||
} | |||||
//})); | |||||
MessageLog.GetInstance.ShowUserLog($"下发工单 { Recipes.ElementAt(index).RecipeName}"); | |||||
devices.Enqueue(deviceName); | |||||
} | |||||
//if (o != null && o is string deviceName) | |||||
//{ | |||||
// int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == deviceName); | |||||
// if (index >= 0 && index < Recipes.Count) | |||||
// { | |||||
// Recipes.ElementAt(index).IsEnable = false; | |||||
// } | |||||
// MessageLog.GetInstance.ShowUserLog($"下发工单 { Recipes.ElementAt(index).RecipeName}"); | |||||
// devices.Enqueue(deviceName); | |||||
//} | |||||
MessageLog.GetInstance.ShowUserLog($"下发工单 { Guid.NewGuid().ToString()}"); | |||||
}); | }); | ||||
@@ -16,6 +16,7 @@ | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="6.0.6" /> | |||||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | <PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | ||||
<PackageReference Include="NModbus" Version="3.0.72" /> | <PackageReference Include="NModbus" Version="3.0.72" /> | ||||
</ItemGroup> | </ItemGroup> | ||||
@@ -0,0 +1,46 @@ | |||||
using Microsoft.AspNetCore.SignalR.Client; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace FryPot_DosingSystem.Helper | |||||
{ | |||||
public class HubHelper | |||||
{ | |||||
private volatile static HubHelper _Instance; | |||||
public static HubHelper GetInstance => _Instance ?? (_Instance = new HubHelper()); | |||||
private HubHelper() { } | |||||
HubConnection hubConnection; | |||||
public void Connect() | |||||
{ | |||||
hubConnection = new HubConnectionBuilder().WithAutomaticReconnect().WithUrl("http://localhost:5175/personhub").Build();//连接 | |||||
hubConnection.On<string>("", (s) => | |||||
{ | |||||
//注册接收消息的委托 | |||||
}); | |||||
try | |||||
{ | |||||
hubConnection.StartAsync(); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
throw; | |||||
} | |||||
} | |||||
public void SendMessage(string info) | |||||
{ | |||||
hubConnection.SendAsync("Send", info); | |||||
} | |||||
} | |||||
} |
@@ -104,7 +104,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkT_Show", | |||||
EndProject | EndProject | ||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FryPot_DosingSystem", "FryPot_DosingSystem\FryPot_DosingSystem.csproj", "{D638DFA2-D160-4D32-912F-385BC04A9382}" | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FryPot_DosingSystem", "FryPot_DosingSystem\FryPot_DosingSystem.csproj", "{D638DFA2-D160-4D32-912F-385BC04A9382}" | ||||
EndProject | EndProject | ||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.ZhuoDian", "BPASmartClient.ZhuoDian\BPASmartClient.ZhuoDian.csproj", "{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}" | |||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.ZhuoDian", "BPASmartClient.ZhuoDian\BPASmartClient.ZhuoDian.csproj", "{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}" | |||||
EndProject | |||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.AgvApi", "BPASmartClient.AgvApi\BPASmartClient.AgvApi.csproj", "{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}" | |||||
EndProject | EndProject | ||||
Global | Global | ||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
@@ -980,6 +982,26 @@ Global | |||||
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Release|x64.Build.0 = Release|Any CPU | {C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Release|x64.Build.0 = Release|Any CPU | ||||
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Release|x86.ActiveCfg = Release|Any CPU | {C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Release|x86.ActiveCfg = Release|Any CPU | ||||
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Release|x86.Build.0 = Release|Any CPU | {C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Release|x86.Build.0 = Release|Any CPU | ||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Debug|ARM.Build.0 = Debug|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Debug|ARM64.Build.0 = Debug|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Debug|x64.ActiveCfg = Debug|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Debug|x64.Build.0 = Debug|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Debug|x86.ActiveCfg = Debug|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Debug|x86.Build.0 = Debug|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Release|ARM.ActiveCfg = Release|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Release|ARM.Build.0 = Release|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Release|ARM64.ActiveCfg = Release|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Release|ARM64.Build.0 = Release|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Release|x64.ActiveCfg = Release|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Release|x64.Build.0 = Release|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Release|x86.ActiveCfg = Release|Any CPU | |||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E}.Release|x86.Build.0 = Release|Any CPU | |||||
EndGlobalSection | EndGlobalSection | ||||
GlobalSection(SolutionProperties) = preSolution | GlobalSection(SolutionProperties) = preSolution | ||||
HideSolutionNode = FALSE | HideSolutionNode = FALSE | ||||
@@ -1028,6 +1050,7 @@ Global | |||||
{3653724D-3683-4722-B978-EB88DD4AE5DB} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | {3653724D-3683-4722-B978-EB88DD4AE5DB} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | ||||
{D638DFA2-D160-4D32-912F-385BC04A9382} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | {D638DFA2-D160-4D32-912F-385BC04A9382} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | ||||
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | {C5D53928-34F6-4FA0-A8E6-261BAC1A659C} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | ||||
{77EE62D2-B6D0-44A6-B7F4-D570E13EC15E} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||||
EndGlobalSection | EndGlobalSection | ||||
GlobalSection(ExtensibilityGlobals) = postSolution | GlobalSection(ExtensibilityGlobals) = postSolution | ||||
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC} | SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC} | ||||
@@ -1,8 +0,0 @@ | |||||
using System; | |||||
namespace WpfLibrary1 | |||||
{ | |||||
public class Class1 | |||||
{ | |||||
} | |||||
} |
@@ -1,9 +0,0 @@ | |||||
<Project Sdk="Microsoft.NET.Sdk"> | |||||
<PropertyGroup> | |||||
<TargetFramework>net6.0-windows</TargetFramework> | |||||
<Nullable>enable</Nullable> | |||||
<UseWPF>true</UseWPF> | |||||
</PropertyGroup> | |||||
</Project> |