Browse Source

解决冲突

样式分支
pengliangyang 2 years ago
parent
commit
89a293ecb4
100 changed files with 6304 additions and 356 deletions
  1. +88
    -3
      BPASmartClient.AGV/AGVHelper.cs
  2. +25
    -0
      BPASmartClient.AGV/Enums/AGVMove.cs
  3. +36
    -0
      BPASmartClient.AGV/Enums/BinTask.cs
  4. +32
    -0
      BPASmartClient.AGV/Enums/CTC.cs
  5. +20
    -0
      BPASmartClient.AGV/Enums/JobType.cs
  6. +29
    -0
      BPASmartClient.AGV/Enums/QuickPickTask.cs
  7. +37
    -0
      BPASmartClient.AGV/Enums/STC.cs
  8. +13
    -0
      BPASmartClient.AGV/Enums/SmallBelt.cs
  9. +23
    -0
      BPASmartClient.AGV/Feedback/JobData.cs
  10. +22
    -0
      BPASmartClient.AGV/Feedback/event.cs
  11. +6
    -2
      BPASmartClient.AgvApi/BPASmartClient.AgvApi.csproj
  12. +16
    -0
      BPASmartClient.AgvApi/Controllers/AgvStatusController.cs
  13. +33
    -0
      BPASmartClient.AgvApi/Controllers/WeatherForecastController.cs
  14. +29
    -0
      BPASmartClient.AgvApi/PersonHub.cs
  15. +36
    -0
      BPASmartClient.AgvApi/Program.cs
  16. +31
    -0
      BPASmartClient.AgvApi/Properties/launchSettings.json
  17. +10
    -0
      BPASmartClient.AgvApi/Sign.cs
  18. +13
    -0
      BPASmartClient.AgvApi/WeatherForecast.cs
  19. +8
    -0
      BPASmartClient.AgvApi/appsettings.Development.json
  20. +9
    -0
      BPASmartClient.AgvApi/appsettings.json
  21. +7
    -1
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  22. BIN
     
  23. BIN
     
  24. BIN
     
  25. BIN
     
  26. +16
    -0
      BPASmartClient.CustomResource/Pages/Enums/Permission.cs
  27. +1
    -2
      BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
  28. +7
    -3
      BPASmartClient.CustomResource/Pages/Model/Config.cs
  29. +6
    -2
      BPASmartClient.CustomResource/Pages/Model/Global.cs
  30. +98
    -0
      BPASmartClient.CustomResource/Pages/Model/MenuManage.cs
  31. +68
    -0
      BPASmartClient.CustomResource/Pages/Model/MessageLog.cs
  32. +73
    -0
      BPASmartClient.CustomResource/Pages/Model/PasswordHelper.cs
  33. +32
    -0
      BPASmartClient.CustomResource/Pages/Model/RunLog.cs
  34. +17
    -0
      BPASmartClient.CustomResource/Pages/Model/UserInfo.cs
  35. +39
    -0
      BPASmartClient.CustomResource/Pages/Model/UserLog.cs
  36. +13
    -0
      BPASmartClient.CustomResource/Pages/Model/UserManager.cs
  37. +428
    -0
      BPASmartClient.CustomResource/Pages/View/LoginView.xaml
  38. +49
    -0
      BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs
  39. +466
    -0
      BPASmartClient.CustomResource/Pages/View/MainView.xaml
  40. +42
    -0
      BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs
  41. +348
    -0
      BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml
  42. +72
    -0
      BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml.cs
  43. +372
    -0
      BPASmartClient.CustomResource/Pages/View/RunLogView.xaml
  44. +28
    -0
      BPASmartClient.CustomResource/Pages/View/RunLogView.xaml.cs
  45. +442
    -0
      BPASmartClient.CustomResource/Pages/View/UserLogView.xaml
  46. +28
    -0
      BPASmartClient.CustomResource/Pages/View/UserLogView.xaml.cs
  47. +2
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs
  48. +78
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs
  49. +64
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
  50. +69
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/PasswordChangeViewModel.cs
  51. +126
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs
  52. +134
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs
  53. +0
    -1
      BPASmartClient.CustomResource/RecDictionarys/BeveledRadioButtonStyle.xaml
  54. +1
    -1
      BPASmartClient.CustomResource/RecDictionarys/DatePickeerDictionary.xaml
  55. +1
    -0
      BPASmartClient.CustomResource/UserControls/DateTimeUI.xaml.cs
  56. +36
    -0
      BPASmartClient.CustomResource/UserControls/WatermarkText.xaml
  57. +121
    -0
      BPASmartClient.CustomResource/UserControls/WatermarkText.xaml.cs
  58. +1
    -1
      BPASmartClient.Helper/RTrig.cs
  59. +124
    -175
      BPASmartClient.Helper/SystemUtils.cs
  60. +4
    -0
      BPASmartClient.Helper/ThreadManage.cs
  61. +72
    -1
      BPASmartClient.Modbus/ModbusTcp.cs
  62. +37
    -0
      BPASmartClient.ZhuoDian/App.xaml
  63. +173
    -0
      BPASmartClient.ZhuoDian/App.xaml.cs
  64. +10
    -0
      BPASmartClient.ZhuoDian/AssemblyInfo.cs
  65. +23
    -0
      BPASmartClient.ZhuoDian/BPASmartClient.ZhuoDian.csproj
  66. +0
    -7
      ClassLibrary1/Class1.cs
  67. +2
    -2
      DosingSystem/App.xaml
  68. +171
    -0
      DosingSystem/App.xaml.cs
  69. +1
    -6
      DosingSystem/BPASmartClient.DosingSystem.csproj
  70. +2
    -2
      DosingSystem/Model/ActionMenu.cs
  71. +1
    -0
      DosingSystem/Model/RecipeModel.cs
  72. +0
    -1
      DosingSystem/View/DeviceListView.xaml
  73. +1
    -1
      DosingSystem/View/MainWindow.xaml
  74. +4
    -0
      DosingSystem/View/MainWindow.xaml.cs
  75. +1
    -1
      DosingSystem/View/NewRecipeView.xaml
  76. +1
    -1
      DosingSystem/View/RecipeControlView.xaml
  77. +0
    -49
      DosingSystem/ViewModel/AdminstratorsViewModel.cs
  78. +65
    -65
      DosingSystem/ViewModel/MainViewModel.cs
  79. +13
    -16
      DosingSystem/ViewModel/RecipeControlViewModel.cs
  80. +36
    -0
      FryPot_DosingSystem/App.xaml
  81. +17
    -0
      FryPot_DosingSystem/App.xaml.cs
  82. +10
    -0
      FryPot_DosingSystem/AssemblyInfo.cs
  83. +106
    -0
      FryPot_DosingSystem/Control/DeviceOperate.cs
  84. +869
    -0
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  85. +410
    -0
      FryPot_DosingSystem/Control/GlobalVariable.cs
  86. +15
    -0
      FryPot_DosingSystem/Control/MaterialInfo.cs
  87. +31
    -0
      FryPot_DosingSystem/FryPot_DosingSystem.csproj
  88. +46
    -0
      FryPot_DosingSystem/Helper/HubHelper.cs
  89. +2
    -5
      FryPot_DosingSystem/Helper/PasswordBoxHelper.cs
  90. +22
    -0
      FryPot_DosingSystem/Model/ActionMenu.cs
  91. +24
    -0
      FryPot_DosingSystem/Model/DeviceInfo.cs
  92. +15
    -0
      FryPot_DosingSystem/Model/DeviceManage.cs
  93. +13
    -0
      FryPot_DosingSystem/Model/Global.cs
  94. +30
    -0
      FryPot_DosingSystem/Model/LogModel.cs
  95. +48
    -0
      FryPot_DosingSystem/Model/LoginInfoConfig.cs
  96. +35
    -0
      FryPot_DosingSystem/Model/MaterialType.cs
  97. +14
    -0
      FryPot_DosingSystem/Model/PlcVariableModel.cs
  98. +17
    -0
      FryPot_DosingSystem/Model/RecipeManage.cs
  99. +32
    -0
      FryPot_DosingSystem/Model/RecipeModel.cs
  100. +6
    -8
      FryPot_DosingSystem/Model/UserManage.cs

+ 88
- 3
BPASmartClient.AGV/AGVHelper.cs View File

@@ -52,9 +52,94 @@ namespace BPASmartClient.AGV
request.Abort();
}
return retString;//返回响应报文


}
/// <summary>
/// AGV去1号线体装桶
/// </summary>
/// <returns></returns>
public string AgvToLineOneLoadRoller()
{
string url = "";
string head = "";
string body = "";
return HttpRequest(url,head,body);
}
/// <summary>
/// AGV去2号线体装桶
/// </summary>
/// <returns></returns>
public string AgvToLineTwoLoadRoller()
{
string url = "";
string head = "";
string body = "";
return HttpRequest(url, head, body);
}
/// <summary>
/// AGV去3号线体装桶
/// </summary>
/// <returns></returns>
public string AgvToLineThreeLoadRoller()
{
string url = "";
string head = "";
string body = "";
return HttpRequest(url, head, body);
}
/// <summary>
/// AGV离开炒锅1
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotOne()
{
string url = "";
string head = "";
string body = "";
return HttpRequest(url, head, body);
}
/// <summary>
/// AGV离开炒锅2
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotTwo()
{
string url = "";
string head = "";
string body = "";
return HttpRequest(url, head, body);
}
/// <summary>
/// AGV离开炒锅3
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotThree()
{
string url = "";
string head = "";
string body = "";
return HttpRequest(url, head, body);
}
/// <summary>
/// AGV离开炒锅4
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotFour()
{
string url = "";
string head = "";
string body = "";
return HttpRequest(url, head, body);
}
/// <summary>
/// AGV离开炒锅5
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotFive()
{
string url = "";
string head = "";
string body = "";
return HttpRequest(url, head, body);
}
}
}

+ 25
- 0
BPASmartClient.AGV/Enums/AGVMove.cs View File

@@ -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
}
}

+ 36
- 0
BPASmartClient.AGV/Enums/BinTask.cs View File

@@ -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,
}
}

+ 32
- 0
BPASmartClient.AGV/Enums/CTC.cs View File

@@ -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,
}
}

+ 20
- 0
BPASmartClient.AGV/Enums/JobType.cs View File

@@ -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
}
}

+ 29
- 0
BPASmartClient.AGV/Enums/QuickPickTask.cs View File

@@ -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
}
}

+ 37
- 0
BPASmartClient.AGV/Enums/STC.cs View File

@@ -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,
}
}

+ 13
- 0
BPASmartClient.AGV/Enums/SmallBelt.cs View File

@@ -0,0 +1,13 @@
namespace BPASmartClient.AGV.Enums
{
/// <summary>
/// 小皮带任务枚举
/// </summary>
public enum SmallBelt
{
/// <summary>
/// 任务完成
/// </summary>
DONE
}
}

+ 23
- 0
BPASmartClient.AGV/Feedback/JobData.cs View File

@@ -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; }
}
}

+ 22
- 0
BPASmartClient.AGV/Feedback/event.cs View File

@@ -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();
}
}

ClassLibrary1/ClassLibrary1.csproj → BPASmartClient.AgvApi/BPASmartClient.AgvApi.csproj View File

@@ -1,9 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>

</Project>

+ 16
- 0
BPASmartClient.AgvApi/Controllers/AgvStatusController.cs View File

@@ -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";
}
}
}

+ 33
- 0
BPASmartClient.AgvApi/Controllers/WeatherForecastController.cs View File

@@ -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();
}
}
}

+ 29
- 0
BPASmartClient.AgvApi/PersonHub.cs View File

@@ -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);
}
}
}

+ 36
- 0
BPASmartClient.AgvApi/Program.cs View File

@@ -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();

+ 31
- 0
BPASmartClient.AgvApi/Properties/launchSettings.json View File

@@ -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"
}
}
}
}

+ 10
- 0
BPASmartClient.AgvApi/Sign.cs View File

@@ -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; }
}
}

+ 13
- 0
BPASmartClient.AgvApi/WeatherForecast.cs View File

@@ -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; }
}
}

+ 8
- 0
BPASmartClient.AgvApi/appsettings.Development.json View File

@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

+ 9
- 0
BPASmartClient.AgvApi/appsettings.json View File

@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

+ 7
- 1
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj View File

@@ -109,6 +109,8 @@
<None Remove="Image\环形切图\外圈\未选中.png" />
<None Remove="Image\环形切图\外圈\选中.png" />
<None Remove="Image\界面2.png" />
<None Remove="Image\登录界面背景.jpg" />
<None Remove="Image\登录界面背景1.jpg" />
<None Remove="Image\矩形.png" />
<None Remove="Image\矩形1.png" />
<None Remove="Image\矩形样式.png" />
@@ -146,6 +148,7 @@
<None Remove="Image\维护.png" />
<None Remove="Image\背景.png" />
<None Remove="Image\背景2.png" />
<None Remove="Image\背景3.jpg" />
<None Remove="Image\背景图片.png" />
<None Remove="Image\背景矢量\内部.png" />
<None Remove="Image\背景矢量\右上.png" />
@@ -188,6 +191,7 @@
</ItemGroup>

<ItemGroup>
<Resource Include="Fonts\iconfont.ttf" />
<Resource Include="Fonts\Quartz Regular.ttf" />
<Resource Include="Image\btn_close.png" />
<Resource Include="Image\ComboBoxPopSelect.png" />
@@ -212,7 +216,10 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Image\圆角矩形 30 拷贝.png" />
<Resource Include="Image\登录界面背景.jpg" />
<Resource Include="Image\登录界面背景1.jpg" />
<Resource Include="Image\背景2.png" />
<Resource Include="Image\背景3.jpg" />
<Resource Include="Image\边角.png" />
</ItemGroup>

@@ -245,7 +252,6 @@
</ItemGroup>

<ItemGroup>
<Resource Include="Fonts\iconfont.ttf" />
<Resource Include="Image\bg.png" />
<Resource Include="Image\btn_normal.png" />
<Resource Include="Image\buttonOff.png" />


BIN
View File


BIN
View File


BIN
View File


BIN
View File


+ 16
- 0
BPASmartClient.CustomResource/Pages/Enums/Permission.cs View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Enums
{
public enum Permission : int
{
管理员 = 1,
操作员 = 2,
观察员 = 3,
技术员 = 4
}
}

+ 1
- 2
BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs View File

@@ -1,5 +1,5 @@
using BPASmartClient.Helper;
using BPASmartClient.Message;
//using BPASmartClient.Message;
using BPASmartClient.Model;
using System;
using System.Collections.Concurrent;
@@ -98,7 +98,6 @@ namespace BPASmartClient.CustomResource.Pages.Model

AddAction?.Invoke(AlarmInfo);//添加报警通知
ChangeAction?.Invoke();//更改报警通知
MessageLog.GetInstance.AddDeviceAlarmLogShow(tempAlarm.Info, Guid.NewGuid().ToString());
}
}



DosingSystem/Model/Config.cs → BPASmartClient.CustomResource/Pages/Model/Config.cs View File

@@ -1,4 +1,5 @@
using BPA.Message;
using BPASmartClient.CustomResource.Pages.Enums;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
@@ -7,16 +8,14 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.DosingSystem.Model
namespace BPASmartClient.CustomResource.Pages.Model
{
public class Config
{

private volatile static Config _Instance;
public static Config GetInstance => _Instance ?? (_Instance = new Config());
private Config() { }


public void Init()
{
if (File.Exists("up.hbl"))
@@ -43,6 +42,11 @@ namespace BPASmartClient.DosingSystem.Model
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.操作员, UserName = "czy", Password = "123456" });
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.观察员, UserName = "gcy", Password = "654321" });
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.技术员, UserName = "jsy", Password = "88888888" });
SaveUser();
}

public void SaveUser()
{
File.WriteAllText("up.hbl", JsonConvert.SerializeObject(Global.userManager).AESEncrypt());
}
}

DosingSystem/Model/Global.cs → BPASmartClient.CustomResource/Pages/Model/Global.cs View File

@@ -1,13 +1,17 @@
using System;
using BPASmartClient.CustomResource.Pages.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.DosingSystem.Model
namespace BPASmartClient.CustomResource.Pages.Model
{
public class Global
{
public static UserManager userManager { get; set; } = new UserManager();

public static UserInfo userInfo { get; set; } = new UserInfo();

}
}

+ 98
- 0
BPASmartClient.CustomResource/Pages/Model/MenuManage.cs View File

@@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPASmartClient.CustomResource.Pages.Enums;
using System.Windows;

namespace BPASmartClient.CustomResource.Pages.Model
{
/// <summary>
/// 在启动界面之前设置菜单项
/// </summary>
public class MenuManage : ObservableObject
{
private volatile static MenuManage _Instance;
public static MenuManage GetInstance => _Instance ?? (_Instance = new MenuManage());
private MenuManage() { }

public ObservableCollection<MenuModel> menuModels { get; set; } = new ObservableCollection<MenuModel>();
}

public class MenuModel : ObservableObject
{
/// <summary>
/// 主菜单权限
/// </summary>
public Permission[] MainMenuPermission { get { return _mMainMenuPermission; } set { _mMainMenuPermission = value; OnPropertyChanged(); } }
private Permission[] _mMainMenuPermission;

/// <summary>
/// 主菜单图标
/// </summary>
public string MainMenuIcon { get { return _mMainMenuIcon; } set { _mMainMenuIcon = value; OnPropertyChanged(); } }
private string _mMainMenuIcon = string.Empty;

/// <summary>
/// 主菜单名称
/// </summary>
public string MainMenuName { get { return _mMainMenuName; } set { _mMainMenuName = value; OnPropertyChanged(); } }
private string _mMainMenuName = string.Empty;

/// <summary>
/// 别名(英文名)
/// </summary>
public string Alias { get { return _mAlias; } set { _mAlias = value; OnPropertyChanged(); } }
private string _mAlias = string.Empty;

/// <summary>
/// 主菜单的显示隐藏设置
/// </summary>
public Visibility MainMenuVisibility { get { return _mMainMenuVisibility; } set { _mMainMenuVisibility = value; OnPropertyChanged(); } }
private Visibility _mMainMenuVisibility;

/// <summary>
/// 子菜单集合
/// </summary>
public ObservableCollection<SubMenumodel> subMenumodels { get; set; } = new ObservableCollection<SubMenumodel>();

}

public class SubMenumodel : ObservableObject
{
/// <summary>
/// 子菜单名称
/// </summary>
public string SubMenuName { get { return _mSubMenuName; } set { _mSubMenuName = value; OnPropertyChanged(); } }
private string _mSubMenuName = string.Empty;

/// <summary>
/// 子菜单权限管理
/// </summary>
public Permission[] SubMenuPermission { get { return _mSubMenuPermission; } set { _mSubMenuPermission = value; OnPropertyChanged(); } }
private Permission[] _mSubMenuPermission;

/// <summary>
/// 切换界面路径
/// </summary>
public string ToggleWindowPath { get { return _mToggleWindowPath; } set { _mToggleWindowPath = value; OnPropertyChanged(); } }
private string _mToggleWindowPath = string.Empty;

/// <summary>
/// 程序集名称
/// </summary>
public string AssemblyName { get { return _mAssemblyName; } set { _mAssemblyName = value; OnPropertyChanged(); } }
private string _mAssemblyName = string.Empty;

/// <summary>
/// 子菜单的显示隐藏设置
/// </summary>
public Visibility SubMenuVisibility { get { return _mSubMenuVisibility; } set { _mSubMenuVisibility = value; OnPropertyChanged(); } }
private Visibility _mSubMenuVisibility;

}

}

