@@ -239,6 +239,55 @@ namespace BPASmartClient.AGV | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV从清洗台到4号线体卸桶 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string AgvFromCleanToLineFourUnLoadRoller(string robotJobId) | |||
{ | |||
//string url = AGVRequestUrl.GetInstance.TaskSendUrl; | |||
////请求报文头 | |||
//HttpRequestHeaderModel.GetInstance.appKey = ""; | |||
//HttpRequestHeaderModel.GetInstance.appSecret = ""; | |||
//HttpRequestHeaderModel.GetInstance.requestId = ""; | |||
//HttpRequestHeaderModel.GetInstance.timestamp = ""; | |||
//HttpRequestHeaderModel.GetInstance.version = "2.8"; | |||
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); | |||
////请求报文体 | |||
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 | |||
//AGVModel.GetInstance.warehouseId = 123; //仓库编号 | |||
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 | |||
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 | |||
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE | |||
////详细任务数据 | |||
////点到点 | |||
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 | |||
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 | |||
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 | |||
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 | |||
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; | |||
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////货位到货位 | |||
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 | |||
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 | |||
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; | |||
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////启用签名 | |||
////url = url + "?sign=" + MD5Deal(body); | |||
//string data = HttpRequest(url, head, body); | |||
//object objData = JsonConvert.DeserializeObject(data); | |||
//if (objData != null && objData is HttpResponseBodyModel response) | |||
//{ | |||
// return response.code; | |||
//} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV离开炒锅1 | |||
/// </summary> | |||
/// <returns></returns> | |||
@@ -483,6 +532,203 @@ namespace BPASmartClient.AGV | |||
//} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV从1号线运空桶洗桶 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string AgvLeaveLOneToClean(string robotJobId) | |||
{ | |||
//string url = AGVRequestUrl.GetInstance.TaskSendUrl; | |||
////请求报文头 | |||
//HttpRequestHeaderModel.GetInstance.appKey = ""; | |||
//HttpRequestHeaderModel.GetInstance.appSecret = ""; | |||
//HttpRequestHeaderModel.GetInstance.requestId = ""; | |||
//HttpRequestHeaderModel.GetInstance.timestamp = ""; | |||
//HttpRequestHeaderModel.GetInstance.version = "2.8"; | |||
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); | |||
////请求报文体 | |||
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 | |||
//AGVModel.GetInstance.warehouseId = 123; //仓库编号 | |||
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 | |||
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 | |||
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE | |||
////详细任务数据 | |||
////点到点 | |||
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 | |||
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 | |||
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 | |||
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 | |||
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; | |||
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////货位到货位 | |||
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 | |||
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 | |||
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; | |||
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////启用签名 | |||
////url = url + "?sign=" + MD5Deal(body); | |||
//string data = HttpRequest(url, head, body); | |||
//object objData = JsonConvert.DeserializeObject(data); | |||
//if (objData != null && objData is HttpResponseBodyModel response) | |||
//{ | |||
// return response.code; | |||
//} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV从2号线运空桶洗桶 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string AgvLeaveLTwoToClean(string robotJobId) | |||
{ | |||
//string url = AGVRequestUrl.GetInstance.TaskSendUrl; | |||
////请求报文头 | |||
//HttpRequestHeaderModel.GetInstance.appKey = ""; | |||
//HttpRequestHeaderModel.GetInstance.appSecret = ""; | |||
//HttpRequestHeaderModel.GetInstance.requestId = ""; | |||
//HttpRequestHeaderModel.GetInstance.timestamp = ""; | |||
//HttpRequestHeaderModel.GetInstance.version = "2.8"; | |||
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); | |||
////请求报文体 | |||
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 | |||
//AGVModel.GetInstance.warehouseId = 123; //仓库编号 | |||
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 | |||
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 | |||
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE | |||
////详细任务数据 | |||
////点到点 | |||
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 | |||
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 | |||
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 | |||
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 | |||
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; | |||
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////货位到货位 | |||
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 | |||
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 | |||
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; | |||
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////启用签名 | |||
////url = url + "?sign=" + MD5Deal(body); | |||
//string data = HttpRequest(url, head, body); | |||
//object objData = JsonConvert.DeserializeObject(data); | |||
//if (objData != null && objData is HttpResponseBodyModel response) | |||
//{ | |||
// return response.code; | |||
//} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV从3号线运空桶洗桶 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string AgvLeaveLThreeToClean(string robotJobId) | |||
{ | |||
//string url = AGVRequestUrl.GetInstance.TaskSendUrl; | |||
////请求报文头 | |||
//HttpRequestHeaderModel.GetInstance.appKey = ""; | |||
//HttpRequestHeaderModel.GetInstance.appSecret = ""; | |||
//HttpRequestHeaderModel.GetInstance.requestId = ""; | |||
//HttpRequestHeaderModel.GetInstance.timestamp = ""; | |||
//HttpRequestHeaderModel.GetInstance.version = "2.8"; | |||
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); | |||
////请求报文体 | |||
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 | |||
//AGVModel.GetInstance.warehouseId = 123; //仓库编号 | |||
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 | |||
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 | |||
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE | |||
////详细任务数据 | |||
////点到点 | |||
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 | |||
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 | |||
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 | |||
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 | |||
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; | |||
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////货位到货位 | |||
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 | |||
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 | |||
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; | |||
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////启用签名 | |||
////url = url + "?sign=" + MD5Deal(body); | |||
//string data = HttpRequest(url, head, body); | |||
//object objData = JsonConvert.DeserializeObject(data); | |||
//if (objData != null && objData is HttpResponseBodyModel response) | |||
//{ | |||
// return response.code; | |||
//} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV从洗桶处运桶到4号洗桶线 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string AgvLeaveCleanToLFour(string robotJobId) | |||
{ | |||
//string url = AGVRequestUrl.GetInstance.TaskSendUrl; | |||
////请求报文头 | |||
//HttpRequestHeaderModel.GetInstance.appKey = ""; | |||
//HttpRequestHeaderModel.GetInstance.appSecret = ""; | |||
//HttpRequestHeaderModel.GetInstance.requestId = ""; | |||
//HttpRequestHeaderModel.GetInstance.timestamp = ""; | |||
//HttpRequestHeaderModel.GetInstance.version = "2.8"; | |||
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); | |||
////请求报文体 | |||
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 | |||
//AGVModel.GetInstance.warehouseId = 123; //仓库编号 | |||
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 | |||
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 | |||
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE | |||
////详细任务数据 | |||
////点到点 | |||
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 | |||
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 | |||
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 | |||
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 | |||
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; | |||
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////货位到货位 | |||
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 | |||
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 | |||
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 | |||
////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 | |||
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; | |||
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); | |||
////启用签名 | |||
////url = url + "?sign=" + MD5Deal(body); | |||
//string data = HttpRequest(url, head, body); | |||
//object objData = JsonConvert.DeserializeObject(data); | |||
//if (objData != null && objData is HttpResponseBodyModel response) | |||
//{ | |||
// return response.code; | |||
//} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// 任务取消 | |||
/// </summary> | |||
@@ -84,6 +84,7 @@ namespace BPASmartClient.Business | |||
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()); | |||
configurationBuilder.AddApolloConfiguration(p => | |||
{ | |||
p.AppId = apoid; | |||
p.MetaServer = apolloUri; | |||
p.Namespaces = new List<string>() { "application", namespa }; | |||
@@ -114,6 +114,10 @@ | |||
<None Remove="Image\工艺流程.jpg" /> | |||
<None Remove="Image\工艺流程.png" /> | |||
<None Remove="Image\底部背景.png" /> | |||
<None Remove="Image\按钮\AddGreen.png" /> | |||
<None Remove="Image\按钮\Delete.png" /> | |||
<None Remove="Image\按钮\停用.png" /> | |||
<None Remove="Image\按钮\添加.png" /> | |||
<None Remove="Image\弹窗.png" /> | |||
<None Remove="Image\搜索按钮.png" /> | |||
<None Remove="Image\搜索框.png" /> | |||
@@ -123,6 +127,7 @@ | |||
<None Remove="Image\智慧城市科技风登录页面.png" /> | |||
<None Remove="Image\智慧城市科技风登录页面边框.png" /> | |||
<None Remove="Image\有告警.png" /> | |||
<None Remove="Image\权限背景.png" /> | |||
<None Remove="Image\标题背景.png" /> | |||
<None Remove="Image\浅色背景.jpeg" /> | |||
<None Remove="Image\环形切图\内圈\未选中.png" /> | |||
@@ -272,9 +277,14 @@ | |||
<Resource Include="Image\告警\轻微告警.png" /> | |||
<Resource Include="Image\工艺流程.jpg" /> | |||
<Resource Include="Image\工艺流程.png" /> | |||
<Resource Include="Image\按钮\AddGreen.png" /> | |||
<Resource Include="Image\按钮\Delete.png" /> | |||
<Resource Include="Image\按钮\停用.png" /> | |||
<Resource Include="Image\按钮\添加.png" /> | |||
<Resource Include="Image\弹窗.png" /> | |||
<Resource Include="Image\智慧城市科技风登录页面.png" /> | |||
<Resource Include="Image\智慧城市科技风登录页面边框.png" /> | |||
<Resource Include="Image\权限背景.png" /> | |||
<Resource Include="Image\浅色背景.jpeg" /> | |||
<Resource Include="Image\界面2.png"> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
@@ -38,10 +38,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
private void AddData() | |||
{ | |||
Global.userManager.userInfos.Add(new UserInfo() {Id= IdProcess(), permission = Permission.管理员, UserName = "admin", Password = "admin" }); ; | |||
Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), permission = Permission.操作员, UserName = "czy", Password = "123456" }); | |||
Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), permission = Permission.观察员, UserName = "gcy", Password = "654321" }); | |||
Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), permission = Permission.技术员, UserName = "jsy", Password = "88888888" }); | |||
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.管理员, UserName = "admin", Password = "admin" }); | |||
SaveUser(); | |||
} | |||
@@ -12,6 +12,10 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
public static UserManager userManager { get; set; } = new UserManager(); | |||
public static UserInfo userInfo { get; set; } = new UserInfo(); | |||
/// <summary> | |||
/// 重置密码页面传值 | |||
/// </summary> | |||
public static UserInfo changeUserInfo { get; set; } = null; | |||
} | |||
} |
@@ -114,7 +114,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
/// 子菜单的显示隐藏设置 | |||
/// </summary> | |||
public Visibility SubMenuVisibility { get { return _mSubMenuVisibility; } set { _mSubMenuVisibility = value; OnPropertyChanged(); } } | |||
private Visibility _mSubMenuVisibility; | |||
private Visibility _mSubMenuVisibility = Visibility.Collapsed; | |||
} | |||
@@ -1,5 +1,6 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
@@ -10,6 +11,6 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
public class PlcVariableInfoManage:ObservableObject | |||
{ | |||
public ObservableCollection<PlcVariableInfoModel> VariablesInfo { get; set; } = new ObservableCollection<PlcVariableInfoModel>(); | |||
public ConcurrentDictionary<string, ObservableCollection<PlcVariableInfoModel>> VariablesInfo { get; set; } = new ConcurrentDictionary<string, ObservableCollection<PlcVariableInfoModel>>(); | |||
} | |||
} |
@@ -10,6 +10,8 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
public class UserInfo:ObservableObject | |||
{ | |||
public String LastLogInTime { get; set; } = "无"; | |||
public List<UserTreeViewModel> userTreeViewModels { get; set; } | |||
public string Id { get { return _id; }set { _id = value;OnPropertyChanged(); } } | |||
private string _id; | |||
public Permission permission { get { return _perimission; } set { _perimission = value;OnPropertyChanged(); } } | |||
@@ -10,5 +10,6 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
public class UserManager | |||
{ | |||
public ObservableCollection<UserInfo> userInfos { get; set; } = new ObservableCollection<UserInfo>(); | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
public class UserTreeViewModel: ObservableObject | |||
{ | |||
public string Name { get; set; } | |||
public List<UserTreeViewModel> TreeViewItems { get; set; } | |||
} | |||
} |
@@ -0,0 +1,330 @@ | |||
<Window x:Class="BPASmartClient.CustomResource.Pages.View.AddNewUser" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:common="clr-namespace:BPASmartClient.CustomResource.Pages.Model" | |||
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel" | |||
Title="AddNewUser" | |||
Width="400" | |||
Height="350" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:AddNewUserViewModel/> | |||
</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="" /> | |||
<!--<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="" /> | |||
<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 Background="Transparent"> | |||
<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"> | |||
<TextBox | |||
Text="{Binding UserName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" | |||
Name="oldpb" | |||
Height="40" | |||
Margin="20,0" | |||
BorderBrush="#009DFF" | |||
FontSize="16" | |||
Foreground="#aadddddd" | |||
Style="{DynamicResource UserTextBoxStyle}" | |||
TabIndex="2" /> | |||
</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 ConfirmCommand}" | |||
Content="确 认" | |||
FontSize="20" | |||
Foreground="White" | |||
TabIndex="3" /> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,60 @@ | |||
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> | |||
/// AddNewUser.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class AddNewUser : Window | |||
{ | |||
public AddNewUser() | |||
{ | |||
InitializeComponent(); | |||
this.br.MouseLeftButtonDown += (o, e) => | |||
{ | |||
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); | |||
}; | |||
ActionManage.GetInstance.CancelRegister("AddNewUserViewConfirm"); | |||
ActionManage.GetInstance.CancelRegister("AddNewUserViewCancel"); | |||
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "AddNewUserViewConfirm"); | |||
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "AddNewUserViewCancel"); | |||
} | |||
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; | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
<UserControl x:Class="BPASmartClient.CustomResource.Pages.View.PermissionConfigurationView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View" | |||
Width="800" | |||
Height="450" | |||
mc:Ignorable="d"> | |||
<Grid> | |||
</Grid> | |||
</UserControl> |
@@ -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> | |||
/// PermissionConfigurationView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class PermissionConfigurationView : UserControl | |||
{ | |||
public PermissionConfigurationView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,406 @@ | |||
<Window x:Class="BPASmartClient.CustomResource.Pages.View.UserConfigView" | |||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View" | |||
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel" | |||
Title="UserConfigView" Width="800" | |||
Height="1000" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:UserConfigViewModel/> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<ImageBrush x:Key="ImageBrushAddBlue" ImageSource="../../Image/按钮/AddGreen.png"></ImageBrush> | |||
<ImageBrush x:Key="ImageBrushAddGray" ImageSource="../../Image/按钮/Delete.png"></ImageBrush> | |||
<Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}"> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="OverridesDefaultStyle" Value="true" /> | |||
<Setter Property="IsTabStop" Value="false" /> | |||
<Setter Property="Focusable" Value="false" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type RepeatButton}"> | |||
<Border Background="Transparent" /> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}"> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="OverridesDefaultStyle" Value="true" /> | |||
<Setter Property="IsTabStop" Value="false" /> | |||
<Setter Property="Focusable" Value="false" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type Thumb}"> | |||
<Border CornerRadius="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" /> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}"> | |||
<Grid> | |||
<Border CornerRadius="2" Width="0.5" Background="#FF046BFF" /> | |||
<Track x:Name="PART_Track" IsDirectionReversed="true"> | |||
<Track.DecreaseRepeatButton> | |||
<RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageUpCommand" /> | |||
</Track.DecreaseRepeatButton> | |||
<Track.Thumb> | |||
<Thumb Style="{StaticResource ScrollBarThumb}" Margin="4,0,4,0" Background="DodgerBlue"></Thumb> | |||
</Track.Thumb> | |||
<Track.IncreaseRepeatButton> | |||
<RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageDownCommand" /> | |||
</Track.IncreaseRepeatButton> | |||
</Track> | |||
</Grid> | |||
</ControlTemplate> | |||
<ControlTemplate x:Key="ScrollViewerControlTemplate1" TargetType="{x:Type ScrollViewer}"> | |||
<Grid x:Name="Grid" Background="{TemplateBinding Background}"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="Auto"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="Auto"/> | |||
</Grid.RowDefinitions> | |||
<Rectangle x:Name="Corner" Grid.Column="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1"/> | |||
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/> | |||
<ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" | |||
Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" | |||
Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" | |||
Template="{StaticResource VerticalScrollBar}"/> | |||
<ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/> | |||
</Grid> | |||
</ControlTemplate> | |||
<!--对象树子模板--> | |||
<DataTemplate x:Key="TreeItemTemplate" DataType="TreeViewItem"> | |||
<Grid Margin="50,0,0,0" Height="28"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="30"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock x:Name="tb_PageName" Text="{Binding Name}" Foreground="White" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0"/> | |||
<Button x:Name="BtnAdd" Grid.Column="1" Background="Transparent" VerticalAlignment="Center" HorizontalAlignment="Center" | |||
Command="{Binding DataContext.AddUserPageCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=TreeView}}" | |||
CommandParameter="{Binding Path=Text,ElementName=tb_PageName}"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="Button"> | |||
<Grid> | |||
<Rectangle x:Name="BtnRetangle" Height="20" Width="20" Stroke="Transparent" StrokeThickness="1" | |||
Fill="{StaticResource ImageBrushAddBlue}" | |||
VerticalAlignment="Center" HorizontalAlignment="Center"> | |||
</Rectangle> | |||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="BtnRetangle" Property="Height" Value="22"></Setter> | |||
<Setter TargetName="BtnRetangle" Property="Width" Value="22"></Setter> | |||
</Trigger> | |||
<DataTrigger Binding="{Binding IsChecked}" Value="true"> | |||
<Setter TargetName="BtnRetangle" Property="Fill" Value="{StaticResource ImageBrushAddGray}"></Setter> | |||
<Setter Property="ToolTip" Value="已添加"></Setter> | |||
</DataTrigger> | |||
<DataTrigger Binding="{Binding IsChecked}" Value="false"> | |||
<Setter TargetName="BtnRetangle" Property="Fill" Value="{StaticResource ImageBrushAddBlue}"></Setter> | |||
<Setter Property="ToolTip" Value="添加"></Setter> | |||
</DataTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
</Grid> | |||
</DataTemplate> | |||
<Style TargetType="TreeViewItem"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="IsExpanded" Value="True"></Setter> | |||
<Setter Property="HeaderTemplate"> | |||
<Setter.Value> | |||
<HierarchicalDataTemplate ItemsSource="{Binding TreeViewItems,Mode=TwoWay}" ItemTemplate="{StaticResource TreeItemTemplate}"> | |||
<StackPanel Orientation="Horizontal" Height="28" VerticalAlignment="Center" HorizontalAlignment="Left"> | |||
<!--Image Source="folder.png" VerticalAlignment="Center" Height="17" Margin="10,0"/>--> | |||
<TextBlock Text="{Binding Name}" Margin="5,0,0,0" FontSize="15" VerticalAlignment="Center" Foreground="White"/> | |||
</StackPanel> | |||
</HierarchicalDataTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type TreeViewItem}"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="Auto" /> | |||
<ColumnDefinition Width="*" /> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="Auto" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<VisualStateManager.VisualStateGroups> | |||
<VisualStateGroup x:Name="SelectionStates"> | |||
<VisualState x:Name="Selected"> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" > | |||
<EasingColorKeyFrame KeyTime="0" Value="Transparent" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState x:Name="Unselected" /> | |||
<VisualState x:Name="SelectedInactive"> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"> | |||
<EasingColorKeyFrame KeyTime="0" Value="Transparent" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</VisualState> | |||
</VisualStateGroup> | |||
<VisualStateGroup x:Name="ExpansionStates"> | |||
<VisualState x:Name="Expanded"> | |||
<Storyboard> | |||
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ItemsHost"> | |||
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" /> | |||
</ObjectAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState x:Name="Collapsed" /> | |||
</VisualStateGroup> | |||
</VisualStateManager.VisualStateGroups> | |||
<Border x:Name="Bd" Grid.Column="0" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"> | |||
<ContentPresenter x:Name="PART_Header" ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/> | |||
</Border> | |||
<ItemsPresenter x:Name="ItemsHost" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Visibility="Collapsed" /> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="HasHeader" Value="false" /> | |||
<Condition Property="Width" Value="Auto" /> | |||
</MultiTrigger.Conditions> | |||
<Setter TargetName="PART_Header" Property="MinWidth" Value="75" /> | |||
</MultiTrigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="HasHeader" Value="false" /> | |||
<Condition Property="Height" Value="Auto" /> | |||
</MultiTrigger.Conditions> | |||
<Setter TargetName="PART_Header" Property="MinHeight" Value="19" /> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="ItemContainer" TargetType="{x:Type ListBoxItem}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ListBoxItem}"> | |||
<Border x:Name="IconBorder" Background="Transparent" CornerRadius="4" BorderThickness="0"> | |||
<ContentPresenter /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsSelected" Value="true"> | |||
<Setter TargetName="IconBorder" Property="BitmapEffect"> | |||
<Setter.Value> | |||
<OuterGlowBitmapEffect GlowColor="Transparent" GlowSize="5" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</Window.Resources> | |||
<Border Background="Black" | |||
x:Name="br" | |||
BorderBrush="#009dff" | |||
BorderThickness="2"> | |||
<Border.Effect> | |||
<DropShadowEffect | |||
BlurRadius="10" | |||
ShadowDepth="1" | |||
Color="#009DFF" /> | |||
</Border.Effect> | |||
<Grid> | |||
<Image Source="../../Image/权限背景.png" Stretch="Fill"/> | |||
<Grid Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="80"/> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="10"/> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock Text="{Binding UserName}" HorizontalAlignment="Center" | |||
FontSize="24" | |||
Foreground="#ddd"/> | |||
<TextBlock Text="权限分配" Margin="10,0,0,0" | |||
HorizontalAlignment="Center" | |||
FontSize="24" | |||
Foreground="#ddd"/> | |||
</StackPanel> | |||
<TextBlock Grid.Row="1" | |||
Text="页面权限分配" Margin="10,0,0,0" | |||
HorizontalAlignment="Center" VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#ddd"/> | |||
<TextBlock Grid.Row="3" | |||
Text="配料权限分配" Margin="10,0,0,0" | |||
HorizontalAlignment="Center" VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#ddd"/> | |||
<Grid Grid.Row="2"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="50"/> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="100"/> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="50"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="权限列表" Width="20" | |||
TextWrapping="Wrap" Grid.Column="0" | |||
HorizontalAlignment="Right" VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#ddd"/> | |||
<TextBlock Text="当前用户权限" Width="20" | |||
Grid.Column="4" | |||
TextWrapping="Wrap" | |||
HorizontalAlignment="Left" VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#ddd"/> | |||
<!--#region 页面权限--> | |||
<ScrollViewer Grid.Column="1" Margin="20,0,0,0" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True"> | |||
<TreeView x:Name="MyTreeView" ItemsSource="{Binding pageTreeViewModels}" | |||
ScrollViewer.VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" Background="Transparent" BorderBrush="Transparent"></TreeView> | |||
</ScrollViewer> | |||
<ScrollViewer Grid.Column="3" Margin="10,0,20,0" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True"> | |||
<ListBox x:Name="RightListBox" Grid.Column="3" Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" | |||
ItemsSource="{Binding SelectePage}" > | |||
<ListBox.Template> | |||
<ControlTemplate> | |||
<StackPanel Background="Transparent" IsItemsHost="True"></StackPanel> | |||
</ControlTemplate> | |||
</ListBox.Template> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="28" Margin="10"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="60"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" /> | |||
<Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left" | |||
Command="{Binding DataContext.DeleteUserPageCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" | |||
CommandParameter="{Binding Path=Text,ElementName=tb_Name}"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="Button"> | |||
<Grid> | |||
<Rectangle x:Name="BtnRetangle" Height="17" Width="17" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left"> | |||
<Rectangle.Fill> | |||
<ImageBrush ImageSource="../../Image/按钮/Delete.png"></ImageBrush> | |||
</Rectangle.Fill> | |||
</Rectangle> | |||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="BtnRetangle" Property="Height" Value="19"></Setter> | |||
<Setter TargetName="BtnRetangle" Property="Width" Value="19"></Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</ScrollViewer> | |||
<StackPanel Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Button Foreground="White" Background="#009DFF" | |||
FontSize="16" Height="50" Width="70" Margin="10,20" | |||
Command="{Binding AddAllPageCommand}"> | |||
<TextBlock Text="全部 | |||
添加" TextWrapping="Wrap"/> | |||
</Button> | |||
<Button Foreground="White" Background="#009DFF" | |||
FontSize="16" Height="50" Width="70" Margin="10,20" | |||
Command="{Binding DeleteAllPageCommand}"> | |||
<TextBlock Text="全部 | |||
移除" TextWrapping="Wrap"/> | |||
</Button> | |||
</StackPanel> | |||
<!--#endregion--> | |||
</Grid> | |||
<Grid Grid.Row="4"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="50"/> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="100"/> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="50"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="当前用户权限" Width="20" | |||
TextWrapping="Wrap" | |||
HorizontalAlignment="Center" VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#ddd"/> | |||
<TextBlock Text="权限列表" Width="20" | |||
Grid.Column="4" | |||
TextWrapping="Wrap" | |||
HorizontalAlignment="Center" VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#ddd"/> | |||
</Grid> | |||
<Grid Grid.Row="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<Button Content="保存" | |||
Background="#009DFF" | |||
Margin="200,5,20,5" | |||
BorderThickness="0" | |||
Command="{Binding SaveCommand}" | |||
FontSize="20" | |||
Foreground="White" | |||
TabIndex="3" /> | |||
<Button Content="取消" Grid.Column="1" Background="#009DFF" | |||
Margin="20,5,200,5" | |||
BorderThickness="0" | |||
Command="{Binding CancelCommand}" | |||
FontSize="20" | |||
Foreground="White" | |||
TabIndex="3"/> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,44 @@ | |||
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> | |||
/// UserConfigView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class UserConfigView : Window | |||
{ | |||
public UserConfigView() | |||
{ | |||
InitializeComponent(); | |||
this.br.MouseLeftButtonDown += (o, e) => | |||
{ | |||
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); | |||
}; | |||
ActionManage.GetInstance.CancelRegister("UserConfigViewConfirm"); | |||
ActionManage.GetInstance.CancelRegister("UserConfigViewCancel"); | |||
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "UserConfigViewConfirm"); | |||
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "UserConfigViewCancel"); | |||
} | |||
} | |||
} |
@@ -0,0 +1,170 @@ | |||
<UserControl x:Class="BPASmartClient.CustomResource.Pages.View.UserManagerView" | |||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View" | |||
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel" | |||
Width="1400" | |||
Height="900" | |||
Background="{x:Null}" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:UserManagerViewModel/> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<Style x:Key="CommonTextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="Foreground" Value="#B1E8FF"/> | |||
<Setter Property="HorizontalAlignment" Value="Center"/> | |||
<Setter Property="VerticalAlignment" Value="Center"/> | |||
</Style> | |||
<Style TargetType="{x:Type DataGridCell}"> | |||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> | |||
<Setter Property="TextBlock.FontSize" Value="13" /> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="BorderBrush" Value="#87CEFA"/> | |||
<Setter Property="BorderThickness" Value="1"/> | |||
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Mode=Self},Path=Content.Text}" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type DataGridCell}"> | |||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"> | |||
<!--HorizontalAlignment 可以设置内容展示位置--> | |||
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" HorizontalAlignment="Center" | |||
Margin="{TemplateBinding Padding}"/> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Style.Triggers> | |||
<Trigger Property="IsEnabled" Value="False"> | |||
<Setter Property="Opacity" Value=".56"/> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
<Style TargetType="DataGridRow"> | |||
<Setter Property="FontSize" Value="16"/> | |||
<Setter Property="VerticalAlignment" Value="Center"/> | |||
<Setter Property="Margin" Value="0,5"/> | |||
<Style.Triggers> | |||
<!-- 隔行换色 --> | |||
<Trigger Property="AlternationIndex" Value="0"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
</Trigger> | |||
<Trigger Property="AlternationIndex" Value="1"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="Background" Value="#87CEFA" /> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
<Style TargetType="DataGridColumnHeader"> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="MinWidth" Value="0" /> | |||
<Setter Property="MinHeight" Value="40" /> | |||
<Setter Property="Foreground" Value="#ddd" /> | |||
<Setter Property="FontSize" Value="26" /> | |||
<Setter Property="Cursor" Value="Hand" /> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="DataGridColumnHeader"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*" /> | |||
</Grid.ColumnDefinitions> | |||
<ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center" | |||
HorizontalAlignment="Center" /> | |||
<Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill" | |||
Grid.Column="0" Width="8" Height="6" Fill="Transparent" Margin="0,0,50,0" | |||
VerticalAlignment="Center" RenderTransformOrigin="1,1" /> | |||
<Rectangle Width="1" Fill="#87CEFA" HorizontalAlignment="Right" Grid.ColumnSpan="1" /> | |||
</Grid> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="Height" Value="25" /> | |||
</Style> | |||
<Style x:Key="datagridButton" TargetType="Button"> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="BorderBrush" Value="Transparent"/> | |||
<Setter Property="Foreground" Value="#1874CD"/> | |||
<Setter Property="FontSize" Value="18"/> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="100"/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="用户管理" FontSize="28" Style="{DynamicResource CommonTextBlockStyle}"/> | |||
<DataGrid Grid.Row="1" Margin="30" AutoGenerateColumns="False" RowHeight="35" ItemsSource="{Binding userManager}" | |||
Background="Transparent" | |||
FrozenColumnCount="1" | |||
VerticalAlignment="Top" | |||
IsReadOnly="True" | |||
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single" | |||
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn Header="用户名" Width="200"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock Text="{Binding UserName}" FontSize="20" Foreground="White"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="最后登录时间" Width="300" > | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock Text="{Binding LastLogInTime}" FontSize="20" Foreground="White"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="权限" Width="250"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<Button Content="权限" Style="{DynamicResource datagridButton}" | |||
Command="{Binding DataContext.EditUserConfigCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" | |||
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid},Path=SelectedItem}"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="重置密码" Width="250"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<Button Content="重置密码" Style="{DynamicResource datagridButton}" Command="{Binding DataContext.ChangePasswardCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" | |||
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid},Path=SelectedItem}"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="删除" Width="*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<Button Content="删除" Style="{DynamicResource datagridButton}" | |||
Command="{Binding DataContext.DeleteUserCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" | |||
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid},Path=SelectedItem}"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
<Button Grid.Row="2" | |||
Height="50" Width="200" | |||
Background="#009DFF" | |||
BorderThickness="0" | |||
Command="{Binding AddNewUserCommand}" | |||
Content="添加新用户" | |||
FontSize="24" | |||
Foreground="White" /> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,27 @@ | |||
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> | |||
/// UserManager.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class UserManagerView : UserControl | |||
{ | |||
public UserManagerView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -5,12 +5,14 @@ | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View" | |||
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel" | |||
xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<UserControl.DataContext> | |||
<vm:VariableViewModel/> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<Style x:Key="dataGrid" TargetType="DataGrid" > | |||
<Setter Property="HorizontalGridLinesBrush" Value="#FF2AB2E7"/> | |||
<Setter Property="VerticalGridLinesBrush" Value="#FF2AB2E7"/> | |||
@@ -83,17 +85,299 @@ | |||
<Setter Property="VerticalAlignment" Value="Center"/> | |||
<Setter Property="FontSize" Value="16"/> | |||
</Style> | |||
<Style x:Key="FocusVisual"> | |||
<Setter Property="Control.Template"> | |||
<Setter.Value> | |||
<ControlTemplate> | |||
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<SolidColorBrush x:Key="TextBox.Static.Background" Color="#FFFFFFFF"/> | |||
<Style x:Key="ComboBoxEditableTextBox" TargetType="{x:Type TextBox}"> | |||
<Setter Property="OverridesDefaultStyle" Value="true"/> | |||
<Setter Property="AllowDrop" Value="true"/> | |||
<Setter Property="MinWidth" Value="0"/> | |||
<Setter Property="MinHeight" Value="0"/> | |||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> | |||
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/> | |||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type TextBox}"> | |||
<ScrollViewer x:Name="PART_ContentHost" Background="Transparent" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<LinearGradientBrush x:Key="ComboBox.Static.Background" EndPoint="0,1" StartPoint="0,0"> | |||
<GradientStop Color="Transparent" Offset="0.0"/> | |||
<GradientStop Color="Transparent" Offset="1.0"/> | |||
</LinearGradientBrush> | |||
<SolidColorBrush x:Key="ComboBox.Static.Border" Color="#FFACACAC"/> | |||
<SolidColorBrush x:Key="ComboBox.Static.Glyph" Color="#FF2AB2E7"/> | |||
<SolidColorBrush x:Key="ComboBox.Static.Editable.Background" Color="Transparent"/> | |||
<SolidColorBrush x:Key="ComboBox.Static.Editable.Border" Color="#FFABADB3"/> | |||
<SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Background" Color="Transparent"/> | |||
<SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Border" Color="Transparent"/> | |||
<LinearGradientBrush x:Key="ComboBox.MouseOver.Background" EndPoint="0,1" StartPoint="0,0"> | |||
<GradientStop Color="Transparent" Offset="0.0"/> | |||
<GradientStop Color="Transparent" Offset="1.0"/> | |||
</LinearGradientBrush> | |||
<SolidColorBrush x:Key="ComboBox.MouseOver.Border" Color="#FF7EB4EA"/> | |||
<SolidColorBrush x:Key="ComboBox.MouseOver.Glyph" Color="#FF000000"/> | |||
<SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Background" Color="Transparent"/> | |||
<SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Border" Color="#FF7EB4EA"/> | |||
<LinearGradientBrush x:Key="ComboBox.MouseOver.Editable.Button.Background" EndPoint="0,1" StartPoint="0,0"> | |||
<GradientStop Color="Transparent" Offset="0.0"/> | |||
<GradientStop Color="Transparent" Offset="1.0"/> | |||
</LinearGradientBrush> | |||
<SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Button.Border" Color="#FF7EB4EA"/> | |||
<LinearGradientBrush x:Key="ComboBox.Pressed.Background" EndPoint="0,1" StartPoint="0,0"> | |||
<GradientStop Color="#FFDAECFC" Offset="0.0"/> | |||
<GradientStop Color="#FFC4E0FC" Offset="1.0"/> | |||
</LinearGradientBrush> | |||
<SolidColorBrush x:Key="ComboBox.Pressed.Border" Color="#FF569DE5"/> | |||
<SolidColorBrush x:Key="ComboBox.Pressed.Glyph" Color="#FF000000"/> | |||
<SolidColorBrush x:Key="ComboBox.Pressed.Editable.Background" Color="#FFFFFFFF"/> | |||
<SolidColorBrush x:Key="ComboBox.Pressed.Editable.Border" Color="#FF569DE5"/> | |||
<LinearGradientBrush x:Key="ComboBox.Pressed.Editable.Button.Background" EndPoint="0,1" StartPoint="0,0"> | |||
<GradientStop Color="#FFDAEBFC" Offset="0.0"/> | |||
<GradientStop Color="#FFC4E0FC" Offset="1.0"/> | |||
</LinearGradientBrush> | |||
<SolidColorBrush x:Key="ComboBox.Pressed.Editable.Button.Border" Color="#FF569DE5"/> | |||
<SolidColorBrush x:Key="ComboBox.Disabled.Background" Color="#FFF0F0F0"/> | |||
<SolidColorBrush x:Key="ComboBox.Disabled.Border" Color="#FFD9D9D9"/> | |||
<SolidColorBrush x:Key="ComboBox.Disabled.Glyph" Color="#FFBFBFBF"/> | |||
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Background" Color="#FFFFFFFF"/> | |||
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Border" Color="#FFBFBFBF"/> | |||
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Background" Color="Transparent"/> | |||
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Border" Color="Transparent"/> | |||
<Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}"> | |||
<Setter Property="OverridesDefaultStyle" Value="true"/> | |||
<Setter Property="IsTabStop" Value="false"/> | |||
<Setter Property="Focusable" Value="false"/> | |||
<Setter Property="ClickMode" Value="Press"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ToggleButton}"> | |||
<Border x:Name="templateRoot" Background="{StaticResource ComboBox.Static.Background}" BorderBrush="{StaticResource ComboBox.Static.Border}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true"> | |||
<Border x:Name="splitBorder" BorderBrush="Transparent" BorderThickness="1" HorizontalAlignment="Right" Margin="0" SnapsToDevicePixels="true" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"> | |||
<Path x:Name="arrow" Data="F1 M 0,0 L 2.667,2.66665 L 5.3334,0 L 5.3334,-1.78168 L 2.6667,0.88501 L0,-1.78168 L0,0 Z" Fill="{StaticResource ComboBox.Static.Glyph}" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center"/> | |||
</Border> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<MultiDataTrigger> | |||
<MultiDataTrigger.Conditions> | |||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/> | |||
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="false"/> | |||
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="false"/> | |||
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="true"/> | |||
</MultiDataTrigger.Conditions> | |||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Static.Editable.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Static.Editable.Border}"/> | |||
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Static.Editable.Button.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Static.Editable.Button.Border}"/> | |||
</MultiDataTrigger> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.MouseOver.Glyph}"/> | |||
</Trigger> | |||
<MultiDataTrigger> | |||
<MultiDataTrigger.Conditions> | |||
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/> | |||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/> | |||
</MultiDataTrigger.Conditions> | |||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Border}"/> | |||
</MultiDataTrigger> | |||
<MultiDataTrigger> | |||
<MultiDataTrigger.Conditions> | |||
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/> | |||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/> | |||
</MultiDataTrigger.Conditions> | |||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Editable.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Editable.Border}"/> | |||
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Border}"/> | |||
</MultiDataTrigger> | |||
<Trigger Property="IsPressed" Value="true"> | |||
<Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.Pressed.Glyph}"/> | |||
</Trigger> | |||
<MultiDataTrigger> | |||
<MultiDataTrigger.Conditions> | |||
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/> | |||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/> | |||
</MultiDataTrigger.Conditions> | |||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Border}"/> | |||
</MultiDataTrigger> | |||
<MultiDataTrigger> | |||
<MultiDataTrigger.Conditions> | |||
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/> | |||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/> | |||
</MultiDataTrigger.Conditions> | |||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Editable.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Editable.Border}"/> | |||
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Pressed.Editable.Button.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Pressed.Editable.Button.Border}"/> | |||
</MultiDataTrigger> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.Disabled.Glyph}"/> | |||
</Trigger> | |||
<MultiDataTrigger> | |||
<MultiDataTrigger.Conditions> | |||
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/> | |||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/> | |||
</MultiDataTrigger.Conditions> | |||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Border}"/> | |||
</MultiDataTrigger> | |||
<MultiDataTrigger> | |||
<MultiDataTrigger.Conditions> | |||
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/> | |||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/> | |||
</MultiDataTrigger.Conditions> | |||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Editable.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Editable.Border}"/> | |||
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Disabled.Editable.Button.Background}"/> | |||
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Disabled.Editable.Button.Border}"/> | |||
</MultiDataTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}"> | |||
<Grid x:Name="templateRoot" SnapsToDevicePixels="true"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/> | |||
</Grid.ColumnDefinitions> | |||
<Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"> | |||
<theme:SystemDropShadowChrome x:Name="shadow" Color="Transparent" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" MaxHeight="{TemplateBinding MaxDropDownHeight}"> | |||
<Border x:Name="dropDownBorder" Background="Transparent" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1"> | |||
<ScrollViewer x:Name="DropDownScrollViewer"> | |||
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled"> | |||
<Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0"> | |||
<Rectangle x:Name="opaqueRect" Fill="{Binding Background, ElementName=dropDownBorder}" Height="{Binding ActualHeight, ElementName=dropDownBorder}" Width="{Binding ActualWidth, ElementName=dropDownBorder}"/> | |||
</Canvas> | |||
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> | |||
</Grid> | |||
</ScrollViewer> | |||
</Border> | |||
</theme:SystemDropShadowChrome> | |||
</Popup> | |||
<ToggleButton x:Name="toggleButton" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxToggleButton}"/> | |||
<Border x:Name="border" Background="{StaticResource TextBox.Static.Background}" Margin="{TemplateBinding BorderThickness}"> | |||
<TextBox x:Name="PART_EditableTextBox" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}" Margin="{TemplateBinding Padding}" Style="{StaticResource ComboBoxEditableTextBox}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/> | |||
</Border> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Opacity" TargetName="border" Value="0.56"/> | |||
</Trigger> | |||
<Trigger Property="IsKeyboardFocusWithin" Value="true"> | |||
<Setter Property="Foreground" Value="Black"/> | |||
</Trigger> | |||
<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true"> | |||
<Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/> | |||
<Setter Property="Color" TargetName="shadow" Value="#71000000"/> | |||
</Trigger> | |||
<Trigger Property="HasItems" Value="false"> | |||
<Setter Property="Height" TargetName="dropDownBorder" Value="95"/> | |||
</Trigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsGrouping" Value="true"/> | |||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/> | |||
</MultiTrigger.Conditions> | |||
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/> | |||
</MultiTrigger> | |||
<Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false"> | |||
<Setter Property="Canvas.Top" TargetName="opaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/> | |||
<Setter Property="Canvas.Left" TargetName="opaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
<ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}"> | |||
<Grid x:Name="templateRoot" SnapsToDevicePixels="true"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/> | |||
</Grid.ColumnDefinitions> | |||
<Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"> | |||
<theme:SystemDropShadowChrome x:Name="shadow" Color="Transparent" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" MaxHeight="{TemplateBinding MaxDropDownHeight}"> | |||
<Border x:Name="dropDownBorder" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1"> | |||
<ScrollViewer x:Name="DropDownScrollViewer"> | |||
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled"> | |||
<Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0"> | |||
<Rectangle x:Name="opaqueRect" Fill="{Binding Background, ElementName=dropDownBorder}" Height="{Binding ActualHeight, ElementName=dropDownBorder}" Width="{Binding ActualWidth, ElementName=dropDownBorder}"/> | |||
</Canvas> | |||
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> | |||
</Grid> | |||
</ScrollViewer> | |||
</Border> | |||
</theme:SystemDropShadowChrome> | |||
</Popup> | |||
<ToggleButton x:Name="toggleButton" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxToggleButton}"/> | |||
<ContentPresenter x:Name="contentPresenter" ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" Content="{TemplateBinding SelectionBoxItem}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="false" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true"> | |||
<Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/> | |||
<Setter Property="Color" TargetName="shadow" Value="#71000000"/> | |||
</Trigger> | |||
<Trigger Property="HasItems" Value="false"> | |||
<Setter Property="Height" TargetName="dropDownBorder" Value="95"/> | |||
</Trigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsGrouping" Value="true"/> | |||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/> | |||
</MultiTrigger.Conditions> | |||
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/> | |||
</MultiTrigger> | |||
<Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false"> | |||
<Setter Property="Canvas.Top" TargetName="opaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/> | |||
<Setter Property="Canvas.Left" TargetName="opaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
<Style x:Key="ComboBoxStyle1" TargetType="{x:Type ComboBox}"> | |||
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/> | |||
<Setter Property="Background" Value="{StaticResource ComboBox.Static.Background}"/> | |||
<Setter Property="BorderBrush" Value="{StaticResource ComboBox.Static.Border}"/> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/> | |||
<Setter Property="BorderThickness" Value="1"/> | |||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/> | |||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/> | |||
<Setter Property="Padding" Value="6,3,5,3"/> | |||
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/> | |||
<Setter Property="ScrollViewer.PanningMode" Value="Both"/> | |||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/> | |||
<Setter Property="Template" Value="{StaticResource ComboBoxTemplate}"/> | |||
<Style.Triggers> | |||
<Trigger Property="IsEditable" Value="true"> | |||
<Setter Property="IsTabStop" Value="false"/> | |||
<Setter Property="Padding" Value="2"/> | |||
<Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.12*"/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<Button HorizontalAlignment="Right" Width="120" Height="40" Margin="0,0,10,0" Background="Transparent" Content="保存配置" Foreground="#FF2AB2E7" FontSize="20" BorderBrush="LightSkyBlue" BorderThickness="2" Command="{Binding SaveDataCommand}" ></Button> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> | |||
<ComboBox ItemsSource="{Binding DeviceName}" Text="滚筒输送线" Style="{StaticResource ComboBoxStyle1}" SelectionChanged="ComboBox_SelectionChanged" FontSize="20" Foreground="#FF2AB2E7" Width="120" Height="40" Margin="0,0,10,0"></ComboBox> | |||
<Button HorizontalAlignment="Right" Width="120" Height="40" Margin="0,0,10,0" Background="Transparent" Content="保存配置" Foreground="#FF2AB2E7" FontSize="20" BorderBrush="LightSkyBlue" BorderThickness="2" Command="{Binding SaveDataCommand}"></Button> | |||
</StackPanel> | |||
<!--变量配置--> | |||
<DataGrid Grid.Row="1" ItemsSource="{Binding Variables}" GridLinesVisibility="All" Background="Transparent" | |||
<DataGrid Name="GT" Grid.Row="1" ItemsSource="{Binding Variables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False" | |||
AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}" | |||
LoadingRow="DataGrid_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}"> | |||
<DataGrid.Columns> | |||
@@ -124,6 +408,165 @@ | |||
</DataGridTemplateColumn>--> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
<!--炒锅1配置--> | |||
<DataGrid x:Name="fryOne" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryOneVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False" | |||
AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}" | |||
LoadingRow="fryOne_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
<!--炒锅2配置--> | |||
<DataGrid x:Name="fryTwo" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryTwoVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False" | |||
AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}" | |||
LoadingRow="fryTwo_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
<!--炒锅3配置--> | |||
<DataGrid x:Name="fryThree" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryThreeVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False" | |||
AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}" | |||
LoadingRow="fryThree_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
<!--炒锅4配置--> | |||
<DataGrid x:Name="fryFour" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryFourVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False" | |||
AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}" | |||
LoadingRow="fryFour_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
<!--炒锅5配置--> | |||
<DataGrid x:Name="fryFive" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryFiveVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False" | |||
AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}" | |||
LoadingRow="fryFive_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }"> | |||
</DataGridTextColumn> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn>--> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
</Grid> | |||
</UserControl> |
@@ -29,7 +29,93 @@ namespace BPASmartClient.CustomResource.Pages.View | |||
{ | |||
e.Row.Header = e.Row.GetIndex() + 1; | |||
} | |||
private void fryOne_LoadingRow(object sender, DataGridRowEventArgs e) | |||
{ | |||
e.Row.Header = e.Row.GetIndex() + 1; | |||
} | |||
private void fryTwo_LoadingRow(object sender, DataGridRowEventArgs e) | |||
{ | |||
e.Row.Header = e.Row.GetIndex() + 1; | |||
} | |||
private void fryThree_LoadingRow(object sender, DataGridRowEventArgs e) | |||
{ | |||
e.Row.Header = e.Row.GetIndex() + 1; | |||
} | |||
private void fryFour_LoadingRow(object sender, DataGridRowEventArgs e) | |||
{ | |||
e.Row.Header = e.Row.GetIndex() + 1; | |||
} | |||
private void fryFive_LoadingRow(object sender, DataGridRowEventArgs e) | |||
{ | |||
e.Row.Header = e.Row.GetIndex() + 1; | |||
} | |||
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | |||
{ | |||
ComboBox cbo= sender as ComboBox; | |||
if (cbo != null) | |||
{ | |||
switch (cbo.SelectedValue) | |||
{ | |||
case "滚筒输送线": | |||
this.GT.Visibility = Visibility.Visible; | |||
this.fryOne.Visibility = Visibility.Collapsed; | |||
this.fryTwo.Visibility=Visibility.Collapsed; | |||
this.fryThree.Visibility = Visibility.Collapsed; | |||
this.fryFour.Visibility = Visibility.Collapsed; | |||
this.fryFive.Visibility = Visibility.Collapsed; | |||
break; | |||
case "炒锅1": | |||
this.GT.Visibility = Visibility.Collapsed; | |||
this.fryOne.Visibility = Visibility.Visible; | |||
this.fryTwo.Visibility = Visibility.Collapsed; | |||
this.fryThree.Visibility = Visibility.Collapsed; | |||
this.fryFour.Visibility = Visibility.Collapsed; | |||
this.fryFive.Visibility = Visibility.Collapsed; | |||
break; | |||
case "炒锅2": | |||
this.GT.Visibility = Visibility.Collapsed; | |||
this.fryOne.Visibility = Visibility.Collapsed; | |||
this.fryTwo.Visibility = Visibility.Visible; | |||
this.fryThree.Visibility = Visibility.Collapsed; | |||
this.fryFour.Visibility = Visibility.Collapsed; | |||
this.fryFive.Visibility = Visibility.Collapsed; | |||
break; | |||
case "炒锅3": | |||
this.GT.Visibility = Visibility.Collapsed; | |||
this.fryOne.Visibility = Visibility.Collapsed; | |||
this.fryTwo.Visibility = Visibility.Collapsed; | |||
this.fryThree.Visibility = Visibility.Visible; | |||
this.fryFour.Visibility = Visibility.Collapsed; | |||
this.fryFive.Visibility = Visibility.Collapsed; | |||
break; | |||
case "炒锅4": | |||
this.GT.Visibility = Visibility.Collapsed; | |||
this.fryOne.Visibility = Visibility.Collapsed; | |||
this.fryTwo.Visibility = Visibility.Collapsed; | |||
this.fryThree.Visibility = Visibility.Collapsed; | |||
this.fryFour.Visibility = Visibility.Visible; | |||
this.fryFive.Visibility = Visibility.Collapsed; | |||
break; | |||
case "炒锅5": | |||
this.GT.Visibility = Visibility.Collapsed; | |||
this.fryOne.Visibility = Visibility.Collapsed; | |||
this.fryTwo.Visibility = Visibility.Collapsed; | |||
this.fryThree.Visibility = Visibility.Collapsed; | |||
this.fryFour.Visibility = Visibility.Collapsed; | |||
this.fryFive.Visibility = Visibility.Visible; | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,61 @@ | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
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; | |||
namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
{ | |||
public class AddNewUserViewModel:ObservableObject | |||
{ | |||
public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | |||
private string _mErrorInfo; | |||
public string UserName { get { return _userName; } set { _userName = value; OnPropertyChanged(); } } | |||
private string _userName; | |||
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; | |||
public RelayCommand ExitCommand { get; set; } | |||
public RelayCommand ConfirmCommand { get; set; } | |||
private void Confirm() | |||
{ | |||
if (UserName == null) { ErrorInfo = "用户名不能为空"; return; } | |||
if (NewPassword1 == null) { ErrorInfo = "请输入密码"; return; } | |||
if (NewPassword2 != NewPassword1) { ErrorInfo = "两次密码不一致"; return; } | |||
var res = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == UserName); | |||
if (res != null) { ErrorInfo = "用户名已存在";return; } | |||
Global.userManager.userInfos.Add(new UserInfo | |||
{ | |||
UserName = UserName, | |||
Password = NewPassword1, | |||
userTreeViewModels = new List<UserTreeViewModel>() | |||
}); | |||
Config.GetInstance.SaveUser(); | |||
ActionManage.GetInstance.Send("AddNewUserViewConfirm"); | |||
} | |||
public AddNewUserViewModel() | |||
{ | |||
ConfirmCommand = new RelayCommand(Confirm); | |||
ExitCommand = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("AddNewUserViewCancel"); | |||
}); | |||
} | |||
} | |||
} |
@@ -63,26 +63,60 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
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++) | |||
Global.userInfo.LastLogInTime = DateTime.Now.ToString(); | |||
res.LastLogInTime = DateTime.Now.ToString(); | |||
Config.GetInstance.SaveUser(); | |||
if(res.permission == Enums.Permission.管理员) | |||
{ | |||
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++) | |||
foreach( var items in MenuManage.GetInstance.menuModels) | |||
{ | |||
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; | |||
foreach(var item in items.subMenumodels) | |||
{ | |||
item.SubMenuVisibility = Visibility.Visible; | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
if (res.userTreeViewModels != null) | |||
{ | |||
if (res.userTreeViewModels.Count > 0) | |||
{ | |||
foreach (var items in MenuManage.GetInstance.menuModels) | |||
{ | |||
foreach (var item in items.subMenumodels) | |||
{ | |||
if (res.userTreeViewModels.FirstOrDefault(p => p.Name == item.SubMenuName) != null) | |||
{ | |||
item.SubMenuVisibility = Visibility.Visible; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
//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("PermissionChange"); | |||
ActionManage.GetInstance.Send("LoginOk"); | |||
} | |||
else | |||
{ | |||
@@ -10,37 +10,48 @@ using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
{ | |||
public class PasswordChangeViewModel : ObservableObject | |||
{ | |||
public PasswordChangeViewModel() | |||
private void CheckPassword(UserInfo userInfo) | |||
{ | |||
LoginCommand = new RelayCommand(() => | |||
if (userInfo.Password == OldPassword) | |||
{ | |||
if (Global.userInfo.Password == OldPassword) | |||
if (NewPassword1 == NewPassword2) | |||
{ | |||
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 = "新密码不匹配"; | |||
} | |||
userInfo.Password = NewPassword2; | |||
int index = Array.FindIndex(Global.userManager.userInfos.ToArray(), p => p.UserName == userInfo.UserName); | |||
if (index >= 0 && index < Global.userManager.userInfos.Count) | |||
Global.userManager.userInfos.ElementAt(index).Password = NewPassword1; | |||
Config.GetInstance.SaveUser(); | |||
ActionManage.GetInstance.Send("PasswordChangeViewconfirm"); | |||
Global.changeUserInfo = null; | |||
} | |||
else | |||
{ | |||
ErrorInfo = "原密码错误"; | |||
ErrorInfo = "新密码不匹配"; | |||
} | |||
} | |||
else | |||
{ | |||
ErrorInfo = "原密码错误"; | |||
} | |||
} | |||
public PasswordChangeViewModel( ) | |||
{ | |||
LoginCommand = new RelayCommand(() => | |||
{ | |||
if (Global.changeUserInfo == null) CheckPassword(Global.userInfo); | |||
else { CheckPassword(Global.changeUserInfo); } | |||
}); | |||
ExitCommand = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("PasswordChangeViewCancel"); | |||
Global.changeUserInfo = null; | |||
}); | |||
} | |||
@@ -0,0 +1,14 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
{ | |||
public class PermissionConfigurationViewModel:ObservableObject | |||
{ | |||
} | |||
} |
@@ -0,0 +1,158 @@ | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.CustomResource.Pages.View; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
{ | |||
public class UserConfigViewModel:ObservableObject | |||
{ | |||
/// <summary> | |||
/// 页面列表集合 | |||
/// </summary> | |||
public ObservableCollection<UserTreeViewModel> pageTreeViewModels { get; set; } = new ObservableCollection<UserTreeViewModel>(); | |||
/// <summary> | |||
/// 已选择页面 | |||
/// </summary> | |||
public ObservableCollection<UserTreeViewModel> SelectePage { get; set; } = new ObservableCollection<UserTreeViewModel>(); | |||
/// <summary> | |||
/// 用户名 | |||
/// </summary> | |||
public string UserName { get { return _username; } set { _username = value; OnPropertyChanged(); } } | |||
private string _username; | |||
public RelayCommand<object> AddUserPageCommand { get; set; } | |||
public RelayCommand<object> DeleteUserPageCommand { get; set; } | |||
public RelayCommand DeleteAllPageCommand { get; set; } | |||
public RelayCommand AddAllPageCommand { get; set; } | |||
public RelayCommand SaveCommand { get; set; } | |||
public RelayCommand CancelCommand { get; set; } | |||
private void AddUserPage(object o) | |||
{ | |||
if (o == null) return; | |||
if(o is string name) | |||
{ | |||
var s = SelectePage.FirstOrDefault(x => x.Name == name); | |||
if (!SelectePage.Contains(s)) | |||
{ | |||
foreach (UserTreeViewModel item in pageTreeViewModels) | |||
{ | |||
var res = item.TreeViewItems.FirstOrDefault(P => P.Name == name); | |||
if(res != null) | |||
{ | |||
SelectePage.Add(res); | |||
return; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
private void DeleteUserPage(object o) | |||
{ | |||
if (o == null) return; | |||
if (o is string name) | |||
{ | |||
var res = SelectePage.FirstOrDefault(p=>p.Name == name); | |||
SelectePage.Remove(res); | |||
} | |||
} | |||
public UserConfigViewModel() | |||
{ | |||
AddUserPageCommand = new RelayCommand<object>(AddUserPage); | |||
DeleteUserPageCommand = new RelayCommand<object>(DeleteUserPage); | |||
DeleteAllPageCommand = new RelayCommand(() => | |||
{ | |||
SelectePage.Clear(); | |||
}); | |||
AddAllPageCommand = new RelayCommand(() => | |||
{ | |||
foreach(UserTreeViewModel item in pageTreeViewModels) | |||
{ | |||
foreach(var res in item.TreeViewItems) | |||
{ | |||
if (!SelectePage.Contains(res)) SelectePage.Add(res); | |||
} | |||
} | |||
}); | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
var res = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == Global.changeUserInfo.UserName && p.Password == Global.changeUserInfo.Password); | |||
if(res != null) | |||
{ | |||
res.userTreeViewModels = new List<UserTreeViewModel>(); | |||
res.userTreeViewModels.AddRange(SelectePage); | |||
Config.GetInstance.SaveUser(); | |||
} | |||
Global.changeUserInfo = null; | |||
ActionManage.GetInstance.Send("UserConfigViewConfirm"); | |||
}); | |||
CancelCommand = new RelayCommand(() => | |||
{ | |||
Global.changeUserInfo = null; | |||
ActionManage.GetInstance.Send("UserConfigViewCancel"); | |||
}); | |||
foreach (var item in MenuManage.GetInstance.menuModels) | |||
{ | |||
List<UserTreeViewModel> list = new List<UserTreeViewModel>(); | |||
foreach(var res in item.subMenumodels) | |||
{ | |||
list.Add(new UserTreeViewModel { Name = res.SubMenuName}); | |||
} | |||
pageTreeViewModels.Add(new UserTreeViewModel | |||
{ | |||
Name = item.MainMenuName, | |||
TreeViewItems = list | |||
}); | |||
} | |||
if(Global.changeUserInfo != null) | |||
{ | |||
UserName = Global.changeUserInfo.UserName; | |||
if (Global.changeUserInfo.userTreeViewModels != null) | |||
{ | |||
if(Global.changeUserInfo.userTreeViewModels.Count > 0) | |||
{ | |||
foreach(UserTreeViewModel item in Global.changeUserInfo.userTreeViewModels) | |||
{ | |||
SelectePage.Add(item); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,77 @@ | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.CustomResource.Pages.View; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
{ | |||
public class UserManagerViewModel | |||
{ | |||
/// <summary> | |||
/// datagrid绑定 | |||
/// </summary> | |||
public ObservableCollection<UserInfo> userManager { get; set; } = Global.userManager.userInfos; | |||
public RelayCommand<object> ChangePasswardCommand { get; set; } | |||
public RelayCommand AddNewUserCommand { get; set; } | |||
public RelayCommand<object> DeleteUserCommand { get; set; } | |||
public RelayCommand<object> EditUserConfigCommand { get; set; } | |||
private void ChangePassward(object o) | |||
{ | |||
if (o != null && o is UserInfo infos) | |||
{ | |||
Global.changeUserInfo = infos; | |||
PasswordChangeView passwordChangeView = new PasswordChangeView(); | |||
passwordChangeView.ShowDialog(); | |||
} | |||
} | |||
private void DeleteUser(object o) | |||
{ | |||
if (o != null && o is UserInfo infos) | |||
{ | |||
var res = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == infos.UserName); | |||
if (res != null) Global.userManager.userInfos.Remove(res); | |||
Config.GetInstance.SaveUser(); | |||
} | |||
} | |||
private void EditUserConfig(object o) | |||
{ | |||
if (o != null && o is UserInfo infos) | |||
{ | |||
Global.changeUserInfo = null; | |||
Global.changeUserInfo = infos; | |||
UserConfigView userConfigView = new UserConfigView(); | |||
userConfigView.ShowDialog(); | |||
} | |||
} | |||
public UserManagerViewModel() | |||
{ | |||
ChangePasswardCommand = new RelayCommand<object>(ChangePassward); | |||
AddNewUserCommand = new RelayCommand(() => | |||
{ | |||
AddNewUser addNewUser = new AddNewUser(); | |||
addNewUser.ShowDialog(); | |||
}); | |||
DeleteUserCommand = new RelayCommand<object>(DeleteUser); | |||
EditUserConfigCommand = new RelayCommand<object>(EditUserConfig); | |||
} | |||
} | |||
} |
@@ -15,15 +15,45 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
public class VariableViewModel : ObservableObject | |||
{ | |||
public ObservableCollection<PlcVariableInfoModel> Variables { get; set; } = new ObservableCollection<PlcVariableInfoModel>(); | |||
public ObservableCollection<PlcVariableInfoModel> FryOneVariables { get; set; } = new ObservableCollection<PlcVariableInfoModel>(); | |||
public ObservableCollection<PlcVariableInfoModel> FryTwoVariables { get; set; } = new ObservableCollection<PlcVariableInfoModel>(); | |||
public ObservableCollection<PlcVariableInfoModel> FryThreeVariables { get; set; } = new ObservableCollection<PlcVariableInfoModel>(); | |||
public ObservableCollection<PlcVariableInfoModel> FryFourVariables { get; set; } = new ObservableCollection<PlcVariableInfoModel>(); | |||
public ObservableCollection<PlcVariableInfoModel> FryFiveVariables { get; set; } = new ObservableCollection<PlcVariableInfoModel>(); | |||
public List<string> DeviceName { get; set; } = new List<string> { "滚筒输送线", "炒锅1", "炒锅2", "炒锅3", "炒锅4", "炒锅5" }; | |||
public RelayCommand SaveDataCommand { get; set; } | |||
public VariableViewModel() | |||
{ | |||
Json<PlcVariableInfoManage>.Read(); | |||
Variables = Json<PlcVariableInfoManage>.Data.VariablesInfo; | |||
try | |||
{ | |||
if (Json<PlcVariableInfoManage>.Data.VariablesInfo.Count>0) | |||
{ | |||
Variables = Json<PlcVariableInfoManage>.Data.VariablesInfo["滚筒输送线"]; | |||
FryOneVariables = Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅1"]; | |||
FryTwoVariables = Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅2"]; | |||
FryThreeVariables = Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅3"]; | |||
FryFourVariables = Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅4"]; | |||
FryFiveVariables = Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅5"]; | |||
} | |||
} | |||
catch (Exception) | |||
{ | |||
} | |||
SaveDataCommand = new RelayCommand(() => | |||
{ | |||
Json<PlcVariableInfoManage>.Data.VariablesInfo["滚筒输送线"] = Variables; | |||
Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅1"] = FryOneVariables; | |||
Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅2"]=FryTwoVariables; | |||
Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅3"] = FryThreeVariables; | |||
Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅4"]= FryFourVariables; | |||
Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅5"] = FryFiveVariables; | |||
Json<PlcVariableInfoManage>.Save(); | |||
MessageBox.Show("保存成功","提示",MessageBoxButton.OK,MessageBoxImage.Information); | |||
}); | |||
@@ -34,7 +34,8 @@ namespace BPASmartClient.MorkS | |||
public override void DoMain() | |||
{ | |||
MonitorViewModel.DeviceId = DeviceId; | |||
ServerInit(); | |||
DataParse(); | |||
@@ -18,7 +18,10 @@ namespace BPASmartClient.MorkS.ViewModel | |||
{ | |||
public DebugViewModel() | |||
{ | |||
InitCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("InitDevice"); }); | |||
InitCommand = new RelayCommand(() => { | |||
ActionManage.GetInstance.Send("InitDevice"); | |||
ActionManage.GetInstance.Send("初始化设定煮面时间"); | |||
}); | |||
SimOrderCommand = new RelayCommand(() => | |||
{ | |||
new MorksSimorderModel() { Bowloc = this.BowlLoc, NoodleLoc = this.NoodleLoc }.Publish(); | |||
@@ -8,6 +8,7 @@ using BPASmartClient.Helper; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.MorkS.Model; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.MorkS.ViewModel | |||
{ | |||
@@ -15,29 +16,34 @@ namespace BPASmartClient.MorkS.ViewModel | |||
{ | |||
public ParSetViewModel() | |||
{ | |||
SaveInfoCommand = new Action(() => | |||
{ | |||
List<ushort> values = new List<ushort>(); | |||
values.Clear(); | |||
List<bool> bools = new List<bool>(); | |||
bools.Clear(); | |||
SaveInfoCommand = new RelayCommand(SaveSettingData); | |||
for (int i = 0; i < Json<MorksPar>.Data.parSets.Count; i++) | |||
{ | |||
values.Clear(); | |||
values.Add(Json<MorksPar>.Data.parSets[i].Minute); | |||
values.Add(Json<MorksPar>.Data.parSets[i].Second); | |||
bools.Add(Json<MorksPar>.Data.parSets[i].IsShield); | |||
ActionManage.GetInstance.Send("WriteVW", new WritePar() { Address = $"VW{116 + (i * 6)}", Value = values.ToArray() }); | |||
} | |||
ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M260.0", Value = bools.ToArray() }); | |||
Json<MorksPar>.Save(); | |||
}); | |||
ActionManage.GetInstance.Register(SaveSettingData, "初始化设定煮面时间"); | |||
} | |||
public Action SaveInfoCommand { get; set; } | |||
public RelayCommand SaveInfoCommand { get; set; } | |||
public ObservableCollection<ParSet> parSets { get; set; } = Json<MorksPar>.Data.parSets; | |||
private void SaveSettingData() | |||
{ | |||
List<ushort> values = new List<ushort>(); | |||
values.Clear(); | |||
List<bool> bools = new List<bool>(); | |||
bools.Clear(); | |||
for (int i = 0; i < Json<MorksPar>.Data.parSets.Count; i++) | |||
{ | |||
values.Clear(); | |||
values.Add(Json<MorksPar>.Data.parSets[i].Minute); | |||
values.Add(Json<MorksPar>.Data.parSets[i].Second); | |||
bools.Add(Json<MorksPar>.Data.parSets[i].IsShield); | |||
ActionManage.GetInstance.Send("WriteVW", new WritePar() { Address = $"VW{116 + (i * 6)}", Value = values.ToArray() }); | |||
} | |||
ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M260.0", Value = bools.ToArray() }); | |||
Json<MorksPar>.Save(); | |||
} | |||
} | |||
} |
@@ -6,20 +6,20 @@ | |||
<!--<add key="ClientId" value="43"/>--> | |||
<add key="IsEnableTest" value="false"/> | |||
<!--测试环境--><!-- | |||
<!--测试环境--> | |||
<add key="apollouri" value="http://10.2.1.21:28080/"/> | |||
<add key="AppId" value="test1_HostComputer"/> | |||
<add key ="Namespaces" value="DEV.test1.Config"/>--> | |||
<add key ="Namespaces" value="DEV.test1.Config"/> | |||
<!--开发环境--><!-- | |||
<add key="apollouri" value="http://10.2.1.21:28080/"/> | |||
<!--开发环境--> | |||
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/> | |||
<add key="AppId" value="HostComputer"/> | |||
<add key ="Namespaces" value="DEV.Config"/>--> | |||
<!--正式环境--> | |||
<add key="apollouri" value="http://47.108.65.220:28080/"/> | |||
<!--<add key="apollouri" value="http://47.108.65.220:28080/"/> | |||
<add key="AppId" value="HostComputer"/> | |||
<add key ="Namespaces" value="TEST1.Config"/> | |||
<add key ="Namespaces" value="TEST1.Config"/>--> | |||
<!--阿里云上报启动方式:API 或者 LOCAL--> | |||
<!--API :通过客户端ID,调用接口查询“设备连接信息”--> | |||
@@ -172,6 +172,13 @@ namespace BPASmartClient.DosingSystem | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.PasswordChangeView" | |||
}); | |||
UserManager.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "用户管理", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.UserManagerView" | |||
}); | |||
UserManager.Add(new SubMenumodel() | |||
{ | |||
@@ -20,15 +20,35 @@ namespace FryPot_DosingSystem.Control | |||
private static DeviceOperate _instance; | |||
public static DeviceOperate GetInstance => _instance ??= new DeviceOperate(); | |||
public bool IsConfig { get; set; }//设备plc数据是否配置 | |||
ModbusTcp modbus = new ModbusTcp(); | |||
private string Ip { get; set; } | |||
private string Port { get; set; } | |||
ModbusTcp modbus = new ModbusTcp();//滚筒线Modbus通讯对象 | |||
ModbusTcp fryOneModbus = new ModbusTcp();//炒锅1Modbus通讯对象 | |||
ModbusTcp fryTwoModbus = new ModbusTcp();//炒锅2Modbus通讯对象 | |||
ModbusTcp fryThreeModbus = new ModbusTcp();//炒锅3Modbus通讯对象 | |||
ModbusTcp fryFourModbus = new ModbusTcp();//炒锅4Modbus通讯对象 | |||
ModbusTcp fryFiveModbus = new ModbusTcp();//炒锅5Modbus通讯对象 | |||
// private string Ip { get; set; } | |||
// private string Port { get; set; } | |||
public bool Connected { get; set; } | |||
public bool FryOneConnected { get; set; } | |||
public bool FryTwoConnected { get; set; } | |||
public bool FryThreeConnected { get; set; } | |||
public bool FryFourConnected { get; set; } | |||
public bool FryFiveConnected { get; set; } | |||
private string DeviceName { get; set; } | |||
// private string DeviceName { get; set; } | |||
public ConcurrentDictionary<string, object> Data { get; set; } = new ConcurrentDictionary<string, object>(); | |||
public ConcurrentDictionary<string, object> FryOneData { get; set; } = new ConcurrentDictionary<string, object>(); | |||
public ConcurrentDictionary<string, object> FryTwoData { get; set; } = new ConcurrentDictionary<string, object>(); | |||
public ConcurrentDictionary<string, object> FryThreeData { get; set; } = new ConcurrentDictionary<string, object>(); | |||
public ConcurrentDictionary<string, object> FryFourData { get; set; } = new ConcurrentDictionary<string, object>(); | |||
public ConcurrentDictionary<string, object> FryFiveData { get; set; } = new ConcurrentDictionary<string, object>(); | |||
public ObservableCollection<PlcVariableModel> Variables { get; set; } = new ObservableCollection<PlcVariableModel>(); | |||
public ObservableCollection<PlcVariableModel> FryOneVariables { get; set; } = new ObservableCollection<PlcVariableModel>(); | |||
public ObservableCollection<PlcVariableModel> FryTwoVariables { get; set; } = new ObservableCollection<PlcVariableModel>(); | |||
public ObservableCollection<PlcVariableModel> FryThreeVariables { get; set; } = new ObservableCollection<PlcVariableModel>(); | |||
public ObservableCollection<PlcVariableModel> FryFourVariables { get; set; } = new ObservableCollection<PlcVariableModel>(); | |||
public ObservableCollection<PlcVariableModel> FryFiveVariables { get; set; } = new ObservableCollection<PlcVariableModel>(); | |||
public DeviceOperate() | |||
{ | |||
Init(); | |||
@@ -37,18 +57,69 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
public void Init() | |||
{ | |||
if (Variables.Count > 0) | |||
{ | |||
Variables.Clear(); | |||
} | |||
Variables.Clear(); | |||
FryOneVariables.Clear(); | |||
FryTwoVariables.Clear(); | |||
FryThreeVariables.Clear(); | |||
FryFourVariables.Clear(); | |||
FryFiveVariables.Clear(); | |||
Json<PlcVariableInfoManage>.Read(); | |||
if (Json<PlcVariableInfoManage>.Data.VariablesInfo.Count > 0) | |||
{ | |||
try | |||
{ | |||
foreach (var item in Json<PlcVariableInfoManage>.Data.VariablesInfo) | |||
if (Json<PlcVariableInfoManage>.Data.VariablesInfo["滚筒输送线"].Count>0) | |||
{ | |||
Variables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) }); | |||
//foreach (var item in Json<PlcVariableInfoManage>.Data.VariablesInfo["滚筒运输线"]) | |||
//{ | |||
// Variables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) }); | |||
//} | |||
foreach (KeyValuePair<string,ObservableCollection<PlcVariableInfoModel>> dic in Json<PlcVariableInfoManage>.Data.VariablesInfo) | |||
{ | |||
if (string.Equals(dic.Key, "滚筒输送线")) | |||
{ | |||
foreach (var item in dic.Value) | |||
{ | |||
Variables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) }); | |||
} | |||
} | |||
if (string.Equals(dic.Key, "炒锅1")) | |||
{ | |||
foreach (var item in dic.Value) | |||
{ | |||
FryOneVariables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) }); | |||
} | |||
} | |||
if (string.Equals(dic.Key, "炒锅2")) | |||
{ | |||
foreach (var item in dic.Value) | |||
{ | |||
FryTwoVariables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) }); | |||
} | |||
} | |||
if (string.Equals(dic.Key, "炒锅3")) | |||
{ | |||
foreach (var item in dic.Value) | |||
{ | |||
FryThreeVariables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) }); | |||
} | |||
} | |||
if (string.Equals(dic.Key, "炒锅4")) | |||
{ | |||
foreach (var item in dic.Value) | |||
{ | |||
FryFourVariables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) }); | |||
} | |||
} | |||
if (string.Equals(dic.Key, "炒锅5")) | |||
{ | |||
foreach (var item in dic.Value) | |||
{ | |||
FryFiveVariables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) }); | |||
} | |||
} | |||
} | |||
} | |||
IsConfig = true; | |||
} | |||
@@ -59,8 +130,8 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
} | |||
else | |||
{ | |||
IsConfig= false; | |||
{ | |||
IsConfig = false; | |||
} | |||
//Variables.Add(new PlcVariableModel() { Address = "D2001", Length = 8 });//1号线体滚筒工位号 | |||
//Variables.Add(new PlcVariableModel() { Address = "D2011", Length = 8 });//2号线体滚筒工位号 | |||
@@ -88,13 +159,26 @@ namespace FryPot_DosingSystem.Control | |||
{ | |||
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)); }); | |||
// Task.Run(() => { modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); App.Current.Dispatcher.Invoke(new Action(() => { BPASmartClient.CustomResource.Pages.Model.MessageLog.GetInstance.RunLog("PLC连接成功"); })); }); | |||
for (int i = 0; i < devices.Devices.Count; i++) | |||
{ | |||
string Ip = devices.Devices[i].Ip; | |||
string Port = devices.Devices[i].Port; | |||
string DeviceName = devices.Devices[i].DeviceName; | |||
switch (DeviceName) | |||
{ | |||
case "滚筒输送线": Task.Run(() => { modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); }); break; | |||
case "炒锅1": Task.Run(() => { fryOneModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); }); break; | |||
case "炒锅2": Task.Run(() => { fryTwoModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); }); break; | |||
case "炒锅3": Task.Run(() => { fryThreeModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); }); break; | |||
case "炒锅4": Task.Run(() => { fryFourModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); }); break; | |||
case "炒锅5": Task.Run(() => { fryFiveModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); }); break; | |||
} | |||
} | |||
// Task.Run(() => { modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); App.Current.Dispatcher.Invoke(new Action(() => { BPASmartClient.CustomResource.Pages.Model.MessageLog.GetInstance.RunLog("PLC连接成功"); })); }); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
public void ReadData() | |||
@@ -103,6 +187,7 @@ namespace FryPot_DosingSystem.Control | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
//滚筒线 | |||
Connected = modbus.Connected; | |||
while (Connected) | |||
{ | |||
@@ -118,11 +203,106 @@ namespace FryPot_DosingSystem.Control | |||
Data.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(500); | |||
Thread.Sleep(50); | |||
} | |||
//炒锅1 | |||
FryOneConnected = fryOneModbus.Connected; | |||
while (FryOneConnected) | |||
{ | |||
foreach (var item in FryOneVariables) | |||
{ | |||
var res = fryOneModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryOneData.ContainsKey(item.Address)) | |||
{ | |||
FryOneData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryOneData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
Thread.Sleep(1000); | |||
}), $"设备【{DeviceName}】PLC实时数据读取线程"); | |||
//炒锅2 | |||
FryTwoConnected = fryTwoModbus.Connected; | |||
while (FryTwoConnected) | |||
{ | |||
foreach (var item in FryTwoVariables) | |||
{ | |||
var res = fryTwoModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryTwoData.ContainsKey(item.Address)) | |||
{ | |||
FryTwoData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryTwoData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
//炒锅3 | |||
FryThreeConnected = fryThreeModbus.Connected; | |||
while (FryThreeConnected) | |||
{ | |||
foreach (var item in FryThreeVariables) | |||
{ | |||
var res = fryThreeModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryThreeData.ContainsKey(item.Address)) | |||
{ | |||
FryThreeData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryThreeData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
//炒锅4 | |||
FryFourConnected = fryFourModbus.Connected; | |||
while (FryFourConnected) | |||
{ | |||
foreach (var item in FryFourVariables) | |||
{ | |||
var res = fryFourModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryFourData.ContainsKey(item.Address)) | |||
{ | |||
FryFourData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryFourData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
//炒锅5 | |||
FryFiveConnected = fryFiveModbus.Connected; | |||
while (FryFiveConnected) | |||
{ | |||
foreach (var item in FryFiveVariables) | |||
{ | |||
var res = fryFiveModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryFiveData.ContainsKey(item.Address)) | |||
{ | |||
FryFiveData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryFiveData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
Thread.Sleep(500); | |||
}), $"PLC实时数据读取线程"); | |||
} | |||
} | |||
public void WritePlcData(string address, ushort value) | |||
@@ -136,5 +316,25 @@ namespace FryPot_DosingSystem.Control | |||
{ | |||
return Data; | |||
} | |||
public ConcurrentDictionary<string, object> GetFryOneData() | |||
{ | |||
return FryOneData; | |||
} | |||
public ConcurrentDictionary<string, object> GetFryTwoData() | |||
{ | |||
return FryTwoData; | |||
} | |||
public ConcurrentDictionary<string, object> GetFryThreeData() | |||
{ | |||
return FryThreeData; | |||
} | |||
public ConcurrentDictionary<string, object> GetFryFourData() | |||
{ | |||
return FryFourData; | |||
} | |||
public ConcurrentDictionary<string, object> GetFryFiveData() | |||
{ | |||
return FryFiveData; | |||
} | |||
} | |||
} |
@@ -57,6 +57,10 @@ namespace FryPot_DosingSystem.Control | |||
/// PLC初始化状态 | |||
/// </summary> | |||
public ushort PlcInite { get; set; } | |||
/// <summary> | |||
/// 清洗台清洗完成信号 | |||
/// </summary> | |||
public ushort CleanComplete { get; set; } | |||
#region 上位机内部逻辑条件 | |||
/// <summary> | |||
/// 退出线体1任务 | |||
@@ -178,8 +182,17 @@ namespace FryPot_DosingSystem.Control | |||
public bool LThreeagvFryPotEmptyRollerArrive { get; set; } | |||
public bool LThreeEmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成 | |||
public int LFourRollerNum { get; set; } = 0; | |||
#endregion | |||
public int LFourRollerNum { get; set; } = 0;//4号线体空桶数量 | |||
//新增 | |||
public bool agvArriveLineFour { get; set; }//agv到达线体4下料位置从清戏台或炒锅 | |||
public bool agvArriveCleanUnLoad { get; set; }//agv到达清洗台下料位置 | |||
public bool agvArriveCleanLoad { get; set; }//agv到达清洗台上料位置 | |||
public bool agvArriveLineOneLoadEmptyRoller { get; set; }//agv到达线体1空桶上料位置 | |||
public bool agvArriveLineTwoLoadEmptyRoller { get; set; }//agv到达线体2空桶上料位置 | |||
public bool agvArriveLineThreeLoadEmptyRoller { get; set; }//agv到达线体3空桶上料位置 | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 滚筒线1相关变量 | |||
@@ -230,8 +243,23 @@ namespace FryPot_DosingSystem.Control | |||
/// 当前线体配方完成信号 | |||
/// </summary> | |||
public ushort RecipeCompleteSingle { get; set; } | |||
/// <summary> | |||
/// 线体1上空桶确认信号 | |||
/// </summary> | |||
public ushort EmptyRollerConfirmSingle { get; set; } | |||
/// <summary> | |||
/// 线体1上单个空桶编号 | |||
/// </summary> | |||
public ushort EmptyRollerNum { get; set; } | |||
/// <summary> | |||
/// 上一个桶是否是空桶 | |||
/// </summary> | |||
public bool IsEpmtyBefore { get; set; } | |||
/// <summary> | |||
/// 线体1上所有空桶的编号集合 | |||
/// </summary> | |||
public List<ushort> EmptyRollerNums { get; set; } = new List<ushort>() {108}; | |||
} | |||
/// <summary> | |||
/// 滚筒线2相关变量 | |||
@@ -282,6 +310,24 @@ namespace FryPot_DosingSystem.Control | |||
/// 当前线体配方完成信号 | |||
/// </summary> | |||
public ushort RecipeCompleteSingle { get; set; } | |||
/// <summary> | |||
/// 线体1上空桶确认信号 | |||
/// </summary> | |||
public ushort EmptyRollerConfirmSingle { get; set; } | |||
/// <summary> | |||
/// 线体1上单个空桶编号 | |||
/// </summary> | |||
public ushort EmptyRollerNum { get; set; } | |||
/// <summary> | |||
/// 上一个同时否是空桶 | |||
/// </summary> | |||
public bool IsEpmtyBefore { get; set; } | |||
/// <summary> | |||
/// 线体2上所有空桶的编号集合 | |||
/// </summary> | |||
public List<ushort> EmptyRollerNums { get; set; }=new List<ushort>(); | |||
} | |||
/// <summary> | |||
/// 滚筒线3相关变量 | |||
@@ -332,6 +378,24 @@ namespace FryPot_DosingSystem.Control | |||
/// 当前线体配方完成信号 | |||
/// </summary> | |||
public ushort RecipeCompleteSingle { get; set; } | |||
/// <summary> | |||
/// 线体1上空桶确认信号 | |||
/// </summary> | |||
public ushort EmptyRollerConfirmSingle { get; set; } | |||
/// <summary> | |||
/// 线体1上单个空桶编号 | |||
/// </summary> | |||
public ushort EmptyRollerNum { get; set; } | |||
/// <summary> | |||
/// 上一个同时否是空桶 | |||
/// </summary> | |||
public bool IsEpmtyBefore { get; set; } | |||
/// <summary> | |||
/// 线体3上所有空桶的编号集合 | |||
/// </summary> | |||
public List<ushort> EmptyRollerNums { get; set; } = new List<ushort>(); | |||
} | |||
/// <summary> | |||
/// 滚筒线4相关变量 | |||
@@ -0,0 +1,16 @@ | |||
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 FlowProcessManage:ObservableObject | |||
{ | |||
public string RecipeName { get; set; } | |||
public ObservableCollection<FlowProcessModel> fpModels { get; set; } = new ObservableCollection<FlowProcessModel>(); | |||
} | |||
} |
@@ -0,0 +1,48 @@ | |||
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 FlowProcessModel:ObservableObject | |||
{ | |||
/// <summary> | |||
/// 工艺对应配方名称 | |||
/// </summary> | |||
public string RecipeName { get { return _recipeName; }set { _recipeName = value;OnPropertyChanged(); } } | |||
private string _recipeName; | |||
/// <summary> | |||
/// 工艺步骤 | |||
/// </summary> | |||
public int Id { get; set; } | |||
/// <summary> | |||
/// 炒制原料/桶号 | |||
/// </summary> | |||
public string FryMaterialNum { get { return _fryMaterialNum; } set { _fryMaterialNum = value;OnPropertyChanged(); } } | |||
private string _fryMaterialNum; | |||
/// <summary> | |||
/// 炒制速度 | |||
/// </summary> | |||
public double FrySpeed { get { return _frySpeed; }set { _frySpeed = value;OnPropertyChanged(); } } | |||
private double _frySpeed; | |||
/// <summary> | |||
/// 炒制重量 | |||
/// </summary> | |||
public double FryWeight { get { return _fryMaterialWeight; }set { _fryMaterialWeight = value;OnPropertyChanged(); } } | |||
private double _fryMaterialWeight; | |||
/// <summary> | |||
/// 炒制温度 | |||
/// </summary> | |||
public double FryTemperature { get { return _fryTemperature; } set { _fryTemperature = value;OnPropertyChanged(); } } | |||
private double _fryTemperature; | |||
/// <summary> | |||
/// 炒制时间 | |||
/// </summary> | |||
public double FryPeriodTime { get { return _fryPeriodTime; } set { _fryPeriodTime = value;OnPropertyChanged(); } } | |||
private double _fryPeriodTime; | |||
} | |||
} |
@@ -29,7 +29,12 @@ namespace FryPot_DosingSystem.Model | |||
private string _updateTime; | |||
public string UpdateTime { get { return _updateTime; } set { _updateTime = value;OnPropertyChanged(); } } | |||
/// <summary> | |||
/// 工艺流程 | |||
/// </summary> | |||
public FlowProcessManage FlowProcess { get { return _flowProcessManage; } set { _flowProcessManage = value;OnPropertyChanged(); } } | |||
private FlowProcessManage _flowProcessManage; | |||
/// <summary> | |||
/// 配方下发状况信息 | |||
/// </summary> | |||
@@ -52,12 +52,30 @@ | |||
<div class="content unicode" style="display: block;"> | |||
<ul class="icon_lists dib-box"> | |||
<li class="dib"> | |||
<span class="icon iconfont"></span> | |||
<div class="name">节点-子流程</div> | |||
<div class="code-name">&#xe6e2;</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont"></span> | |||
<div class="name">流程</div> | |||
<div class="code-name">&#xe64c;</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont"></span> | |||
<div class="name">下载</div> | |||
<div class="code-name">&#xe622;</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont"></span> | |||
<div class="name">232编辑、输入</div> | |||
<div class="code-name">&#xe8cc;</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont"></span> | |||
<div class="name">账号信息</div> | |||
@@ -118,6 +136,12 @@ | |||
<div class="code-name">&#xe6b7;</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont"></span> | |||
<div class="name">工艺流程_0</div> | |||
<div class="code-name">&#xe7ab;</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont"></span> | |||
<div class="name">166-NFC</div> | |||
@@ -142,7 +166,7 @@ | |||
<pre><code class="language-css" | |||
>@font-face { | |||
font-family: 'iconfont'; | |||
src: url('iconfont.ttf?t=1659497763775') format('truetype'); | |||
src: url('iconfont.ttf?t=1659942239310') format('truetype'); | |||
} | |||
</code></pre> | |||
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3> | |||
@@ -168,6 +192,24 @@ | |||
<div class="content font-class"> | |||
<ul class="icon_lists dib-box"> | |||
<li class="dib"> | |||
<span class="icon iconfont icon-jiedianziliucheng"></span> | |||
<div class="name"> | |||
节点-子流程 | |||
</div> | |||
<div class="code-name">.icon-jiedianziliucheng | |||
</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont icon-liucheng"></span> | |||
<div class="name"> | |||
流程 | |||
</div> | |||
<div class="code-name">.icon-liucheng | |||
</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont icon-xiazai"></span> | |||
<div class="name"> | |||
@@ -177,6 +219,15 @@ | |||
</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont icon-bianjishuru"></span> | |||
<div class="name"> | |||
232编辑、输入 | |||
</div> | |||
<div class="code-name">.icon-bianjishuru | |||
</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont icon-zhanghaoxinxi"></span> | |||
<div class="name"> | |||
@@ -267,6 +318,15 @@ | |||
</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont icon-gongyiliucheng_0"></span> | |||
<div class="name"> | |||
工艺流程_0 | |||
</div> | |||
<div class="code-name">.icon-gongyiliucheng_0 | |||
</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont icon-a-166-NFC"></span> | |||
<div class="name"> | |||
@@ -303,6 +363,22 @@ | |||
<div class="content symbol"> | |||
<ul class="icon_lists dib-box"> | |||
<li class="dib"> | |||
<svg class="icon svg-icon" aria-hidden="true"> | |||
<use xlink:href="#icon-jiedianziliucheng"></use> | |||
</svg> | |||
<div class="name">节点-子流程</div> | |||
<div class="code-name">#icon-jiedianziliucheng</div> | |||
</li> | |||
<li class="dib"> | |||
<svg class="icon svg-icon" aria-hidden="true"> | |||
<use xlink:href="#icon-liucheng"></use> | |||
</svg> | |||
<div class="name">流程</div> | |||
<div class="code-name">#icon-liucheng</div> | |||
</li> | |||
<li class="dib"> | |||
<svg class="icon svg-icon" aria-hidden="true"> | |||
<use xlink:href="#icon-xiazai"></use> | |||
@@ -311,6 +387,14 @@ | |||
<div class="code-name">#icon-xiazai</div> | |||
</li> | |||
<li class="dib"> | |||
<svg class="icon svg-icon" aria-hidden="true"> | |||
<use xlink:href="#icon-bianjishuru"></use> | |||
</svg> | |||
<div class="name">232编辑、输入</div> | |||
<div class="code-name">#icon-bianjishuru</div> | |||
</li> | |||
<li class="dib"> | |||
<svg class="icon svg-icon" aria-hidden="true"> | |||
<use xlink:href="#icon-zhanghaoxinxi"></use> | |||
@@ -391,6 +475,14 @@ | |||
<div class="code-name">#icon-mianxingmima</div> | |||
</li> | |||
<li class="dib"> | |||
<svg class="icon svg-icon" aria-hidden="true"> | |||
<use xlink:href="#icon-gongyiliucheng_0"></use> | |||
</svg> | |||
<div class="name">工艺流程_0</div> | |||
<div class="code-name">#icon-gongyiliucheng_0</div> | |||
</li> | |||
<li class="dib"> | |||
<svg class="icon svg-icon" aria-hidden="true"> | |||
<use xlink:href="#icon-a-166-NFC"></use> | |||
@@ -32,26 +32,42 @@ | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<UniformGrid Columns="2"> | |||
<GroupBox Grid.Column="1" Header="PLC信号" Foreground="Aqua" BorderBrush="Pink"> | |||
<WrapPanel Orientation="Horizontal"> | |||
<GroupBox Grid.Column="1" Header="PLC信号" Foreground="Aqua" BorderBrush="Pink"> | |||
<WrapPanel Orientation="Horizontal"> | |||
<Button Content="滚筒线运行信号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding RollerLineRunning}"></Button> | |||
<!--<Button Content="工位号8桶号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding EightWorkLoc}"></Button>--> | |||
<ComboBox SelectionChanged="ComboBox_SelectionChanged" ItemsSource="{Binding LineOneRollerCode}" Background="Transparent" Width="100" Height="34" Margin="3,3"/> | |||
<Button Content="炒锅进料就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotInputArrive}"/> | |||
<Button Content="炒锅空桶就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotEmptyRollerArrive}"/> | |||
<Button Content="线体1任务重置" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding LineOneTaskExit}"></Button> | |||
<Button Content="AGV接口调试" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvDebug}"/> | |||
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="800" Y1="0" Y2="0"/> | |||
<WrapPanel Orientation="Horizontal"> | |||
<Button Content="清洗台呼叫AGV" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding CleanPlateCallAgv}"/> | |||
</WrapPanel> | |||
</WrapPanel> | |||
</GroupBox> | |||
</GroupBox> | |||
<GroupBox Grid.Column="2" Header="AGV信号" Foreground="Aqua"> | |||
<WrapPanel Orientation="Horizontal"> | |||
<Button Content="AGV线体1上料就位" Style="{StaticResource buttonStyle}" Width="120" Command="{Binding AGVLOneArrive}"/> | |||
<Button Content="AGV炒锅下料就位" Style="{StaticResource buttonStyle}" RenderTransformOrigin="0.5,0.5" Width="114" Command="{Binding AGVFryPotDownArrive}"> | |||
</Button> | |||
<Button Content="AGV炒锅空桶上料就位" Style="{StaticResource buttonStyle}" Width="139" Command="{Binding AGVFryPotUpArrive}"/> | |||
<Button Content="AGV拿到空桶信号" Style="{StaticResource buttonStyle}" Width="114" Command="{Binding AGVFryPotGetEmptyRoller}"/> | |||
<Button Content="AGV拿到空桶信号" Style="{StaticResource buttonStyle}" Width="114" Command="{Binding AGVFryPotGetEmptyRoller}"/> | |||
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="800" Y1="0" Y2="0"/> | |||
<WrapPanel Orientation="Horizontal"> | |||
<Button Content="AGV线体1空桶上料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineOneEmptyRollerLoc}"/> | |||
<Button Content="AGV空桶清洗下料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLoc}"/> | |||
<Button Content="AGV线体4空桶下料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineFourLoc}"/> | |||
<Button Content="AGV空桶清洗上料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLocLoad}"/> | |||
</WrapPanel> | |||
</GroupBox> | |||
</WrapPanel> | |||
</GroupBox> | |||
</UniformGrid> | |||
<UniformGrid Columns="2" Grid.Row="1"> | |||
<GroupBox Grid.Column="1" Header="PLC信号" Foreground="Aqua" BorderBrush="Pink"> | |||
@@ -62,6 +78,10 @@ | |||
<Button Content="炒锅进料就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotTwoInputArrive}"/> | |||
<Button Content="炒锅空桶就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotTwoEmptyRollerArrive}"/> | |||
<Button Content="线体2任务重置" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding LineTwoTaskExit}"></Button> | |||
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="800" Y1="0" Y2="0"/> | |||
<WrapPanel Orientation="Horizontal"> | |||
<Button Content="清洗台呼叫AGV" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding CleanPlateCallAgv}"/> | |||
</WrapPanel> | |||
</WrapPanel> | |||
</GroupBox> | |||
<GroupBox Grid.Column="2" Header="AGV信号" Foreground="Aqua"> | |||
@@ -71,6 +91,12 @@ | |||
</Button> | |||
<Button Content="AGV炒锅空桶上料就位" Style="{StaticResource buttonStyle}" Width="139" Command="{Binding AGVFryPotTwoUpArrive}"/> | |||
<Button Content="AGV拿到空桶信号" Style="{StaticResource buttonStyle}" Width="114" Command="{Binding AGVFryPotTwoGetEmptyRoller}"/> | |||
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="800" Y1="0" Y2="0"/> | |||
<WrapPanel Orientation="Horizontal"> | |||
<Button Content="AGV线体2空桶上料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineTwoEmptyRollerLoc}"/> | |||
<Button Content="AGV空桶清洗下料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLoc}"/> | |||
<Button Content="AGV线体4空桶下料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineFourLoc}"/> | |||
</WrapPanel> | |||
</WrapPanel> | |||
</GroupBox> | |||
</UniformGrid> | |||
@@ -83,6 +109,10 @@ | |||
<Button Content="炒锅进料就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotThreeInputArrive}"/> | |||
<Button Content="炒锅空桶就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotThreeEmptyRollerArrive}"/> | |||
<Button Content="线体3任务重置" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding LineThreeTaskExit}"></Button> | |||
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="800" Y1="0" Y2="0"/> | |||
<WrapPanel Orientation="Horizontal"> | |||
<Button Content="清洗台呼叫AGV" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding CleanPlateCallAgv}"/> | |||
</WrapPanel> | |||
</WrapPanel> | |||
</GroupBox> | |||
<GroupBox Grid.Column="2" Header="AGV信号" Foreground="Aqua"> | |||
@@ -92,6 +122,12 @@ | |||
</Button> | |||
<Button Content="AGV炒锅空桶上料就位" Style="{StaticResource buttonStyle}" Width="139" Command="{Binding AGVFryPotThreeUpArrive}"/> | |||
<Button Content="AGV拿到空桶信号" Style="{StaticResource buttonStyle}" Width="114" Command="{Binding AGVFryPotThreeGetEmptyRoller}"/> | |||
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="800" Y1="0" Y2="0"/> | |||
<WrapPanel Orientation="Horizontal"> | |||
<Button Content="AGV线体3空桶上料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineThreeEmptyRollerLoc}"/> | |||
<Button Content="AGV空桶清洗下料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveCleanPlateLoc}"/> | |||
<Button Content="AGV线体4空桶下料就位" Width="145" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvArriveLineFourLoc}"/> | |||
</WrapPanel> | |||
</WrapPanel> | |||
</GroupBox> | |||
</UniformGrid> | |||
@@ -0,0 +1,75 @@ | |||
<Window x:Class="FryPot_DosingSystem.View.FlowProcessView" | |||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:local="clr-namespace:FryPot_DosingSystem.View" | |||
xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel" | |||
mc:Ignorable="d" | |||
Title="FlowProcessView" Height="550" Width="800" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True"> | |||
<Window.DataContext> | |||
<vm:FlowProcessSetViewModel/> | |||
</Window.DataContext> | |||
<Border x:Name="br"> | |||
<Border.Background> | |||
<SolidColorBrush Color="#264c73"/> | |||
</Border.Background> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="炒锅工艺" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" Background="Transparent" FontSize="25" Cursor="Arrow" ></TextBlock> | |||
<Border BorderThickness="0,0,0,1" BorderBrush="#FF2AB2E7"></Border> | |||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right"> | |||
<Button Content="保存工艺" Width="100" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" FontSize="18" Command="{Binding ConfirmCommand}" ></Button> | |||
<Button Content="取消" Height="30" Width="100" Margin="0,0,10,0" Background="Transparent" FontSize="18" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Command="{Binding CloseWindowCommand}"></Button> | |||
</StackPanel> | |||
<Grid Grid.Row="2" Background="#FF2AB2E7" Margin="0,0,0,8"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="100"/> | |||
<ColumnDefinition Width="140"/> | |||
<ColumnDefinition Width="140"/> | |||
<ColumnDefinition Width="140"/> | |||
<ColumnDefinition Width="140"/> | |||
<ColumnDefinition Width="140"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="工艺步骤" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="white" FontSize="18"/> | |||
<GridSplitter BorderThickness="0.2" BorderBrush="White"></GridSplitter> | |||
<TextBlock Grid.Column="1" Text="炒制原料/桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="white" FontSize="18"/> | |||
<GridSplitter Grid.Column="1" BorderThickness="0.2" BorderBrush="White"></GridSplitter> | |||
<TextBlock Grid.Column="2" Text="炒制速度" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="white" FontSize="18"/> | |||
<GridSplitter Grid.Column="2" BorderThickness="0.2" BorderBrush="White"></GridSplitter> | |||
<TextBlock Grid.Column="3" Text="炒制重量" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"></TextBlock> | |||
<GridSplitter Grid.Column="3" BorderThickness="0.2" BorderBrush="White"></GridSplitter> | |||
<TextBlock Grid.Column="4" Text="炒制温度" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/> | |||
<GridSplitter Grid.Column="4" BorderThickness="0.2" BorderBrush="White"></GridSplitter> | |||
<TextBlock Grid.Column="5" Text="炒制时间" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/> | |||
</Grid> | |||
<ItemsControl ItemsSource="{Binding flowProcessModels}" Grid.Row="3"> | |||
<ItemsControl.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<StackPanel/> | |||
</ItemsPanelTemplate> | |||
</ItemsControl.ItemsPanel> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<StackPanel Orientation="Horizontal" > | |||
<TextBox Text="{Binding Id}" Foreground="SkyBlue" Width="100" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="18" Background="Transparent" IsReadOnly="True" BorderBrush="#FF2AB2E7" BorderThickness="1,1,0.5,1" /> | |||
<TextBox Text="{Binding FryMaterialNum}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FrySpeed}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FryWeight}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FryTemperature}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FryPeriodTime}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,1,1"/> | |||
</StackPanel> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,35 @@ | |||
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 FryPot_DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// FlowProcessView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class FlowProcessView : Window | |||
{ | |||
public FlowProcessView() | |||
{ | |||
InitializeComponent(); | |||
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||
ActionManage.GetInstance.CancelRegister("CloseFlowProcessView"); | |||
ActionManage.GetInstance.Register(new Action(() => { | |||
this.Close(); | |||
}), "CloseFlowProcessView"); | |||
} | |||
} | |||
} |
@@ -195,20 +195,20 @@ | |||
<RowDefinition></RowDefinition> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="配方信息" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" FontSize="25" Margin="0,10"></TextBlock> | |||
<TextBlock Text="配方信息" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="0,10"></TextBlock> | |||
<UniformGrid Grid.Row="1" Columns="2"> | |||
<StackPanel Orientation="Vertical"> | |||
<StackPanel Orientation="Horizontal" Margin="0,8"> | |||
<TextBlock Text="请输入配方名称:" Foreground="Aqua" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="请输入配方名称:" Foreground="#FF2AB2E7" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBox Style="{DynamicResource TextBoxStyle}" Text="{Binding RecipeName}" Width="230" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange" | |||
VerticalContentAlignment="Center" | |||
BorderBrush="Aqua" VerticalAlignment="Center" FontSize="16" ></TextBox> | |||
BorderBrush="#FF2AB2E7" VerticalAlignment="Center" FontSize="16" ></TextBox> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="请输入桶的数量:" Foreground="Aqua" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="请输入桶的数量:" Foreground="#FF2AB2E7" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBox Style="{DynamicResource TextBoxStyle}" Text="{Binding RecipeRollerNum}" InputMethod.IsInputMethodEnabled="False" Width="230" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange" | |||
VerticalContentAlignment="Center" | |||
BorderBrush="Aqua" VerticalAlignment="Center" FontSize="16" TextChanged="TextBox_TextChanged"></TextBox> | |||
BorderBrush="#FF2AB2E7" VerticalAlignment="Center" FontSize="16" TextChanged="TextBox_TextChanged"></TextBox> | |||
</StackPanel> | |||
</StackPanel> | |||
<Grid> | |||
@@ -217,30 +217,30 @@ | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> | |||
<Button Content="添加原料" Width="180" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Cursor="Hand" Command="{Binding AddRecipe}" ></Button> | |||
<Button Content="确认更新" Height="30" Width="180" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Command="{Binding Comfirm}"></Button> | |||
<Button Content="添加原料" Width="180" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" Command="{Binding AddRecipe}" ></Button> | |||
<Button Content="确认更新" Height="30" Width="180" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Command="{Binding Comfirm}"></Button> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center"> | |||
<Button Content="另存为" Height="30" Width="180" Margin="0,0,10,0" Command="{Binding SaveAs}" Cursor="Hand"/> | |||
<Button Click="Button_Click" Content="取消" Height="30" FontSize="20" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Width="180" Cursor="Hand"></Button> | |||
<Button Click="Button_Click" Content="取消" Height="30" FontSize="20" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Width="180" Cursor="Hand"></Button> | |||
</StackPanel> | |||
</Grid> | |||
</UniformGrid> | |||
<Grid Grid.Row="2" Background="Cyan" Margin="0,0,0,10"> | |||
<Grid Grid.Row="2" Background="#FF2AB2E7" Margin="0,0,0,10"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="210"/> | |||
<ColumnDefinition Width="225"/> | |||
<ColumnDefinition Width="225"/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="原料名称" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Tomato"/> | |||
<TextBlock Text="原料名称" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/> | |||
<GridSplitter></GridSplitter> | |||
<TextBlock Grid.Column="1" Text="原料桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Tomato"/> | |||
<TextBlock Grid.Column="1" Text="原料桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/> | |||
<GridSplitter Grid.Column="1"></GridSplitter> | |||
<TextBlock Grid.Column="2" Text="原料重量" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Tomato"></TextBlock> | |||
<TextBlock Grid.Column="2" Text="原料重量" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"></TextBlock> | |||
<GridSplitter Grid.Column="2"></GridSplitter> | |||
<TextBlock Grid.Column="3" Text="操作" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Tomato"/> | |||
<TextBlock Grid.Column="3" Text="操作" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/> | |||
</Grid> | |||
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding materials}"> | |||
@@ -150,6 +150,7 @@ | |||
<TextBlock Text="操作:" Foreground="White" FontSize="18"></TextBlock> | |||
<Button Style="{DynamicResource ButtonStyle1}" Content="编辑" Cursor="Hand" Foreground="Orange" FontSize="18" Background="Transparent" BorderThickness="0" Command="{Binding DataContext.EditRecipeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" | |||
CommandParameter="{Binding RecipeId}"/> | |||
<Button Margin="60,0,0,0" Style="{DynamicResource ButtonStyle1}" Content="炒制工艺" Cursor="Hand" Foreground="Orange" FontSize="18" Background="Transparent" BorderThickness="0" Command="{Binding DataContext.OperateFlowProcess,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" CommandParameter="{Binding RecipeName}"/> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Margin="0,5"> | |||
<TextBlock Text="创建时间:" FontSize="18" Foreground="White"></TextBlock> | |||
@@ -53,8 +53,55 @@ namespace FryPot_DosingSystem.ViewModel | |||
public RelayCommand AGVFryPotThreeUpArrive { get; set; } | |||
public RelayCommand AGVFryPotThreeGetEmptyRoller { get; set; } | |||
//AGV接口联调 | |||
public RelayCommand AgvDebug { get; set; } | |||
//线体123空桶清洗以及回收 | |||
public RelayCommand AgvArriveLineOneEmptyRollerLoc { get; set; } | |||
public RelayCommand AgvArriveLineTwoEmptyRollerLoc { get; set; } | |||
public RelayCommand AgvArriveLineThreeEmptyRollerLoc { get; set; } | |||
public RelayCommand CleanPlateCallAgv { get; set; } | |||
public RelayCommand AgvArriveCleanPlateLoc { get; set; }//下料 | |||
public RelayCommand AgvArriveLineFourLoc { get; set; } | |||
public RelayCommand AgvArriveCleanPlateLocLoad { get; set; }//上料 | |||
public DebugViewModel() | |||
{ | |||
AgvDebug = new RelayCommand(new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("AgvDebug"); | |||
})); | |||
AgvArriveLineOneEmptyRollerLoc = new RelayCommand(new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("AgvArriveLineOneEmptyRollerLoc"); | |||
})); | |||
AgvArriveLineTwoEmptyRollerLoc = new RelayCommand(new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("AgvArriveLineTwoEmptyRollerLoc"); | |||
})); | |||
AgvArriveLineThreeEmptyRollerLoc = new RelayCommand(new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("AgvArriveLineThreeEmptyRollerLoc"); | |||
})); | |||
CleanPlateCallAgv = new RelayCommand(new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("CleanPlateCallAgv"); | |||
})); | |||
AgvArriveCleanPlateLoc = new RelayCommand(new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("AgvArriveCleanPlateLoc"); | |||
})); | |||
AgvArriveCleanPlateLocLoad = new RelayCommand(new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("AgvArriveCleanPlateLocLoad"); | |||
})); | |||
AgvArriveLineFourLoc = new RelayCommand(new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("AgvArriveLineFourLoc"); | |||
})); | |||
RollerLineRunning = new RelayCommand(new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("RollerLineRunning"); | |||
@@ -20,7 +20,7 @@ namespace FryPot_DosingSystem.ViewModel | |||
public RelayCommand<string> DeleteDevice { get; set; } | |||
public DeviceListViewModel() | |||
{ | |||
//Json<DeviceManage>.Read(); | |||
Json<DeviceManage>.Read(); | |||
devices = Json<DeviceManage>.Data.Devices; | |||
DeviceName.Add("滚筒输送线"); | |||
DeviceName.Add("炒锅1"); | |||
@@ -0,0 +1,77 @@ | |||
using BPASmartClient.Helper; | |||
using FryPot_DosingSystem.Model; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace FryPot_DosingSystem.ViewModel | |||
{ | |||
internal class FlowProcessSetViewModel | |||
{ | |||
public int Id { get; set; } = 0; | |||
public ObservableCollection<FlowProcessModel> flowProcessModels { get; set; } = new ObservableCollection<FlowProcessModel>(); | |||
public string currnetRecipeName { get; set;} | |||
public RelayCommand CloseWindowCommand { get; set; } | |||
public RelayCommand ConfirmCommand { get; set; } | |||
public FlowProcessSetViewModel() | |||
{ | |||
ActionManage.GetInstance.Register(new Action<object>(recipeName => | |||
{ | |||
if (recipeName != null) | |||
{ | |||
currnetRecipeName = recipeName.ToString(); | |||
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.FlowProcess.RecipeName == recipeName.ToString()); | |||
if (res != null && res is NewRecipeModel recipe) //编辑已有工艺 | |||
{ | |||
//flowProcessModels = recipe.FlowProcess.fpModels; | |||
foreach (var item in recipe.FlowProcess.fpModels) | |||
{ | |||
flowProcessModels.Add(new FlowProcessModel { Id = item.Id, FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryWeight = item.FryWeight, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime }); | |||
} | |||
} | |||
else//创建新工艺 | |||
{ | |||
var name = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p=>p.RecipeName==recipeName.ToString()); | |||
if (name != null) | |||
{ | |||
name.FlowProcess.RecipeName = recipeName.ToString(); | |||
flowProcessModels.Add(new FlowProcessModel { Id = Id + 1, FryMaterialNum = "油" }); | |||
Id++; | |||
foreach (var item in name.materialCollection) | |||
{ | |||
flowProcessModels.Add(new FlowProcessModel { Id = Id + 1, FryMaterialNum = item.MaterialName }); | |||
Id++; | |||
} | |||
name.FlowProcess.fpModels= flowProcessModels; | |||
} | |||
} | |||
} | |||
}), "EditFlowProcess"); | |||
CloseWindowCommand = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("CloseFlowProcessView"); | |||
}); | |||
ConfirmCommand = new RelayCommand(() => | |||
{ | |||
var name = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeName == currnetRecipeName.ToString()); | |||
if (name != null) | |||
{ | |||
name.FlowProcess.RecipeName = currnetRecipeName.ToString(); | |||
name.FlowProcess.fpModels = flowProcessModels; | |||
} | |||
Json<RecipeManage>.Save(); | |||
ActionManage.GetInstance.Send("CloseFlowProcessView"); | |||
}); | |||
} | |||
} | |||
} |
@@ -102,7 +102,7 @@ namespace FryPot_DosingSystem.ViewModel | |||
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID); | |||
if (res == null) | |||
{ | |||
Json<RecipeManage>.Data.Recipes.Add(new NewRecipeModel { RecipeId = recipeID, RecipeName = RecipeName, materialCollection = materials,DataTime=DateTime.Now.ToShortDateString()});//配方添加 | |||
Json<RecipeManage>.Data.Recipes.Add(new NewRecipeModel { RecipeId = recipeID, RecipeName = RecipeName, FlowProcess=new FlowProcessManage(), materialCollection = materials,DataTime=DateTime.Now.ToShortDateString()});//配方添加 | |||
} | |||
else | |||
{ | |||
@@ -33,6 +33,10 @@ namespace FryPot_DosingSystem.ViewModel | |||
public RelayCommand SaveRecipe { get; set; } | |||
/// <summary> | |||
/// 工艺操作 | |||
/// </summary> | |||
public RelayCommand<string> OperateFlowProcess { get; set; } | |||
/// <summary> | |||
/// 编辑配方 | |||
/// </summary> | |||
public RelayCommand<object> EditRecipeCommand { get; set; } | |||
@@ -103,6 +107,18 @@ namespace FryPot_DosingSystem.ViewModel | |||
} | |||
} | |||
}); | |||
//工艺流程操作 | |||
OperateFlowProcess = new RelayCommand<string>((recipeName) => | |||
{ | |||
if (recipeName != null && recipeName != string.Empty && recipeName != "") | |||
{ | |||
ActionManage.GetInstance.CancelRegister("EditFlowProcess"); | |||
FlowProcessView fps = new FlowProcessView(); | |||
ActionManage.GetInstance.Send("EditFlowProcess", recipeName); | |||
fps.ShowDialog(); | |||
} | |||
}); | |||
} | |||
} | |||
} |
@@ -120,6 +120,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MilkWithTea" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.KHKJ", "BPASmartClient.KHKJ\BPASmartClient.KHKJ.csproj", "{C0060FB3-7AEA-4D14-ADCE-DB78D3665D5B}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.KHKJ", "BPASmartClient.KHKJ\BPASmartClient.KHKJ.csproj", "{C0060FB3-7AEA-4D14-ADCE-DB78D3665D5B}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTM", "BPASmartClient.MorkTM\BPASmartClient.MorkTM.csproj", "{1612F583-D328-45C6-8BB1-5D41B8F1D216}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Nfc", "BPASmartClient.Nfc\BPASmartClient.Nfc.csproj", "{42D35B7C-764C-4692-AA85-9B343A0F5B7F}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Argox", "BPASmartClient.Argox\BPASmartClient.Argox.csproj", "{B8D499BA-A18A-4FD6-B036-44F02B4D164B}" | |||
@@ -1138,6 +1142,26 @@ Global | |||
{C0060FB3-7AEA-4D14-ADCE-DB78D3665D5B}.Release|x64.Build.0 = Release|Any CPU | |||
{C0060FB3-7AEA-4D14-ADCE-DB78D3665D5B}.Release|x86.ActiveCfg = Release|Any CPU | |||
{C0060FB3-7AEA-4D14-ADCE-DB78D3665D5B}.Release|x86.Build.0 = Release|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Debug|x64.Build.0 = Debug|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Debug|x86.Build.0 = Debug|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Release|ARM.Build.0 = Release|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Release|ARM64.Build.0 = Release|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Release|x64.ActiveCfg = Release|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Release|x64.Build.0 = Release|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Release|x86.ActiveCfg = Release|Any CPU | |||
{1612F583-D328-45C6-8BB1-5D41B8F1D216}.Release|x86.Build.0 = Release|Any CPU | |||
{42D35B7C-764C-4692-AA85-9B343A0F5B7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{42D35B7C-764C-4692-AA85-9B343A0F5B7F}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{42D35B7C-764C-4692-AA85-9B343A0F5B7F}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||