+ 68
- 0
BPASmartClient.CustomResource/Pages/Model/MessageLog.cs View File

@@ -0,0 +1,68 @@
using BPASmartClient.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections.ObjectModel;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class MessageLog
{
private volatile static MessageLog _Instance;
public static MessageLog GetInstance => _Instance ?? (_Instance = new MessageLog());
private MessageLog() { }

public Action<string> UserLog { get; set; }

public Action<string> RunLog { get; set; }

public ObservableCollection<RunLog> runLogs { get; set; } = new ObservableCollection<RunLog>();

public ObservableCollection<UserLog> userLogs { get; set; } = new ObservableCollection<UserLog>();

public void LogSave()
{
Sqlite<UserLog>.GetInstance.Save();
Sqlite<RunLog>.GetInstance.Save();
}

//public void GetLog()
//{
// Sqlite<UserLog>.GetInstance.GetData();
// Sqlite<RunLog>.GetInstance.GetData();
//}

public void ShowUserLog(string info)
{
UserLog userLog = new UserLog()
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
Permission = Global.userInfo.permission.ToString(),
UserName = Global.userInfo.UserName,
LogInfo = info
};
Sqlite<UserLog>.GetInstance.Base.Add(userLog);
Application.Current.Dispatcher.Invoke(new Action(() => { userLogs.Insert(0, userLog); }));
UserLog?.Invoke(info);
}

public void ShowRunLog(string info)
{
RunLog runLog = new RunLog()
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
RunLogInfo = info
};
Sqlite<RunLog>.GetInstance.Base.Add(runLog);
Application.Current.Dispatcher.Invoke(new Action(() => { runLogs.Insert(0, runLog); }));
RunLog?.Invoke(info);
}


}
}

+ 73
- 0
BPASmartClient.CustomResource/Pages/Model/PasswordHelper.cs View File

@@ -0,0 +1,73 @@
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.CustomResource.Pages.Model
{
/// <summary>
/// 给PasswordBox添加一个可以绑定的附加类
/// </summary>
public class PasswordHelper
{

static bool IsUpdete = false;

#region PasswordProperty
public static readonly DependencyProperty PasswordProperty = DependencyProperty.RegisterAttached("Password", typeof(string),
typeof(PasswordHelper), new FrameworkPropertyMetadata("", new PropertyChangedCallback(OnPropertyChanged)));


public static string GetPassword(DependencyObject d)
{
return d.GetValue(PasswordProperty).ToString();
}

public static void SetPassword(DependencyObject d, string value)
{
d.SetValue(PasswordProperty, value);
}

private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
PasswordBox password = d as PasswordBox;
password.PasswordChanged -= password_PasswordChanged;
if (!IsUpdete) password.Password = e.NewValue?.ToString();
password.PasswordChanged += password_PasswordChanged;
}
#endregion

#region AttachProperty
public static readonly DependencyProperty AttachProperty = DependencyProperty.RegisterAttached("Attach", typeof(bool),
typeof(PasswordHelper), new FrameworkPropertyMetadata(default(bool), new PropertyChangedCallback(OnAttachChanged)));

public static bool GetAttach(DependencyObject d)
{
return (bool)d.GetValue(AttachProperty);
}

public static void SetAttach(DependencyObject d, bool value)
{
d.SetValue(AttachProperty, value);
}

private static void OnAttachChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
PasswordBox password = d as PasswordBox;
password.PasswordChanged += password_PasswordChanged;
}

private static void password_PasswordChanged(object sender, RoutedEventArgs e)
{
PasswordBox passwordBox = sender as PasswordBox;
IsUpdete = true;
SetPassword(passwordBox, passwordBox.Password);
IsUpdete = false;
}

#endregion
}
}

+ 32
- 0
BPASmartClient.CustomResource/Pages/Model/RunLog.cs View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class RunLog : ObservableObject
{
[Key]
public int Id { get; set; }

//public string Date { get { return _mDate; } set { _mDate = value; OnPropertyChanged(); } }
//private string _mDate;

//public string Time { get { return _mTime; } set { _mTime = value; OnPropertyChanged(); } }
//private string _mTime;

//public string RunLogInfo { get { return _mRunLogInfo; } set { _mRunLogInfo = value; OnPropertyChanged(); } }
//private string _mRunLogInfo;

public string Date { get; set; }

public string Time { get; set; }

public string RunLogInfo { get; set; }

}
}

+ 17
- 0
BPASmartClient.CustomResource/Pages/Model/UserInfo.cs View File

@@ -0,0 +1,17 @@
using BPASmartClient.CustomResource.Pages.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class UserInfo
{
public Permission permission { get; set; }
public string UserName { get; set; }
public string Password { get; set; }

}
}

+ 39
- 0
BPASmartClient.CustomResource/Pages/Model/UserLog.cs View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class UserLog : ObservableObject
{
[Key]
public int Id { get; set; }

//public string Permission { get { return _mPermission; } set { _mPermission = value; OnPropertyChanged(); } }
//private string _mPermission;

//public string Date { get { return _mDate; } set { _mDate = value; OnPropertyChanged(); } }
//private string _mDate;

//public string Time { get { return _mTime; } set { _mTime = value; OnPropertyChanged(); } }
//private string _mTime;

//public string LogInfo { get { return _mLogInfo; } set { _mLogInfo = value; OnPropertyChanged(); } }
//private string _mLogInfo;

public string Permission { get; set; }

public string Date { get; set; }

public string Time { get; set; }

public string UserName { get; set; }

public string LogInfo { get; set; }

}
}

+ 13
- 0
BPASmartClient.CustomResource/Pages/Model/UserManager.cs View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class UserManager
{
public List<UserInfo> userInfos { get; set; } = new List<UserInfo>();
}
}

+ 428
- 0
BPASmartClient.CustomResource/Pages/View/LoginView.xaml View File

@@ -0,0 +1,428 @@
<Window
x:Class="BPASmartClient.CustomResource.Pages.View.LoginView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="clr-namespace:BPASmartClient.CustomResource.Pages.Model"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
Title="LoginView"
Width="500"
Height="300"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">

<Window.DataContext>
<vm:LoginViewModel />
</Window.DataContext>

<Window.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>

<!--#region 密码输入框样式-->
<Style x:Key="PasswordBoxStyle" TargetType="{x:Type PasswordBox}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontFamily" Value="Times New Roman" />
<Setter Property="PasswordChar" Value="●" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Padding" Value="1" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="AllowDrop" Value="true" />
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type PasswordBox}">
<Border
x:Name="Bd"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"
SnapsToDevicePixels="true">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="UserTextBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="20"
Foreground="{TemplateBinding BorderBrush}"
Text="&#xe850;" />

<!--<TextBlock
Name="markText"
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
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="Bd" Property="Opacity" Value="0.56" />
<Setter TargetName="UserTextBlock" Property="Opacity" Value="0.56" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF7EB4EA" />
<Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF7EB4EA" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF569DE5" />
<Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF569DE5" />
</Trigger>
<!--<DataTrigger Binding="{Binding Path=Password, RelativeSource={RelativeSource Mode=self}}" Value="">
<Setter TargetName="markText" Property="Visibility" Value="Visible" />
</DataTrigger>-->

</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" />
<Condition Property="IsSelectionActive" Value="false" />
</MultiTrigger.Conditions>
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
</MultiTrigger>
</Style.Triggers>
</Style>
<!--#endregion-->

<!--#region 用户输入框样式-->
<Style x:Key="UserTextBoxStyle" 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="5"
SnapsToDevicePixels="true">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="PasswordTextBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="20"
Foreground="{TemplateBinding BorderBrush}"
Text="&#xe66d;" />

<TextBlock
Name="markText"
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
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-->

</Window.Resources>

<Border
x:Name="br"
BorderBrush="#009dff"
BorderThickness="2">
<Border.Effect>
<DropShadowEffect
BlurRadius="10"
ShadowDepth="1"
Color="#009DFF" />
</Border.Effect>
<Grid>
<Image Source="../../Image/登录界面背景.jpg" Stretch="Fill" />
<Image Source="../../Image/阴影边框.png" Stretch="Fill" />

<Grid Margin="50,20">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Margin="0,10,0,0"
HorizontalAlignment="Center"
FontSize="20"
Foreground="#ddd"
Text="用户登录" />

<TextBlock
Margin="20,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
FontSize="16"
Foreground="#FFEF2020"
Text="{Binding ErrorInfo}" />

<TextBox
Grid.Row="1"
Height="40"
Margin="20,0"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
Style="{DynamicResource UserTextBoxStyle}"
TabIndex="1"
Text="{Binding UserName}" />

<PasswordBox
Name="pb"
Grid.Row="2"
Height="40"
Margin="20,0"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
PasswordChanged="PasswordBox_PasswordChanged"
Style="{DynamicResource PasswordBoxStyle}"
TabIndex="2" />

<TextBlock
Name="markText"
Grid.Row="2"
Margin="70,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
IsHitTestVisible="False"
Text="请输入账号密码"
Visibility="Visible" />


<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Button
Margin="20,10"
Background="#009DFF"
BorderThickness="0"
Command="{Binding ExitCommand}"
Content="退 出"
FontSize="20"
Foreground="White" />

<Button
Grid.Column="1"
Margin="20,10"
Background="#009DFF"
BorderThickness="0"
Command="{Binding LoginCommand}"
Content="登 录"
FontSize="20"
Foreground="White"
TabIndex="3" />

</Grid>

</Grid>
</Grid>

</Border>

<!--<Grid x:Name="gr">
<Grid.Background>
<ImageBrush Opacity="0.8" ImageSource="../../Image/登录界面背景.jpg" />
</Grid.Background>

<Image
Margin="201 101"
Source="../../Image/阴影边框.png"
Stretch="Fill" />

<Border
Margin="200 100"
BorderBrush="#009dff"
BorderThickness="1">
<Border.Effect>
<DropShadowEffect
BlurRadius="10"
ShadowDepth="1"
Color="#009DFF" />
</Border.Effect>
-->
<!--<Border.Background>
<ImageBrush ImageSource="../../Image/矩形样式.png"/>
</Border.Background>-->
<!--

<Grid>

<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Margin="0,10,0,0"
HorizontalAlignment="Center"
FontSize="20"
Foreground="#ddd"
Text="用户登录" />

<TextBlock
Margin="20,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
FontSize="16"
Foreground="#FFEF2020"
Text="{Binding ErrorInfo}" />

<TextBox
Grid.Row="1"
Height="40"
Margin="20,0"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
Style="{DynamicResource UserTextBoxStyle}"
Text="{Binding UserName}" />

<PasswordBox
Name="pb"
Grid.Row="2"
Height="40"
Margin="20,0"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
PasswordChanged="PasswordBox_PasswordChanged"
Style="{DynamicResource PasswordBoxStyle}" />

<TextBlock
Name="markText"
Grid.Row="2"
Margin="70,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
IsHitTestVisible="False"
Text="请输入账号密码"
Visibility="Visible" />


<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Button
Margin="20,10"
Background="#009DFF"
BorderThickness="0"
Command="{Binding ExitCommand}"
Content="退 出"
FontSize="20"
Foreground="White" />

<Button
Grid.Column="1"
Margin="20,10"
Background="#009DFF"
BorderThickness="0"
Command="{Binding LoginCommand}"
Content="登 录"
FontSize="20"
Foreground="White" />

</Grid>

</Grid>

</Border>




</Grid>-->



</Window>

+ 49
- 0
BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs View File

@@ -0,0 +1,49 @@
using BPASmartClient.Helper;
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.Shapes;

namespace BPASmartClient.CustomResource.Pages.View
{
/// <summary>
/// LoginView.xaml 的交互逻辑
/// </summary>
public partial class LoginView : Window
{
public LoginView()
{
InitializeComponent();
this.br.MouseLeftButtonDown += (o, e) =>
{
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove();
};
ActionManage.GetInstance.CancelRegister("LoginOk");
ActionManage.GetInstance.CancelRegister("ExitAction");
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "LoginOk");
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "ExitAction");

}

private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
{
if (this.pb.Password.Length > 0)
{
this.markText.Visibility = Visibility.Collapsed;
}
else
{
this.markText.Visibility = Visibility.Visible;
}
}
}
}

+ 466
- 0
BPASmartClient.CustomResource/Pages/View/MainView.xaml View File

@@ -0,0 +1,466 @@
<Window
x:Class="BPASmartClient.CustomResource.Pages.View.MainView"
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.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
Title="MainView"
Width="1200"
Height="700"
Topmost="False"
AllowsTransparency="True"
Background="{x:Null}"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">

<Window.DataContext>
<vm:MainViewModel />
</Window.DataContext>

<Window.Resources>

<!--#region 静态资源-->
<ImageBrush x:Key="leftImage" ImageSource="../../Image/leftImage.png" />
<ImageBrush x:Key="leftImageSub" ImageSource="../../Image/leftImageSub.png" />
<ImageBrush x:Key="topImage" ImageSource="../../Image/topImage.png" />
<!--#endregion-->

<!--#region 标题栏按钮样式-->
<Style x:Key="TitleBarStyle" TargetType="Button">
<Setter Property="Foreground" Value="White" />
<Setter Property="FontSize" Value="24" />
<Setter Property="FontFamily" Value="../../Fonts/#iconfont" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Name="TitleBarBr" Background="Transparent">
<ContentPresenter
Margin="{TemplateBinding Margin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="TitleBarBr" Property="Background" Value="#22ffffff" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

<!--#region 导航栏样式-->
<Style x:Key="NavButtonStyle" TargetType="{x:Type RadioButton}">
<Setter Property="Foreground" Value="White" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Border
x:Name="NvaBor"
Background="Transparent"
BorderBrush="#55ffffff"
BorderThickness="0,0,0,1.5">
<ContentControl
Margin="10,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="16" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="NvaBor" Property="Background" Value="#865eec" />
<Setter TargetName="NvaBor" Property="BorderThickness" Value="0,0,1.5,1.5" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="false" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
</MultiTrigger.Setters>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

<!--#region 下拉列表单选按钮样式-->
<Style x:Key="RadioMiniButtonStyle" TargetType="{x:Type RadioButton}">
<Setter Property="Margin" Value="5,10,1,5" />
<Setter Property="Width" Value="160" />
<Setter Property="Height" Value="30" />
<Setter Property="FontSize" Value="14" />
<Setter Property="FontFamily" Value="粗体" />
<Setter Property="Foreground" Value="#DDD" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="#DDD" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Grid
x:Name="templateRoot"
Background="Transparent"
SnapsToDevicePixels="True">
<Border x:Name="border2" />
<ContentPresenter
x:Name="contentPresenter"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Focusable="False"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />

</Grid>
<ControlTemplate.Triggers>
<Trigger Property="HasContent" Value="True">
<Setter Property="FocusVisualStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle
Margin="14,0,0,0"
SnapsToDevicePixels="True"
Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
StrokeDashArray="1 2"
StrokeThickness="1" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Padding" Value="4,-1,0,0" />
</Trigger>
<Trigger Property="IsChecked" Value="{x:Null}" />

<Trigger Property="IsChecked" Value="true">
<Setter Property="Foreground" Value="White" />
<Setter TargetName="border2" Property="Background" Value="{StaticResource ResourceKey=leftImageSub}">
<!--<Setter.Value>
<ImageBrush ImageSource="./images/back.png" />
</Setter.Value>-->
</Setter>
</Trigger>

<Trigger Property="IsChecked" Value="false">
<Setter TargetName="border2" Property="Background" Value="#101F3F" />
<Setter Property="Foreground" Value="#4B8EC4" />
</Trigger>

<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="false" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter TargetName="border2" Property="Background" Value="#55007acc" />
</MultiTrigger.Setters>
</MultiTrigger>

</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

<!--#region 下拉列表样式-->
<Style x:Key="ToggleButtonStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Height" Value="80" />
<Setter Property="HorizontalContentAlignment" Value="Right" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="10,10" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Grid>
<Border
x:Name="border2"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}">
<ContentPresenter
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Grid>

<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" Value="#FFd2e7f4" />
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter TargetName="border2" Property="Background" Value="{StaticResource ResourceKey=leftImage}" />
</Trigger>
<Trigger Property="IsChecked" Value="false">
<Setter TargetName="border2" Property="Background" Value="#191E36" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="White" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="ExpanderStyle" TargetType="{x:Type Expander}">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="1" />

<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Expander}">
<DockPanel>
<ToggleButton
x:Name="HeaderSite"
Height="60"
MinWidth="0"
MinHeight="0"
Margin="1"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
DockPanel.Dock="Top"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontStretch="{TemplateBinding FontStretch}"
FontStyle="{TemplateBinding FontStyle}"
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}"
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource ToggleButtonStyle}" />
<ContentPresenter
x:Name="ExpandSite"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
DockPanel.Dock="Left"
Focusable="false"
Visibility="Collapsed" />
</DockPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="true">
<Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

</Window.Resources>

<Grid Background="#103153">

<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>

<!--#region 标题栏设置-->
<Border
x:Name="MoveBorder"
Height="50"
VerticalAlignment="Top"
Background="#0C2349"
BorderBrush="#55ffffff"
BorderThickness="0,0,0,1">

<StackPanel Orientation="Horizontal">
<Image Margin="15,5,0,5" Source="../../Image/HBL.png" />
<TextBlock
Name="tbTitle"
Margin="20,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="18"
Foreground="White"
Text="上位机监控系统" />
</StackPanel>


</Border>

<UniformGrid
Width="150"
Height="50"
HorizontalAlignment="Right"
Columns="3">
<Button
Name="ButMin"
Content="&#xe664;"
Style="{StaticResource TitleBarStyle}" />
<Button
Name="ButMax"
Content="&#xe65d;"
FontSize="22"
Style="{StaticResource TitleBarStyle}" />
<Button
Name="ButClose"
Content="&#xe639;"
Style="{StaticResource TitleBarStyle}" />
</UniformGrid>
<!--#endregion-->

<!--#region 显示区设置-->

<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<!-- 侧边栏菜单设置 -->
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<Grid>
<Border BorderBrush="#121F40" BorderThickness="1">
<Border.Background>
<ImageBrush ImageSource="../../Image/leftback.png" />
</Border.Background>
</Border>

<ScrollViewer
Grid.Row="1"
Margin="10"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding menuModels}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Visibility="{Binding MainMenuVisibility}">
<Expander x:Name="E1" Style="{DynamicResource ExpanderStyle}">
<Expander.Header>
<StackPanel
Margin="10,0,0,10"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="25"
Foreground="#ddd"
Text="{Binding MainMenuIcon, Converter={StaticResource StringToIconConverter}}" />
<StackPanel Margin="10,0,0,0" VerticalAlignment="Center">
<TextBlock
FontSize="16"
Foreground="White"
Text="{Binding MainMenuName}" />
<TextBlock
FontSize="13"
Foreground="Gray"
Text="{Binding Alias}" />
</StackPanel>
</StackPanel>
</Expander.Header>
<Expander.Content>
<StackPanel>
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding subMenumodels}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton
Command="{Binding DataContext.NavChangedCommand, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}"
CommandParameter="{Binding ToggleWindowPath}"
Content="{Binding SubMenuName}"
GroupName="All"
Style="{StaticResource RadioMiniButtonStyle}"
Visibility="{Binding SubMenuVisibility}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</StackPanel>
</Expander.Content>
</Expander>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</ScrollViewer>
<!--#endregion-->

<!--#region 页面显示-->
<Grid Grid.Column="1">
<Grid.Background>
<ImageBrush ImageSource="../../Image/WindowImages.png" />
</Grid.Background>

<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Margin="0,0,0,20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="20"
Foreground="#1A8ADE"
Text="{Binding DisplayName}" />

<TextBlock
Margin="10,10,0,5"
HorizontalAlignment="left"
VerticalAlignment="Center"
FontSize="18"
Foreground="#1A8ADE"
Text="{Binding DateVisible}" />

<TextBlock
Margin="0,10,50,5"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="18"
Foreground="#1A8ADE"
Text="{Binding TimeVisible}" />

<ContentControl Grid.Row="1" Content="{Binding MainContent}" />

</Grid>

<!--#endregion-->

</Grid>


<!--#endregion-->

</Grid>

</Window>

+ 42
- 0
BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
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.Shapes;

namespace BPASmartClient.CustomResource.Pages.View
{
/// <summary>
/// MainView.xaml 的交互逻辑
/// </summary>
public partial class MainView : Window
{
public MainView()
{
InitializeComponent();
this.ButMin.Click += (o, e) => { this.WindowState = WindowState.Minimized; };
this.ButMax.Click += (o, e) => { this.WindowState = this.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; };
this.ButClose.Click += (o, e) => { this.Close(); };
this.MoveBorder.MouseLeftButtonDown += (o, e) =>
{
if (e.ClickCount > 1)
{
if (this.WindowState == WindowState.Maximized)
this.WindowState = WindowState.Normal;
else if (this.WindowState == WindowState.Normal)
this.WindowState = WindowState.Maximized;
}
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove();
};
}
}
}

+ 348
- 0
BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml View File

@@ -0,0 +1,348 @@
<Window
x:Class="BPASmartClient.CustomResource.Pages.View.PasswordChangeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="clr-namespace:BPASmartClient.CustomResource.Pages.Model"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
Title="PasswordChangeView"
Width="500"
Height="350"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">

<Window.DataContext>
<vm:PasswordChangeViewModel />
</Window.DataContext>

<Window.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>

<!--#region 密码输入框样式-->
<Style x:Key="PasswordBoxStyle" TargetType="{x:Type PasswordBox}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontFamily" Value="Times New Roman" />
<Setter Property="PasswordChar" Value="●" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Padding" Value="1" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="AllowDrop" Value="true" />
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type PasswordBox}">
<Border
x:Name="Bd"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"
SnapsToDevicePixels="true">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="UserTextBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="20"
Foreground="{TemplateBinding BorderBrush}"
Text="&#xe850;" />

<!--<TextBlock
Name="markText"
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
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="Bd" Property="Opacity" Value="0.56" />
<Setter TargetName="UserTextBlock" Property="Opacity" Value="0.56" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF7EB4EA" />
<Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF7EB4EA" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF569DE5" />
<Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF569DE5" />
</Trigger>
<!--<DataTrigger Binding="{Binding Path=Password, RelativeSource={RelativeSource Mode=self}}" Value="">
<Setter TargetName="markText" Property="Visibility" Value="Visible" />
</DataTrigger>-->

</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" />
<Condition Property="IsSelectionActive" Value="false" />
</MultiTrigger.Conditions>
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
</MultiTrigger>
</Style.Triggers>
</Style>
<!--#endregion-->

<!--#region 用户输入框样式-->
<Style x:Key="UserTextBoxStyle" 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="5"
SnapsToDevicePixels="true">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="PasswordTextBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="20"
Foreground="{TemplateBinding BorderBrush}"
Text="&#xe66d;" />

<TextBlock
Name="markText"
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
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-->

</Window.Resources>

<Border
x:Name="br"
BorderBrush="#009dff"
BorderThickness="2">
<Border.Effect>
<DropShadowEffect
BlurRadius="10"
ShadowDepth="1"
Color="#009DFF" />
</Border.Effect>
<Grid>
<Image Source="../../Image/登录界面背景.jpg" Stretch="Fill" />
<Image Source="../../Image/阴影边框.png" Stretch="Fill" />

<Grid Margin="50,20">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Margin="0,10,0,0"
HorizontalAlignment="Center"
FontSize="20"
Foreground="#ddd"
Text="密码修改" />

<TextBlock
Margin="20,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
FontSize="16"
Foreground="#FFEF2020"
Text="{Binding ErrorInfo}" />

<Grid Grid.Row="1">
<PasswordBox
Name="oldpb"
Height="40"
Margin="20,0"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding OldPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
PasswordChanged="oldpb_PasswordChanged"
Style="{DynamicResource PasswordBoxStyle}"
TabIndex="2" />

<TextBlock
Name="oldmarkText"
Margin="70,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
IsHitTestVisible="False"
Text="请输入原密码"
Visibility="Visible" />

</Grid>

<Grid Grid.Row="2">
<PasswordBox
Name="newpb1"
Height="40"
Margin="20,0"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding NewPassword1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
PasswordChanged="newpb1_PasswordChanged"
Style="{DynamicResource PasswordBoxStyle}"
TabIndex="2" />

<TextBlock
Name="newmarkText1"
Margin="70,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
IsHitTestVisible="False"
Text="请输入新密码"
Visibility="Visible" />

</Grid>

<Grid Grid.Row="3">
<PasswordBox
Name="newpb2"
Height="40"
Margin="20,0"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding NewPassword2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
PasswordChanged="newpb2_PasswordChanged"
Style="{DynamicResource PasswordBoxStyle}"
TabIndex="2" />

<TextBlock
Name="newmarkText2"
Margin="70,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
IsHitTestVisible="False"
Text="请再次输入新密码"
Visibility="Visible" />

</Grid>

<Grid Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Button
Margin="20,10"
Background="#009DFF"
BorderThickness="0"
Command="{Binding ExitCommand}"
Content="取 消"
FontSize="20"
Foreground="White" />

<Button
Grid.Column="1"
Margin="20,10"
Background="#009DFF"
BorderThickness="0"
Command="{Binding LoginCommand}"
Content="确 认"
FontSize="20"
Foreground="White"
TabIndex="3" />

</Grid>

</Grid>
</Grid>

</Border>

</Window>

+ 72
- 0
BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml.cs View File

@@ -0,0 +1,72 @@
using BPASmartClient.Helper;
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.Shapes;

namespace BPASmartClient.CustomResource.Pages.View
{
/// <summary>
/// PasswordChangeView.xaml 的交互逻辑
/// </summary>
public partial class PasswordChangeView : Window
{
public PasswordChangeView()
{
InitializeComponent();
this.br.MouseLeftButtonDown += (o, e) =>
{
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove();
};
ActionManage.GetInstance.CancelRegister("PasswordChangeViewconfirm");
ActionManage.GetInstance.CancelRegister("PasswordChangeViewCancel");
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "PasswordChangeViewconfirm");
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "PasswordChangeViewCancel");
}

private void newpb2_PasswordChanged(object sender, RoutedEventArgs e)
{
if (this.newpb2.Password.Length > 0)
{
this.newmarkText2.Visibility = Visibility.Collapsed;
}
else
{
this.newmarkText2.Visibility = Visibility.Visible;
}
}

private void newpb1_PasswordChanged(object sender, RoutedEventArgs e)
{
if (this.newpb1.Password.Length > 0)
{
this.newmarkText1.Visibility = Visibility.Collapsed;
}
else
{
this.newmarkText1.Visibility = Visibility.Visible;
}
}

private void oldpb_PasswordChanged(object sender, RoutedEventArgs e)
{
if (this.oldpb.Password.Length > 0)
{
this.oldmarkText.Visibility = Visibility.Collapsed;
}
else
{
this.oldmarkText.Visibility = Visibility.Visible;
}
}
}
}

+ 372
- 0
BPASmartClient.CustomResource/Pages/View/RunLogView.xaml View File

@@ -0,0 +1,372 @@
<UserControl
x:Class="BPASmartClient.CustomResource.Pages.View.RunLogView"
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.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:RunLogViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" />
<convert:IsEnableConvert x:Key="isEnableConvert" />
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" />
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" />
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />-->
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" />
<SolidColorBrush x:Key="CursorColor" Color="Aqua" />
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" />

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="BorderBrush" Value="#FF23CACA" />
<Setter Property="CaretBrush" Value="Aqua" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="DataTextBlockStyle" TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="Red" />
<Setter Property="FontSize" Value="14" />
</Style>

<ControlTemplate x:Key="ButTemplate" TargetType="Button">
<Border
x:Name="br"
Background="Transparent"
BorderBrush="#FF19B7EC"
BorderThickness="2">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<ContentControl
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

<Trigger Property="IsPressed" Value="true">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

</ControlTemplate.Triggers>
</ControlTemplate>

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel
Margin="0,8"
HorizontalAlignment="Right"
Orientation="Horizontal">

<DatePicker
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding StartDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入开始时间"
Visibility="{Binding IsVisibility}" />

<DatePicker
Margin="20,0,20,0"
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding EndDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入结束时间"
Visibility="{Binding IsVisibility}" />

<Button
Width="140"
Height="30"
Background="#FF19B7EC"
Command="{Binding ControlCommand}"
Content="{Binding ControlButText}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}"
Visibility="{Binding IsVisibility}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

<Button
Width="140"
Height="30"
Margin="20,0,0,0"
Background="#FF19B7EC"
Command="{Binding SwitchCommand}"
Content="{Binding ButContent}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

</StackPanel>

<!--#region 表格标题栏设置-->
<Grid Grid.Row="1" Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="日期" />

<Grid Grid.Column="1">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="时间" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="消息日志" />

<!--<Grid Grid.Column="3">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警信息" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>-->

<!--<TextBlock
Grid.Column="4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警值" />

<Grid Grid.Column="5">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警等级" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>-->
</Grid>
<!--#endregion-->

<!--#region 表格数据显示-->
<ScrollViewer
Grid.Row="2"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">

<Grid>
<!--#region 实时报警信息-->
<ItemsControl ItemsSource="{Binding Log}" Visibility="{Binding CurrentDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Date}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding RunLogInfo}" />

<!--<Grid Grid.Column="3">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Info}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="4"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Value}" />

<Grid Grid.Column="5">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>-->

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->

<!--#region 历史报警信息-->
<ItemsControl ItemsSource="{Binding HistoryRunLog}" Visibility="{Binding HistoryDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Date}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding RunLogInfo}" />

<!--<Grid Grid.Column="3">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Info}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="4"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Value}" />

<Grid Grid.Column="5">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>-->

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->
</Grid>
</ScrollViewer>
<!--#endregion-->


</Grid>

</UserControl>

+ 28
- 0
BPASmartClient.CustomResource/Pages/View/RunLogView.xaml.cs View File

@@ -0,0 +1,28 @@
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;

namespace BPASmartClient.CustomResource.Pages.View
{
/// <summary>
/// RunLogView.xaml 的交互逻辑
/// </summary>
public partial class RunLogView : UserControl
{
public RunLogView()
{
InitializeComponent();
}
}
}

+ 442
- 0
BPASmartClient.CustomResource/Pages/View/UserLogView.xaml View File

@@ -0,0 +1,442 @@
<UserControl
x:Class="BPASmartClient.CustomResource.Pages.View.UserLogView"
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.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:UserLogViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" />
<convert:IsEnableConvert x:Key="isEnableConvert" />
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" />
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" />
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />-->
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" />
<SolidColorBrush x:Key="CursorColor" Color="Aqua" />
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" />

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="BorderBrush" Value="#FF23CACA" />
<Setter Property="CaretBrush" Value="Aqua" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="DataTextBlockStyle" TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="#20FDFA" />
<Setter Property="FontSize" Value="14" />
</Style>

<ControlTemplate x:Key="ButTemplate" TargetType="Button">
<Border
x:Name="br"
Background="Transparent"
BorderBrush="#FF19B7EC"
BorderThickness="2">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<ContentControl
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

<Trigger Property="IsPressed" Value="true">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

</ControlTemplate.Triggers>
</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="&#xe602;" />

<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.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel
Margin="0,8"
HorizontalAlignment="Right"
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
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding StartDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入开始时间"
Visibility="{Binding IsVisibility}" />

<DatePicker
Margin="20,0,20,0"
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding EndDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入结束时间"
Visibility="{Binding IsVisibility}" />

<Button
Width="140"
Height="30"
Background="#FF19B7EC"
Command="{Binding ControlCommand}"
Content="{Binding ControlButText}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}"
Visibility="{Binding IsVisibility}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

<Button
Width="140"
Height="30"
Margin="20,0,0,0"
Background="#FF19B7EC"
Command="{Binding SwitchCommand}"
Content="{Binding ButContent}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

</StackPanel>

<!--#region 表格标题栏设置-->
<Grid Grid.Row="1" Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="日期" />

<Grid Grid.Column="1">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="时间" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="操作权限" />

<Grid Grid.Column="3">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="用户名" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="消息日志" />

</Grid>
<!--#endregion-->

<!--#region 表格数据显示-->
<ScrollViewer
Grid.Row="2"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">

<Grid>
<!--#region 实时报警信息-->
<ItemsControl ItemsSource="{Binding UserLogs}" Visibility="{Binding CurrentDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Date}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Permission}" />

<Grid Grid.Column="3">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding UserName}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="4"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding LogInfo}" />

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->

<!--#region 历史报警信息-->
<ItemsControl ItemsSource="{Binding HistoryUserLog}" Visibility="{Binding HistoryDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Date}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Permission}" />

<Grid Grid.Column="3">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding UserName}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="4"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding LogInfo}" />

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->
</Grid>
</ScrollViewer>
<!--#endregion-->


</Grid>

</UserControl>

+ 28
- 0
BPASmartClient.CustomResource/Pages/View/UserLogView.xaml.cs View File

@@ -0,0 +1,28 @@
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;

namespace BPASmartClient.CustomResource.Pages.View
{
/// <summary>
/// UserLogView.xaml 的交互逻辑
/// </summary>
public partial class UserLogView : UserControl
{
public UserLogView()
{
InitializeComponent();
}
}
}

+ 2
- 0
BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs View File

@@ -137,4 +137,6 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

}



}

+ 78
- 0
BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs View File

@@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class LoginViewModel : ObservableObject
{
public LoginViewModel()
{
LoginCommand = new RelayCommand(() =>
{
var res = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == UserName && p.Password == Password);
if (res != null)
{
Global.userInfo.permission = res.permission;
Global.userInfo.UserName = res.UserName;
Global.userInfo.Password = res.Password;
for (int i = 0; i < MenuManage.GetInstance.menuModels.Count; i++)
{
if (MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuPermission.Contains(res.permission))
MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Visible;
else
MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;

if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.SubMenuPermission.Contains(res.permission)) == null)
MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;

for (int m = 0; m < MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.Count; m++)
{
if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuPermission.Contains(res.permission))
MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Visible;
else
MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Collapsed;
}
}
ActionManage.GetInstance.Send("LoginOk");
}
else
{
ErrorInfo = "用户名或密码错误!";
}

});

ExitCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("ExitAction");
});
}

public RelayCommand LoginCommand { get; set; }

public RelayCommand ExitCommand { get; set; }



public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
private string _mErrorInfo;


public string UserName { get { return _mUserName; } set { _mUserName = value; OnPropertyChanged(); } }
private string _mUserName = "admin";


public string Password { get { return _mPassword; } set { _mPassword = value; OnPropertyChanged(); } }
private string _mPassword;


}
}

+ 64
- 0
BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs View File

@@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using BPASmartClient.CustomResource.Pages.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class MainViewModel : ObservableObject
{
public MainViewModel()
{
NavChangedCommand = new RelayCommand<object>(DoNavChanged);
menuModels = MenuManage.GetInstance.menuModels;
}
public ObservableCollection<MenuModel> menuModels { get; set; }

private void DoNavChanged(object obj)
{
for (int i = 0; i < menuModels.Count; i++)
{
var res = menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.ToggleWindowPath == obj.ToString());
if (res != null)
{
DisplayName = res.SubMenuName;
var end = res.AssemblyName.Substring(res.AssemblyName.Length - 1);
var start = res.ToggleWindowPath.Substring(0, 1);
bool isAddPoint = end != "." && start != ".";
string point = isAddPoint ? "." : "";
Type type = Assembly.Load(res.AssemblyName)?.GetType($"{res.AssemblyName }{point}{ res.ToggleWindowPath}");
ConstructorInfo cti = type?.GetConstructor(System.Type.EmptyTypes);
if (type?.BaseType.Name == "Window")
{
((Window)cti?.Invoke(null)).ShowDialog();
break;
}
else if (type?.BaseType.Name == "UserControl")
{
//ConstructorInfo cti = type?.GetConstructor(System.Type.EmptyTypes);
MainContent = (FrameworkElement)cti?.Invoke(null);
break;
}
}
}
}

public RelayCommand<object> NavChangedCommand { get; set; }

public FrameworkElement MainContent { get { return _mMainContent; } set { _mMainContent = value; OnPropertyChanged(); } }
private FrameworkElement _mMainContent;

public string DisplayName { get { return _mDisplayName; } set { _mDisplayName = value; OnPropertyChanged(); } }
private string _mDisplayName;



}
}

+ 69
- 0
BPASmartClient.CustomResource/Pages/ViewModel/PasswordChangeViewModel.cs View File

@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class PasswordChangeViewModel : ObservableObject
{
public PasswordChangeViewModel()
{
LoginCommand = new RelayCommand(() =>
{
if (Global.userInfo.Password == OldPassword)
{
if (NewPassword1 == NewPassword2)
{
Global.userInfo.Password = NewPassword2;
int index = Array.FindIndex(Global.userManager.userInfos.ToArray(), p => p.UserName == Global.userInfo.UserName);
if (index >= 0 && index < Global.userManager.userInfos.Count)
Global.userManager.userInfos.ElementAt(index).Password = NewPassword1;
Config.GetInstance.SaveUser();
ActionManage.GetInstance.Send("PasswordChangeViewconfirm");
}
else
{
ErrorInfo = "新密码不匹配";
}
}
else
{
ErrorInfo = "原密码错误";
}
});

ExitCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("PasswordChangeViewCancel");
});
}

public RelayCommand LoginCommand { get; set; }

public RelayCommand ExitCommand { get; set; }



public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
private string _mErrorInfo;

public string OldPassword { get { return _mOldPassword; } set { _mOldPassword = value; OnPropertyChanged(); } }
private string _mOldPassword;


public string NewPassword1 { get { return _mNewPassword1; } set { _mNewPassword1 = value; OnPropertyChanged(); } }
private string _mNewPassword1;


public string NewPassword2 { get { return _mNewPassword2; } set { _mNewPassword2 = value; OnPropertyChanged(); } }
private string _mNewPassword2;


}
}

+ 126
- 0
BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs View File

@@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System.Collections.ObjectModel;
using BPASmartClient.CustomResource.Pages.Model;
using System.Windows;
using BPASmartClient.Helper;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class RunLogViewModel : ObservableObject
{
public RunLogViewModel()
{
Sqlite<RunLog>.GetInstance.Save();
SwitchCommand = new RelayCommand(() =>
{
if (ButContent == "历史日志")
{
GetHistoryRunLog();
CurrentDataVis = Visibility.Hidden;
HistoryDataVis = Visibility.Visible;
IsVisibility = Visibility.Visible;
ControlButText = "开始查询";
ButContent = "实时日志";
return;
}

if (ButContent == "实时日志")
{
HistoryDataVis = Visibility.Hidden;
CurrentDataVis = Visibility.Visible;
IsVisibility = Visibility.Hidden;
ButContent = "历史日志";
return;
}

});

ControlCommand = new RelayCommand(() =>
{

if (ControlButText == "报警复位") return;
if (ControlButText == "开始查询")
{
var lists = Sqlite<RunLog>.GetInstance.GetData();
var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList();
if (res != null)
{
HistoryRunLog.Clear();
foreach (var item in res)
{
HistoryRunLog.Add(item);
}
}
}

});
}

private void GetHistoryRunLog()
{
var data = Sqlite<RunLog>.GetInstance.GetData();
if (data != null)
{
HistoryRunLog.Clear();
foreach (var item in data)
{
int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days;
if (day == 0)
{
HistoryRunLog.Add(item);
}
}
}
}

public RelayCommand SwitchCommand { get; set; }

public RelayCommand ControlCommand { get; set; }

public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } }
private Visibility _mCurrentDataVis = Visibility.Visible;

public Visibility HistoryDataVis { get { return _mHistoryDataVis; } set { _mHistoryDataVis = value; OnPropertyChanged(); } }
private Visibility _mHistoryDataVis = Visibility.Hidden;

/// <summary>
/// 是否显示
/// </summary>
public Visibility IsVisibility { get { return _mIsVisibility; } set { _mIsVisibility = value; OnPropertyChanged(); } }
private Visibility _mIsVisibility = Visibility.Hidden;

/// <summary>
/// 文字显示
/// </summary>
public string ButContent { get { return _mButContent; } set { _mButContent = value; OnPropertyChanged(); } }
private string _mButContent = "历史日志";

/// <summary>
/// 控制按钮文本显示
/// </summary>
public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } }
private string _mControlButText = "报警复位";

/// <summary>
/// 开始时间
/// </summary>
public DateTime StartDateTime { get { return _mStartDateTime; } set { _mStartDateTime = value; OnPropertyChanged(); } }
private DateTime _mStartDateTime = DateTime.Now;

/// <summary>
/// 结束时间
/// </summary>
public DateTime EndDateTime { get { return _mEndDateTime; } set { _mEndDateTime = value; OnPropertyChanged(); } }
private DateTime _mEndDateTime = DateTime.Now;

public ObservableCollection<RunLog> HistoryRunLog { get; set; } = new ObservableCollection<RunLog>();

public ObservableCollection<RunLog> Log { get; set; } = MessageLog.GetInstance.runLogs;
}
}

+ 134
- 0
BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs View File

@@ -0,0 +1,134 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using BPASmartClient.CustomResource.Pages.Model;
using System.Windows;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.Helper;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class UserLogViewModel : ObservableObject
{
public UserLogViewModel()
{
Sqlite<UserLog>.GetInstance.Save();
UserLogs = MessageLog.GetInstance.userLogs;
SwitchCommand = new RelayCommand(() =>
{
if (ButContent == "历史日志")
{
GetHistoryUserLog();
CurrentDataVis = Visibility.Hidden;
HistoryDataVis = Visibility.Visible;
IsVisibility = Visibility.Visible;
ControlButText = "开始查询";
ButContent = "实时日志";
return;
}

if (ButContent == "实时日志")
{
HistoryDataVis = Visibility.Hidden;
CurrentDataVis = Visibility.Visible;
IsVisibility = Visibility.Hidden;
ButContent = "历史日志";
return;
}

});

ControlCommand = new RelayCommand(() =>
{
if (ControlButText == "报警复位") return;
if (ControlButText == "开始查询")
{
var lists = Sqlite<UserLog>.GetInstance.GetData();
var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList();
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();
foreach (var item in logs)
{
HistoryUserLog.Add(item);
}
}
}
});
}

private void GetHistoryUserLog()
{
var data = Sqlite<UserLog>.GetInstance.GetData();
var res = data.Where(p => p.UserName == Global.userInfo.UserName).ToList();
if (res != null)
{
HistoryUserLog.Clear();
foreach (var item in res)
{
int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days;
if (day == 0)
{
HistoryUserLog.Add(item);
}
}
}
}

public RelayCommand SwitchCommand { get; set; }

public RelayCommand ControlCommand { get; set; }

public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } }
private Visibility _mCurrentDataVis = Visibility.Visible;

public Visibility HistoryDataVis { get { return _mHistoryDataVis; } set { _mHistoryDataVis = value; OnPropertyChanged(); } }
private Visibility _mHistoryDataVis = Visibility.Hidden;

/// <summary>
/// 是否显示
/// </summary>
public Visibility IsVisibility { get { return _mIsVisibility; } set { _mIsVisibility = value; OnPropertyChanged(); } }
private Visibility _mIsVisibility = Visibility.Hidden;

/// <summary>
/// 文字显示
/// </summary>
public string ButContent { get { return _mButContent; } set { _mButContent = value; OnPropertyChanged(); } }
private string _mButContent = "历史日志";

/// <summary>
/// 控制按钮文本显示
/// </summary>
public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } }
private string _mControlButText = "报警复位";

/// <summary>
/// 开始时间
/// </summary>
public DateTime StartDateTime { get { return _mStartDateTime; } set { _mStartDateTime = value; OnPropertyChanged(); } }
private DateTime _mStartDateTime = DateTime.Now;

/// <summary>
/// 结束时间
/// </summary>
public DateTime EndDateTime { get { return _mEndDateTime; } set { _mEndDateTime = value; OnPropertyChanged(); } }
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> UserLogs { get; set; }

}
}

+ 0
- 1
BPASmartClient.CustomResource/RecDictionarys/BeveledRadioButtonStyle.xaml View File

@@ -215,5 +215,4 @@
</Setter>
</Style>
<!--#endregion-->

</ResourceDictionary>

+ 1
- 1
BPASmartClient.CustomResource/RecDictionarys/DatePickeerDictionary.xaml View File

@@ -432,7 +432,7 @@
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<!-- Set CalendarStyle to DatePickerCalendarStyle. -->
<Setter Property="CalendarStyle" Value="{DynamicResource DatePickerCalendarStyle}" />
<Setter Property="Width" Value="200" />
<Setter Property="Width" Value="130" />
<Setter Property="FontSize" Value="12" />
<!--<Setter Property="Height" Value="30" />-->
<Setter Property="Template">


+ 1
- 0
BPASmartClient.CustomResource/UserControls/DateTimeUI.xaml.cs View File

@@ -21,6 +21,7 @@ namespace BPASmartClient.CustomResource.UserControls
/// </summary>
public partial class DateTimeUI : UserControl
{

public DateTimeUI()
{
InitializeComponent();


+ 36
- 0
BPASmartClient.CustomResource/UserControls/WatermarkText.xaml View File

@@ -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>

+ 121
- 0
BPASmartClient.CustomResource/UserControls/WatermarkText.xaml.cs View File

@@ -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
- 1
BPASmartClient.Helper/RTrig.cs View File

@@ -15,7 +15,7 @@ namespace BPASmartClient.Helper
private volatile static ConcurrentDictionary<string, RTrig> _Instance;
public static RTrig GetInstance(string name)
{
if (_Instance == null) _Instance = new ConcurrentDictionary<string, RTrig>();
if (_Instance == null) _Instance = new ConcurrentDictionary<string, RTrig>();
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new RTrig());
return _Instance[name];
}


+ 124
- 175
BPASmartClient.Helper/SystemUtils.cs View File

@@ -9,25 +9,11 @@ using System.Threading.Tasks;
using System.ComponentModel;
using System.IO;


namespace BPASmartClient.Helper
{
public class SystemUtils
{

//private static ILogger logger = NLog.LogManager.GetCurrentClassLogger();
//public static bool isShowNumBoard = false;

//[DllImport("kernel32.dll", SetLastError = true)]
//public static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr);

//[DllImport("kernel32.dll", SetLastError = true)]
//public static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr);

//public static IntPtr ptr = new IntPtr();




public static bool isShowNumBoard = false;
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr);
@@ -35,100 +21,65 @@ namespace BPASmartClient.Helper
public static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr);


public static void StartKeyBoardFun()
{
try
{

}
catch (Exception)
{

throw;
}


}


public static void ShowScreenKeyboard()
{
try
{

//string file = @"C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe";
////if (!System.IO.File.Exists(file))
//// return;
//Process.Start(file);

string path = "C:/Program Files/Common Files/microsoft shared/ink/TabTip.exe";
if (File.Exists(path))
{
Process p = Process.Start(path);
}
else
//获得当前登录的Windows用户标示
System.Security.Principal.WindowsIdentity identity = System.Security.Principal.WindowsIdentity.GetCurrent();
System.Security.Principal.WindowsPrincipal principal = new System.Security.Principal.WindowsPrincipal(identity);
//判断当前登录用户是否为管理员
if (principal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator))
{
try
{
//判断软键盘是否进程是否已经存在,如果不存在进行调用
Process[] pro = Process.GetProcessesByName("osk");
//说明已经存在,不再进行调用
if (pro != null && pro.Length > 0)
return;
IntPtr ptr = new IntPtr();
bool isWow64FsRedirectionDisabled = Wow64DisableWow64FsRedirection(ref ptr);
if (isWow64FsRedirectionDisabled)
Process[] pros = Process.GetProcessesByName("TabTip");
string path = "C:/Program Files/Common Files/microsoft shared/ink/TabTip.exe";
if (File.Exists(path)) Process.Start(path);
else
{
Process.Start(@"C:\WINDOWS\system32\osk.exe");
bool isWow64FsRedirectionReverted = Wow64RevertWow64FsRedirection(ptr);
Process[] pro = Process.GetProcessesByName("osk");//判断软键盘是否进程是否已经存在,如果不存在进行调用
if (pro != null && pro.Length > 0) return;//说明已经存在,不再进行调用
IntPtr ptr = new IntPtr();
bool isWow64FsRedirectionDisabled = Wow64DisableWow64FsRedirection(ref ptr);
if (isWow64FsRedirectionDisabled)
{
Process.Start(@"C:\WINDOWS\system32\osk.exe");
bool isWow64FsRedirectionReverted = Wow64RevertWow64FsRedirection(ptr);
}
}
}
catch (Exception)
{

throw;
}


//ProcessStartInfo psi = new ProcessStartInfo();
//psi.FileName = @"C:\Windows\System32\osk.exe";
//psi.UseShellExecute = false;
//psi.CreateNoWindow = true;
//Process.Start(psi);
//Process kbpr = System.Diagnostics.Process.Start(@"C:\Windows\System32\osk.exe"); // 打开系统键盘

////判断软键盘是否进程是否已经存在,如果不存在进行调用
//Process[] pro = Process.GetProcessesByName("osk");
//bool isWow64FsRedirectionDisabled = Wow64DisableWow64FsRedirection(ref ptr);

////键盘如果已经打开则重新打开,防止最小化无法显示
//if (pro != null && pro.Length > 0)
//{
// Process kbpr = pro[0];
// kbpr.Kill();
// if (isWow64FsRedirectionDisabled)
// {
// Process.Start(@"C:WINDOWSsystem32osk.exe");
// Wow64RevertWow64FsRedirection(ptr);
// }
// return;
//}
////if (isWow64FsRedirectionDisabled)
////{
//Process.Start(@"C:WINDOWSsystem32osk.exe");
//Wow64RevertWow64FsRedirection(ptr);
//}
}
catch (Exception ex)
else
{
//logger.Error(ex.Message);
}
}
//创建启动对象
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();

startInfo.FileName = "";//Application.ExecutablePath;//设置运行文件

startInfo.Arguments = "";// String.Join(" ", args); //设置启动参数

startInfo.Verb = "runas"; //设置启动动作,确保以管理员身份运行

System.Diagnostics.Process.Start(startInfo); //如果不是管理员,则启动UAC
//退出应用程序

}
}






}
}



@@ -136,113 +87,111 @@ namespace BPASmartClient.Helper



//[DllImport("kernel32.dll", SetLastError = true)]
//private static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr);
//[DllImport("kernel32.dll", SetLastError = true)]
//public static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr);
//private const UInt32 WM_SYSCOMMAND = 0x112;
//private const UInt32 SC_RESTORE = 0xf120;
//[DllImport("user32.dll", CharSet = CharSet.Auto)]
//static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
//private const string OnScreenKeyboadApplication = "osk.exe";


///// <summary>
///// 启用系统软键盘
///// </summary>
//public static void OpenKeyBoardFun()
//{
// try
// {
// //判断软键盘是否进程是否已经存在,如果不存在进行调用
// Process[] pro = Process.GetProcessesByName("osk");
// //如果键盘已打开,则进行关闭操作
// if (pro != null && pro.Length > 0)
// {
// CloseKeyBoardFun();
// return;
// }

// // Get the name of the On screen keyboard
// string processName = System.IO.Path.GetFileNameWithoutExtension(OnScreenKeyboadApplication);

// // Check whether the application is not running
// var query = from process in Process.GetProcesses()
// where process.ProcessName == processName
// select process;

// var keyboardProcess = query.FirstOrDefault();
//[DllImport("kernel32.dll", SetLastError = true)]
//private static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr);
//[DllImport("kernel32.dll", SetLastError = true)]
//public static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr);
//private const UInt32 WM_SYSCOMMAND = 0x112;
//private const UInt32 SC_RESTORE = 0xf120;
//[DllImport("user32.dll", CharSet = CharSet.Auto)]
//static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
//private const string OnScreenKeyboadApplication = "osk.exe";

// // launch it if it doesn't exist
// if (keyboardProcess == null)
// {
// IntPtr ptr = new IntPtr(); ;
// bool sucessfullyDisabledWow64Redirect = false;

// // Disable x64 directory virtualization if we're on x64,
// // otherwise keyboard launch will fail.
// if (System.Environment.Is64BitOperatingSystem)
// {
// sucessfullyDisabledWow64Redirect = Wow64DisableWow64FsRedirection(ref ptr);
// }
///// <summary>
///// 启用系统软键盘
///// </summary>
//public static void OpenKeyBoardFun()
//{
// try
// {
// //判断软键盘是否进程是否已经存在,如果不存在进行调用
// Process[] pro = Process.GetProcessesByName("osk");
// //如果键盘已打开,则进行关闭操作
// if (pro != null && pro.Length > 0)
// {
// CloseKeyBoardFun();
// return;
// }

// // osk.exe is in windows/system folder. So we can directky call it without path
// using (Process osk = new Process())
// {
// osk.StartInfo.FileName = OnScreenKeyboadApplication;
// osk.Start();
// //osk.WaitForInputIdle(2000);
// }
// // Get the name of the On screen keyboard
// string processName = System.IO.Path.GetFileNameWithoutExtension(OnScreenKeyboadApplication);

// // Re-enable directory virtualisation if it was disabled.
// if (System.Environment.Is64BitOperatingSystem)
// if (sucessfullyDisabledWow64Redirect)
// Wow64RevertWow64FsRedirection(ptr);
// }
// else
// {
// // Bring keyboard to the front if it's already running
// var windowHandle = keyboardProcess.MainWindowHandle;
// SendMessage(windowHandle, WM_SYSCOMMAND, new IntPtr(SC_RESTORE), new IntPtr(0));
// }
// // Check whether the application is not running
// var query = from process in Process.GetProcesses()
// where process.ProcessName == processName
// select process;

// }
// catch (Exception ex)
// {
// //LogUtil.WriteLog(MethodBase.GetCurrentMethod().Name, LogUtil.ERROE, ex.Message);
// //LogUtil.WriteLog(MethodBase.GetCurrentMethod().Name, LogUtil.ERROE, ex.StackTrace);
// }
// var keyboardProcess = query.FirstOrDefault();

//}
// // launch it if it doesn't exist
// if (keyboardProcess == null)
// {
// IntPtr ptr = new IntPtr(); ;
// bool sucessfullyDisabledWow64Redirect = false;

// // Disable x64 directory virtualization if we're on x64,
// // otherwise keyboard launch will fail.
// if (System.Environment.Is64BitOperatingSystem)
// {
// sucessfullyDisabledWow64Redirect = Wow64DisableWow64FsRedirection(ref ptr);
// }

///// <summary>
///// 关闭系统软键盘
///// </summary>
//public static void CloseKeyBoardFun()
//{
// try
// {
// Process[] pros = Process.GetProcessesByName("osk");
// foreach (Process p in pros)
// {
// p.Kill();
// }
// }
// catch (Exception ex)
// {
// //LogUtil.WriteLog(MethodBase.GetCurrentMethod().Name, LogUtil.ERROE, ex.Message);
// //LogUtil.WriteLog(MethodBase.GetCurrentMethod().Name, LogUtil.ERROE, ex.StackTrace);
// }

//}
// // osk.exe is in windows/system folder. So we can directky call it without path
// using (Process osk = new Process())
// {
// osk.StartInfo.FileName = OnScreenKeyboadApplication;
// osk.Start();
// //osk.WaitForInputIdle(2000);
// }

// // Re-enable directory virtualisation if it was disabled.
// if (System.Environment.Is64BitOperatingSystem)
// if (sucessfullyDisabledWow64Redirect)
// Wow64RevertWow64FsRedirection(ptr);
// }
// else
// {
// // Bring keyboard to the front if it's already running
// var windowHandle = keyboardProcess.MainWindowHandle;
// SendMessage(windowHandle, WM_SYSCOMMAND, new IntPtr(SC_RESTORE), new IntPtr(0));
// }

}
// }
// catch (Exception ex)
// {
// //LogUtil.WriteLog(MethodBase.GetCurrentMethod().Name, LogUtil.ERROE, ex.Message);
// //LogUtil.WriteLog(MethodBase.GetCurrentMethod().Name, LogUtil.ERROE, ex.StackTrace);
// }

//}


///// <summary>
///// 关闭系统软键盘
///// </summary>
//public static void CloseKeyBoardFun()
//{
// try
// {
// Process[] pros = Process.GetProcessesByName("osk");
// foreach (Process p in pros)
// {
// p.Kill();
// }
// }
// catch (Exception ex)
// {
// //LogUtil.WriteLog(MethodBase.GetCurrentMethod().Name, LogUtil.ERROE, ex.Message);
// //LogUtil.WriteLog(MethodBase.GetCurrentMethod().Name, LogUtil.ERROE, ex.StackTrace);
// }

//}



}

+ 4
- 0
BPASmartClient.Helper/ThreadManage.cs View File

@@ -32,6 +32,10 @@ namespace BPASmartClient.Helper
if (CancellationTokenSources.ContainsKey(guid + key))
{
CancellationTokenSources[guid + key]?.Cancel();
if (key.Equals("MainTask"))
{
ActionManage.GetInstance.Send("FryPotDosingMainTaskExit");
}
ActionManage.GetInstance.Register(ExitCallback, guid + key);
}
else


+ 72
- 1
BPASmartClient.Modbus/ModbusTcp.cs View File

@@ -145,7 +145,7 @@ namespace BPASmartClient.Modbus
}
return -1;
}
private void ExceptionHandling(Exception ex)
{
if (ex.InnerException is SocketException)
@@ -189,7 +189,78 @@ namespace BPASmartClient.Modbus
}
return default(object);
}
#region 180项目调用
public int GetAddress(string address, string target)
{
if (address == null) return -1;
if (address.Length > 0)
{
if (address.ToUpper().Contains("D") && address.Length == 5)
{
try
{
string head = (Convert.ToInt32(address.Substring(1, 1)) - 1).ToString();
string tail = address.Substring(2, 3);
address = head + tail;
}
catch (Exception)
{
//打印日志
return -1;
}
}

}
return -1;
}
public object Read(string address, ushort len, string target, byte slaveAddress = 1)
{
if (address == null || tcpClient == null) return default(object);
ushort startAddress = (ushort)GetAddress(address, target);
CommandType commandType = CommandType.HoldingRegisters;
try
{
if (address.ToUpper().Contains("D"))
{
commandType = CommandType.HoldingRegisters;
return master.ReadHoldingRegisters(slaveAddress, startAddress, len);
}

}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"读取地址:【{address}:= {startAddress}】,读取类型:【{commandType.ToString()}】出错,{ex.ToString()}");
ExceptionHandling(ex);
}
return default(object);
}

public void Write<T>(string address, T value, string target, byte slaveAddress = 1)
{
if (address == null || tcpClient == null) return;
ushort startAddress = (ushort)GetAddress(address,target);
CommandType commandType = CommandType.Coils;
try
{
if (address.ToUpper().Contains("D"))
{
commandType = CommandType.HoldingRegisters;
if (value is ushort ushortValue)
{
master.WriteSingleRegister(slaveAddress, startAddress, ushortValue);
}
}
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"写入地址:【{address}:= {startAddress}】,写入类型:【{commandType.ToString()}】出错,{ex.ToString()}");
ExceptionHandling(ex);
}
}
#endregion
public void Write<T>(string address, T value, byte slaveAddress = 1)
{
if (address == null || tcpClient == null) return;


+ 37
- 0
BPASmartClient.ZhuoDian/App.xaml View File

@@ -0,0 +1,37 @@
<Application
x:Class="BPASmartClient.ZhuoDian.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters;assembly=BPASmartClient.CustomResource"
xmlns:local="clr-namespace:BPASmartClient.ZhuoDian">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>

<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecCheckBox.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecTitleBarButton.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/GlobalStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecComboBox.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecIcoButtonStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecToggleButton.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/BeveledRadioButtonStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/DatePickeerDictionary.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecButtonStyle.xaml" />

<ResourceDictionary>
<con:ColorConverter x:Key="ColorConverter" />
<con:TextConverter x:Key="TextConverter" />
<con:VisibleTypeConverter x:Key="VisibleTypeConverter" />
<con:StatusConverter x:Key="StatusConverter" />
<con:StringToIconConverter x:Key="StringToIconConverter" />
</ResourceDictionary>

<ResourceDictionary>
<ImageBrush x:Key="hbl" ImageSource="/BPASmartClient.CustomResource;component/Image/HBL.png" />
<ImageBrush x:Key="dbxt" ImageSource="/BPASmartClient.CustomResource;component/Image/顶部线条.png" />
</ResourceDictionary>

</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

+ 173
- 0
BPASmartClient.ZhuoDian/App.xaml.cs View File

@@ -0,0 +1,173 @@
using BPASmartClient.CustomResource.Pages.Enums;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.Pages.View;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.ZhuoDian
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
MenuInit();
DataInit();

MainView mv = new MainView();
LoginView lv = new LoginView();
var res = lv.ShowDialog();
if (res != null && res == true)
mv.Show();
else
mv.Close();
}

protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
MessageLog.GetInstance.LogSave();
}

private void MenuInit()
{

#region 配方管理菜单
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "配方管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.RecipeSettingsView"
});

RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "配方下发",
SubMenuPermission = new Permission[] { Permission.操作员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.RecipeControlView"
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe683;",
MainMenuName = "配方管理",
Alias = "Recipe Management",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员 },
subMenumodels = RecipeManage,
});
#endregion

#region 消息日志
ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
InfoLog.Add(new SubMenumodel()
{
SubMenuName = "操作日志",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.UserLogView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "运行日志",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.RunLogView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "报警记录",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.AlarmView"
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe668;",
MainMenuName = "消息日志",
Alias = "Message Log",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
subMenumodels = InfoLog,
});
#endregion

#region 硬件设备监控
ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "原料设备列表",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.DeviceListView"
});

DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "设备状态",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.HardwareStatusView"
});


MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe603;",
MainMenuName = "设备监控",
Alias = "Device Monitor",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
subMenumodels = DeviceMonitor,
});
#endregion

#region 用户管理
ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
UserManager.Add(new SubMenumodel()
{
SubMenuName = "用户登录",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.LoginView"
});

UserManager.Add(new SubMenumodel()
{
SubMenuName = "密码修改",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.PasswordChangeView"
});


MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe66d;",
MainMenuName = "用户管理",
Alias = "User Management",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
subMenumodels = UserManager,
});
#endregion
}

private void DataInit()
{
Config.GetInstance.Init();
}

}
}

+ 10
- 0
BPASmartClient.ZhuoDian/AssemblyInfo.cs View File

@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

+ 23
- 0
BPASmartClient.ZhuoDian/BPASmartClient.ZhuoDian.csproj View File

@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<Folder Include="View\" />
<Folder Include="ViewModel\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
</ItemGroup>

</Project>

+ 0
- 7
ClassLibrary1/Class1.cs View File

@@ -1,7 +0,0 @@
namespace ClassLibrary1
{
public class Class1
{

}
}

+ 2
- 2
DosingSystem/App.xaml View File

@@ -3,8 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters;assembly=BPASmartClient.CustomResource"
xmlns:local="clr-namespace:BPASmartClient.DosingSystem"
StartupUri="View/MainWindow.xaml">
xmlns:local="clr-namespace:BPASmartClient.DosingSystem">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
@@ -24,6 +23,7 @@
<con:TextConverter x:Key="TextConverter" />
<con:VisibleTypeConverter x:Key="VisibleTypeConverter" />
<con:StatusConverter x:Key="StatusConverter" />
<con:StringToIconConverter x:Key="StringToIconConverter" />
</ResourceDictionary>

<ResourceDictionary>


+ 171
- 0
DosingSystem/App.xaml.cs View File

@@ -1,10 +1,17 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using BPASmartClient.CustomResource.Pages.Enums;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.Pages.View;
using BPASmartClient.DosingSystem.Model;
using BPASmartClient.DosingSystem.View;
using BPASmartClient.Helper;

namespace BPASmartClient.DosingSystem
{
@@ -13,5 +20,169 @@ namespace BPASmartClient.DosingSystem
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
MenuInit();
DataInit();

MainView mv = new MainView();
LoginView lv = new LoginView();
var res = lv.ShowDialog();
if (res != null && res == true)
mv.Show();
else
mv.Close();



//MainWindow mw = new MainWindow();
//LoginView lv = new LoginView();
//var res = lv.ShowDialog();
//if (res != null && res == true)
// mw.Show();
//else
// mw.Close();
}

protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
Json<LocaPar>.Save();
MessageLog.GetInstance.LogSave();
}

private void MenuInit()
{

#region 配方管理菜单
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "配方管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.RecipeSettingsView"
});

RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "配方下发",
SubMenuPermission = new Permission[] { Permission.操作员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.RecipeControlView"
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe683;",
MainMenuName = "配方管理",
Alias = "Recipe Management",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员 },
subMenumodels = RecipeManage,
});
#endregion

#region 消息日志
ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
InfoLog.Add(new SubMenumodel()
{
SubMenuName = "操作日志",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.UserLogView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "运行日志",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.RunLogView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "报警记录",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.AlarmView"
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe668;",
MainMenuName = "消息日志",
Alias = "Message Log",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
subMenumodels = InfoLog,
});
#endregion

#region 硬件设备监控
ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "原料设备列表",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.DeviceListView"
});

DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "设备状态",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.HardwareStatusView"
});


MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe603;",
MainMenuName = "设备监控",
Alias = "Device Monitor",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
subMenumodels = DeviceMonitor,
});
#endregion

#region 用户管理
ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
UserManager.Add(new SubMenumodel()
{
SubMenuName = "用户登录",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.LoginView"
});

UserManager.Add(new SubMenumodel()
{
SubMenuName = "密码修改",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.PasswordChangeView"
});


MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe66d;",
MainMenuName = "用户管理",
Alias = "User Management",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
subMenumodels = UserManager,
});
#endregion
}

private void DataInit()
{
Config.GetInstance.Init();
Json<LocaPar>.Read();
}

}
}

+ 1
- 6
DosingSystem/BPASmartClient.DosingSystem.csproj View File

@@ -7,6 +7,7 @@
<UseWPF>true</UseWPF>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>hbl.ico</ApplicationIcon>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>

<ItemGroup>
@@ -24,10 +25,4 @@
<ProjectReference Include="..\BPASmartClient.Modbus\BPASmartClient.Modbus.csproj" />
</ItemGroup>

<ItemGroup>
<Page Update="View\AdminstratorsView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
</Page>
</ItemGroup>

</Project>

+ 2
- 2
DosingSystem/Model/ActionMenu.cs View File

@@ -13,8 +13,8 @@ namespace BPASmartClient.DosingSystem.Model
public string CommandParameter { get { return _mCommandParameter; } set { _mCommandParameter = value; OnPropertyChanged(); } }
private string _mCommandParameter;

public Permission[] permission { get { return _mpermission; } set { _mpermission = value; OnPropertyChanged(); } }
private Permission[] _mpermission;
//public Permission[] permission { get { return _mpermission; } set { _mpermission = value; OnPropertyChanged(); } }
//private Permission[] _mpermission;

public string MenuName { get { return _mMenuName; } set { _mMenuName = value; OnPropertyChanged(); } }
private string _mMenuName;


+ 1
- 0
DosingSystem/Model/RecipeModel.cs View File

@@ -15,6 +15,7 @@ namespace BPASmartClient.DosingSystem.Model
/// </summary>
public class RecipeModel : ObservableObject
{
[Newtonsoft.Json.JsonIgnore]
public bool IsEnable { get { return _mIsEnable; } set { _mIsEnable = value; OnPropertyChanged(); } }
private bool _mIsEnable = true;



+ 0
- 1
DosingSystem/View/DeviceListView.xaml View File

@@ -101,7 +101,6 @@
Foreground="#00BEFA"
Text="{Binding DeviceName}" />


<StackPanel
Grid.Row="1"
Grid.ColumnSpan="2"


+ 1
- 1
DosingSystem/View/MainWindow.xaml View File

@@ -238,7 +238,7 @@
</Grid>

<!--#region 底部窗体栏-->
<ContentControl
<ContentControl
x:Name="contentRegion"
Grid.Row="1"
Content="{Binding MyWindow}" />


+ 4
- 0
DosingSystem/View/MainWindow.xaml.cs View File

@@ -40,5 +40,9 @@ namespace BPASmartClient.DosingSystem.View
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove();
};
}




}
}

+ 1
- 1
DosingSystem/View/NewRecipeView.xaml View File

@@ -116,7 +116,7 @@
Height="30"
Margin="0,0,7,0"
Command="{Binding AddCommand}"
Content="添加原料" />
Content="添加原料" Cursor="Hand" />

<Button
Width="80"


+ 1
- 1
DosingSystem/View/RecipeControlView.xaml View File

@@ -46,7 +46,7 @@

<Grid>

<ScrollViewer>
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding Recipes}">
<ItemsControl.ItemTemplate>
<DataTemplate>


+ 0
- 49
DosingSystem/ViewModel/AdminstratorsViewModel.cs View File

@@ -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];
}
}
}

+ 65
- 65
DosingSystem/ViewModel/MainViewModel.cs View File

@@ -18,28 +18,28 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
public class MainViewModel : ObservableObject
{
ObservableCollection<ActionMenu> menus = new ObservableCollection<ActionMenu>();
private Permission _permission;
public Permission permission
{
get { return _permission; }
set
{
var res = menus.Where(p => Array.FindIndex(p.permission, s => s == value) >= 0).ToList();
if (res != null && res.Count > 0)
{
Menus.Clear();
res.ForEach((item) => { Menus.Add(item); });
}
_permission = value;
}
}
//ObservableCollection<ActionMenu> menus = new ObservableCollection<ActionMenu>();
//private Permission _permission;
//public Permission permission
//{
// get { return _permission; }
// set
// {
// var res = menus.Where(p => Array.FindIndex(p.permission, s => s == value) >= 0).ToList();
// if (res != null && res.Count > 0)
// {
// Menus.Clear();
// res.ForEach((item) => { Menus.Add(item); });
// }
// _permission = value;
// }
//}


public MainViewModel()
{
Json<LocaPar>.Read();
//Json<LocaPar>.Read();
TogglePag = new RelayCommand<object>(DoNavChanged);
Login = new RelayCommand(() => { DoNavChanged("BPASmartClient.DosingSystem.View.AdminstratorsView_用户登录"); UserManagement = false; });
PasswordChange = new RelayCommand(() =>
@@ -49,15 +49,15 @@ namespace BPASmartClient.DosingSystem.ViewModel
});
ExitLogin = new RelayCommand(() =>
{
SystemUtils.ShowScreenKeyboard();
//SystemUtils.ShowScreenKeyboard();
//DoNavChanged("LoginView.退出登录");
UserManagement = false;
});
Config.GetInstance.Init();
//Config.GetInstance.Init();
LoginRegister();
MenuInit();
permission = Permission.管理员;
if (Menus.Count > 0) DoNavChanged(Menus.ElementAt(0).CommandParameter);
//permission = Permission.管理员;
//if (Menus.Count > 0) DoNavChanged(Menus.ElementAt(0).CommandParameter);
DeviceInquire.GetInstance.Init();

}
@@ -66,55 +66,55 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
ActionManage.GetInstance.Register(new Func<object, object>((o) =>
{
if (o != null && o is string str)
{
var strs = str.Split("-=");
if (strs != null && strs.Length == 3)
{
var us = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == strs[0]);
if (us != null && strs[1] == us.Password && strs[2] == us.permission.ToString())
{
permission = us.permission;
return string.Empty;
}
}
}
//if (o != null && o is string str)
//{
// var strs = str.Split("-=");
// if (strs != null && strs.Length == 3)
// {
// var us = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == strs[0]);
// if (us != null && strs[1] == us.Password && strs[2] == us.permission.ToString())
// {
// permission = us.permission;
// return string.Empty;
// }
// }
//}
return "用户名或密码错误";
}), "LoginBPASmartClient.DosingSystem");
}

private void MenuInit()
{
menus.Add(new ActionMenu()
{
MenuName = "配方设置",
CommandParameter = "BPASmartClient.DosingSystem.View.RecipeSettingsView_配方设置",
permission = new Permission[] { Permission.管理员, Permission.技术员 },
});
menus.Add(new ActionMenu()
{
MenuName = "设备列表",
CommandParameter = "BPASmartClient.DosingSystem.View.DeviceListView_设备列表",
permission = new Permission[] { Permission.管理员, Permission.技术员 },
});
menus.Add(new ActionMenu()
{
MenuName = "硬件状态",
CommandParameter = "BPASmartClient.DosingSystem.View.HardwareStatusView_硬件状态",
permission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
});
menus.Add(new ActionMenu()
{
MenuName = "报警记录",
CommandParameter = "BPASmartClient.CustomResource.Pages.View.AlarmView_报警记录",
permission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
});
menus.Add(new ActionMenu()
{
MenuName = "配方下发",
CommandParameter = "BPASmartClient.DosingSystem.View.RecipeControlView_配方控制",
permission = new Permission[] { Permission.管理员, Permission.操作员 },
});
//menus.Add(new ActionMenu()
//{
// MenuName = "配方设置",
// CommandParameter = "BPASmartClient.DosingSystem.View.RecipeSettingsView_配方设置",
// permission = new Permission[] { Permission.管理员, Permission.技术员 },
//});
//menus.Add(new ActionMenu()
//{
// MenuName = "设备列表",
// CommandParameter = "BPASmartClient.DosingSystem.View.DeviceListView_设备列表",
// permission = new Permission[] { Permission.管理员, Permission.技术员 },
//});
//menus.Add(new ActionMenu()
//{
// MenuName = "硬件状态",
// CommandParameter = "BPASmartClient.DosingSystem.View.HardwareStatusView_硬件状态",
// permission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
//});
//menus.Add(new ActionMenu()
//{
// MenuName = "报警记录",
// CommandParameter = "BPASmartClient.CustomResource.Pages.View.AlarmView_报警记录",
// permission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
//});
//menus.Add(new ActionMenu()
//{
// MenuName = "配方下发",
// CommandParameter = "BPASmartClient.DosingSystem.View.RecipeControlView_配方控制",
// permission = new Permission[] { Permission.管理员, Permission.操作员 },
//});
}

public void DoNavChanged(object obj)


+ 13
- 16
DosingSystem/ViewModel/RecipeControlViewModel.cs View File

@@ -11,6 +11,7 @@ using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.DosingSystem.Model;
using System.Threading;
using BPASmartClient.CustomResource.Pages.Model;

namespace BPASmartClient.DosingSystem.ViewModel
{
@@ -23,22 +24,18 @@ namespace BPASmartClient.DosingSystem.ViewModel
Recipes = Json<LocaPar>.Data.Recipes;
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);//启动写入
//}
}
//}));
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()}");
});




+ 36
- 0
FryPot_DosingSystem/App.xaml View File

@@ -0,0 +1,36 @@
<Application x:Class="FryPot_DosingSystem.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:FryPot_DosingSystem" xmlns:con="clr-namespace:System.Drawing;assembly=netstandard"
xmlns:con1="clr-namespace:BPASmartClient.CustomResource.Converters;assembly=BPASmartClient.CustomResource"
StartupUri="View/MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>

<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecCheckBox.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecTitleBarButton.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/GlobalStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecComboBox.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecIcoButtonStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecToggleButton.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/BeveledRadioButtonStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/DatePickeerDictionary.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecButtonStyle.xaml" />

<ResourceDictionary>
<con:ColorConverter x:Key="ColorConverter" />
<con1:TextConverter x:Key="TextConverter" />
<con1:VisibleTypeConverter x:Key="VisibleTypeConverter" />
<con1:StatusConverter x:Key="StatusConverter" />
</ResourceDictionary>

<ResourceDictionary>
<ImageBrush x:Key="hbl" ImageSource="/BPASmartClient.CustomResource;component/Image/HBL.png" />
<ImageBrush x:Key="dbxt" ImageSource="/BPASmartClient.CustomResource;component/Image/顶部线条.png" />
</ResourceDictionary>

</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

+ 17
- 0
FryPot_DosingSystem/App.xaml.cs View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace FryPot_DosingSystem
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

+ 10
- 0
FryPot_DosingSystem/AssemblyInfo.cs View File

@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

+ 106
- 0
FryPot_DosingSystem/Control/DeviceOperate.cs View File

@@ -0,0 +1,106 @@
using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPASmartClient.Modbus;
using FryPot_DosingSystem.Model;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace FryPot_DosingSystem.Control
{
internal class DeviceOperate
{
private static DeviceOperate _instance;
public static DeviceOperate GetInstance=>_instance ??= new DeviceOperate();
ModbusTcp modbus = new ModbusTcp();
private string Ip { get; set; }
private string Port { get; set; }
private bool Connected { get; set; }

private string DeviceName { get; set; }

public ConcurrentDictionary<string, object> Data { get; set; } = new ConcurrentDictionary<string, object>();
public ObservableCollection<PlcVariableModel> Variables { get; set; }=new ObservableCollection<PlcVariableModel>();
public DeviceOperate()
{
Init();
Connect();
ReadData();
}
public void Init()
{
if (Variables.Count > 0)
{
Variables.Clear();
}
Variables.Add(new PlcVariableModel() { Address = "D2001", Length = 8 });//1号线体滚筒工位号
Variables.Add(new PlcVariableModel() { Address = "D2011", Length = 8 });//2号线体滚筒工位号
Variables.Add(new PlcVariableModel() { Address = "D2021", Length = 8 });//3号线体滚筒工位号
Variables.Add(new PlcVariableModel() { Address = "D2031", Length = 9 });//输送线出料状态
Variables.Add(new PlcVariableModel() { Address = "D2040", Length = 5 });//炒锅1-5进料滚筒运行
Variables.Add(new PlcVariableModel() { Address = "D2045", Length = 5 });//炒锅1-5进料到位信号
Variables.Add(new PlcVariableModel() { Address = "D2050", Length = 5 });//炒锅1-5空桶到位信号
Variables.Add(new PlcVariableModel() { Address = "D2055", Length = 5 });//炒锅1-5空桶呼叫AGV
Variables.Add(new PlcVariableModel() { Address = "D2060", Length = 5 });//炒锅1空桶洗桶呼叫AGV
Variables.Add(new PlcVariableModel() { Address = "D2065", Length = 5 });//炒锅1-5空桶滚筒运行
Variables.Add(new PlcVariableModel() { Address = "D2070", Length = 5 });//炒锅1-5滚筒故障信号
Variables.Add(new PlcVariableModel() { Address = "D2075", Length = 1 });//洗桶进桶滚筒运行信号
Variables.Add(new PlcVariableModel() { Address = "D2076", Length = 1 });//洗桶出桶呼叫AGV
Variables.Add(new PlcVariableModel() { Address = "D2077", Length = 1 });// 洗桶出桶滚筒运行信号
Variables.Add(new PlcVariableModel() { Address = "D2078", Length = 3 });//1-3滚筒线体配方完成信号
}
public void Connect()
{
Json<DeviceManage>.Read();
DeviceManage devices = Json<DeviceManage>.Data;
if (devices != null)
{
if (devices.Devices.Count > 0)
{
Ip = devices.Devices[0].Ip;
Port = devices.Devices[0].Port;
DeviceName = devices.Devices[0].DeviceName;
Task.Run(() => { modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); });
}
}
}
public void ReadData()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
Connected = modbus.Connected;
while (Connected)
{
foreach (var item in Variables)
{
var res = modbus.Read(item.Address, item.Length, "180项目");
if (Data.ContainsKey(item.Address))
{
Data[item.Address] = res;
}
else
{
Data.TryAdd(item.Address, res);
}
}
Thread.Sleep(500);
}
Thread.Sleep(1000);
}),$"设备【{DeviceName}】PLC实时数据读取线程");
}
public void WritePlcData(string address,ushort value)
{
modbus.Write(address, value,"180项目");
}
public ConcurrentDictionary<string, object> GetAllData()
{
return Data;
}
}
}

+ 869
- 0
FryPot_DosingSystem/Control/DosingLogicControl.cs View File

@@ -0,0 +1,869 @@
using BPASmartClient.AGV;
using BPASmartClient.Helper;
using BPASmartClient.Message;
using FryPot_DosingSystem.Model;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace FryPot_DosingSystem.Control
{
internal class DosingLogicControl
{
public static DosingLogicControl _instance;
public static DosingLogicControl GetInstance => _instance ??= new DosingLogicControl();
public ConcurrentDictionary<string, object> PlcReadData = new ConcurrentDictionary<string, object>();
/// <summary>
/// 配方队列
/// </summary>
public ConcurrentQueue<NewRecipeModel> RecipeQuene = new ConcurrentQueue<NewRecipeModel>();
/// <summary>
/// 进料原料队列
/// </summary>
public ConcurrentQueue<MaterialInfo> InputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
/// <summary>
/// 出料原料队列
/// </summary>
public ConcurrentQueue<MaterialInfo> OutputMaterialQuene = new ConcurrentQueue<MaterialInfo>();
/// <summary>
/// 全局变量对象声明
/// </summary>
GlobalVariable globalVar;

#region 上位机内部变量
int lineAlarm = 0;//线体故障信号 1:无故障 -1:故障
int FryPotAlarm = 0;//炒锅滚筒故障信号 1:无故障 -1:故障
int ReicpeNum = 0;//记录接收到的配方数
#endregion
#region agv临时变量
bool agvArriveLine = false;//agv是否到达线体装料位置
bool agvArriveFryPot = false;//agv是否到达炒锅送料位置
bool agvFryPotEmptyRollerArrive = false;//agv是否拿到炒锅空桶
#endregion
public DosingLogicControl()
{
globalVar = new GlobalVariable();
ActionManage.GetInstance.Register(new Action<object>(RecipeDataParse), "RecipeSetDown");
ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); }), "ClearRecipes");
ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 1; }), "StartPlcInite");
ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 0; }), "EndPlcInite");
ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitMainTask = true; }), "FryPotDosingMainTaskExit");
ResetProgram();
ReadPlcData();
IniteTask();
}
/// <summary>
/// 主任务重启
/// </summary>
private void ResetProgram()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
if (RTrig.GetInstance("ResetProgram").Start(globalVar.PlcInite == 1))//判断是否初始化 一初始化就重启主任务
{
MessageLog.GetInstance.Show("主任务正在重启");
ThreadManage.GetInstance().StopTask("MainTask", new Action(() =>
{
ThreadManage.GetInstance().StopTask("MainViewReadPlcData", new Action(() =>
{
globalVar = null;
globalVar = new GlobalVariable();
ReicpeNum = 0;
ActionManage.GetInstance.CancelRegister("RecipeSetDown");
ActionManage.GetInstance.Register(new Action<object>(RecipeDataParse), "RecipeSetDown");
ActionManage.GetInstance.Send("ClearRecipes");
ReadPlcData();
IniteTask();
MessageLog.GetInstance.Show("主任务重启完成");
}));
}));
}

Thread.Sleep(10);
}), "ResetProgram");
}
/// <summary>
/// 实时获取plc数据
/// </summary>
public void ReadPlcData()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
GetAddressData("D2001", new Action<ushort[]>((data) =>
{
globalVar.rollerLineOne.StationOne = data[0];
globalVar.rollerLineOne.StationTwo = data[1];
globalVar.rollerLineOne.StationThree = data[2];
globalVar.rollerLineOne.StationFour = data[3];
globalVar.rollerLineOne.StationFive = data[4];
globalVar.rollerLineOne.StationSix = data[5];
globalVar.rollerLineOne.StationSeven = data[6];
globalVar.rollerLineOne.StationEight = data[7];
}));
GetAddressData("D2011", new Action<ushort[]>((data) =>
{
globalVar.rollerLineTwo.StationOne = data[0];
globalVar.rollerLineTwo.StationTwo = data[1];
globalVar.rollerLineTwo.StationThree = data[2];
globalVar.rollerLineTwo.StationFour = data[3];
globalVar.rollerLineTwo.StationFive = data[4];
globalVar.rollerLineTwo.StationSix = data[5];
globalVar.rollerLineTwo.StationSeven = data[6];
globalVar.rollerLineTwo.StationEight = data[7];
}));
GetAddressData("D2021", new Action<ushort[]>((data) =>
{
globalVar.rollerLineThree.StationOne = data[0];
globalVar.rollerLineThree.StationTwo = data[1];
globalVar.rollerLineThree.StationThree = data[2];
globalVar.rollerLineThree.StationFour = data[3];
globalVar.rollerLineThree.StationFive = data[4];
globalVar.rollerLineThree.StationSix = data[5];
globalVar.rollerLineThree.StationSeven = data[6];
globalVar.rollerLineThree.StationEight = data[7];
}));
GetAddressData("D2040", new Action<ushort[]>((data) =>
{
globalVar.fryPotOne.InputMaterialRollerRunningSingle = data[0];
globalVar.fryPotTwo.InputMaterialRollerRunningSingle = data[1];
globalVar.fryPotThree.InputMaterialRollerRunningSingle = data[2];
globalVar.fryPotFour.InputMaterialRollerRunningSingle = data[3];
globalVar.fryPotFive.InputMaterialRollerRunningSingle = data[4];
}));
GetAddressData("D2045", new Action<ushort[]>((data) =>
{
globalVar.fryPotOne.InputMaterialArrivedSingle = data[0];
globalVar.fryPotTwo.InputMaterialArrivedSingle = data[1];
globalVar.fryPotThree.InputMaterialArrivedSingle = data[2];
globalVar.fryPotFour.InputMaterialArrivedSingle = data[3];
globalVar.fryPotFive.InputMaterialArrivedSingle = data[4];
}));
GetAddressData("D2050", new Action<ushort[]>((data) =>
{
globalVar.fryPotOne.EmptyBarrelArrivedSingle = data[0];
globalVar.fryPotTwo.EmptyBarrelArrivedSingle = data[1];
globalVar.fryPotThree.EmptyBarrelArrivedSingle = data[2];
globalVar.fryPotFour.EmptyBarrelArrivedSingle = data[3];
globalVar.fryPotFive.EmptyBarrelArrivedSingle = data[4];
}));
GetAddressData("D2065", new Action<ushort[]>((data) =>
{
globalVar.fryPotOne.EmptyBarrelRollerRunningSingle = data[0];
globalVar.fryPotTwo.EmptyBarrelRollerRunningSingle = data[1];
globalVar.fryPotThree.EmptyBarrelRollerRunningSingle = data[2];
globalVar.fryPotFour.EmptyBarrelRollerRunningSingle = data[3];
globalVar.fryPotFive.EmptyBarrelRollerRunningSingle = data[4];
}));
GetAddressData("D2070", new Action<ushort[]>((data) =>
{
globalVar.fryPotOne.RollerTroubleSingle = data[0];
globalVar.fryPotTwo.RollerTroubleSingle = data[1];
globalVar.fryPotThree.RollerTroubleSingle = data[2];
globalVar.fryPotFour.RollerTroubleSingle = data[3];
globalVar.fryPotFive.RollerTroubleSingle = data[4];
}));
GetAddressData("D2078", new Action<ushort[]>(data =>
{
globalVar.rollerLineOne.RecipeCompleteSingle = data[0];
globalVar.rollerLineTwo.RecipeCompleteSingle = data[1];
globalVar.rollerLineThree.RecipeCompleteSingle = data[2];
}));
GetAddressData("D2075", new Action<ushort[]>(data =>
{

globalVar.CleadBarrelEnterSingle = data[0];
}));
GetAddressData("D2077", new Action<ushort[]>(data =>
{

globalVar.CleadBarrelExitSingle = data[0];
}));
Thread.Sleep(10);
}), "MainViewReadPlcData");

}

/// <summary>
/// 返回指定地址指定长度的数据
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
public void GetAddressData(string address, Action<ushort[]> action)
{
PlcReadData = DeviceOperate.GetInstance.GetAllData();
if (PlcReadData.ContainsKey(address))
{
action((ushort[])(PlcReadData[address]));
}
}
/// <summary>
/// 写Plc数据
/// </summary>
/// <param name="address"></param>
/// <param name="Value"></param>
public void WritePlcData(string address, ushort Value)
{
DeviceOperate.GetInstance.WritePlcData(address, Value);
}
/// <summary>
/// 初始化任务
/// </summary>
public void IniteTask()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
MainTask();
}), "MainTask");
}
/// <summary>
/// 配方数据接收
/// </summary>
public void RecipeDataParse(object obj)
{
if (obj != null && obj is NewRecipeModel recipe)
{
RecipeQuene.Enqueue(recipe);
ReicpeNum++;
MessageLog.GetInstance.Show($"接收到{ReicpeNum}个配方");
}

}
/// <summary>
/// 开启主任务
/// </summary>
public void MainTask()
{
RecipeDataToPlc();
AgvLoadRoller();
FryPotInputMaterial();
FryPotOutputMaterial();
}
/// <summary>
/// 数据下发PLC
/// </summary>
public void RecipeDataToPlc()
{
if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0)//后续添加其它限制条件
{

if (RecipeQuene.TryDequeue(out NewRecipeModel result))
{
MessageLog.GetInstance.Show($"开始制作【{result.RecipeName}】 配方");
for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
{
//将配方中原料加入新的队列
InputMaterialQuene.Enqueue(new MaterialInfo()
{
materialType = result.materialCollection[i],
materialId = result.RecipeId
});
ushort n = result.materialCollection[i].MaterialLoc;
switch (n / 100)
{
case 1:
case 4: RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//1号滚筒线桶号以及重量数据下发
case 2:
case 5: RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//2号滚筒线桶号以及重量数据下发
case 3: RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//3号滚筒线桶号以及重量数据下发
}
}
switch (result.materialCollection[0].MaterialLoc / 100)
{
case 1:
DeviceOperate.GetInstance.WritePlcData("D1009", (ushort)result.materialCollection.Count); break;//发送1号滚筒线工序数据
case 2:
DeviceOperate.GetInstance.WritePlcData("D1026", (ushort)result.materialCollection.Count); break;//发送2号滚筒线工序数据
case 3:
DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count); break;//发送3号滚筒线工序数据
}
}
}

}
/// <summary>
/// AGV到配方对应线体装桶以及出料到炒锅
/// </summary>
public void AgvLoadRoller()
{
lineAlarm = 0;
if (InputMaterialQuene.Count > 0)
{
switch (InputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
{
case 1:
case 4: AgvToLineOneLoadRoller(); AgvFromLineOneToFryPot(); break;//AGV到1号线体装桶
case 2:
case 5: AgvToLineTwoLoadRoller(); AgvFromLineTwoToFryPot(); break;//AGV到2号线体装桶
case 3: AgvToLineThreeLoadRoller(); AgvFromLineThreeToFryPot(); break;//AGV到3号线体装桶
}
}

}
/// <summary>
/// AGV从炒锅送料位置到倒料过程处理
/// </summary>
public void FryPotInputMaterial()
{
if (OutputMaterialQuene.Count > 0 && !globalVar.InOrOutputLock)
{
while (!agvArriveFryPot)//等待agv到达炒锅位置
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
AgvArriveFryPotSingleSetDown();
FryPotRollerTroubleCheck();
if (FryPotAlarm == 1)//炒锅滚筒无故障
{
//炒锅滚筒进料运行到位处理
FryPotInputMaterialRollerOperate();
globalVar.InOrOutputLock = true;
}
else
{
//MessageLog.GetInstance.ShowEx($"警告:炒锅{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100}滚筒故障!!!");
}
}

}
/// <summary>
/// 炒锅出桶
/// </summary>
public void FryPotOutputMaterial()
{
if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock)
{
while (!agvArriveFryPot)//等待agv到达炒锅位置
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
AgvArriveFryPotOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
FryPotRollerTroubleCheck();
if (FryPotAlarm == 1)//无故障
{
FryPotOutEmpetyRollerOperate();
if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
{
while (!agvFryPotEmptyRollerArrive)//等待AGV拿到出桶空桶
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
//AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
globalVar.AllowAgvToLineLoadRoller = true;
globalVar.InOrOutputLock = false;
}
}
else//有故障
{

}
}
}
/// <summary>
/// 炒锅滚筒进料运行到位处理
/// </summary>
public void FryPotInputMaterialRollerOperate()
{
switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
{
case 1:
while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0 || globalVar.fryPotOne.InputMaterialRollerRunningSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.Show($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
case 2:
while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0 || globalVar.fryPotTwo.InputMaterialRollerRunningSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.Show($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
case 3:
while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0 || globalVar.fryPotThree.InputMaterialRollerRunningSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.Show($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
case 4:
while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0 || globalVar.fryPotFour.InputMaterialRollerRunningSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.Show($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
case 5:
while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0 || globalVar.fryPotFive.InputMaterialRollerRunningSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.Show($"炒锅【5】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
}

}
/// <summary>
/// 炒锅滚筒空桶出桶处理
/// </summary>
public void FryPotOutEmpetyRollerOperate()
{
switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
{
case 1: while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0 || globalVar.fryPotOne.EmptyBarrelRollerRunningSingle == 0) { Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
} MessageLog.GetInstance.Show($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
case 2: while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0 || globalVar.fryPotTwo.EmptyBarrelRollerRunningSingle == 0) { Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
} MessageLog.GetInstance.Show($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
case 3: while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0 || globalVar.fryPotThree.EmptyBarrelRollerRunningSingle == 0) { Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
} MessageLog.GetInstance.Show($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
case 4: while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0 || globalVar.fryPotFour.EmptyBarrelRollerRunningSingle == 0) { Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
} MessageLog.GetInstance.Show($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
case 5: while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0 || globalVar.fryPotFive.EmptyBarrelRollerRunningSingle == 0) { Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
} MessageLog.GetInstance.Show($"炒锅【5】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;

}
}
/// <summary>
/// 发送agv送料就位信号至PLC(线体到炒锅)
/// </summary>
public void AgvArriveFryPotSingleSetDown()
{
switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
{
case 1: DeviceOperate.GetInstance.WritePlcData("D1055", 1); break;//agv到炒锅1送料就位信号
case 2: DeviceOperate.GetInstance.WritePlcData("D1056", 1); break;//agv到炒锅2送料就位信号
case 3: DeviceOperate.GetInstance.WritePlcData("D1057", 1); break;//agv到炒锅3送料就位信号
case 4: DeviceOperate.GetInstance.WritePlcData("D1058", 1); break;//agv到炒锅4送料就位信号
case 5: DeviceOperate.GetInstance.WritePlcData("D1059", 1); break;//agv到炒锅5送料就位信号
}
}
/// <summary>
/// 发送agv回桶就位信号至PLC
/// </summary>
public void AgvArriveFryPotOutEmptyRollerSingleSetDown()
{
switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
{
case 1: DeviceOperate.GetInstance.WritePlcData("D1060", 1); break;//agv到炒锅1送料就位信号
case 2: DeviceOperate.GetInstance.WritePlcData("D1061", 1); break;//agv到炒锅2送料就位信号
case 3: DeviceOperate.GetInstance.WritePlcData("D1062", 1); break;//agv到炒锅3送料就位信号
case 4: DeviceOperate.GetInstance.WritePlcData("D1063", 1); break;//agv到炒锅4送料就位信号
case 5: DeviceOperate.GetInstance.WritePlcData("D1064", 1); break;//agv到炒锅5送料就位信号
}
}
/// <summary>
/// 处理agv从线体1到送料到炒锅的条件
/// </summary>
/// <param name="lineAlarm"></param>
public void AgvFromLineOneToFryPot()
{
erp: if (lineAlarm == 1)//无故障
{
while (!agvArriveLine)//等待AGV到线体装料位置
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
agvArriveLine = false;
AgvArriveLineSingelSetDown();
if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
{
while (!(globalVar.rollerLineOne.StationEight == materialInfo.materialType.MaterialLoc))//等待线体工号位8存放对应原料桶号
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
OutputMaterialQuene.Enqueue(materialInfo);
//原料到位,agv到位,agv运料到炒锅
}

}
else//有故障
{
while (lineAlarm == -1)
{
Thread.Sleep(50);
if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.Show("线体【1】滚筒故障解除,继续运行");
lineAlarm = 1;
goto erp;
}
}
/// <summary>
/// 处理agv从线体2到送料到炒锅的条件
/// </summary>
/// <param name="lineAlarm"></param>
public void AgvFromLineTwoToFryPot()
{
erp: if (lineAlarm == 1)//无故障
{
while (!agvArriveLine)//等待AGV到线体装料位置
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
agvArriveLine = false;
AgvArriveLineSingelSetDown();
if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
{
while (!(globalVar.rollerLineTwo.StationEight == materialInfo.materialType.MaterialLoc))//等待线体工号位8存放对应原料桶号
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
OutputMaterialQuene.Enqueue(materialInfo);
//原料到位,agv到位,agv运料到炒锅
}

}
else//有故障
{
while (lineAlarm == -1)
{
Thread.Sleep(50);
if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.Show("线体【2】滚筒故障解除,继续运行");
lineAlarm = 1;
goto erp;
}
}
/// <summary>
/// 处理agv从线体3到送料到炒锅的条件
/// </summary>
/// <param name="lineAlarm"></param>
public void AgvFromLineThreeToFryPot()
{
erp: if (lineAlarm == 1)//无故障
{
while (!agvArriveLine)//等待AGV到线体装料位置
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
agvArriveLine = false;
AgvArriveLineSingelSetDown();
if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
{
while (!(globalVar.rollerLineThree.StationEight == materialInfo.materialType.MaterialLoc))//等待线体工号位8存放对应原料桶号
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
OutputMaterialQuene.Enqueue(materialInfo);
//原料到位,agv到位,agv运料到炒锅
}

}
else//有故障
{
while (lineAlarm == -1)
{
Thread.Sleep(50);
if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.Show("线体【3】滚筒故障解除,继续运行");
lineAlarm = 1;
goto erp;
}
}
public void AgvToLineOneLoadRoller()
{
if (globalVar.rollerLineOne.OutMaterialingTroubleSingle == 0)//输送线无故障
{
if (InputMaterialQuene.Count > 0)
{
while (!globalVar.AllowAgvToLineLoadRoller || globalVar.rollerLineOne.OutMaterialingSingle == 0)
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
AGVHelper.GetInstance.AgvToLineOneLoadRoller();
MessageLog.GetInstance.Show("AGV去1号线体");
globalVar.AllowAgvToLineLoadRoller = false;
}
}
else
{
MessageLog.GetInstance.ShowEx("警告:滚筒输送线体【1】故障!!!");
lineAlarm = -1;
}
lineAlarm = 1;
}
public void AgvToLineTwoLoadRoller()
{
if (globalVar.rollerLineTwo.OutMaterialingTroubleSingle == 0)//输送线无故障
{
if (InputMaterialQuene.Count > 0)
{
while (!globalVar.AllowAgvToLineLoadRoller || globalVar.rollerLineOne.OutMaterialingSingle == 0) //后续考虑是否用while
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
AGVHelper.GetInstance.AgvToLineTwoLoadRoller();
MessageLog.GetInstance.Show("AGV去2号线体");
globalVar.AllowAgvToLineLoadRoller = false;
}

}
else
{
MessageLog.GetInstance.ShowEx("警告:滚筒输送线体【2】故障!!!");
lineAlarm = -1;
}
lineAlarm = 1;
}
public void AgvToLineThreeLoadRoller()
{
if (globalVar.rollerLineThree.OutMaterialingTroubleSingle == 0)//输送线无故障
{
if (InputMaterialQuene.Count > 0)
{
while (!globalVar.AllowAgvToLineLoadRoller || globalVar.rollerLineOne.OutMaterialingSingle == 0) //后续考虑是否用while
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
AGVHelper.GetInstance.AgvToLineThreeLoadRoller();
MessageLog.GetInstance.Show("AGV去3号线体");
globalVar.AllowAgvToLineLoadRoller = false;
}

}
else
{
MessageLog.GetInstance.ShowEx("警告:滚筒输送线体【3】故障!!!");
lineAlarm = -1;
}
lineAlarm = 1;
}
/// <summary>
/// 1号线体数据下发
/// </summary>
/// <param name="count"></param>
/// <param name="materialLoc"></param>
/// <param name="materialWeight"></param>
public void RollerOneDataWrite(int count, ushort materialLoc, ushort materialWeight)
{
switch (count)
{
case 0:
DeviceOperate.GetInstance.WritePlcData("D1001", materialLoc);//桶1位置
DeviceOperate.GetInstance.WritePlcData("D1010", materialWeight);//桶2重量
break;
case 1:
DeviceOperate.GetInstance.WritePlcData("D1002", materialLoc);//桶2位置
DeviceOperate.GetInstance.WritePlcData("D1011", materialWeight);//桶2重量
break;
case 2:
DeviceOperate.GetInstance.WritePlcData("D1003", materialLoc);//桶3位置
DeviceOperate.GetInstance.WritePlcData("D1012", materialWeight);//桶3重量
break;
case 3:
DeviceOperate.GetInstance.WritePlcData("D1004", materialLoc);//桶4位置
DeviceOperate.GetInstance.WritePlcData("D1013", materialWeight);//桶4重量
break;
case 4:
DeviceOperate.GetInstance.WritePlcData("D1005", materialLoc);//桶5位置
DeviceOperate.GetInstance.WritePlcData("D1014", materialWeight);//桶5重量
break;
case 5:
DeviceOperate.GetInstance.WritePlcData("D1006", materialLoc);//桶6位置
DeviceOperate.GetInstance.WritePlcData("D1015", materialWeight);//桶6重量
break;
case 6:
DeviceOperate.GetInstance.WritePlcData("D1007", materialLoc);//桶7位置
DeviceOperate.GetInstance.WritePlcData("D1016", materialWeight);//桶7重量
break;
case 7:
DeviceOperate.GetInstance.WritePlcData("D1008", materialLoc);//桶8位置
DeviceOperate.GetInstance.WritePlcData("D1017", materialWeight);//桶8重量
break;

}
}
/// <summary>
/// 2号线体数据下发
/// </summary>
/// <param name="count"></param>
/// <param name="materialLoc"></param>
/// <param name="materialWeight"></param>
public void RollerTwoDataWrite(int count, ushort materialLoc, ushort materialWeight)
{
switch (count)
{
case 0:
DeviceOperate.GetInstance.WritePlcData("D1018", materialLoc);//桶1位置
DeviceOperate.GetInstance.WritePlcData("D1027", materialWeight);//桶2重量
break;
case 1:
DeviceOperate.GetInstance.WritePlcData("D1019", materialLoc);//桶2位置
DeviceOperate.GetInstance.WritePlcData("D1028", materialWeight);//桶2重量
break;
case 2:
DeviceOperate.GetInstance.WritePlcData("D1020", materialLoc);//桶3位置
DeviceOperate.GetInstance.WritePlcData("D1029", materialWeight);//桶3重量
break;
case 3:
DeviceOperate.GetInstance.WritePlcData("D1021", materialLoc);//桶4位置
DeviceOperate.GetInstance.WritePlcData("D1030", materialWeight);//桶4重量
break;
case 4:
DeviceOperate.GetInstance.WritePlcData("D1022", materialLoc);//桶5位置
DeviceOperate.GetInstance.WritePlcData("D1031", materialWeight);//桶5重量
break;
case 5:
DeviceOperate.GetInstance.WritePlcData("D1023", materialLoc);//桶6位置
DeviceOperate.GetInstance.WritePlcData("D1032", materialWeight);//桶6重量
break;
case 6:
DeviceOperate.GetInstance.WritePlcData("D1024", materialLoc);//桶7位置
DeviceOperate.GetInstance.WritePlcData("D1033", materialWeight);//桶7重量
break;
case 7:
DeviceOperate.GetInstance.WritePlcData("D1025", materialLoc);//桶8位置
DeviceOperate.GetInstance.WritePlcData("D1034", materialWeight);//桶8重量
break;

}
}
/// <summary>
/// 3号线体数据下发
/// </summary>
/// <param name="count"></param>
/// <param name="materialLoc"></param>
/// <param name="materialWeight"></param>
public void RollerThreeDataWrite(int count, ushort materialLoc, ushort materialWeight)
{
switch (count)
{
case 0:
DeviceOperate.GetInstance.WritePlcData("D1035", materialLoc);//桶1位置
DeviceOperate.GetInstance.WritePlcData("D1044", materialWeight);//桶2重量
break;
case 1:
DeviceOperate.GetInstance.WritePlcData("D1036", materialLoc);//桶2位置
DeviceOperate.GetInstance.WritePlcData("D1045", materialWeight);//桶2重量
break;
case 2:
DeviceOperate.GetInstance.WritePlcData("D1037", materialLoc);//桶3位置
DeviceOperate.GetInstance.WritePlcData("D1046", materialWeight);//桶3重量
break;
case 3:
DeviceOperate.GetInstance.WritePlcData("D1038", materialLoc);//桶4位置
DeviceOperate.GetInstance.WritePlcData("D1047", materialWeight);//桶4重量
break;
case 4:
DeviceOperate.GetInstance.WritePlcData("D1039", materialLoc);//桶5位置
DeviceOperate.GetInstance.WritePlcData("D1048", materialWeight);//桶5重量
break;
case 5:
DeviceOperate.GetInstance.WritePlcData("D1040", materialLoc);//桶6位置
DeviceOperate.GetInstance.WritePlcData("D1049", materialWeight);//桶6重量
break;
case 6:
DeviceOperate.GetInstance.WritePlcData("D1041", materialLoc);//桶7位置
DeviceOperate.GetInstance.WritePlcData("D1050", materialWeight);//桶7重量
break;
case 7:
DeviceOperate.GetInstance.WritePlcData("D1042", materialLoc);//桶8位置
DeviceOperate.GetInstance.WritePlcData("D1051", materialWeight);//桶8重量
break;

}

}
/// <summary>
/// AGV进料就位信号下发至PLC
/// </summary>
public void AgvArriveLineSingelSetDown()
{
switch (InputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
{
case 1:
case 4: DeviceOperate.GetInstance.WritePlcData("D1052", 1); break;//AGV进料就位信号1
case 2:
case 5: DeviceOperate.GetInstance.WritePlcData("D1053", 1); break;//AGV进料就位信号2
case 3: DeviceOperate.GetInstance.WritePlcData("D1054", 1); break;//AGV进料就位信号3
}

}
/// <summary>
/// 炒锅滚筒信号检测
/// </summary>
public void FryPotRollerTroubleCheck()
{
FryPotAlarm = 0;
switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
{
case 1:
if (globalVar.fryPotOne.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowEx("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotOne.RollerTroubleSingle == 1)
{
Thread.Sleep(50); if (globalVar.ExitMainTask)
return;
}
FryPotAlarm = 1; break;
case 2:
if (globalVar.fryPotTwo.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowEx("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotTwo.RollerTroubleSingle == 1)
{
Thread.Sleep(50); if (globalVar.ExitMainTask)
return;
}
FryPotAlarm = 1; break;
case 3:
if (globalVar.fryPotThree.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowEx("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotThree.RollerTroubleSingle == 1)
{
Thread.Sleep(50); if (globalVar.ExitMainTask)
return;
}
FryPotAlarm = 1; break;
case 4:
if (globalVar.fryPotFour.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowEx("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotFour.RollerTroubleSingle == 1)
{
Thread.Sleep(50); if (globalVar.ExitMainTask)
return;
}
FryPotAlarm = 1; break;
case 5:
if (globalVar.fryPotFive.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowEx("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotFive.RollerTroubleSingle == 1)
{
Thread.Sleep(50); if (globalVar.ExitMainTask)
return;
}
FryPotAlarm = 1; break;

}
}

}
}

+ 410
- 0
FryPot_DosingSystem/Control/GlobalVariable.cs View File

@@ -0,0 +1,410 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FryPot_DosingSystem.Control
{
/// <summary>
/// plc变量
/// </summary>
internal class GlobalVariable
{
/// <summary>
/// 滚筒线1
/// </summary>
public RollerLineOne rollerLineOne = new RollerLineOne();
/// <summary>
/// 滚筒线2
/// </summary>
public RollerLineTwo rollerLineTwo = new RollerLineTwo();
/// <summary>
/// 滚筒线3
/// </summary>
public RollerLineThree rollerLineThree = new RollerLineThree();
/// <summary>
/// 炒锅1
/// </summary>
public FryPotOne fryPotOne= new FryPotOne();
/// <summary>
/// 炒锅2
/// </summary>
public FryPotTwo fryPotTwo= new FryPotTwo();
/// <summary>
/// 炒锅3
/// </summary>
public FryPotThree fryPotThree= new FryPotThree();
/// <summary>
/// 炒锅4
/// </summary>
public FryPotFour fryPotFour= new FryPotFour();
/// <summary>
/// 炒锅5
/// </summary>
public FryPotFive fryPotFive= new FryPotFive();
/// <summary>
/// 洗桶进桶滚筒运行信号
/// </summary>
public ushort CleadBarrelEnterSingle { get; set; }
/// <summary>
/// 洗桶出桶滚筒运行信号
/// </summary>
public ushort CleadBarrelExitSingle { get; set; }
/// <summary>
/// PLC初始化状态
/// </summary>
public ushort PlcInite { get; set; }
#region 上位机内部逻辑条件
/// <summary>
/// 退出主任务循环
/// </summary>
public bool ExitMainTask { get; set; }
/// <summary>
/// 允许AGV去线体装桶条件
/// </summary>
public bool AllowAgvToLineLoadRoller { get; set; } = true;
/// <summary>
/// 配方唯一ID
/// </summary>
public string RecipeId { get; set; }
/// <summary>
/// 进桶出桶互锁
/// </summary>
public bool InOrOutputLock { get; set; }
#endregion

}
/// <summary>
/// 滚筒线1相关变量
/// </summary>
public class RollerLineOne
{
/// <summary>
/// 工位号1
/// </summary>
public ushort StationOne { get; set; }
/// <summary>
/// 工位号2
/// </summary>
public ushort StationTwo { get; set; }
/// <summary>
/// 工位号3
/// </summary>
public ushort StationThree { get; set; }
/// <summary>
/// 工位号4
/// </summary>
public ushort StationFour { get; set; }
/// <summary>
/// 工位号5
/// </summary>
public ushort StationFive { get; set; }
/// <summary>
/// 工位号6
/// </summary>
public ushort StationSix { get; set; }
/// <summary>
/// 工位号7
/// </summary>
public ushort StationSeven { get; set; }
/// <summary>
/// 工位号8
/// </summary>
public ushort StationEight { get; set; }
/// <summary>
/// 输送出料滚筒运行信号
/// </summary>
public ushort OutMaterialingSingle { get; set; }
/// <summary>
/// 输送出料滚筒运行故障信号
/// </summary>
public ushort OutMaterialingTroubleSingle { get; set; }
/// <summary>
/// 当前线体配方完成信号
/// </summary>
public ushort RecipeCompleteSingle { get; set; }


}
/// <summary>
/// 滚筒线2相关变量
/// </summary>
public class RollerLineTwo
{
/// <summary>
/// 工位号1
/// </summary>
public ushort StationOne { get; set; }
/// <summary>
/// 工位号2
/// </summary>
public ushort StationTwo { get; set; }
/// <summary>
/// 工位号3
/// </summary>
public ushort StationThree { get; set; }
/// <summary>
/// 工位号4
/// </summary>
public ushort StationFour { get; set; }
/// <summary>
/// 工位号5
/// </summary>
public ushort StationFive { get; set; }
/// <summary>
/// 工位号6
/// </summary>
public ushort StationSix { get; set; }
/// <summary>
/// 工位号7
/// </summary>
public ushort StationSeven { get; set; }
/// <summary>
/// 工位号8
/// </summary>
public ushort StationEight { get; set; }
/// <summary>
/// 输送出料滚筒运行信号
/// </summary>
public ushort OutMaterialingSingle { get; set; }
/// <summary>
/// 输送出料滚筒运行故障信号
/// </summary>
public ushort OutMaterialingTroubleSingle { get; set; }
/// <summary>
/// 当前线体配方完成信号
/// </summary>
public ushort RecipeCompleteSingle { get; set; }
}
/// <summary>
/// 滚筒线3相关变量
/// </summary>
public class RollerLineThree
{
/// <summary>
/// 工位号1
/// </summary>
public ushort StationOne { get; set; }
/// <summary>
/// 工位号2
/// </summary>
public ushort StationTwo { get; set; }
/// <summary>
/// 工位号3
/// </summary>
public ushort StationThree { get; set; }
/// <summary>
/// 工位号4
/// </summary>
public ushort StationFour { get; set; }
/// <summary>
/// 工位号5
/// </summary>
public ushort StationFive { get; set; }
/// <summary>
/// 工位号6
/// </summary>
public ushort StationSix { get; set; }
/// <summary>
/// 工位号7
/// </summary>
public ushort StationSeven { get; set; }
/// <summary>
/// 工位号8
/// </summary>
public ushort StationEight { get; set; }
/// <summary>
/// 输送出料滚筒运行信号
/// </summary>
public ushort OutMaterialingSingle { get; set; }
/// <summary>
/// 输送出料滚筒运行故障信号
/// </summary>
public ushort OutMaterialingTroubleSingle { get; set; }
/// <summary>
/// 当前线体配方完成信号
/// </summary>
public ushort RecipeCompleteSingle { get; set; }
}
/// <summary>
/// 滚筒线4相关变量
/// </summary>
public class RollerLineFour
{
/// <summary>
/// 工位号1
/// </summary>
public ushort StationOne { get; set; }
/// <summary>
/// 工位号2
/// </summary>
public ushort StationTwo { get; set; }
/// <summary>
/// 工位号3
/// </summary>
public ushort StationThree { get; set; }
/// <summary>
/// 工位号4
/// </summary>
public ushort StationFour { get; set; }
/// <summary>
/// 工位号5
/// </summary>
public ushort StationFive { get; set; }
/// <summary>
/// 工位号6
/// </summary>
public ushort StationSix { get; set; }
/// <summary>
/// 工位号7
/// </summary>
public ushort StationSeven { get; set; }
/// <summary>
/// 工位号8
/// </summary>
public ushort StationEight { get; set; }
/// <summary>
/// 输送出料滚筒运行信号
/// </summary>
public ushort OutMaterialingSingle { get; set; }
/// <summary>
/// 输送出料滚筒运行故障信号
/// </summary>
public ushort OutMaterialingTroubleSingle { get; set; }
/// <summary>
/// 当前线体配方完成信号
/// </summary>
public ushort RecipeCompleteSingle { get; set; }
}
/// <summary>
/// 炒锅1相关变量
/// </summary>
public class FryPotOne
{
/// <summary>
/// 进料滚筒运行信号
/// </summary>
public ushort InputMaterialRollerRunningSingle { get; set; }
/// <summary>
/// 进料到位信号
/// </summary>
public ushort InputMaterialArrivedSingle { get; set; }
/// <summary>
/// 空桶到位信号
/// </summary>
public ushort EmptyBarrelArrivedSingle { get; set; }
/// <summary>
/// 空桶滚筒运行信号
/// </summary>
public ushort EmptyBarrelRollerRunningSingle { get; set; }
/// <summary>
/// 滚筒故障信号
/// </summary>
public ushort RollerTroubleSingle { get; set; }
}
/// <summary>
/// 炒锅2相关变量
/// </summary>
public class FryPotTwo
{
/// <summary>
/// 进料滚筒运行信号
/// </summary>
public ushort InputMaterialRollerRunningSingle { get; set; }
/// <summary>
/// 进料到位信号
/// </summary>
public ushort InputMaterialArrivedSingle { get; set; }
/// <summary>
/// 空桶到位信号
/// </summary>
public ushort EmptyBarrelArrivedSingle { get; set; }
/// <summary>
/// 空桶滚筒运行信号
/// </summary>
public ushort EmptyBarrelRollerRunningSingle { get; set; }
/// <summary>
/// 滚筒故障信号
/// </summary>
public ushort RollerTroubleSingle { get; set; }
}
/// <summary>
/// 炒锅3相关变量
/// </summary>
public class FryPotThree
{
/// <summary>
/// 进料滚筒运行信号
/// </summary>
public ushort InputMaterialRollerRunningSingle { get; set; }
/// <summary>
/// 进料到位信号
/// </summary>
public ushort InputMaterialArrivedSingle { get; set; }
/// <summary>
/// 空桶到位信号
/// </summary>
public ushort EmptyBarrelArrivedSingle { get; set; }
/// <summary>
/// 空桶滚筒运行信号
/// </summary>
public ushort EmptyBarrelRollerRunningSingle { get; set; }
/// <summary>
/// 滚筒故障信号
/// </summary>
public ushort RollerTroubleSingle { get; set; }
}
/// <summary>
/// 炒锅4相关变量
/// </summary>
public class FryPotFour
{
/// <summary>
/// 进料滚筒运行信号
/// </summary>
public ushort InputMaterialRollerRunningSingle { get; set; }
/// <summary>
/// 进料到位信号
/// </summary>
public ushort InputMaterialArrivedSingle { get; set; }
/// <summary>
/// 空桶到位信号
/// </summary>
public ushort EmptyBarrelArrivedSingle { get; set; }
/// <summary>
/// 空桶滚筒运行信号
/// </summary>
public ushort EmptyBarrelRollerRunningSingle { get; set; }
/// <summary>
/// 滚筒故障信号
/// </summary>
public ushort RollerTroubleSingle { get; set; }
}
/// <summary>
/// 炒锅5相关变量
/// </summary>
public class FryPotFive
{
/// <summary>
/// 进料滚筒运行信号
/// </summary>
public ushort InputMaterialRollerRunningSingle { get; set; }
/// <summary>
/// 进料到位信号
/// </summary>
public ushort InputMaterialArrivedSingle { get; set; }
/// <summary>
/// 空桶到位信号
/// </summary>
public ushort EmptyBarrelArrivedSingle { get; set; }
/// <summary>
/// 空桶滚筒运行信号
/// </summary>
public ushort EmptyBarrelRollerRunningSingle { get; set; }
/// <summary>
/// 滚筒故障信号
/// </summary>
public ushort RollerTroubleSingle { get; set; }
}
}

+ 15
- 0
FryPot_DosingSystem/Control/MaterialInfo.cs View File

@@ -0,0 +1,15 @@
using FryPot_DosingSystem.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FryPot_DosingSystem.Control
{
internal class MaterialInfo
{
public MaterialType materialType { get; set;}
public string materialId { get; set; }//原料所属配方的唯一ID
}
}

+ 31
- 0
FryPot_DosingSystem/FryPot_DosingSystem.csproj View File

@@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<None Remove="hbl.ico" />
</ItemGroup>

<ItemGroup>
<Content Include="hbl.ico" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="6.0.6" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="NModbus" Version="3.0.72" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.AGV\BPASmartClient.AGV.csproj" />
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Helper\BPASmartClient.Helper.csproj" />
<ProjectReference Include="..\BPASmartClient.Modbus\BPASmartClient.Modbus.csproj" />
</ItemGroup>

</Project>

+ 46
- 0
FryPot_DosingSystem/Helper/HubHelper.cs View File

@@ -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);
}



}
}

DosingSystem/View/Helper/PasswordBoxHelper.cs → FryPot_DosingSystem/Helper/PasswordBoxHelper.cs View File

@@ -6,12 +6,9 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace BPASmartClient.DosingSystem.View.Helper
namespace FryPot_DosingSystem.Helper
{
/// <summary>
/// 为PasswordBox控件的Password增加绑定功能
/// </summary>
public static class PasswordBoxHelper
public class PasswordBoxHelper
{
public static string GetPasswordContent(DependencyObject obj) => (string)obj.GetValue(PasswordContentProperty);


+ 22
- 0
FryPot_DosingSystem/Model/ActionMenu.cs View File

@@ -0,0 +1,22 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FryPot_DosingSystem.Model
{
public class ActionMenu:ObservableObject
{
private string commandParmeter;
public string CommandParameter { get { return commandParmeter; }set { commandParmeter = value; OnPropertyChanged(); } }

private string menuName;
public string MenuName { get { return menuName; } set { menuName = value;OnPropertyChanged(); } }

private Authority[] authority;
public Authority[] Authority { get { return authority; } set { authority = value; OnPropertyChanged(); } }
}
}

+ 24
- 0
FryPot_DosingSystem/Model/DeviceInfo.cs View File

@@ -0,0 +1,24 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FryPot_DosingSystem.Model
{
internal class DeviceInfo : ObservableObject
{
private string _deviceNum;
public string DeviceNum { get { return _deviceNum; }set { _deviceNum = value;OnPropertyChanged(); } }

private string _deviceName;
public string DeviceName { get { return _deviceName; } set { _deviceName = value; OnPropertyChanged(); } }

private string _ip;
public string Ip { get { return _ip; } set { _ip = value; OnPropertyChanged(); } }

private string _port;
public string Port { get { return _port; } set { _port = value; OnPropertyChanged(); } }
}
}

+ 15
- 0
FryPot_DosingSystem/Model/DeviceManage.cs View File

@@ -0,0 +1,15 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FryPot_DosingSystem.Model
{
internal class DeviceManage:ObservableObject
{
public ObservableCollection<DeviceInfo> Devices { get; set; } = new ObservableCollection<DeviceInfo>();
}
}

+ 13
- 0
FryPot_DosingSystem/Model/Global.cs View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FryPot_DosingSystem.Model
{
internal class Global
{
public static UserManage userManager { get; set; } = new UserManage();
}
}

+ 30
- 0
FryPot_DosingSystem/Model/LogModel.cs View File

@@ -0,0 +1,30 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;

namespace FryPot_DosingSystem.Model
{
internal class LogModel:ObservableObject
{
private string _logTime;
public string LogTime { get { return _logTime; } set { _logTime = value; OnPropertyChanged(); } }

private string _logType;
public string LogType { get { return _logType; } set { _logType = value; OnPropertyChanged(); } }

private string _logMessage;
public string LogMessage { get { return _logMessage; } set { _logMessage = value; OnPropertyChanged(); } }

private Brush _foreColor;
public Brush ForeColor { get { return _foreColor; } set { _foreColor = value; OnPropertyChanged(); } }
public LogModel()
{
ForeColor = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#21bb2e"));
LogTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
}
}

+ 48
- 0
FryPot_DosingSystem/Model/LoginInfoConfig.cs View File

@@ -0,0 +1,48 @@
using BPA.Message;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FryPot_DosingSystem.Model
{
internal class LoginInfoConfig
{
private volatile static LoginInfoConfig _Instance;
public static LoginInfoConfig GetInstance => _Instance ?? (_Instance = new LoginInfoConfig());
private LoginInfoConfig() { }


public void Init()
{
if (File.Exists("LoginUp.hbl"))
{
var result = JsonConvert.DeserializeObject<UserManage>(File.ReadAllText("LoginUp.hbl").AESDecrypt());
if (result == null || (result != null && result.userInfos.Count <= 0))//无用户登陆相关信息
{
}
else
{
Global.userManager = result;
}
}
else
{
AddData();
}
}

private void AddData()
{
Global.userManager.userInfos.Add(new UserInfo() { Authority = Authority.管理员, UserName = "admin", Password = "123456",UserId="123" });
//Global.userManager.userInfos.Add(new UserInfo() { Authority = Authority.操作员, UserName = "czy", Password = "123456" });
//Global.userManager.userInfos.Add(new UserInfo() { Authority = Authority.观察员, UserName = "gcy", Password = "123456" });
//Global.userManager.userInfos.Add(new UserInfo() { Authority = Authority.技术员, UserName = "jsy", Password = "123456" });
File.WriteAllText("LoginUp.hbl", JsonConvert.SerializeObject(Global.userManager).AESEncrypt());
}
}
}

+ 35
- 0
FryPot_DosingSystem/Model/MaterialType.cs View File

@@ -0,0 +1,35 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FryPot_DosingSystem.Model
{
internal class MaterialType:ObservableObject
{
/// <summary>
/// 原料名称
/// </summary>
private string _materialName;
public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } }
/// <summary>
/// 原料编码
/// </summary>
private string _materialCode;
public string MaterialCode { get { return _materialCode; } set { _materialCode = value; OnPropertyChanged(); } }
/// <summary>
/// 原料重量
/// </summary>
private ushort _materialWeight;
public ushort MaterialWeight { get { return _materialWeight; }set { _materialWeight = value;OnPropertyChanged(); } }
/// <summary>
/// 原料对应桶位置
/// </summary>
private ushort _materialLoc;
public ushort MaterialLoc { get { return _materialLoc; } set { _materialLoc = value; OnPropertyChanged(); } }

}
}

+ 14
- 0
FryPot_DosingSystem/Model/PlcVariableModel.cs View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FryPot_DosingSystem.Model
{
internal class PlcVariableModel
{
public string Address { get; set; }
public ushort Length { get; set;}
}
}

+ 17
- 0
FryPot_DosingSystem/Model/RecipeManage.cs View File

@@ -0,0 +1,17 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FryPot_DosingSystem.Model
{
internal class RecipeManage:ObservableObject
{
//private static RecipeManage _Instance;
//public static RecipeManage GetInstance=>_Instance ?? (_Instance = new RecipeManage());
public ObservableCollection<NewRecipeModel> Recipes { get; set; }=new ObservableCollection<NewRecipeModel>();
}
}

+ 32
- 0
FryPot_DosingSystem/Model/RecipeModel.cs View File

@@ -0,0 +1,32 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FryPot_DosingSystem.Model
{
internal class NewRecipeModel:ObservableObject
{
/// <summary>
/// 配方唯一ID
/// </summary>
private string _recipeId;
public string RecipeId { get { return _recipeId; }set { _recipeId = value; OnPropertyChanged(); } }
/// <summary>
/// 配方名称
/// </summary>
private string _recipeName;
public string RecipeName { get { return _recipeName; } set { _recipeName = value;OnPropertyChanged(); } }

/// <summary>
/// 配方下发状况信息
/// </summary>
private string _recipeSetInfo;
public string RecipeSetInfo { get { return _recipeSetInfo; } set { _recipeSetInfo = value; OnPropertyChanged(); } }

public ObservableCollection<MaterialType> materialCollection { get; set; } = new ObservableCollection<MaterialType>();
}
}

DosingSystem/Model/UserManager.cs → FryPot_DosingSystem/Model/UserManage.cs View File

@@ -4,27 +4,25 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.DosingSystem.Model
namespace FryPot_DosingSystem.Model
{
public class UserManager
internal class UserManage
{
public List<UserInfo> userInfos { get; set; } = new List<UserInfo>();
}

public class UserInfo
{
public Permission permission { get; set; }
{
public Authority Authority { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public string UserId { get; set; }
}

public enum Permission : int
public enum Authority
{
管理员 = 1,
操作员 = 2,
观察员 = 3,
技术员 = 4
}

}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save