@@ -7,7 +7,7 @@ using System.Net; | |||
using System.Web; | |||
using Newtonsoft.Json; | |||
using System.Net.Http; | |||
using System.Configuration; | |||
namespace BPASmartClient.AGV | |||
{ | |||
@@ -20,7 +20,24 @@ namespace BPASmartClient.AGV | |||
{ | |||
} | |||
/// <summary> | |||
/// 获取配置文件信息 | |||
/// </summary> | |||
/// <param name="strKey"></param> | |||
/// <returns></returns> | |||
public string GetAppSettingValue(string strKey) | |||
{ | |||
string file = System.Environment.CurrentDirectory; | |||
Configuration config = ConfigurationManager.OpenExeConfiguration(file); | |||
foreach (string key in config.AppSettings.Settings.AllKeys) | |||
{ | |||
if (key == strKey) | |||
{ | |||
return config.AppSettings.Settings[strKey].Value.ToString(); | |||
} | |||
} | |||
return null; | |||
} | |||
public string HttpRequest(string url, string head, string body) | |||
{ | |||
return PostData(url, head, body); | |||
@@ -57,89 +74,460 @@ namespace BPASmartClient.AGV | |||
/// AGV去1号线体装桶 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string AgvToLineOneLoadRoller() | |||
public string AgvToLineOneLoadRoller(string robotJobId) | |||
{ | |||
string url = ""; | |||
string head = ""; | |||
string body = ""; | |||
return HttpRequest(url,head,body); | |||
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); | |||
// string newBody = String.Join(",\r\n", bodyData.Split(','));//格式处理,看需求 | |||
//货位到货位 | |||
//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); | |||
string data = HttpRequest(url, head, body); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
if (objData != null && objData is HttpResponseModel response) | |||
{ | |||
return response.Body?.code; | |||
} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV去2号线体装桶 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string AgvToLineTwoLoadRoller() | |||
public string AgvToLineTwoLoadRoller(string robotJobId) | |||
{ | |||
string url = ""; | |||
string head = ""; | |||
string body = ""; | |||
return HttpRequest(url, head, body); | |||
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); | |||
string data= HttpRequest(url, head, body); | |||
object objData= JsonConvert.DeserializeObject(data); | |||
if (objData != null && objData is HttpResponseModel response) | |||
{ | |||
return response.Body?.code; | |||
} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV去3号线体装桶 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string AgvToLineThreeLoadRoller() | |||
public string AgvToLineThreeLoadRoller(string robotJobId) | |||
{ | |||
string url = ""; | |||
string head = ""; | |||
string body = ""; | |||
return HttpRequest(url, head, body); | |||
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); | |||
string data = HttpRequest(url, head, body); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
if (objData != null && objData is HttpResponseModel response) | |||
{ | |||
return response.Body?.code; | |||
} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV离开炒锅1 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string AgvLeaveFryPotOne() | |||
public string AgvLeaveFryPotOne(string robotJobId) | |||
{ | |||
string url = ""; | |||
string head = ""; | |||
string body = ""; | |||
return HttpRequest(url, head, body); | |||
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); | |||
string data = HttpRequest(url, head, body); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
if (objData != null && objData is HttpResponseModel response) | |||
{ | |||
return response.Body?.code; | |||
} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV离开炒锅2 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string AgvLeaveFryPotTwo() | |||
public string AgvLeaveFryPotTwo(string robotJobId) | |||
{ | |||
string url = ""; | |||
string head = ""; | |||
string body = ""; | |||
return HttpRequest(url, head, body); | |||
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); | |||
string data = HttpRequest(url, head, body); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
if (objData != null && objData is HttpResponseModel response) | |||
{ | |||
return response.Body?.code; | |||
} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV离开炒锅3 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string AgvLeaveFryPotThree() | |||
public string AgvLeaveFryPotThree(string robotJobId) | |||
{ | |||
string url = ""; | |||
string head = ""; | |||
string body = ""; | |||
return HttpRequest(url, head, body); | |||
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); | |||
string data = HttpRequest(url, head, body); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
if (objData != null && objData is HttpResponseModel response) | |||
{ | |||
return response.Body?.code; | |||
} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV离开炒锅4 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string AgvLeaveFryPotFour() | |||
public string AgvLeaveFryPotFour(string robotJobId) | |||
{ | |||
string url = ""; | |||
string head = ""; | |||
string body = ""; | |||
return HttpRequest(url, head, body); | |||
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); | |||
string data = HttpRequest(url, head, body); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
if (objData != null && objData is HttpResponseModel response) | |||
{ | |||
return response.Body?.code; | |||
} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV离开炒锅5 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string AgvLeaveFryPotFive() | |||
public string AgvLeaveFryPotFive(string robotJobId) | |||
{ | |||
string url = ""; | |||
string head = ""; | |||
string body = ""; | |||
return HttpRequest(url, head, body); | |||
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); | |||
string data = HttpRequest(url, head, body); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
if (objData != null && objData is HttpResponseModel response) | |||
{ | |||
return response.Body?.code; | |||
} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// 任务取消 | |||
/// </summary> | |||
/// <param name="robotJobId">上游系统任务号,全局唯一</param> | |||
public string CancelJobTask(string robotJobId) | |||
{ | |||
string url = AGVRequestUrl.GetInstance.TaskCancelUrl; | |||
//请求报文头 | |||
HttpRequestHeaderModel.GetInstance.appKey = ""; | |||
HttpRequestHeaderModel.GetInstance.appSecret = ""; | |||
HttpRequestHeaderModel.GetInstance.requestId = ""; | |||
HttpRequestHeaderModel.GetInstance.timestamp = ""; | |||
HttpRequestHeaderModel.GetInstance.version = "2.8"; | |||
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); | |||
//请求报文体 | |||
AGVTaskCancelModel.GetInstance.robotJobId = robotJobId; | |||
AGVTaskCancelModel.GetInstance.warehouseId = 123;//仓库编号 | |||
string body = JsonConvert.SerializeObject(AGVTaskCancelModel.GetInstance); | |||
string data = HttpRequest(url, head, body); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
if (objData != null && objData is HttpResponseModel response) | |||
{ | |||
return response.Body?.code; | |||
} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// 实操任务完成通知 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string TaskCompleteNotify(string robotJobId) | |||
{ | |||
string url = AGVRequestUrl.GetInstance.TaskCompleteUrl; | |||
//请求报文头 | |||
HttpRequestHeaderModel.GetInstance.appKey = ""; | |||
HttpRequestHeaderModel.GetInstance.appSecret = ""; | |||
HttpRequestHeaderModel.GetInstance.requestId = ""; | |||
HttpRequestHeaderModel.GetInstance.timestamp = ""; | |||
HttpRequestHeaderModel.GetInstance.version = "2.8"; | |||
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); | |||
//请求报文体 | |||
AGVTaskCompleteNotifyModel.GetInstance.robotJobId = robotJobId; | |||
AGVTaskCompleteNotifyModel.GetInstance.warehouseId = 123;//仓库编号 | |||
string body=JsonConvert.SerializeObject(AGVTaskCompleteNotifyModel.GetInstance); | |||
string data = HttpRequest(url, head, body); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
if (objData != null && objData is HttpResponseModel response) | |||
{ | |||
return response.Body?.code; | |||
} | |||
return "Analysis Error"; | |||
} | |||
/// <summary> | |||
/// AGV上下料交互反馈 | |||
/// </summary> | |||
/// <param name="agvCode">AGV编号</param> | |||
/// <param name="jobId">任务编号</param> | |||
/// <param name="msgId">消息编号</param> | |||
/// <returns></returns> | |||
public string UpDownFeedBack(string agvCode,string jobId,string msgId) | |||
{ | |||
string url = AGVRequestUrl.GetInstance.TaskCompleteUrl; | |||
//请求报文头 | |||
HttpRequestHeaderModel.GetInstance.appKey = ""; | |||
HttpRequestHeaderModel.GetInstance.appSecret = ""; | |||
HttpRequestHeaderModel.GetInstance.requestId = ""; | |||
HttpRequestHeaderModel.GetInstance.timestamp = ""; | |||
HttpRequestHeaderModel.GetInstance.version = "2.8"; | |||
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); | |||
//请求报文体 | |||
AGVLoadInteracteModel.GetInstance.agvCode = agvCode; | |||
AGVLoadInteracteModel.GetInstance.jobId = jobId; | |||
AGVLoadInteracteModel.GetInstance.msgId= msgId; | |||
string body=JsonConvert.SerializeObject(AGVLoadInteracteModel.GetInstance); | |||
string data = HttpRequest(url, head, body); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
if (objData != null && objData is HttpResponseModel response) | |||
{ | |||
return response.Body?.code; | |||
} | |||
return "Analysis Error"; | |||
} | |||
} | |||
} |
@@ -11,6 +11,8 @@ namespace BPASmartClient.AGV | |||
/// </summary> | |||
internal class AGVLoadInteracteModel | |||
{ | |||
private static AGVLoadInteracteModel _instance; | |||
public static AGVLoadInteracteModel GetInstance=>_instance ??= new AGVLoadInteracteModel(); | |||
public string agvCode { get; set;} | |||
public string jobId { get; set; } | |||
public string msgId { get; set; } | |||
@@ -11,6 +11,9 @@ namespace BPASmartClient.AGV | |||
/// </summary> | |||
internal class AGVModel | |||
{ | |||
private static AGVModel _instance; | |||
public static AGVModel GetInstance => _instance ??= new AGVModel(); | |||
/// <summary> | |||
/// 必填项 | |||
/// </summary> | |||
@@ -2,10 +2,11 @@ | |||
{ | |||
public class AGVRequestUrl | |||
{ | |||
//public string HttpHeader { get; set; } | |||
//public string TaskSendBody { get; set; } | |||
public AGVRequestUrl(string IpAddress) | |||
private static AGVRequestUrl _instance; | |||
public static AGVRequestUrl GetInstance => _instance ??= new AGVRequestUrl(); | |||
public AGVRequestUrl() | |||
{ | |||
string IpAddress = ""; | |||
TaskSendUrl= $"http://{IpAddress}/api/quicktron/wcs/standardized.robot.job.submit"; | |||
TaskCancelUrl= $"http://{IpAddress}/api/quicktron/wcs/standardized.robot.job.cancel"; | |||
TaskCompleteUrl= $"http://{IpAddress}/api/quicktron/wcs/standardized.operation.notice"; | |||
@@ -11,6 +11,8 @@ namespace BPASmartClient.AGV | |||
/// </summary> | |||
internal class AGVTaskCancelModel | |||
{ | |||
private static AGVTaskCancelModel _instance; | |||
public static AGVTaskCancelModel GetInstance => _instance ??= new AGVTaskCancelModel(); | |||
public string robotJobId { get; set; } | |||
public long warehouseId { get; set; } | |||
public string? executeMode { get; set; } | |||
@@ -11,6 +11,8 @@ namespace BPASmartClient.AGV | |||
/// </summary> | |||
internal class AGVTaskCompleteNotifyModel | |||
{ | |||
private static AGVTaskCompleteNotifyModel _instance; | |||
public static AGVTaskCompleteNotifyModel GetInstance=>_instance ??= new AGVTaskCompleteNotifyModel(); | |||
public string? robotJobId { get; set; } | |||
public string? bucketCode { get; set; } | |||
public string? bucketslotCode { get; set; } | |||
@@ -11,6 +11,8 @@ namespace BPASmartClient.AGV | |||
/// </summary> | |||
internal class AGV_PointRollerJobData:IJobData | |||
{ | |||
private static AGV_PointRollerJobData _instance; | |||
public static AGV_PointRollerJobData GetInstance => _instance ??= new AGV_PointRollerJobData(); | |||
public string? containerCode { get; set; } | |||
public string startPoint { get; set; } | |||
public string endPoint { get; set; } | |||
@@ -11,8 +11,10 @@ namespace BPASmartClient.AGV | |||
/// </summary> | |||
internal class AGV_SlotRollerJobData:IJobData | |||
{ | |||
private static AGV_SlotRollerJobData _instance; | |||
public static AGV_SlotRollerJobData GetInstance => _instance ??= new AGV_SlotRollerJobData(); | |||
public string? containerCode { get; set; } | |||
public string startIotCode { get; set; } | |||
public string startSlotCode { get; set; } | |||
public string endSlotCode { get; set; } | |||
public bool autoLoad { get; set; } | |||
public bool enableIOLoad { get; set; } | |||
@@ -0,0 +1,13 @@ | |||
<?xml version="1.0" encoding="utf-8" ?> | |||
<configuration> | |||
<appSettings> | |||
<!--请求报文头--> | |||
<add key="appKey" value="132"/> | |||
<add key="appSecret" value="123"/> | |||
<add key="requestId" value="123"/> | |||
<add key="timestamp" value="123"/> | |||
<add key ="version" value="2.8"/> | |||
<!--请求报文体--> | |||
</appSettings> | |||
</configuration> |
@@ -8,6 +8,7 @@ | |||
<ItemGroup> | |||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | |||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,17 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.AGV.Feedback | |||
{ | |||
public class AGVUpReportHeader | |||
{ | |||
public string? appKey { get; set; } | |||
public string? appSecret { get; set; } | |||
public string? requestId { get; set; } | |||
public string? timestamp { get; set; } | |||
public string? version { get; set; } | |||
} | |||
} |
@@ -49,6 +49,5 @@ namespace BPASmartClient.AGV.Feedback | |||
/// 上游任务号 | |||
/// </summary> | |||
public string robotJobId { get; set; } | |||
} | |||
} |
@@ -8,10 +8,12 @@ namespace BPASmartClient.AGV | |||
{ | |||
internal class HttpRequestHeaderModel | |||
{ | |||
public string appKey { get; set; } | |||
public string appSecret { get; set; } | |||
public string requestId { get; set; } | |||
public string timestamp { get; set; } | |||
public string version { get; set; } | |||
private static HttpRequestHeaderModel _instance; | |||
public static HttpRequestHeaderModel GetInstance => _instance ??= new HttpRequestHeaderModel(); | |||
public string? appKey { get; set; } | |||
public string? appSecret { get; set; } | |||
public string? requestId { get; set; } | |||
public string? timestamp { get; set; } | |||
public string? version { get; set; } | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.AGV | |||
{ | |||
internal class HttpResponseBodyModel | |||
{ | |||
public string code { get; set; } | |||
public string message { get; set; } | |||
public bool success { get; set; } | |||
public HttpResponseData data { get; set; } | |||
} | |||
} |
@@ -0,0 +1,15 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.AGV | |||
{ | |||
internal class HttpResponseHeaderModel | |||
{ | |||
public string? requestId { get; set; } | |||
public string? timestamp { get; set; } | |||
public string? version { get; set; } | |||
} | |||
} |
@@ -8,9 +8,7 @@ namespace BPASmartClient.AGV | |||
{ | |||
internal class HttpResponseModel | |||
{ | |||
public string code { get; set; } | |||
public string message { get; set; } | |||
public bool success { get; set; } | |||
public HttpResponseData data { get; set; } | |||
public HttpResponseHeaderModel? Header { get; set; } | |||
public HttpResponseBodyModel? Body { get; set; } | |||
} | |||
} |
@@ -19,8 +19,18 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<None Remove="Fonts\80号-萌趣小鱼体.ttf" /> | |||
<None Remove="Fonts\iconfont.ttf" /> | |||
<None Remove="Fonts\Quartz Regular.ttf" /> | |||
<None Remove="Image\AGV\停车位.png" /> | |||
<None Remove="Image\AGV\充电桩.png" /> | |||
<None Remove="Image\AGV\墙.png" /> | |||
<None Remove="Image\AGV\汤碗.png" /> | |||
<None Remove="Image\AGV\炒锅.png" /> | |||
<None Remove="Image\AGV\物流车.png" /> | |||
<None Remove="Image\AGV\砖块.png" /> | |||
<None Remove="Image\AGV\蔬菜.png" /> | |||
<None Remove="Image\AGV\语音箭头.png" /> | |||
<None Remove="Image\bg.png" /> | |||
<None Remove="Image\btn_close.png" /> | |||
<None Remove="Image\btn_normal.png" /> | |||
@@ -190,7 +200,17 @@ | |||
<None Remove="Image\顶部线条.png" /> | |||
<None Remove="Image\顶部背景.png" /> | |||
<None Remove="Image\黑菠萝科技.png" /> | |||
<None Remove="Videos\Login.mp4" /> | |||
<None Remove="Vioce\取餐通知.wav" /> | |||
<None Remove="Vioce\电子提示音.wav" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<EmbeddedResource Include="Vioce\取餐通知.wav"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</EmbeddedResource> | |||
<EmbeddedResource Include="Vioce\电子提示音.wav"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</EmbeddedResource> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -200,8 +220,18 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Resource Include="Fonts\80号-萌趣小鱼体.ttf" /> | |||
<Resource Include="Fonts\iconfont.ttf" /> | |||
<Resource Include="Fonts\Quartz Regular.ttf" /> | |||
<Resource Include="Image\AGV\停车位.png" /> | |||
<Resource Include="Image\AGV\充电桩.png" /> | |||
<Resource Include="Image\AGV\墙.png" /> | |||
<Resource Include="Image\AGV\汤碗.png" /> | |||
<Resource Include="Image\AGV\炒锅.png" /> | |||
<Resource Include="Image\AGV\物流车.png" /> | |||
<Resource Include="Image\AGV\砖块.png" /> | |||
<Resource Include="Image\AGV\蔬菜.png" /> | |||
<Resource Include="Image\AGV\语音箭头.png" /> | |||
<Resource Include="Image\btn_close.png" /> | |||
<Resource Include="Image\ComboBoxPopSelect.png" /> | |||
<Resource Include="Image\ComboBoxSelect.png" /> | |||
@@ -15,6 +15,7 @@ | |||
Topmost="False" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
WindowState="Normal" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
@@ -232,28 +233,6 @@ | |||
VerticalAlignment="Center" | |||
LoadedBehavior="Manual" /> | |||
<!--<MediaElement | |||
Name="player" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Source="../../Videos/Login.mp4" | |||
LoadedBehavior="Play"> | |||
<MediaElement.Triggers> | |||
<EventTrigger RoutedEvent="MediaElement.Loaded"> | |||
<EventTrigger.Actions> | |||
<BeginStoryboard> | |||
<Storyboard> | |||
<MediaTimeline | |||
RepeatBehavior="Forever" | |||
Source="../../Videos/Login.mp4" | |||
Storyboard.TargetName="player" /> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</EventTrigger.Actions> | |||
</EventTrigger> | |||
</MediaElement.Triggers> | |||
</MediaElement>--> | |||
<Grid x:Name="grid" Margin="400,180"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
@@ -279,10 +258,10 @@ | |||
Text="{Binding ErrorInfo}" /> | |||
<TextBox | |||
Name="Username" | |||
Grid.Row="1" | |||
Margin="20,20" | |||
BorderBrush="#009DFF" | |||
Name="Username" | |||
BorderThickness="3" | |||
FontSize="30" | |||
Foreground="#009DFF" | |||
@@ -294,7 +273,6 @@ | |||
<PasswordBox | |||
Name="pb" | |||
Grid.Row="2" | |||
KeyDown="pb_KeyDown" | |||
Margin="20,20" | |||
common:PasswordHelper.Attach="True" | |||
common:PasswordHelper.Password="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" | |||
@@ -302,6 +280,7 @@ | |||
BorderThickness="3" | |||
FontSize="30" | |||
Foreground="#009DFF" | |||
KeyDown="pb_KeyDown" | |||
PasswordChanged="PasswordBox_PasswordChanged" | |||
Style="{DynamicResource PasswordBoxStyle}" | |||
TabIndex="2" /> | |||
@@ -337,271 +316,6 @@ | |||
TabIndex="3" /> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
<!--<Border | |||
x:Name="br" | |||
BorderBrush="#009dff" | |||
BorderThickness="2"> | |||
<Border.Effect> | |||
<DropShadowEffect | |||
BlurRadius="10" | |||
ShadowDepth="1" | |||
Color="#009DFF" /> | |||
</Border.Effect> | |||
<Grid> | |||
--> | |||
<!--<Image Source="../../Image/登录界面背景1.jpg" Stretch="Fill" /> | |||
<Image Source="../../Image/阴影边框.png" Stretch="Fill" />--> | |||
<!-- | |||
<Border | |||
Width="400" | |||
Height="260" | |||
Margin="0,0,0,250" | |||
BorderBrush="#009dff" | |||
BorderThickness="2"> | |||
<Border.Effect> | |||
<DropShadowEffect | |||
BlurRadius="10" | |||
ShadowDepth="1" | |||
Color="#009DFF" /> | |||
</Border.Effect> | |||
<Grid Width="400" Height="260"> | |||
--> | |||
<!--<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions>--> | |||
<!--<TextBlock | |||
Margin="0,10,0,0" | |||
HorizontalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#ddd" | |||
Text="用户登录" /> | |||
<TextBlock | |||
Margin="20,10,0,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Bottom" | |||
FontSize="16" | |||
Foreground="#FFEF2020" | |||
Text="{Binding ErrorInfo}" /> | |||
<TextBox | |||
Grid.Row="1" | |||
Height="40" | |||
Margin="20,0" | |||
BorderBrush="#009DFF" | |||
FontSize="16" | |||
Foreground="#009DFF" | |||
Style="{DynamicResource UserTextBoxStyle}" | |||
TabIndex="1" | |||
Text="{Binding UserName}" /> | |||
<PasswordBox | |||
Name="pb" | |||
Grid.Row="2" | |||
Height="40" | |||
Margin="20,0" | |||
common:PasswordHelper.Attach="True" | |||
common:PasswordHelper.Password="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" | |||
BorderBrush="#009DFF" | |||
FontSize="16" | |||
Foreground="#009DFF" | |||
PasswordChanged="PasswordBox_PasswordChanged" | |||
Style="{DynamicResource PasswordBoxStyle}" | |||
TabIndex="2" /> | |||
<TextBlock | |||
Name="markText" | |||
Grid.Row="2" | |||
Margin="70,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#88009dff" | |||
IsHitTestVisible="False" | |||
Text="请输入账号密码" | |||
Visibility="Visible" /> | |||
<Grid Grid.Row="3"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Button | |||
Margin="20,10" | |||
Background="#009DFF" | |||
BorderThickness="0" | |||
Command="{Binding ExitCommand}" | |||
Content="退 出" | |||
FontSize="20" | |||
Foreground="White" /> | |||
<Button | |||
Grid.Column="1" | |||
Margin="20,10" | |||
Background="#009DFF" | |||
BorderThickness="0" | |||
Command="{Binding LoginCommand}" | |||
Content="登 录" | |||
FontSize="20" | |||
Foreground="White" | |||
TabIndex="3" /> | |||
</Grid>--> | |||
<!-- | |||
</Grid> | |||
</Border> | |||
</Grid> | |||
</Border> | |||
--> | |||
<!--<Grid x:Name="gr"> | |||
<Grid.Background> | |||
<ImageBrush Opacity="0.8" ImageSource="../../Image/登录界面背景.jpg" /> | |||
</Grid.Background> | |||
<Image | |||
Margin="201 101" | |||
Source="../../Image/阴影边框.png" | |||
Stretch="Fill" /> | |||
<Border | |||
Margin="200 100" | |||
BorderBrush="#009dff" | |||
BorderThickness="1"> | |||
<Border.Effect> | |||
<DropShadowEffect | |||
BlurRadius="10" | |||
ShadowDepth="1" | |||
Color="#009DFF" /> | |||
</Border.Effect> | |||
--> | |||
<!--<Border.Background> | |||
<ImageBrush ImageSource="../../Image/矩形样式.png"/> | |||
</Border.Background>--> | |||
<!-- | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Margin="0,10,0,0" | |||
HorizontalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#ddd" | |||
Text="用户登录" /> | |||
<TextBlock | |||
Margin="20,10,0,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Bottom" | |||
FontSize="16" | |||
Foreground="#FFEF2020" | |||
Text="{Binding ErrorInfo}" /> | |||
<TextBox | |||
Grid.Row="1" | |||
Height="40" | |||
Margin="20,0" | |||
BorderBrush="#009DFF" | |||
FontSize="16" | |||
Foreground="#aadddddd" | |||
Style="{DynamicResource UserTextBoxStyle}" | |||
Text="{Binding UserName}" /> | |||
<PasswordBox | |||
Name="pb" | |||
Grid.Row="2" | |||
Height="40" | |||
Margin="20,0" | |||
common:PasswordHelper.Attach="True" | |||
common:PasswordHelper.Password="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" | |||
BorderBrush="#009DFF" | |||
FontSize="16" | |||
Foreground="#aadddddd" | |||
PasswordChanged="PasswordBox_PasswordChanged" | |||
Style="{DynamicResource PasswordBoxStyle}" /> | |||
<TextBlock | |||
Name="markText" | |||
Grid.Row="2" | |||
Margin="70,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#88009dff" | |||
IsHitTestVisible="False" | |||
Text="请输入账号密码" | |||
Visibility="Visible" /> | |||
<Grid Grid.Row="3"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Button | |||
Margin="20,10" | |||
Background="#009DFF" | |||
BorderThickness="0" | |||
Command="{Binding ExitCommand}" | |||
Content="退 出" | |||
FontSize="20" | |||
Foreground="White" /> | |||
<Button | |||
Grid.Column="1" | |||
Margin="20,10" | |||
Background="#009DFF" | |||
BorderThickness="0" | |||
Command="{Binding LoginCommand}" | |||
Content="登 录" | |||
FontSize="20" | |||
Foreground="White" /> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</Grid>--> | |||
</Window> |
@@ -21,6 +21,7 @@ | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<!--#region 静态资源--> | |||
<ImageBrush x:Key="leftImage" ImageSource="../../Image/leftImage.png" /> | |||
@@ -280,7 +281,90 @@ | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
<Style x:Key="checkBoxStyle" TargetType="CheckBox"> | |||
<Setter Property="Foreground" Value="#a2c2e8" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="FocusVisualStyle"> | |||
<Setter.Value> | |||
<Style> | |||
<Setter Property="Control.Template"> | |||
<Setter.Value> | |||
<ControlTemplate> | |||
<Rectangle | |||
Margin="1" | |||
SnapsToDevicePixels="True" | |||
Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" | |||
StrokeDashArray="1 2" | |||
StrokeThickness="1" /> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type CheckBox}"> | |||
<StackPanel | |||
Background="Transparent" | |||
Orientation="Horizontal" | |||
SnapsToDevicePixels="True"> | |||
<Grid> | |||
<Image | |||
Width="12" | |||
Height="14" | |||
Source="/BPASmartClient.CustomResource;component/Image/Cb_HalfChecked.png" /> | |||
<Image | |||
x:Name="image1" | |||
Width="12" | |||
Height="14" | |||
Source="/BPASmartClient.CustomResource;component/Image/Cb_HalfChecked.png" /> | |||
</Grid> | |||
<ContentPresenter | |||
Margin="{TemplateBinding Padding}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |||
Content="{TemplateBinding Content}" | |||
ContentStringFormat="{TemplateBinding ContentStringFormat}" | |||
RecognizesAccessKey="True" | |||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||
</StackPanel> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="HasContent" Value="True"> | |||
<Setter Property="FocusVisualStyle"> | |||
<Setter.Value> | |||
<Style> | |||
<Setter Property="Control.Template"> | |||
<Setter.Value> | |||
<ControlTemplate> | |||
<Rectangle | |||
Margin="14,0,0,0" | |||
SnapsToDevicePixels="True" | |||
Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" | |||
StrokeDashArray="1 2" | |||
StrokeThickness="1" /> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="Padding" Value="4,0,0,0" /> | |||
</Trigger> | |||
<Trigger Property="IsEnabled" Value="False"> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="true"> | |||
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/Cb_Checked.png" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="{x:Null}"> | |||
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/Cb_HalfChecked.png" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</Window.Resources> | |||
<Grid Background="#103153"> | |||
@@ -430,7 +514,19 @@ | |||
<RowDefinition Height="60" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> | |||
<CheckBox | |||
Style="{StaticResource checkBoxStyle}" | |||
Margin="5,0,5,0" | |||
Content="开机启动" | |||
IsChecked="{Binding AutoStart}" /> | |||
<CheckBox | |||
Style="{StaticResource checkBoxStyle}" | |||
Margin="5,0,5,0" | |||
Content="设备初始化" | |||
IsChecked="{Binding Status}" | |||
/> | |||
</StackPanel> | |||
<TextBlock | |||
Margin="0,0,0,20" | |||
HorizontalAlignment="Center" | |||
@@ -70,7 +70,31 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
} | |||
} | |||
} | |||
private bool _status; | |||
/// <summary> | |||
/// 设备初始化状态 | |||
/// </summary> | |||
public bool Status | |||
{ | |||
get { return _status; } | |||
set | |||
{ | |||
if (value) | |||
{ | |||
ActionManage.GetInstance.Send("StartPlcInite"); | |||
} | |||
else | |||
{ | |||
ActionManage.GetInstance.Send("EndPlcInite"); | |||
} | |||
_status = value; | |||
OnPropertyChanged(); | |||
} | |||
} | |||
/// <summary> | |||
/// 开机自启 | |||
/// </summary> | |||
public bool AutoStart { get { return SystemHelper.GetInstance.IsAutoStart(); } set { SystemHelper.GetInstance.AutoStart(value); OnPropertyChanged(); } } | |||
public RelayCommand<object> NavChangedCommand { get; set; } | |||
public FrameworkElement MainContent { get { return _mMainContent; } set { _mMainContent = value; OnPropertyChanged(); } } | |||
@@ -173,6 +173,14 @@ | |||
<ImageBrush x:Key="image1" ImageSource="/BPASmartClient.CustomResource;component/Image/shape.png" /> | |||
<ImageBrush x:Key="image2" ImageSource="/BPASmartClient.CustomResource;component/Image/shape1.png" /> | |||
<Style x:Key="image墙" TargetType="Image"> | |||
<Style.Setters> | |||
<Setter Property="VerticalAlignment" Value="Stretch" /> | |||
<Setter Property="HorizontalAlignment" Value="Stretch" /> | |||
<Setter Property="Source" Value="/BPASmartClient.CustomResource;component/Image/AGV/墙.png" /> | |||
</Style.Setters> | |||
</Style> | |||
<Style TargetType="Image"> | |||
<Style.Setters> | |||
<Setter Property="UseLayoutRounding" Value="True" /> | |||
@@ -356,6 +364,158 @@ | |||
<!--#endregion--> | |||
<!--#region Border--> | |||
<Style x:Key="border车" TargetType="Border"> | |||
<Style.Setters> | |||
<Setter Property="Height" Value="80"/> | |||
<Setter Property="Width" Value="80"/> | |||
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/> | |||
<Setter Property="RenderTransform" > | |||
<Setter.Value> | |||
<TransformGroup> | |||
<ScaleTransform ScaleY="-0.6" ScaleX="0.8"/> | |||
<SkewTransform AngleY="0"/> | |||
<RotateTransform Angle="180"/> | |||
<TranslateTransform X="1" Y="0.5"/> | |||
</TransformGroup> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="Background"> | |||
<Setter.Value> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/物流车.png" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Style.Setters> | |||
</Style> | |||
<Style x:Key="border停车位" TargetType="Border"> | |||
<Style.Setters> | |||
<Setter Property="Height" Value="80"/> | |||
<Setter Property="Width" Value="80"/> | |||
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/> | |||
<Setter Property="RenderTransform" > | |||
<Setter.Value> | |||
<TransformGroup> | |||
<ScaleTransform/> | |||
<SkewTransform AngleY="20"/> | |||
<RotateTransform/> | |||
<TranslateTransform/> | |||
</TransformGroup> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="Background"> | |||
<Setter.Value> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/停车位.png" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Style.Setters> | |||
</Style> | |||
<Style x:Key="border充电桩" TargetType="Border"> | |||
<Style.Setters> | |||
<Setter Property="Height" Value="60"/> | |||
<Setter Property="Width" Value="60"/> | |||
<Setter Property="Margin" Value="0,20,0,0"/> | |||
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/> | |||
<Setter Property="RenderTransform" > | |||
<Setter.Value> | |||
<TransformGroup> | |||
<ScaleTransform/> | |||
<SkewTransform AngleY="20"/> | |||
<RotateTransform/> | |||
<TranslateTransform/> | |||
</TransformGroup> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="Background"> | |||
<Setter.Value> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/充电桩.png" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Style.Setters> | |||
</Style> | |||
<Style x:Key="border炒锅" TargetType="Border"> | |||
<Style.Setters> | |||
<Setter Property="Margin" Value="60,0,0,20"/> | |||
<Setter Property="Height" Value="80"/> | |||
<Setter Property="Width" Value="80"/> | |||
<Setter Property="VerticalAlignment" Value="Bottom"/> | |||
<Setter Property="Background"> | |||
<Setter.Value> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/炒锅.png" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Style.Setters> | |||
</Style> | |||
<Style x:Key="border碗" TargetType="Border"> | |||
<Style.Setters> | |||
<Setter Property="Height" Value="50"/> | |||
<Setter Property="Width" Value="40"/> | |||
<Setter Property="VerticalAlignment" Value="Bottom"/> | |||
<Setter Property="Background"> | |||
<Setter.Value> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/汤碗.png" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Style.Setters> | |||
</Style> | |||
<Style x:Key="border菜" TargetType="Border"> | |||
<Style.Setters> | |||
<Setter Property="Margin" Value="0,3,0,0"/> | |||
<Setter Property="Height" Value="25"/> | |||
<Setter Property="Width" Value="33"/> | |||
<Setter Property="VerticalAlignment" Value="Top"/> | |||
<Setter Property="Background"> | |||
<Setter.Value> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/蔬菜.png" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Style.Setters> | |||
</Style> | |||
<Style x:Key="border垂直墙" TargetType="Border"> | |||
<Style.Setters> | |||
<Setter Property="Background"> | |||
<Setter.Value> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/砖块.png" Viewport="0, 0, 1, 0.03" TileMode="FlipY" Stretch="UniformToFill" ViewportUnits="RelativeToBoundingBox" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Style.Setters> | |||
</Style> | |||
<Style x:Key="border水平墙" TargetType="Border"> | |||
<Style.Setters> | |||
<Setter Property="Background"> | |||
<Setter.Value> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/砖块.png" Viewport="0, 0, 0.02, 1" TileMode="FlipY" Stretch="UniformToFill" ViewportUnits="RelativeToBoundingBox" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Style.Setters> | |||
</Style> | |||
<Style x:Key="border垂直墙1" TargetType="Border"> | |||
<Style.Setters> | |||
<Setter Property="Background"> | |||
<Setter.Value> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/砖块.png" Viewport="0, 0, 1, 0.1" TileMode="FlipY" Stretch="UniformToFill" ViewportUnits="RelativeToBoundingBox" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Style.Setters> | |||
</Style> | |||
<Style x:Key="border水平墙1" TargetType="Border"> | |||
<Style.Setters> | |||
<Setter Property="Background"> | |||
<Setter.Value> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/砖块.png" Viewport="0, 0, 0.1, 1" TileMode="FlipY" Stretch="UniformToFill" ViewportUnits="RelativeToBoundingBox" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Style.Setters> | |||
</Style> | |||
<Style x:Key="FromBJ" TargetType="Border"> | |||
<Style.Setters> | |||
<Setter Property="Background"> | |||
@@ -787,7 +947,7 @@ | |||
</Style.Setters> | |||
</Style> | |||
<!--#endregion--> | |||
<!--#region Button--> | |||
<Style x:Key="TitleBarStyle" TargetType="Button"> | |||
<Setter Property="Foreground" Value="White" /> | |||
@@ -1662,6 +1822,14 @@ | |||
<!--#endregion--> | |||
<!--#region TextBlock--> | |||
<Style x:Key="80号字体样式" TargetType="TextBlock"> | |||
<Setter Property="TextWrapping" Value="Wrap" /> | |||
<Setter Property="FontFamily" Value="/BPASmartClient.CustomResource;Component/Fonts/#zihun80hao-mengquxiaoyuti"/> | |||
<Setter Property="Foreground" Value="#FFC6AE82" /> | |||
</Style> | |||
<Style TargetType="TextBlock"> | |||
<Style.Setters> | |||
<Setter Property="Foreground" Value="{DynamicResource foreground}" /> | |||
@@ -1769,5 +1937,97 @@ | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
<!--#region dataGrid--> | |||
<Style TargetType="DataGrid" x:Key="dataGrid_Style"> | |||
<!--网格线颜色--> | |||
<Setter Property="CanUserResizeColumns" Value="false" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="BorderBrush" Value="#a2c2e8" /> | |||
<Setter Property="HorizontalGridLinesBrush"> | |||
<Setter.Value> | |||
<SolidColorBrush Color="#a2c2e8" /> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="VerticalGridLinesBrush"> | |||
<Setter.Value> | |||
<SolidColorBrush Color="#a2c2e8" /> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#region dataGridRow--> | |||
<Style x:Key="DatagridRow_Style" TargetType="DataGridRow"> | |||
<Setter Property="Background" Value="#3afdff" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
<Setter Property="Height" Value="20"/> | |||
<Style.Triggers> | |||
<!-- 隔行换色 --> | |||
<Trigger Property="AlternationIndex" Value="0"> | |||
<Setter Property="Background" Value="#FFFAFAFA" /> | |||
</Trigger> | |||
<Trigger Property="AlternationIndex" Value="1"> | |||
<Setter Property="Background" Value="#FFF5F5F7" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="Background" Value="#4fade8" /> | |||
</Trigger> | |||
<Trigger Property="IsSelected" Value="True"> | |||
<Setter Property="Background" Value="#4fade8" /> | |||
<Setter Property="Foreground" Value="#FF111111" /> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
<!--#endregion--> | |||
<!--#region dataGridHeader--> | |||
<Style TargetType="DataGridColumnHeader" x:Key="dataGridHeader_Style"> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="MinWidth" Value="0" /> | |||
<Setter Property="MinHeight" Value="30" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Cursor" Value="Hand" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="DataGridColumnHeader"> | |||
<Border x:Name="BackgroundBorder" BorderThickness="0,1,0,1" | |||
BorderBrush="#e6dbba" | |||
Width="Auto"> | |||
<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="White" Margin="0,0,50,0" | |||
VerticalAlignment="Center" RenderTransformOrigin="1,1" /> | |||
<Rectangle Width="1" Fill="#d6c79b" HorizontalAlignment="Right" Grid.ColumnSpan="1" /> | |||
</Grid> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="Height" Value="25" /> | |||
</Style> | |||
<!--#endregion--> | |||
<!--#region dataGridCell--> | |||
<Style TargetType="DataGridCell" x:Key="dataGridCell_Style"> | |||
<Setter Property="Height" Value="20"/> | |||
<Setter Property="FontSize" Value="14"/> | |||
<Style.Triggers> | |||
<Trigger Property="IsSelected" Value="True"> | |||
<Setter Property="Background" Value="White" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="Foreground" Value="Black" /> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
<!--#endregion--> | |||
<!--#endregion--> | |||
</ResourceDictionary> |
@@ -191,6 +191,7 @@ namespace BPASmartClient.DRCoffee | |||
commProxy.SendData(DrCoffee.Packe(drinksOrder)); | |||
Thread.Sleep(200); | |||
free = false; | |||
MessageLog.GetInstance.Show($"咖啡机: 制作咖啡指令"); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -210,6 +211,7 @@ namespace BPASmartClient.DRCoffee | |||
commProxy.SendData(DrCoffee.Packe(drinksOrder)); | |||
Thread.Sleep(200); | |||
free = false; | |||
MessageLog.GetInstance.Show($"咖啡机: 咖啡取消指令"); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -228,6 +230,7 @@ namespace BPASmartClient.DRCoffee | |||
commProxy.SendData(DrCoffee.Packe(drinksOrder)); | |||
Thread.Sleep(200); | |||
free = false; | |||
MessageLog.GetInstance.Show($"咖啡机: 咖啡模式设置指令"); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -1,37 +0,0 @@ | |||
<Application | |||
x:Class="BPASmartClient.DosingSystem.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters;assembly=BPASmartClient.CustomResource" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem"> | |||
<Application.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecCheckBox.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecTitleBarButton.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/GlobalStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecComboBox.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecIcoButtonStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecToggleButton.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/BeveledRadioButtonStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/DatePickeerDictionary.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecButtonStyle.xaml" /> | |||
<ResourceDictionary> | |||
<con:ColorConverter x:Key="ColorConverter" /> | |||
<con:TextConverter x:Key="TextConverter" /> | |||
<con:VisibleTypeConverter x:Key="VisibleTypeConverter" /> | |||
<con:StatusConverter x:Key="StatusConverter" /> | |||
<con:StringToIconConverter x:Key="StringToIconConverter" /> | |||
</ResourceDictionary> | |||
<ResourceDictionary> | |||
<ImageBrush x:Key="hbl" ImageSource="/BPASmartClient.CustomResource;component/Image/HBL.png" /> | |||
<ImageBrush x:Key="dbxt" ImageSource="/BPASmartClient.CustomResource;component/Image/顶部线条.png" /> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</Application.Resources> | |||
</Application> |
@@ -1,188 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Configuration; | |||
using System.Data; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using BPASmartClient.CustomResource.Pages.Enums; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.CustomResource.Pages.View; | |||
using BPASmartClient.DosingSystem.Model; | |||
using BPASmartClient.DosingSystem.View; | |||
using BPASmartClient.Helper; | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
/// <summary> | |||
/// Interaction logic for App.xaml | |||
/// </summary> | |||
public partial class App : Application | |||
{ | |||
protected override void OnStartup(StartupEventArgs e) | |||
{ | |||
base.OnStartup(e); | |||
MenuInit(); | |||
DataInit(); | |||
MainView mv = new MainView(); | |||
LoginView lv = new LoginView(); | |||
var res = lv.ShowDialog(); | |||
if (res != null && res == true) | |||
mv.Show(); | |||
else | |||
mv.Close(); | |||
//MainWindow mw = new MainWindow(); | |||
//LoginView lv = new LoginView(); | |||
//var res = lv.ShowDialog(); | |||
//if (res != null && res == true) | |||
// mw.Show(); | |||
//else | |||
// mw.Close(); | |||
} | |||
protected override void OnExit(ExitEventArgs e) | |||
{ | |||
base.OnExit(e); | |||
Json<LocaPar>.Save(); | |||
MessageLog.GetInstance.LogSave(); | |||
} | |||
private void MenuInit() | |||
{ | |||
#region 配方管理菜单 | |||
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>(); | |||
RecipeManage.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "配方管理", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.DosingSystem", | |||
ToggleWindowPath = "View.RecipeSettingsView" | |||
}); | |||
RecipeManage.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "配方下发", | |||
SubMenuPermission = new Permission[] { Permission.操作员 }, | |||
AssemblyName = "BPASmartClient.DosingSystem", | |||
ToggleWindowPath = "View.RecipeControlView" | |||
}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
{ | |||
MainMenuIcon = "", | |||
MainMenuName = "配方管理", | |||
Alias = "Recipe Management", | |||
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员 }, | |||
subMenumodels = RecipeManage, | |||
}); | |||
#endregion | |||
#region 消息日志 | |||
ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>(); | |||
InfoLog.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "操作日志", | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.UserLogView" | |||
}); | |||
InfoLog.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "运行日志", | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.RunLogView" | |||
}); | |||
InfoLog.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "报警记录", | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.AlarmView" | |||
}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
{ | |||
MainMenuIcon = "", | |||
MainMenuName = "消息日志", | |||
Alias = "Message Log", | |||
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
subMenumodels = InfoLog, | |||
}); | |||
#endregion | |||
#region 硬件设备监控 | |||
ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>(); | |||
DeviceMonitor.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "原料设备列表", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.DosingSystem", | |||
ToggleWindowPath = "View.DeviceListView" | |||
}); | |||
DeviceMonitor.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "设备状态", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.DosingSystem", | |||
ToggleWindowPath = "View.HardwareStatusView" | |||
}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
{ | |||
MainMenuIcon = "", | |||
MainMenuName = "设备监控", | |||
Alias = "Device Monitor", | |||
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
subMenumodels = DeviceMonitor, | |||
}); | |||
#endregion | |||
#region 用户管理 | |||
ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>(); | |||
UserManager.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "用户登录", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.LoginView" | |||
}); | |||
UserManager.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "密码修改", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.PasswordChangeView" | |||
}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
{ | |||
MainMenuIcon = "", | |||
MainMenuName = "用户管理", | |||
Alias = "User Management", | |||
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
subMenumodels = UserManager, | |||
}); | |||
#endregion | |||
} | |||
private void DataInit() | |||
{ | |||
Config.GetInstance.Init(); | |||
Json<LocaPar>.Read(); | |||
} | |||
} | |||
} |
@@ -1,10 +0,0 @@ | |||
using System.Windows; | |||
[assembly: ThemeInfo( | |||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | |||
//(used if a resource is not found in the page, | |||
// or application resource dictionaries) | |||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | |||
//(used if a resource is not found in the page, | |||
// app, or any theme specific resource dictionaries) | |||
)] |
@@ -1,28 +0,0 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<OutputType>WinExe</OutputType> | |||
<TargetFramework>net6.0-windows</TargetFramework> | |||
<Nullable>enable</Nullable> | |||
<UseWPF>true</UseWPF> | |||
<ApplicationManifest>app.manifest</ApplicationManifest> | |||
<ApplicationIcon>hbl.ico</ApplicationIcon> | |||
<PlatformTarget>AnyCPU</PlatformTarget> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Content Include="hbl.ico" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Message" Version="1.0.46" /> | |||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | |||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Modbus\BPASmartClient.Modbus.csproj" /> | |||
</ItemGroup> | |||
</Project> |
@@ -1,28 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class ActionMenu : ObservableObject | |||
{ | |||
public string CommandParameter { get { return _mCommandParameter; } set { _mCommandParameter = value; OnPropertyChanged(); } } | |||
private string _mCommandParameter; | |||
//public Permission[] permission { get { return _mpermission; } set { _mpermission = value; OnPropertyChanged(); } } | |||
//private Permission[] _mpermission; | |||
public string MenuName { get { return _mMenuName; } set { _mMenuName = value; OnPropertyChanged(); } } | |||
private string _mMenuName; | |||
//public string NameSpace { get { return _mNameSpace; } set { _mNameSpace = value; OnPropertyChanged(); } } | |||
//private string _mNameSpace; | |||
} | |||
} |
@@ -1,44 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class DeviceAddress | |||
{ | |||
/// <summary> | |||
/// 设备名称起始地址 | |||
/// </summary> | |||
public static string DeviceName { get; set; } = "LW0"; | |||
/// <summary> | |||
/// 料仓重量反馈起始地址 | |||
/// </summary> | |||
public static string WeightFeedback { get; set; } = "LW204"; | |||
/// <summary> | |||
/// 重量设置地址 | |||
/// </summary> | |||
public static string WeightSet { get; set; } = "LW200"; | |||
/// <summary> | |||
/// 启动信号地址 | |||
/// </summary> | |||
public static string Start { get; set; } = "LW210"; | |||
/// <summary> | |||
/// 下料重量反馈地址 | |||
/// </summary> | |||
public static string CutWeightFeedback { get; set; } = "LW202"; | |||
/// <summary> | |||
/// 设备运行状态地址 | |||
/// </summary> | |||
public static string RunStatus { get; set; } = "LW206"; | |||
} | |||
} |
@@ -1,221 +0,0 @@ | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Message; | |||
using BPASmartClient.Modbus; | |||
using BPASmartClient.DosingSystem.ViewModel; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Diagnostics; | |||
using System.Linq; | |||
using System.Net.NetworkInformation; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class DeviceInquire | |||
{ | |||
private volatile static DeviceInquire _Instance; | |||
public static DeviceInquire GetInstance => _Instance ?? (_Instance = new DeviceInquire()); | |||
private DeviceInquire() { } | |||
string IPSegment = "192.168.0."; | |||
ConcurrentDictionary<string, DeviceStatus> DeviceLists = new ConcurrentDictionary<string, DeviceStatus>(); | |||
List<string> InvalidIP = new List<string>();//无效 IP 集合 | |||
List<string> IPLists = new List<string>();//启动 Ping 任务IP集合 | |||
ConcurrentQueue<string> IPQueues = new ConcurrentQueue<string>();//pincomplete 完成队列 | |||
public void Init() | |||
{ | |||
IpAddressLines(); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
if (IPQueues.Count >= IPLists.Count) | |||
IpAddressLines(); | |||
Thread.Sleep(5000); | |||
}), "配料机设备上线监听", true); | |||
} | |||
public void Rescan() | |||
{ | |||
InvalidIP.Clear(); | |||
} | |||
public DeviceStatus GetDevice(string ip) | |||
{ | |||
if (ip != null) | |||
{ | |||
var res = DeviceLists.Values.FirstOrDefault(p => p.IpAddress == ip); | |||
if (res != null) return res; | |||
} | |||
return new DeviceStatus(); | |||
} | |||
private void IpAddressLines() | |||
{ | |||
IPLists.Clear(); | |||
IPQueues.Clear(); | |||
for (int i = 1; i <= 255; i++) | |||
{ | |||
if (!InvalidIP.Contains($"{IPSegment}{i}") && !DeviceLists.ContainsKey($"{IPSegment}{i}")) | |||
{ | |||
IPLists.Add($"{IPSegment}{i}"); | |||
} | |||
} | |||
IPLists.ForEach((item) => | |||
{ | |||
Ping myPing = new Ping(); | |||
myPing.PingCompleted += new PingCompletedEventHandler(_myPing_PingCompleted); | |||
myPing.SendAsync(item, 1000, null); | |||
}); | |||
} | |||
private void _myPing_PingCompleted(object sender, PingCompletedEventArgs e) | |||
{ | |||
if (e.Reply.Status == IPStatus.Success) | |||
{ | |||
string ip = e.Reply.Address.ToString(); | |||
if (!DeviceLists.ContainsKey(ip)) | |||
{ | |||
DeviceStatus DS = new DeviceStatus(); | |||
DS.modbusTcp.IsReconnect = false; | |||
DS.modbusTcp.ConnectOk = new Action(() => | |||
{ | |||
string DeviceName = DS.modbusTcp.GetString(DeviceAddress.DeviceName, 20); | |||
if (DeviceName.Length > 0) | |||
{ | |||
DeviceLists.TryAdd(ip, DS); | |||
DeviceLists[ip].Init(DeviceName); | |||
DeviceLists[ip].modbusTcp.IsReconnect = false; | |||
App.Current.Dispatcher.Invoke(new Action(() => | |||
{ | |||
DeviceListViewModel.devices.Add(new Devices() | |||
{ | |||
DeviceName = DeviceName, | |||
IpAddress = ip | |||
}); | |||
for (int i = 0; i < Json<LocaPar>.Data.Recipes.Count; i++) | |||
{ | |||
for (int m = 0; m < Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.Count; m++) | |||
{ | |||
if (Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp == ip) | |||
{ | |||
Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName; | |||
} | |||
} | |||
} | |||
if (!NewRecipeViewModel.RawMaterialNames.Contains(DeviceName)) | |||
NewRecipeViewModel.RawMaterialNames.Add(DeviceName); | |||
})); | |||
} | |||
else | |||
{ | |||
if (!InvalidIP.Contains(ip)) InvalidIP.Add(ip); | |||
} | |||
}); | |||
DS.modbusTcp.ConnectFail = new Action(() => | |||
{ | |||
if (!InvalidIP.Contains(ip)) InvalidIP.Add(ip); | |||
MessageLog.GetInstance.Show($"{ip}连接失败"); | |||
}); | |||
DS.modbusTcp.Disconnect = new Action(() => | |||
{ | |||
if (InvalidIP.Contains(ip)) InvalidIP.Remove(ip); | |||
var res = DeviceListViewModel.devices.FirstOrDefault(P => P.IpAddress == ip); | |||
if (res != null && DeviceListViewModel.devices.Contains(res)) | |||
App.Current.Dispatcher.Invoke(new Action(() => | |||
{ | |||
DeviceListViewModel.devices.Remove(res); | |||
if (!NewRecipeViewModel.RawMaterialNames.Contains(res.DeviceName)) | |||
NewRecipeViewModel.RawMaterialNames.Remove(res.DeviceName); | |||
})); | |||
if (DeviceLists.ContainsKey(ip)) DeviceLists[ip].Dispose(); | |||
}); | |||
Task.Run(new Action(() => | |||
{ | |||
DS.modbusTcp.ModbusTcpConnect(ip, 502); | |||
IPQueues.Enqueue(e.Reply.Address.ToString()); | |||
})); | |||
} | |||
else IPQueues.Enqueue(e.Reply.Address.ToString()); | |||
} | |||
else IPQueues.Enqueue(e.Reply.Address.ToString()); | |||
} | |||
} | |||
public class DeviceStatus | |||
{ | |||
#region 对象属性声明 | |||
public string DeviceName = String.Empty; | |||
public string IpAddress => modbusTcp.IPAdress; | |||
/// <summary> | |||
/// 设备状态 | |||
/// </summary> | |||
public RawMaterialDeviceStatus deviceStatus { get; set; } = new RawMaterialDeviceStatus(); | |||
public ModbusTcp modbusTcp = new ModbusTcp(); | |||
public bool IsConnected => modbusTcp.Connected; | |||
#endregion | |||
public void Init(string DeviceName) | |||
{ | |||
this.DeviceName = DeviceName; | |||
if (modbusTcp.Connected) | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
//获取设备运行状态 | |||
var res = this.modbusTcp.Read(DeviceAddress.RunStatus); | |||
if (res != null && res is ushort[] ushortValue) | |||
{ | |||
if (ushortValue.Length >= 1) deviceStatus.RunStatus = ushortValue[0]; | |||
} | |||
//获取设备料仓剩余重量 | |||
deviceStatus.WeightFeedback = this.modbusTcp.GetUint(DeviceAddress.WeightFeedback) * 10; | |||
Thread.Sleep(100); | |||
}), $"{DeviceName} 开始监听", true); | |||
} | |||
} | |||
public void SetDeviceName(string name) | |||
{ | |||
this.modbusTcp.Write(DeviceAddress.DeviceName, new ushort[20]); | |||
this.modbusTcp.SetString(DeviceAddress.DeviceName, name); | |||
} | |||
public void StatusReset() | |||
{ | |||
this.modbusTcp.Write(DeviceAddress.RunStatus, (ushort)0); | |||
} | |||
public void Dispose() | |||
{ | |||
ThreadManage.GetInstance().StopTask($"{DeviceName} 开始监听"); | |||
} | |||
public void Start(uint Value) | |||
{ | |||
if (modbusTcp.Connected) | |||
{ | |||
modbusTcp.SetUint(DeviceAddress.WeightSet, Value);//写入配方量 | |||
modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入 | |||
} | |||
} | |||
} | |||
} |
@@ -1,15 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Collections.ObjectModel; | |||
using BPASmartClient.DosingSystem.ViewModel; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class LocaPar | |||
{ | |||
public ObservableCollection<RecipeModel> Recipes { get; set; } = new ObservableCollection<RecipeModel>(); | |||
} | |||
} |
@@ -1,45 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class RawMaterialDeviceStatus | |||
{ | |||
/// <summary> | |||
/// 原料类型 | |||
/// 1:液体 | |||
/// 2:膏体 | |||
/// 3:粉体 | |||
/// </summary> | |||
public ushort RawMaterialType { get; set; } | |||
/// <summary> | |||
/// 料仓重量反馈 | |||
/// </summary> | |||
public float WeightFeedback { get; set; } | |||
/// <summary> | |||
/// 上限反馈 | |||
/// </summary> | |||
public bool UpLimitFeedback { get; set; } | |||
/// <summary> | |||
/// 下限反馈 | |||
/// </summary> | |||
public bool DownLimitFeedback { get; set; } | |||
/// <summary> | |||
/// 下料重量反馈 | |||
/// </summary> | |||
public float CutWeightFeedback { get; set; } | |||
/// <summary> | |||
/// 设备运行状态 | |||
/// </summary> | |||
public ushort RunStatus { get; set; } | |||
} | |||
} |
@@ -1,88 +0,0 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
/// <summary> | |||
/// 原料模块 | |||
/// </summary> | |||
public class RawMaterialModel : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 原料名称 | |||
/// </summary> | |||
public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } } | |||
private string _mRawMaterialName; | |||
/// <summary> | |||
/// 原料设备IP | |||
/// </summary> | |||
public string DeviceIp { get; set; } | |||
/// <summary> | |||
/// 原料重量设置 | |||
/// </summary> | |||
public uint RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } } | |||
private uint _mRawMaterialWeight; | |||
/// <summary> | |||
/// 原料类型 MW18 | |||
/// 1:液体 | |||
/// 2:膏体 | |||
/// 3:粉体 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public ushort RawMaterialType { get { return _mRawMaterialType; } set { _mRawMaterialType = value; OnPropertyChanged(); } } | |||
private ushort _mRawMaterialType; | |||
/// <summary> | |||
/// 料仓重量反馈 MD40 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public float WeightFeedback { get { return _mWeightFeedback; } set { _mWeightFeedback = value; OnPropertyChanged(); } } | |||
private float _mWeightFeedback; | |||
/// <summary> | |||
/// 上限反馈 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public bool UpLimtFeedback { get { return _mUpLimtFeedback; } set { _mUpLimtFeedback = value; OnPropertyChanged(); } } | |||
private bool _mUpLimtFeedback; | |||
/// <summary> | |||
/// 下限反馈 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public bool DownLimtFeedback { get { return _mDownLimtFeedback; } set { _mDownLimtFeedback = value; OnPropertyChanged(); } } | |||
private bool _mDownLimtFeedback; | |||
/// <summary> | |||
/// 下料重量反馈 MD52 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public float UpLimtWeightFeedback { get { return _mUpLimtWeightFeedback; } set { _mUpLimtWeightFeedback = value; OnPropertyChanged(); } } | |||
private float _mUpLimtWeightFeedback; | |||
/// <summary> | |||
/// 原料ID | |||
/// </summary> | |||
public string RawMaterialId { get { return _mRawMaterialId; } set { _mRawMaterialId = value; OnPropertyChanged(); } } | |||
private string _mRawMaterialId; | |||
/// <summary> | |||
/// 原料设备执行状态 | |||
/// 1:空闲状态 | |||
/// 2:下料中 | |||
/// 3:下料完成 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public ushort RecipeStatus { get { return _mRecipeStatus; } set { _mRecipeStatus = value; OnPropertyChanged(); } } | |||
private ushort _mRecipeStatus = 1; | |||
} | |||
} |
@@ -1,51 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.DosingSystem.ViewModel; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
/// <summary> | |||
/// 配方模块 | |||
/// </summary> | |||
public class RecipeModel : ObservableObject | |||
{ | |||
[Newtonsoft.Json.JsonIgnore] | |||
public bool IsEnable { get { return _mIsEnable; } set { _mIsEnable = value; OnPropertyChanged(); } } | |||
private bool _mIsEnable = true; | |||
/// <summary> | |||
/// 序号 | |||
/// </summary> | |||
public int SerialNum { get { return _mSerialNum; } set { _mSerialNum = value; OnPropertyChanged(); } } | |||
private int _mSerialNum; | |||
/// <summary> | |||
/// 配方名称 | |||
/// </summary> | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } | |||
private string _mRecipeName; | |||
/// <summary> | |||
/// 配方编码 | |||
/// </summary> | |||
public string RecipCode { get { return _mRecipCode; } set { _mRecipCode = value; OnPropertyChanged(); } } | |||
private string _mRecipCode; | |||
[Newtonsoft.Json.JsonIgnore] | |||
public AutoResetEvent Are { get; set; } = new AutoResetEvent(false); | |||
/// <summary> | |||
/// 原料集合 | |||
/// </summary> | |||
public ObservableCollection<RawMaterialModel> RawMaterials { get; set; } = new ObservableCollection<RawMaterialModel>(); | |||
} | |||
} |
@@ -1,380 +0,0 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.DosingSystem.View.AlarmRecordView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:AlarmRecordViewModel /> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary> | |||
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" /> | |||
<convert:IsEnableConvert x:Key="isEnableConvert" /> | |||
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" /> | |||
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" /> | |||
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />--> | |||
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" /> | |||
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" /> | |||
<SolidColorBrush x:Key="CursorColor" Color="Aqua" /> | |||
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" /> | |||
<Style x:Key="TextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="TextBoxStyle" TargetType="TextBox"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="22" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" /> | |||
<Setter Property="BorderBrush" Value="#FF23CACA" /> | |||
<Setter Property="CaretBrush" Value="Aqua" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="DataTextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="Foreground" Value="Red" /> | |||
<Setter Property="FontSize" Value="14" /> | |||
</Style> | |||
<ControlTemplate x:Key="ButTemplate" TargetType="Button"> | |||
<Border | |||
x:Name="br" | |||
Background="Transparent" | |||
BorderBrush="#FF19B7EC" | |||
BorderThickness="2"> | |||
<StackPanel | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<ContentControl | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
Foreground="{TemplateBinding Foreground}" /> | |||
</StackPanel> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="br" Property="Background" Value="#2219B7EC" /> | |||
</Trigger> | |||
<Trigger Property="IsPressed" Value="true"> | |||
<Setter TargetName="br" Property="Background" Value="#2219B7EC" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50" /> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel | |||
Margin="0,8" | |||
HorizontalAlignment="Right" | |||
Orientation="Horizontal"> | |||
<DatePicker | |||
Background="Transparent" | |||
BorderBrush="#aa3aa7f3" | |||
BorderThickness="2" | |||
SelectedDate="{Binding StartDateTime}" | |||
Style="{StaticResource PickerStyle}" | |||
Text="请输入开始时间" | |||
Visibility="{Binding IsVisibility}" /> | |||
<DatePicker | |||
Margin="20,0,20,0" | |||
Background="Transparent" | |||
BorderBrush="#aa3aa7f3" | |||
BorderThickness="2" | |||
SelectedDate="{Binding EndDateTime}" | |||
Style="{StaticResource PickerStyle}" | |||
Text="请输入结束时间" | |||
Visibility="{Binding IsVisibility}" /> | |||
<Button | |||
Width="140" | |||
Height="30" | |||
Background="#FF19B7EC" | |||
Command="{Binding ControlCommand}" | |||
Content="{Binding ControlButText}" | |||
FontFamily="楷体" | |||
FontSize="18" | |||
Template="{StaticResource ButTemplate}"> | |||
<Button.Foreground> | |||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> | |||
<GradientStop Color="#FFBB662A" /> | |||
<GradientStop Offset="1" Color="White" /> | |||
</LinearGradientBrush> | |||
</Button.Foreground> | |||
</Button> | |||
<Button | |||
Width="140" | |||
Height="30" | |||
Margin="20,0,0,0" | |||
Background="#FF19B7EC" | |||
Command="{Binding SwitchCommand}" | |||
Content="{Binding ButContent}" | |||
FontFamily="楷体" | |||
FontSize="18" | |||
Template="{StaticResource ButTemplate}"> | |||
<Button.Foreground> | |||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> | |||
<GradientStop Color="#FFBB662A" /> | |||
<GradientStop Offset="1" Color="White" /> | |||
</LinearGradientBrush> | |||
</Button.Foreground> | |||
</Button> | |||
</StackPanel> | |||
<!--#region 表格标题栏设置--> | |||
<Grid Grid.Row="1" Background="#dd2AB2E7"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="ID" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警日期" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警时间" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警信息" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警值" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警等级" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 表格数据显示--> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<Grid> | |||
<!--#region 实时报警信息--> | |||
<ItemsControl ItemsSource="{Binding AlarmInfos}" Visibility="{Binding CurrentDataVis}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding NumId}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Date}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Time}" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Left" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Info}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Value}" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="6" | |||
BorderBrush="{StaticResource BorderSolid}" | |||
BorderThickness="1" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<!--#endregion--> | |||
<!--#region 历史报警信息--> | |||
<ItemsControl ItemsSource="{Binding HistoryAlarm}" Visibility="{Binding HistoryDataVis}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Id}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Date}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Time}" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Left" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Info}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Value}" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="6" | |||
BorderBrush="{StaticResource BorderSolid}" | |||
BorderThickness="1" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<!--#endregion--> | |||
</Grid> | |||
</ScrollViewer> | |||
<!--#endregion--> | |||
</Grid> | |||
</UserControl> |
@@ -1,122 +0,0 @@ | |||
<Window | |||
x:Class="BPASmartClient.DosingSystem.View.ChangeDeviceNameView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
Title="ChangeDeviceNameView" | |||
Width="400" | |||
Height="200" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:ChangeDeviceNameViewModel /> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" /> | |||
<ResourceDictionary> | |||
<!--#region ListBox样式--> | |||
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}"> | |||
<Setter Property="OverridesDefaultStyle" Value="True" /> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="BorderBrush" Value="{x:Null}" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
<Setter Property="FontSize" Value="20" /> | |||
<Setter Property="HorizontalContentAlignment" Value="Center" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ListBoxItem}"> | |||
<Border x:Name="border" CornerRadius="8"> | |||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Border | |||
Name="br" | |||
Background="#FF0B2F5F" | |||
BorderThickness="1"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition Height="0.5*" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="请输入新设备名称:" /> | |||
<TextBox | |||
Grid.Column="1" | |||
Width="200" | |||
Height="30" | |||
Margin="0,0,7,0" | |||
FontSize="16" | |||
Text="{Binding DeviceName}" /> | |||
</StackPanel> | |||
<TextBlock | |||
Grid.Row="1" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="16" | |||
Foreground="Red" | |||
Text="{Binding ErrorInfo}" /> | |||
<Grid Grid.Row="2"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Button | |||
Grid.Column="1" | |||
Width="148" | |||
Height="30" | |||
Margin="0,0,7,0" | |||
Command="{Binding ConfirmCommand}" | |||
Content="确认" /> | |||
<Button | |||
Name="btClose" | |||
Width="148" | |||
Height="30" | |||
Command="{Binding CancleCommand}" | |||
Content="取消" /> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -1,31 +0,0 @@ | |||
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.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// ChangeDeviceNameView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class ChangeDeviceNameView : Window | |||
{ | |||
public ChangeDeviceNameView() | |||
{ | |||
InitializeComponent(); | |||
ActionManage.GetInstance.CancelRegister("ChangeDeviceNameViewClose"); | |||
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "ChangeDeviceNameViewClose"); | |||
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||
} | |||
} | |||
} |
@@ -1,143 +0,0 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.DosingSystem.View.DeviceListView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:DeviceListViewModel /> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<Style x:Key="UserItemContainerStyle" TargetType="ListBoxItem"> | |||
<Style.Resources> | |||
<!-- SelectedItem with focus --> | |||
<SolidColorBrush | |||
x:Key="{x:Static SystemColors.HighlightBrushKey}" | |||
Opacity=".4" | |||
Color="White" /> | |||
<!-- SelectedItem without focus --> | |||
<SolidColorBrush | |||
x:Key="{x:Static SystemColors.ControlBrushKey}" | |||
Opacity=".4" | |||
Color="White" /> | |||
</Style.Resources> | |||
<!-- 设置触发器 --> | |||
<Style.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter Property="Background" Value="White" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
</Trigger> | |||
<Trigger Property="IsFocused" Value="true"> | |||
<Setter Property="Background" Value="White" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid> | |||
<Grid> | |||
<ListView | |||
Grid.Column="1" | |||
Margin="10" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding devices}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="4" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Border | |||
Name="ShadowElement" | |||
Height="150" | |||
VerticalAlignment="Top" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="2" | |||
ClipToBounds="True" | |||
CornerRadius="8"> | |||
<Border.Effect> | |||
<DropShadowEffect | |||
BlurRadius="18" | |||
ShadowDepth="0" | |||
Color="#00BEFA" /> | |||
</Border.Effect> | |||
<Grid Margin="20,0,20,0"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Row="0" | |||
Grid.ColumnSpan="2" | |||
VerticalAlignment="Bottom" | |||
FontSize="40" | |||
Foreground="#00BEFA" | |||
Text="{Binding DeviceName}" /> | |||
<StackPanel | |||
Grid.Row="1" | |||
Grid.ColumnSpan="2" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
Grid.Row="1" | |||
FontSize="14" | |||
Foreground="Aqua" | |||
Text="设备IP:" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
FontSize="14" | |||
Foreground="Aqua" | |||
Text="{Binding IpAddress}" /> | |||
</StackPanel> | |||
<Button | |||
Grid.Row="1" | |||
Grid.Column="0" | |||
Grid.ColumnSpan="2" | |||
Width="130" | |||
Height="30" | |||
Margin="0,0,0,10" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Bottom" | |||
Command="{Binding DataContext.ChangeNameCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding IpAddress}" | |||
Content="修改设备名称" | |||
IsEnabled="{Binding IsEnable}" /> | |||
</Grid> | |||
</Border> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -1,27 +0,0 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.DosingSystem.View.HardwareStatusView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:HardwareStatusViewModel /> | |||
</UserControl.DataContext> | |||
<Grid> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="40" | |||
Foreground="Wheat" | |||
Text="硬件状态" /> | |||
</Grid> | |||
</UserControl> |
@@ -1,28 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// HardwareStatusView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class HardwareStatusView : UserControl | |||
{ | |||
public HardwareStatusView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -1,251 +0,0 @@ | |||
<Window | |||
x:Class="BPASmartClient.DosingSystem.View.MainWindow" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
Title="MainWindow" | |||
Width="1300" | |||
Height="800" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="False" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" /> | |||
<ResourceDictionary> | |||
<!--#region ListBox样式--> | |||
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}"> | |||
<Setter Property="OverridesDefaultStyle" Value="True" /> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="BorderBrush" Value="{x:Null}" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
<Setter Property="FontSize" Value="20" /> | |||
<Setter Property="HorizontalContentAlignment" Value="Center" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ListBoxItem}"> | |||
<Border x:Name="border" CornerRadius="8"> | |||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Window.DataContext> | |||
<vm:MainViewModel /> | |||
</Window.DataContext> | |||
<Border x:Name="br" Style="{DynamicResource border主窗体背景}"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="60" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<!-- 标题 --> | |||
<Grid Grid.Row="0"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="300" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Border | |||
Grid.ColumnSpan="2" | |||
Height="52" | |||
VerticalAlignment="Top" | |||
Style="{DynamicResource bordertop矩形}" /> | |||
<Border Style="{DynamicResource bordertopL}" /> | |||
<Image | |||
Margin="20,0,0,0" | |||
VerticalAlignment="Center" | |||
Style="{DynamicResource imagetop_Title}" /> | |||
<Grid Grid.Column="1"> | |||
<ListBox | |||
x:Name="lstEnt" | |||
Background="{x:Null}" | |||
BorderBrush="{x:Null}" | |||
BorderThickness="0" | |||
ItemContainerStyle="{StaticResource ResourceKey=ListBoxItemStyle1}" | |||
ItemsSource="{Binding Menus}"> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<StackPanel Orientation="Horizontal" /> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton | |||
Command="{Binding DataContext.TogglePag, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" | |||
CommandParameter="{Binding CommandParameter}" | |||
Content="{Binding MenuName}" | |||
GroupName="all" | |||
Style="{StaticResource MenuRadioButtonStyle}" /> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</Grid> | |||
<StackPanel | |||
Grid.Column="4" | |||
Height="50" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Top" | |||
Orientation="Horizontal"> | |||
<Border Style="{DynamicResource border竖线}" /> | |||
<Grid> | |||
<ToggleButton | |||
Name="tb" | |||
Margin="5" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Cursor="Hand" | |||
IsChecked="{Binding UserManagement}" | |||
Style="{DynamicResource StatusBtnStyle网络连接状态}" | |||
ToolTip="用户管理" /> | |||
<!-- 当 StaysOpen 设置为 True 时 popup失去焦点的时候不会自动关闭 --> | |||
<Popup | |||
AllowsTransparency="True" | |||
Focusable="False" | |||
IsOpen="{Binding IsChecked, ElementName=tb}" | |||
Placement="Bottom" | |||
PlacementTarget="{Binding ElementName=tb}" | |||
StaysOpen="False"> | |||
<Border Background="#081424" ClipToBounds="True"> | |||
<Grid Width="100" Margin="0"> | |||
<StackPanel Width="{Binding RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Grid}, Path=ActualWidth}"> | |||
<Button | |||
Width="{Binding RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Grid}, Path=ActualWidth}" | |||
Margin="0,5,0,1" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Command="{Binding PasswordChange}" | |||
Content="密码修改" | |||
Cursor="Hand" /> | |||
<Button | |||
Width="{Binding RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Grid}, Path=ActualWidth}" | |||
Margin="0,5,0,1" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Command="{Binding Login}" | |||
Content="登录账号" | |||
Cursor="Hand" /> | |||
<Button | |||
Width="{Binding RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Grid}, Path=ActualWidth}" | |||
Margin="0,5,0,1" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Command="{Binding ExitLogin}" | |||
Content="退出登录" | |||
Cursor="Hand" /> | |||
</StackPanel> | |||
</Grid> | |||
</Border> | |||
</Popup> | |||
</Grid> | |||
<Border Style="{DynamicResource border竖线}" /> | |||
<ToggleButton | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Cursor="Hand" | |||
DataContext="{Binding IsAlarm}" | |||
Style="{DynamicResource StatusBtnStyle告警}" | |||
ToolTip="告警消息" /> | |||
<Border Style="{DynamicResource border竖线}" /> | |||
<control:DateTimeUI Margin="10,0,10,0" VerticalAlignment="Center" /> | |||
<Border Style="{DynamicResource border竖线}" /> | |||
<Button | |||
x:Name="ButClose" | |||
Grid.Column="4" | |||
Margin="10,0,20,0" | |||
VerticalAlignment="Center" | |||
Content="退出" | |||
Cursor="Hand" | |||
Style="{DynamicResource CommonBtn_返回}" | |||
ToolTip="退出程序" /> | |||
</StackPanel> | |||
</Grid> | |||
<!-- 底部窗体 --> | |||
<Grid Grid.Row="1" Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="45" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<!-- 顶部装饰 --> | |||
<Border | |||
Grid.Row="0" | |||
Grid.RowSpan="2" | |||
Style="{DynamicResource border右下}" /> | |||
<Border | |||
Grid.Row="0" | |||
Grid.RowSpan="2" | |||
Style="{DynamicResource border左下}" /> | |||
<Border | |||
Grid.Row="0" | |||
Grid.RowSpan="2" | |||
Style="{DynamicResource border右上}" /> | |||
<Border | |||
Grid.Row="0" | |||
Grid.RowSpan="2" | |||
Style="{DynamicResource border左上}" /> | |||
<Grid Margin="10"> | |||
<Border Width="600" Style="{DynamicResource borderFromTitle}" /> | |||
<StackPanel Orientation="Horizontal"> | |||
<CheckBox | |||
Margin="5,0,5,0" | |||
Content="开机启动" | |||
IsChecked="{Binding AutoStart}" /> | |||
</StackPanel> | |||
<TextBlock | |||
x:Name="Title" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="16" | |||
Foreground="#feffff" | |||
Text="{Binding WindowTitleName}" /> | |||
</Grid> | |||
<!--#region 底部窗体栏--> | |||
<ContentControl | |||
x:Name="contentRegion" | |||
Grid.Row="1" | |||
Content="{Binding MyWindow}" /> | |||
<!--#endregion--> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -1,48 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// Interaction logic for MainWindow.xaml | |||
/// </summary> | |||
public partial class MainWindow : Window | |||
{ | |||
public MainWindow() | |||
{ | |||
InitializeComponent(); | |||
this.ButClose.Click += (o, e) => { this.Close(); }; | |||
this.MaxWidth = SystemParameters.WorkArea.Width; | |||
this.MaxHeight = SystemParameters.WorkArea.Height; | |||
this.br.MouseLeftButtonDown += (o, e) => | |||
{ | |||
if (e.ClickCount > 1) | |||
{ | |||
if (this.WindowState == WindowState.Maximized) | |||
this.WindowState = WindowState.Normal; | |||
else if (this.WindowState == WindowState.Normal) | |||
this.WindowState = WindowState.Maximized; | |||
} | |||
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); | |||
}; | |||
} | |||
} | |||
} |
@@ -1,222 +0,0 @@ | |||
<Window | |||
x:Class="BPASmartClient.DosingSystem.View.NewRecipeView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
Title="NewRecipeView" | |||
Width="550" | |||
Height="450" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:NewRecipeViewModel /> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" /> | |||
<ResourceDictionary> | |||
<!--#region ListBox样式--> | |||
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}"> | |||
<Setter Property="OverridesDefaultStyle" Value="True" /> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="BorderBrush" Value="{x:Null}" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
<Setter Property="FontSize" Value="20" /> | |||
<Setter Property="HorizontalContentAlignment" Value="Center" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ListBoxItem}"> | |||
<Border x:Name="border" CornerRadius="8"> | |||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Border Name="br" BorderThickness="1"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" /> | |||
</Border.Background> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="5" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<!--<Button | |||
Name="btClose" | |||
Margin="0,0,5,0" | |||
Padding="10,5" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
Content="X" | |||
FontSize="18" | |||
Foreground="White" /> | |||
<Border BorderBrush="#88DDDDDD" BorderThickness="0,0,0,1" />--> | |||
<Grid Grid.Row="1"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="请输入配方名称:" /> | |||
<TextBlock | |||
Margin="0,0,10,0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="16" | |||
Foreground="Red" | |||
Text="{Binding ErrorInfo}" /> | |||
<StackPanel | |||
Grid.Row="1" | |||
Margin="10,0,0,0" | |||
Orientation="Horizontal"> | |||
<TextBox | |||
Grid.Column="1" | |||
Width="200" | |||
Height="30" | |||
Margin="0,0,7,0" | |||
FontSize="16" | |||
Text="{Binding RecipeName}" /> | |||
<Button | |||
Width="148" | |||
Height="30" | |||
Margin="0,0,7,0" | |||
Command="{Binding AddCommand}" | |||
Content="添加原料" Cursor="Hand" /> | |||
<Button | |||
Width="80" | |||
Height="30" | |||
Command="{Binding SaveCommand}" | |||
Content="确认" /> | |||
<Button | |||
Name="btClose" | |||
Width="80" | |||
Height="30" | |||
Margin="7,0,0,0" | |||
Content="取消" /> | |||
</StackPanel> | |||
<ScrollViewer Grid.Row="2" Margin="5"> | |||
<ItemsControl ItemsSource="{Binding RawMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton GroupName="all"> | |||
<RadioButton.Template> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Grid Name="gr" Height="40"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<ComboBox | |||
Name="cb" | |||
Grid.Column="0" | |||
Margin="3,1" | |||
VerticalAlignment="Center" | |||
BorderBrush="#FF074B92" | |||
BorderThickness="1" | |||
FontFamily="楷体" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
IsEditable="False" | |||
ItemsSource="{Binding DataContext.RawMaterialNames, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
SelectedIndex="0" | |||
Style="{StaticResource ComboBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<!--<TextBox | |||
Name="cb" | |||
Grid.Column="0" | |||
Margin="3,1" | |||
VerticalAlignment="Center" | |||
BorderBrush="#FF074B92" | |||
BorderThickness="1" | |||
FontFamily="楷体" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RawMaterialName}" />--> | |||
<StackPanel | |||
Grid.Column="1" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBox | |||
Name="tb" | |||
Grid.Column="1" | |||
Width="150" | |||
Height="29" | |||
Margin="3,1" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Text="{Binding RawMaterialWeight}" /> | |||
<TextBlock | |||
Grid.Column="1" | |||
Margin="0,0,8,4" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Text="mg" /> | |||
</StackPanel> | |||
<Button | |||
Grid.Column="2" | |||
Margin="10,0,10,0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RawMaterialId}" | |||
Content="删除" /> | |||
</Grid> | |||
</ControlTemplate> | |||
</RadioButton.Template> | |||
</RadioButton> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -1,32 +0,0 @@ | |||
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.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// NewRecipeView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class NewRecipeView : Window | |||
{ | |||
public NewRecipeView() | |||
{ | |||
InitializeComponent(); | |||
this.btClose.Click += (o, e) => { this.Close(); }; | |||
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||
ActionManage.GetInstance.CancelRegister("CloseNewRecipeView"); | |||
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseNewRecipeView"); | |||
} | |||
} | |||
} |
@@ -1,188 +0,0 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.DosingSystem.View.RecipeControlView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:RecipeControlViewModel /> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<Style x:Key="UserItemContainerStyle" TargetType="ListBoxItem"> | |||
<Style.Resources> | |||
<!-- SelectedItem with focus --> | |||
<SolidColorBrush | |||
x:Key="{x:Static SystemColors.HighlightBrushKey}" | |||
Opacity=".4" | |||
Color="White" /> | |||
<!-- SelectedItem without focus --> | |||
<SolidColorBrush | |||
x:Key="{x:Static SystemColors.ControlBrushKey}" | |||
Opacity=".4" | |||
Color="White" /> | |||
</Style.Resources> | |||
<!-- 设置触发器 --> | |||
<Style.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter Property="Background" Value="White" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
</Trigger> | |||
<Trigger Property="IsFocused" Value="true"> | |||
<Setter Property="Background" Value="White" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid> | |||
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding Recipes}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="150" VerticalAlignment="Top"> | |||
<Border | |||
Name="ShadowElement" | |||
Height="150" | |||
VerticalAlignment="Top" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="2" | |||
ClipToBounds="True" | |||
CornerRadius="8"> | |||
<Border.Effect> | |||
<DropShadowEffect | |||
BlurRadius="18" | |||
ShadowDepth="0" | |||
Color="#00BEFA" /> | |||
</Border.Effect> | |||
</Border> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="auto" /> | |||
</Grid.ColumnDefinitions> | |||
<Grid Margin="20,0,0,0"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
FontSize="40" | |||
Foreground="White" | |||
Text="{Binding RecipeName}" /> | |||
<Button | |||
Grid.Row="1" | |||
Width="80" | |||
Height="30" | |||
HorizontalAlignment="Left" | |||
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeName}" | |||
Content="配方下发" | |||
IsEnabled="{Binding IsEnable}" /> | |||
</Grid> | |||
<ListView | |||
Grid.Column="1" | |||
Margin="10" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="2,0,2,0" | |||
ItemsSource="{Binding RawMaterials}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="4" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<StackPanel | |||
Grid.Column="1" | |||
Height="20" | |||
Margin="20,0,0,0" | |||
VerticalAlignment="Top" | |||
Orientation="Horizontal"> | |||
<Ellipse | |||
Width="{Binding ElementName=n, Path=ActualHeight}" | |||
Margin="0,0,5,0" | |||
Fill="{Binding RecipeStatus, Converter={StaticResource StatusConverter}}" /> | |||
<TextBlock | |||
Name="n" | |||
FontSize="16" | |||
Foreground="White" | |||
Text="{Binding RawMaterialName}" /> | |||
</StackPanel> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
<StackPanel | |||
Grid.Column="2" | |||
Margin="5,0" | |||
VerticalAlignment="Center"> | |||
<StackPanel Margin="0,0,0,5" Orientation="Horizontal"> | |||
<Ellipse | |||
Width="{Binding ElementName=tb, Path=ActualHeight}" | |||
Margin="0,0,5,0" | |||
Fill="Green" /> | |||
<TextBlock | |||
Name="tb" | |||
Foreground="#ddd" | |||
Text="准备就绪" /> | |||
</StackPanel> | |||
<StackPanel Margin="0,0,0,5" Orientation="Horizontal"> | |||
<Ellipse | |||
Width="{Binding ElementName=tb, Path=ActualHeight}" | |||
Margin="0,0,5,0" | |||
Fill="Yellow" /> | |||
<TextBlock | |||
Name="tb1" | |||
Foreground="#ddd" | |||
Text="等待接料" /> | |||
</StackPanel> | |||
<StackPanel Margin="0,0,0,5" Orientation="Horizontal"> | |||
<Ellipse | |||
Width="{Binding ElementName=tb, Path=ActualHeight}" | |||
Margin="0,0,5,0" | |||
Fill="Aqua" /> | |||
<TextBlock | |||
Name="tb2" | |||
Foreground="#ddd" | |||
Text="接料完成" /> | |||
</StackPanel> | |||
<StackPanel Margin="0,0,0,5" Orientation="Horizontal"> | |||
<Ellipse | |||
Width="{Binding ElementName=tb, Path=ActualHeight}" | |||
Margin="0,0,5,0" | |||
Fill="Red" /> | |||
<TextBlock | |||
Name="tb3" | |||
Foreground="#ddd" | |||
Text="设备异常" /> | |||
</StackPanel> | |||
</StackPanel> | |||
</Grid> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</UserControl> |
@@ -1,28 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// RecipeControlView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class RecipeControlView : UserControl | |||
{ | |||
public RecipeControlView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -1,246 +0,0 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.DosingSystem.View.RecipeSettingsView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.Resources> | |||
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" /> | |||
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" /> | |||
<SolidColorBrush x:Key="CursorColor" Color="Aqua" /> | |||
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="TextBlockForeground" Color="#9934F7F7" /> | |||
<Style x:Key="TextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="16" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<!--<Setter Property="Foreground" Value="{StaticResource FontColor}" />--> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="buttonStyle" TargetType="Button"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="FontSize" Value="16" /> | |||
<Setter Property="Foreground" Value="Aqua" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
</Style> | |||
</UserControl.Resources> | |||
<UserControl.DataContext> | |||
<vm:RecipeSettingsViewModel /> | |||
</UserControl.DataContext> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50" /> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<!--#region 操作按钮--> | |||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> | |||
<pry:IcoButton | |||
Grid.Column="3" | |||
Width="140" | |||
Margin="10" | |||
HorizontalAlignment="Left" | |||
Command="{Binding NewRecipe}" | |||
Content="新建配方" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
IcoText="" | |||
Style="{StaticResource NewButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Column="3" | |||
Width="140" | |||
Margin="10" | |||
HorizontalAlignment="Left" | |||
Command="{Binding SaveRecipe}" | |||
Content="保存配方" | |||
EnableColor="#FFB7B7B7" | |||
FontSize="17" | |||
Foreground="Aqua" | |||
IcoText="" | |||
IsEnabled="True" | |||
Style="{StaticResource NewButtonStyle}" /> | |||
</StackPanel> | |||
<!--#endregion--> | |||
<!--#region 表格标题栏设置--> | |||
<!--<Grid Grid.Row="1" Background="#dd2AB2E7"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="序号" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="配方名称" /> | |||
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="编码" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="结束时间" /> | |||
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<Grid Grid.Column="5"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="制作状态" /> | |||
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="0,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="6" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="完成时间" /> | |||
</Grid>--> | |||
<!--#endregion--> | |||
<!--#region 表格数据显示--> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding Recipes}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton Background="Transparent" GroupName="all"> | |||
<RadioButton.Template> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Grid Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Foreground="#ff00ccff" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="{Binding SerialNum}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
Foreground="#ff00ccff" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="{Binding RecipeName}" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Foreground="#ff00ccff" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="{Binding RecipCode}" /> | |||
<!--<Grid Grid.Column="3"> | |||
<Button | |||
Command="{Binding DataContext.EditCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="编辑" | |||
Style="{StaticResource buttonStyle}" /> | |||
</Grid>--> | |||
<Grid Grid.Column="5"> | |||
<Button | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="详情" | |||
Style="{StaticResource buttonStyle}" /> | |||
</Grid> | |||
<Grid Grid.Column="6"> | |||
<Button | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="删除" | |||
Style="{StaticResource buttonStyle}" /> | |||
</Grid> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter TargetName="gr" Property="Background" Value="#3300ccff" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#3300ccff" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</RadioButton.Template> | |||
</RadioButton> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
<!--#endregion--> | |||
</Grid> | |||
</UserControl> |
@@ -1,28 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// RecipeSettingsView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class RecipeSettingsView : UserControl | |||
{ | |||
public RecipeSettingsView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -1,18 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.Concurrent; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class AlarmRecordViewModel : ObservableObject | |||
{ | |||
} | |||
} |
@@ -1,71 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.DosingSystem.Model; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class ChangeDeviceNameViewModel : ObservableObject | |||
{ | |||
public ChangeDeviceNameViewModel() | |||
{ | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (o != null && o is string str) IpAddress = str; | |||
}), "ChangeDeviceNameViewOpen"); | |||
CancleCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); }); | |||
ConfirmCommand = new RelayCommand(() => | |||
{ | |||
if (string.IsNullOrEmpty(DeviceName)) | |||
{ | |||
ErrorInfo = "设备名称不能为空"; | |||
return; | |||
} | |||
int index = Array.FindIndex(DeviceListViewModel.devices.ToArray(), p => p.IpAddress == IpAddress); | |||
if (index >= 0 && index < DeviceListViewModel.devices.Count) | |||
{ | |||
if (DeviceListViewModel.devices.FirstOrDefault(p => p.DeviceName == DeviceName) != null) | |||
ErrorInfo = "设备名称已存在"; | |||
else | |||
{ | |||
NewRecipeViewModel.RawMaterialNames.Remove(DeviceListViewModel.devices.ElementAt(index).DeviceName); | |||
NewRecipeViewModel.RawMaterialNames.Add(DeviceName); | |||
DeviceListViewModel.devices.ElementAt(index).DeviceName = DeviceName; | |||
DeviceInquire.GetInstance.GetDevice(IpAddress).SetDeviceName(DeviceName);//设置PLC名称 | |||
for (int i = 0; i < Json<LocaPar>.Data.Recipes.Count; i++) | |||
{ | |||
for (int m = 0; m < Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.Count; m++) | |||
{ | |||
Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName; | |||
} | |||
} | |||
ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); | |||
} | |||
} | |||
}); | |||
} | |||
private static string IpAddress = string.Empty; | |||
public RelayCommand ConfirmCommand { get; set; } | |||
public RelayCommand CancleCommand { get; set; } | |||
public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | |||
private string _mErrorInfo; | |||
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } } | |||
private string _mDeviceName; | |||
} | |||
} |
@@ -1,45 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.Concurrent; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.DosingSystem.View; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class DeviceListViewModel : ObservableObject | |||
{ | |||
public DeviceListViewModel() | |||
{ | |||
ChangeNameCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (o != null && o is string str) | |||
{ | |||
ChangeDeviceNameView cdn = new ChangeDeviceNameView(); | |||
ActionManage.GetInstance.Send("ChangeDeviceNameViewOpen", str); | |||
cdn.ShowDialog(); | |||
} | |||
}); | |||
} | |||
public RelayCommand<object> ChangeNameCommand { get; set; } | |||
public static ObservableCollection<Devices> devices { get; set; } = new ObservableCollection<Devices>(); | |||
} | |||
public class Devices : ObservableObject | |||
{ | |||
public string IpAddress { get { return _mIpAddress; } set { _mIpAddress = value; OnPropertyChanged(); } } | |||
private string _mIpAddress; | |||
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } } | |||
private string _mDeviceName; | |||
} | |||
} |
@@ -1,18 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.Concurrent; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class HardwareStatusViewModel : ObservableObject | |||
{ | |||
} | |||
} |
@@ -1,161 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.Concurrent; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.DosingSystem.Model; | |||
using Newtonsoft.Json; | |||
using System.IO; | |||
using System.Reflection; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class MainViewModel : ObservableObject | |||
{ | |||
//ObservableCollection<ActionMenu> menus = new ObservableCollection<ActionMenu>(); | |||
//private Permission _permission; | |||
//public Permission permission | |||
//{ | |||
// get { return _permission; } | |||
// set | |||
// { | |||
// var res = menus.Where(p => Array.FindIndex(p.permission, s => s == value) >= 0).ToList(); | |||
// if (res != null && res.Count > 0) | |||
// { | |||
// Menus.Clear(); | |||
// res.ForEach((item) => { Menus.Add(item); }); | |||
// } | |||
// _permission = value; | |||
// } | |||
//} | |||
public MainViewModel() | |||
{ | |||
//Json<LocaPar>.Read(); | |||
TogglePag = new RelayCommand<object>(DoNavChanged); | |||
Login = new RelayCommand(() => { DoNavChanged("BPASmartClient.DosingSystem.View.AdminstratorsView_用户登录"); UserManagement = false; }); | |||
PasswordChange = new RelayCommand(() => | |||
{ | |||
//DoNavChanged("PasswordChangeView.密码修改"); | |||
UserManagement = false; | |||
}); | |||
ExitLogin = new RelayCommand(() => | |||
{ | |||
//SystemUtils.ShowScreenKeyboard(); | |||
//DoNavChanged("LoginView.退出登录"); | |||
UserManagement = false; | |||
}); | |||
//Config.GetInstance.Init(); | |||
LoginRegister(); | |||
MenuInit(); | |||
//permission = Permission.管理员; | |||
//if (Menus.Count > 0) DoNavChanged(Menus.ElementAt(0).CommandParameter); | |||
DeviceInquire.GetInstance.Init(); | |||
} | |||
private void LoginRegister() | |||
{ | |||
ActionManage.GetInstance.Register(new Func<object, object>((o) => | |||
{ | |||
//if (o != null && o is string str) | |||
//{ | |||
// var strs = str.Split("-="); | |||
// if (strs != null && strs.Length == 3) | |||
// { | |||
// var us = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == strs[0]); | |||
// if (us != null && strs[1] == us.Password && strs[2] == us.permission.ToString()) | |||
// { | |||
// permission = us.permission; | |||
// return string.Empty; | |||
// } | |||
// } | |||
//} | |||
return "用户名或密码错误"; | |||
}), "LoginBPASmartClient.DosingSystem"); | |||
} | |||
private void MenuInit() | |||
{ | |||
//menus.Add(new ActionMenu() | |||
//{ | |||
// MenuName = "配方设置", | |||
// CommandParameter = "BPASmartClient.DosingSystem.View.RecipeSettingsView_配方设置", | |||
// permission = new Permission[] { Permission.管理员, Permission.技术员 }, | |||
//}); | |||
//menus.Add(new ActionMenu() | |||
//{ | |||
// MenuName = "设备列表", | |||
// CommandParameter = "BPASmartClient.DosingSystem.View.DeviceListView_设备列表", | |||
// permission = new Permission[] { Permission.管理员, Permission.技术员 }, | |||
//}); | |||
//menus.Add(new ActionMenu() | |||
//{ | |||
// MenuName = "硬件状态", | |||
// CommandParameter = "BPASmartClient.DosingSystem.View.HardwareStatusView_硬件状态", | |||
// permission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, | |||
//}); | |||
//menus.Add(new ActionMenu() | |||
//{ | |||
// MenuName = "报警记录", | |||
// CommandParameter = "BPASmartClient.CustomResource.Pages.View.AlarmView_报警记录", | |||
// permission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, | |||
//}); | |||
//menus.Add(new ActionMenu() | |||
//{ | |||
// MenuName = "配方下发", | |||
// CommandParameter = "BPASmartClient.DosingSystem.View.RecipeControlView_配方控制", | |||
// permission = new Permission[] { Permission.管理员, Permission.操作员 }, | |||
//}); | |||
} | |||
public void DoNavChanged(object obj) | |||
{ | |||
if (obj != null && obj is string stobj) | |||
{ | |||
var strs = stobj.Split('_'); | |||
if (strs != null && strs.Length == 2) | |||
{ | |||
Type type; | |||
if (!stobj.Contains("BPASmartClient.DosingSystem")) | |||
{ | |||
type = Assembly.Load("BPASmartClient.CustomResource").GetType(strs[0]); | |||
} | |||
else type = Type.GetType(strs[0]); | |||
var res = type?.GetConstructor(System.Type.EmptyTypes)?.Invoke(null); | |||
if (res != null && res is FrameworkElement fe) MyWindow = fe; | |||
WindowTitleName = strs[1]; | |||
} | |||
} | |||
} | |||
public RelayCommand<object> TogglePag { get; set; } | |||
public RelayCommand Login { get; set; } | |||
public RelayCommand PasswordChange { get; set; } | |||
public RelayCommand ExitLogin { get; set; } | |||
public ObservableCollection<ActionMenu> Menus { get; set; } = new ObservableCollection<ActionMenu>(); | |||
public FrameworkElement MyWindow { get { return _mMyWindow; } set { _mMyWindow = value; OnPropertyChanged(); } } | |||
private FrameworkElement _mMyWindow; | |||
public string WindowTitleName { get { return _mWindowTitleName; } set { _mWindowTitleName = value; OnPropertyChanged(); } } | |||
private string _mWindowTitleName; | |||
public bool UserManagement { get { return _mUserManagement; } set { _mUserManagement = value; OnPropertyChanged(); } } | |||
private bool _mUserManagement; | |||
public bool AutoStart { get { return SystemHelper.GetInstance.IsAutoStart(); } set { SystemHelper.GetInstance.AutoStart(value); OnPropertyChanged(); } } | |||
} | |||
} |
@@ -1,131 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.DosingSystem.Model; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class NewRecipeViewModel : ObservableObject | |||
{ | |||
public NewRecipeViewModel() | |||
{ | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (o != null && o is RecipeModel rm) | |||
{ | |||
RecipeName = rm.RecipeName; | |||
foreach (var item in rm.RawMaterials) | |||
{ | |||
RawMaterials.Add(item); | |||
} | |||
RecipCode = rm.RecipCode; | |||
} | |||
}), "Details"); | |||
AddCommand = new RelayCommand(() => | |||
{ | |||
p: | |||
string guid = Guid.NewGuid().ToString(); | |||
if (RawMaterials.FirstOrDefault(p => p.RawMaterialId == guid) == null) | |||
{ | |||
RawMaterials.Add(new RawMaterialModel() | |||
{ | |||
RawMaterialId = guid | |||
}); | |||
} | |||
else goto p; | |||
}); | |||
RemoveCommand = new RelayCommand<object>((obj) => | |||
{ | |||
if (obj is string rm) | |||
{ | |||
var res = RawMaterials.FirstOrDefault(p => p.RawMaterialId == rm); | |||
if (res != null) RawMaterials.Remove(res); | |||
} | |||
}); | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
for (int i = 0; i < RawMaterials.Count; i++) | |||
{ | |||
var res = DeviceListViewModel.devices.FirstOrDefault(p => p.DeviceName == RawMaterials.ElementAt(i).RawMaterialName); | |||
if (res != null) RawMaterials.ElementAt(i).DeviceIp = res.IpAddress; | |||
} | |||
if (RecipCode.Length <= 0) | |||
{ | |||
var res = Array.FindIndex(Json<LocaPar>.Data.Recipes.ToArray(), p => p.RecipeName == RecipeName); | |||
if (res >= 0 && res < Json<LocaPar>.Data.Recipes.Count) | |||
{ | |||
ErrorInfo = "该配方已存在,请重新输入"; | |||
} | |||
else | |||
{ | |||
AddRecipes(); | |||
} | |||
} | |||
else | |||
{ | |||
var res = Array.FindIndex(Json<LocaPar>.Data.Recipes.ToArray(), p => p.RecipCode == RecipCode); | |||
if (res >= 0 && res < Json<LocaPar>.Data.Recipes.Count) | |||
{ | |||
Json<LocaPar>.Data.Recipes.ElementAt(res).RecipeName = RecipeName; | |||
Json<LocaPar>.Data.Recipes.ElementAt(res).RawMaterials.Clear(); | |||
foreach (var item in RawMaterials) | |||
{ | |||
Json<LocaPar>.Data.Recipes.ElementAt(res).RawMaterials.Add(item); | |||
} | |||
} | |||
} | |||
ActionManage.GetInstance.Send("CloseNewRecipeView"); | |||
}); | |||
} | |||
private void AddRecipes() | |||
{ | |||
string date = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"); | |||
var dates = date.Split("-").ToList(); | |||
StringBuilder sb = new StringBuilder(); | |||
dates?.ForEach((item) => { sb.Append(item); }); | |||
Json<LocaPar>.Data.Recipes.Add(new RecipeModel() | |||
{ | |||
SerialNum = Json<LocaPar>.Data.Recipes.Count + 1, | |||
RawMaterials = RawMaterials, | |||
RecipCode = sb.ToString(), | |||
RecipeName = RecipeName, | |||
}); | |||
} | |||
static NewRecipeViewModel() | |||
{ | |||
RawMaterialNames.Clear(); | |||
} | |||
private string RecipCode = string.Empty; | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } | |||
private string _mRecipeName; | |||
public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | |||
private string _mErrorInfo; | |||
public RelayCommand AddCommand { get; set; } | |||
public RelayCommand<object> RemoveCommand { get; set; } | |||
public RelayCommand SaveCommand { get; set; } | |||
public ObservableCollection<RawMaterialModel> RawMaterials { get; set; } = new ObservableCollection<RawMaterialModel>(); | |||
public static ObservableCollection<string> RawMaterialNames { get; set; } = new ObservableCollection<string>(); | |||
} | |||
} |
@@ -1,92 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.Concurrent; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.DosingSystem.Model; | |||
using System.Threading; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class RecipeControlViewModel : ObservableObject | |||
{ | |||
ConcurrentQueue<string> devices = new ConcurrentQueue<string>(); | |||
public RecipeControlViewModel() | |||
{ | |||
Recipes = Json<LocaPar>.Data.Recipes; | |||
StartCommand = new RelayCommand<object>((o) => | |||
{ | |||
//if (o != null && o is string deviceName) | |||
//{ | |||
// int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == deviceName); | |||
// if (index >= 0 && index < Recipes.Count) | |||
// { | |||
// Recipes.ElementAt(index).IsEnable = false; | |||
// } | |||
// MessageLog.GetInstance.ShowUserLog($"下发工单 { Recipes.ElementAt(index).RecipeName}"); | |||
// devices.Enqueue(deviceName); | |||
//} | |||
MessageLog.GetInstance.ShowUserLog($"下发工单 { Guid.NewGuid().ToString()}"); | |||
}); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
if (devices.Count > 0) | |||
{ | |||
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == devices.ElementAt(0)); | |||
if (index >= 0 && index < Recipes.Count) | |||
{ | |||
Recipes.ElementAt(index).Are.Reset(); | |||
Recipes.ElementAt(index).IsEnable = false; | |||
foreach (var item in Recipes.ElementAt(index).RawMaterials) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice(item.DeviceIp)?.Start(item.RawMaterialWeight);//启动写入 | |||
} | |||
Recipes.ElementAt(index).Are.WaitOne(); | |||
devices.TryDequeue(out string deviceName); | |||
} | |||
} | |||
Thread.Sleep(100); | |||
}), "启动配发下发"); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
for (int i = 0; i < Recipes.Count; i++) | |||
{ | |||
for (int m = 0; m < Recipes.ElementAt(i).RawMaterials.Count; m++) | |||
{ | |||
var RunStatus = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp).deviceStatus.RunStatus; | |||
Recipes.ElementAt(i).RawMaterials.ElementAt(m).RecipeStatus = RunStatus; | |||
var res = Recipes.ElementAt(i).RawMaterials.Where(p => p.RecipeStatus == 3).ToList(); | |||
if (res != null && res.Count == Recipes.ElementAt(i).RawMaterials.Count) | |||
{ | |||
for (int r = 0; r < Recipes.ElementAt(i).RawMaterials.Count; r++) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(r).DeviceIp).StatusReset(); | |||
} | |||
Recipes.ElementAt(i).IsEnable = true; | |||
Recipes.ElementAt(i).Are.Set(); | |||
} | |||
} | |||
} | |||
Thread.Sleep(100); | |||
}), "RecipeControlViewModelStatusInquire"); | |||
} | |||
public RelayCommand<object> StartCommand { get; set; } | |||
public ObservableCollection<RecipeModel> Recipes { get; set; } | |||
} | |||
} |
@@ -1,63 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.Concurrent; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.DosingSystem.Model; | |||
using BPASmartClient.DosingSystem.View; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class RecipeSettingsViewModel : ObservableObject | |||
{ | |||
public RecipeSettingsViewModel() | |||
{ | |||
//Json<LocaPar>.Read(); | |||
Recipes = Json<LocaPar>.Data.Recipes; | |||
NewRecipe = new Action(() => | |||
{ | |||
NewRecipeView nrv = new NewRecipeView(); | |||
nrv.ShowDialog(); | |||
}); | |||
SaveRecipe = new Action(() => { Json<LocaPar>.Save(); }); | |||
RemoveCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (o is string str) | |||
{ | |||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipCode == str); | |||
if (res != null) Json<LocaPar>.Data.Recipes.Remove(res); | |||
} | |||
}); | |||
DetailsCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (o != null && o is string str) | |||
{ | |||
ActionManage.GetInstance.CancelRegister("Details"); | |||
NewRecipeView nrv = new NewRecipeView(); | |||
ActionManage.GetInstance.Send("Details", Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipCode == str)); | |||
nrv.ShowDialog(); | |||
} | |||
}); | |||
} | |||
public Action NewRecipe { get; set; } | |||
public Action SaveRecipe { get; set; } | |||
public RelayCommand<object> EditCommand { get; set; } | |||
public RelayCommand<object> DetailsCommand { get; set; } | |||
public RelayCommand<object> RemoveCommand { get; set; } | |||
public ObservableCollection<RecipeModel> Recipes { get; set; } | |||
} | |||
} |
@@ -1,79 +0,0 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> | |||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/> | |||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> | |||
<security> | |||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> | |||
<!-- UAC 清单选项 | |||
如果想要更改 Windows 用户帐户控制级别,请使用 | |||
以下节点之一替换 requestedExecutionLevel 节点。 | |||
<requestedExecutionLevel level="asInvoker" uiAccess="false" /> | |||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> | |||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" /> | |||
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。 | |||
如果你的应用程序需要此虚拟化来实现向后兼容性,则移除此 | |||
元素。 | |||
--> | |||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> | |||
</requestedPrivileges> | |||
</security> | |||
</trustInfo> | |||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> | |||
<application> | |||
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的 | |||
Windows 版本的列表。取消评论适当的元素, | |||
Windows 将自动选择最兼容的环境。 --> | |||
<!-- Windows Vista --> | |||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />--> | |||
<!-- Windows 7 --> | |||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />--> | |||
<!-- Windows 8 --> | |||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />--> | |||
<!-- Windows 8.1 --> | |||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />--> | |||
<!-- Windows 10 --> | |||
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />--> | |||
</application> | |||
</compatibility> | |||
<!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行 | |||
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需 | |||
选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应 | |||
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。 | |||
将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation --> | |||
<!-- | |||
<application xmlns="urn:schemas-microsoft-com:asm.v3"> | |||
<windowsSettings> | |||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware> | |||
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware> | |||
</windowsSettings> | |||
</application> | |||
--> | |||
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) --> | |||
<!-- | |||
<dependency> | |||
<dependentAssembly> | |||
<assemblyIdentity | |||
type="win32" | |||
name="Microsoft.Windows.Common-Controls" | |||
version="6.0.0.0" | |||
processorArchitecture="*" | |||
publicKeyToken="6595b64144ccf1df" | |||
language="*" | |||
/> | |||
</dependentAssembly> | |||
</dependency> | |||
--> | |||
</assembly> |
@@ -176,6 +176,7 @@ namespace BPASmartClient.GSIceCream | |||
private void ProcessHeart(ICMSG_Heart_UP heartUpMsg) | |||
{ | |||
IsConnected = OnLine; | |||
status["IceCreamIsConnected"] = OnLine; | |||
status["IceCreamCurrentMode"] = heartUpMsg.MS; | |||
@@ -184,6 +185,8 @@ namespace BPASmartClient.GSIceCream | |||
status["IceCreamHJWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.HJWD_L, heartUpMsg.HJWD_H }, 0); | |||
status["IceCreamDL"] = BitConverter.ToInt16(new byte[] { heartUpMsg.DL_L, heartUpMsg.DL_H }, 0); | |||
status["IceCreamFault"] = (MORKI_FAULT)BitConverter.ToInt16(new byte[] { heartUpMsg.GZ_L, heartUpMsg.GZ_H }, 0); | |||
heartUpMsg.HasGZ(out string msg); | |||
status["IceCreamError"] = msg; | |||
status["IceCreamCXB"] = heartUpMsg.CXB; | |||
status["IceCreamDLCompleted"] = (heartUpMsg.DLTJ >> 4 & 1) == 1; | |||
@@ -65,7 +65,7 @@ namespace BPASmartClient.GSIceCream | |||
msg += ((GZ_L >> 3) & 1) == 1 ? "皮带打滑" : string.Empty; | |||
msg += ((GZ_L >> 2) & 1) == 1 ? "冻缸报警" : string.Empty; | |||
msg += ((GZ_L >> 1) & 1) == 1 ? "缺料报警" : string.Empty; | |||
msg = msg == string.Empty ? "无异常" : msg; | |||
return string.IsNullOrEmpty(msg); | |||
} | |||
@@ -28,5 +28,6 @@ namespace BPASmartClient.GSIceCream | |||
皮带打滑 = 1 >> 4, | |||
冻缸报警 = 1 >> 5, | |||
缺料报警 = 1 >> 6, | |||
} | |||
} |
@@ -17,6 +17,7 @@ namespace BPASmartClient.Juicer | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
IsConnected = juicerHelper.IsOpen; | |||
status["JuiceIsConnect"] = juicerHelper.IsOpen; | |||
if (!IsConnected) IsWork = false; | |||
while (IsConnected) | |||
{ | |||
@@ -108,7 +108,7 @@ namespace BPASmartClient.KLMCoffee | |||
{ | |||
byte item = dataStorage.GetData(); | |||
List<byte> data = new List<byte>() { item }; | |||
if (Encoding.ASCII.GetString(data.ToArray()) == ":") | |||
if (Encoding.ASCII.GetString(data.ToArray()) == ":") | |||
{ | |||
temp.Add(item); | |||
while (dataStorage.GetSize() < 32) { Thread.Sleep(5); } | |||
@@ -119,10 +119,12 @@ namespace BPASmartClient.KLMCoffee | |||
} | |||
List<byte> vs = new List<byte>() { temp[temp.Count - 4], temp[temp.Count - 3], temp[temp.Count - 2], temp[temp.Count - 1] }; | |||
string t = Encoding.ASCII.GetString(vs.ToArray()).ToLower(); | |||
//帧尾 | |||
if (Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\\r\\n" || Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\r\n") | |||
//if (Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\\r\\n" || Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\r\n") | |||
var package = Encoding.ASCII.GetString(temp.ToArray()); | |||
if(package.Contains("\\r\\n")) | |||
{ | |||
var package = Encoding.ASCII.GetString(temp.ToArray()); | |||
ProcessMsg(package); | |||
} | |||
temp.Clear(); | |||
@@ -136,19 +138,26 @@ namespace BPASmartClient.KLMCoffee | |||
{ | |||
try | |||
{ | |||
lastRefreshTime = DateTime.Now; | |||
SystemStatusModel systemStatus = new K95Command().StateResolution(data); | |||
if (systemStatus != null) | |||
{ | |||
status["Status"] = systemStatus.temStatus; | |||
status["drinkType"] = systemStatus.drinkType; | |||
status["AppStatus"] = systemStatus.taskIndex; | |||
status["progress"] = systemStatus.progress; | |||
status["Warning"] = systemStatus.faultMessage.dataFault(); | |||
status["Keep"] = systemStatus.upkeepMessage; | |||
if (systemStatus.faultMessage.IsFault() || systemStatus.upkeepMessage.IsUpkeep()) | |||
IsWork = false; | |||
else | |||
IsWork = true; | |||
status["CoffeeIsConnected"] = OnLine; | |||
if((K95SysTemStatus)status["CoffeeStatus"] == K95SysTemStatus.正在制作咖啡&&systemStatus.temStatus != K95SysTemStatus.正在制作咖啡) | |||
{ | |||
status["CoffeeStatus"] = systemStatus.temStatus; | |||
EventBus.EventBus.GetInstance().Publish(new KLMCoffee_CoffeEndCookEvent { DeviceId = DeviceId }); | |||
} | |||
else status["CoffeeStatus"] = systemStatus.temStatus; | |||
status["CoffeedrinkType"] = systemStatus.drinkType; | |||
status["CoffeeAppStatus"] = systemStatus.taskIndex; | |||
status["Coffeeprogress"] = systemStatus.progress; | |||
status["CoffeeWarning"] = systemStatus.faultMessage?.dataFault(); | |||
status["CoffeeKeep"] = systemStatus.upkeepMessage; | |||
//if (systemStatus.faultMessage.IsFault() || systemStatus.upkeepMessage.IsUpkeep()) | |||
// IsWork = false; | |||
//else | |||
// IsWork = true; | |||
} | |||
} | |||
@@ -160,18 +169,18 @@ namespace BPASmartClient.KLMCoffee | |||
protected override void InitStatus() | |||
{ | |||
status["Status"] = K95SysTemStatus.空闲状态; | |||
status["drinkType"] = DrinkType.意式; | |||
status["AppStatus"] = TaskIndex.无任务; | |||
status["progress"] = 0; | |||
status["Warning"] = new FaultMessage(0x00, 0x00).dataFault(); | |||
status["Keep"] = new UpkeepMessage(0x00).dataFault(); | |||
status["CoffeeStatus"] = K95SysTemStatus.空闲状态; | |||
status["CoffeedrinkType"] = DrinkType.意式; | |||
status["CoffeeAppStatus"] = TaskIndex.无任务; | |||
status["Coffeeprogress"] = 0; | |||
status["CoffeeWarning"] = new FaultMessage(0x00, 0x00).dataFault(); | |||
status["CoffeeKeep"] = new UpkeepMessage(0x00).dataFault(); | |||
} | |||
public override void Init() | |||
{ | |||
commProxy = new SerialPortClient(PortName, (BaudRates)Enum.Parse(typeof(BaudRates), BaudRate)); | |||
commProxy = new SerialPortClient(communicationPar.SerialPort, (BaudRates)communicationPar.BaudRate); | |||
commProxy.SetDataStorage(dataStorage); | |||
//伽乐美咖啡机制作 | |||
@@ -284,6 +293,7 @@ namespace BPASmartClient.KLMCoffee | |||
} | |||
}); | |||
InitStatus(); | |||
Start(); | |||
} | |||
public override void WriteData(string address, object value) | |||
@@ -90,11 +90,11 @@ namespace BPASmartClient.KLMCoffee.Protocal | |||
if (makeSta.Substring(2,1) == ((TaskIndex)Enum.Parse(typeof(TaskIndex),item)).GetString()) | |||
taskIndex = ((TaskIndex)Enum.Parse(typeof(TaskIndex),item)); | |||
} | |||
if (makeProgress1 != "0000") | |||
progress = Convert.ToInt32(makeProgress,16) / Convert.ToInt32(makeProgress1,16); | |||
faultMessage = new FaultMessage(ErrorL,ErrorH); | |||
faultMessage = new FaultMessage(ErrorL, ErrorH); | |||
upkeepMessage = new UpkeepMessage(InFormation); | |||
if ( makeProgress1 != "0000") | |||
progress = Convert.ToInt32(makeProgress,16) / Convert.ToInt32(makeProgress1,16); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -365,5 +365,18 @@ namespace BPASmartClient.LebaiRobot | |||
await client?.RunScene(id); | |||
MessageLog.GetInstance.Show($"调用场景:{id}"); | |||
} | |||
//public async void ExecuteLua() | |||
// { | |||
// try | |||
// { | |||
// string lua = "" | |||
// if (client == null) return; | |||
// await client?.ExecuteLua() | |||
// } | |||
// catch (Exception ex) | |||
// } | |||
} | |||
} |
@@ -9,6 +9,7 @@ namespace BPASmartClient.Model.乐白机器人.Enum | |||
public class Lebai_qsqdCode | |||
{ | |||
#region 且时且多设备 | |||
public const int SENCE_自嗨 = 10008; | |||
public const int SENCE_取咖啡杯 = 10031; | |||
public const int SENCE_取冰淇淋杯 = 10032; | |||
public const int SENCE_咖啡杯检测 = 10033; | |||
@@ -29,6 +30,7 @@ namespace BPASmartClient.Model.乐白机器人.Enum | |||
public const int SENCE_冰淇淋杯回原点 = 10049; | |||
public const int SENCE_取咖啡出餐 = 10052; | |||
public const int SENCE_机器人回原点 = 10058; | |||
// 单片机冰淇淋机器场景 | |||
public const int SENCE_单片机接冰淇淋 = 10055; | |||
public const int SENCE_单片机放冰淇淋位置 = 10056; | |||
@@ -11,6 +11,7 @@ | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Models" Version="1.0.13" /> | |||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | |||
<PackageReference Include="System.Speech" Version="6.0.0" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -20,6 +20,9 @@ using BPASmartClient.MorkS.ViewModel; | |||
using BPASmartClient.Business; | |||
using BPASmartClient.Model.小炒机; | |||
using BPA.Models; | |||
using System.Speech.Synthesis; | |||
using System.Windows.Forms; | |||
using System.Media; | |||
namespace BPASmartClient.MorkS | |||
{ | |||
@@ -31,6 +34,7 @@ namespace BPASmartClient.MorkS | |||
public override void DoMain() | |||
{ | |||
MonitorViewModel.DeviceId = DeviceId; | |||
ServerInit(); | |||
DataParse(); | |||
@@ -53,22 +57,26 @@ namespace BPASmartClient.MorkS | |||
} | |||
} | |||
ActionManage.GetInstance.Register(new Action(() => | |||
ActionManage.GetInstance.Register(new Action<object[]>((o) => | |||
{ | |||
Random rd = new Random(); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
if (o.Length > 0 ) | |||
{ | |||
int NoodleLoc = rd.Next(1, 6); | |||
int BowlLoc = rd.Next(10, 11); | |||
string guid = new Guid().ToString(); | |||
Random rd = new Random(); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
int NoodleLoc = (int)o[0] == 0? rd.Next(1, 6) : (int)o[0]; | |||
int BowlLoc = (int)o[1] == 0 ? rd.Next(10, 12) : (int)o[1]; | |||
string guid = new Guid().ToString(); | |||
mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid }); | |||
MessageLog.GetInstance.Show($"添加订单:面条位置【{NoodleLoc}】"); | |||
mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid }); | |||
MessageLog.GetInstance.Show($"添加订单:面条位置【{NoodleLoc}】"); | |||
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid }); | |||
MessageLog.GetInstance.Show($"添加订单:碗位置【{BowlLoc}】"); | |||
Thread.Sleep(60000); | |||
}), "ForOrder"); | |||
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid }); | |||
MessageLog.GetInstance.Show($"添加订单:碗位置【{BowlLoc}】"); | |||
Thread.Sleep(60000); | |||
}), "ForOrder"); | |||
} | |||
}), "EnableForOrder"); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
@@ -80,6 +88,7 @@ namespace BPASmartClient.MorkS | |||
if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value); | |||
}), "WriteBools"); | |||
ActionManage.GetInstance.Register(new Action(() => { DeviceInit(); }), "InitDevice"); | |||
} | |||
public override void ResetProgram() | |||
@@ -135,7 +144,7 @@ namespace BPASmartClient.MorkS | |||
private void GetStatus(string key, Action<object> action) | |||
{ | |||
if (peripheralStatus.ContainsKey(key)) | |||
{ | |||
{ | |||
if (peripheralStatus[key] != null) | |||
{ | |||
action?.Invoke(peripheralStatus[key]); | |||
@@ -335,6 +344,7 @@ namespace BPASmartClient.MorkS | |||
if (orderLocInfo.Loc >= 10 && orderLocInfo.Loc <= 11) | |||
{ | |||
mORKS.TakeBowlId = orderLocInfo.SuborderId; | |||
mORKS.TakeBowName = orderLocInfo.GoodName; | |||
TakeBowlControl(orderLocInfo.Loc); | |||
SetRecipeNumber(orderLocInfo.RecipeNumber); | |||
OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING); | |||
@@ -350,6 +360,7 @@ namespace BPASmartClient.MorkS | |||
{ | |||
if (mORKS.AllowRun && mORKS.TakeBowlTask.Count > 0 && !mORKS.TakeBowlIdle && !mORKS.TakeBowlInterlock) | |||
{ | |||
DeviceProcessLogShow("开始取碗流程"); | |||
ushort BowLoc = 0; | |||
var res = orderMaterialDelivery?.BatchingInfo?.Where(p => p.BatchingId == mORKS.TakeBowlTask.ElementAt(0).BatchingId).ToList(); | |||
if (res == null || res?.Count == 0) | |||
@@ -547,9 +558,11 @@ namespace BPASmartClient.MorkS | |||
mORKS.OutMealId = mORKS.IngredientsCompleteId; | |||
mORKS.OutMealName = mORKS.IngredientsCompleteName; | |||
mORKS.IngredientsCompleteId = string.Empty; | |||
mORKS.CookNodelId[loc] = string.Empty; | |||
DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{ mORKS.OutMealId}"); | |||
mORKS.OutNoodleing = true; | |||
} | |||
} | |||
@@ -565,7 +578,9 @@ namespace BPASmartClient.MorkS | |||
if (RTrig.GetInstance("AllowFallNoodle").Start(mORKS.AllowFallNoodle)) | |||
{ | |||
mORKS.IngredientsCompleteId = mORKS.TakeBowlId; | |||
mORKS.IngredientsCompleteName = mORKS.TakeBowName; | |||
mORKS.TakeBowlId = string.Empty; | |||
mORKS.TakeBowName = string.Empty; | |||
DeviceProcessLogShow($"碗到位,允许到面,{mORKS.IngredientsCompleteId}"); | |||
mORKS.TakeBowlInterlock = false; | |||
} | |||
@@ -577,6 +592,7 @@ namespace BPASmartClient.MorkS | |||
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】制作完成"); | |||
mORKS.CookCompleteFlatBit = true; | |||
mORKS.OutNoodleing = false; | |||
WaitMeaLSpeak(mORKS.OutMealName); | |||
} | |||
//取餐完成逻辑处理 | |||
@@ -587,6 +603,7 @@ namespace BPASmartClient.MorkS | |||
ResetCookComplete(); | |||
mORKS.CookCompleteFlatBit = false; | |||
mORKS.OutMealId = string.Empty; | |||
mORKS.OutMealName = string.Empty; | |||
} | |||
//机器人取面完成信号检测 | |||
@@ -611,7 +628,17 @@ namespace BPASmartClient.MorkS | |||
} | |||
/// <summary> | |||
/// 语音提醒取餐 | |||
/// </summary> | |||
/// <param name="meal"></param> | |||
private void WaitMeaLSpeak(string meal) | |||
{ | |||
VoiceAPI.m_SystemPlayWav(@"Vioce\电子提示音.wav"); | |||
Thread.Sleep(1000); | |||
mORKS.speech.Speak(meal); | |||
VoiceAPI.m_SystemPlayWav(@"Vioce\取餐通知.wav"); | |||
} | |||
#region PLC 控制函数 | |||
@@ -4,6 +4,7 @@ using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Speech.Synthesis; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
@@ -328,11 +329,19 @@ namespace BPASmartClient.MorkS | |||
/// 取碗订单ID | |||
/// </summary> | |||
public string TakeBowlId = string.Empty; | |||
/// <summary> | |||
/// 取碗订单名称 | |||
/// </summary> | |||
public string TakeBowName = string.Empty; | |||
/// <summary> | |||
/// 配料完成订单ID | |||
/// </summary> | |||
public string IngredientsCompleteId = string.Empty; | |||
/// <summary> | |||
/// 配料完成订单名称 | |||
/// </summary> | |||
public string IngredientsCompleteName = string.Empty; | |||
/// <summary> | |||
/// 煮面口对应的订单ID | |||
@@ -343,6 +352,10 @@ namespace BPASmartClient.MorkS | |||
/// 出餐订单ID | |||
/// </summary> | |||
public string OutMealId = string.Empty; | |||
/// <summary> | |||
/// 出餐订单名称 | |||
/// </summary> | |||
public string OutMealName = string.Empty; | |||
/// <summary> | |||
/// 转台位置轮询 | |||
@@ -355,6 +368,8 @@ namespace BPASmartClient.MorkS | |||
[VariableMonitor("转台当前启动位置")] | |||
public ushort CurrentLoc { get; set; } = 0; | |||
public SpeechSynthesizer speech = new SpeechSynthesizer(); | |||
#endregion | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPA.Message; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -13,5 +14,10 @@ namespace BPASmartClient.MorkS | |||
public ushort RecipeNumber { get; set; } | |||
public int BatchingId { get; set; } | |||
public string GoodName { get; set; } | |||
public int RecipeId { get; set; } | |||
public List<int> Recipes { get; set; } | |||
} | |||
} |
@@ -25,6 +25,15 @@ | |||
<Setter Property="BorderThickness" Value="1" /> | |||
<Setter Property="CaretBrush" Value="Aqua" /> | |||
</Style> | |||
<Style x:Key="CheckBox" TargetType="CheckBox"> | |||
<Setter Property="Foreground" Value="Aqua"/> | |||
<Setter Property="FontSize" Value="16"/> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="VerticalAlignment" Value="Center"/> | |||
<Setter Property="HorizontalAlignment" Value="Center"/> | |||
<Setter Property="Margin" Value="10,0"/> | |||
<Setter Property="IsChecked" Value="False"/> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid Margin="20"> | |||
@@ -40,6 +49,8 @@ | |||
Foreground="{StaticResource TitleBorderColor}" | |||
Text="面条位置:" /> | |||
<TextBox Style="{StaticResource TextboxStyle}" Text="{Binding NoodleLoc}" /> | |||
<CheckBox Content="随机面条位置" Style="{StaticResource CheckBox}" IsChecked="{Binding IsNoodPositon}" Background="White"/> | |||
</StackPanel> | |||
<StackPanel Margin="10,0,0,20" Orientation="Horizontal"> | |||
@@ -48,16 +59,37 @@ | |||
Foreground="{StaticResource TitleBorderColor}" | |||
Text="面碗位置:" /> | |||
<TextBox Style="{StaticResource TextboxStyle}" Text="{Binding BowlLoc}" /> | |||
<CheckBox Content="随机面碗位置" Style="{StaticResource CheckBox}" IsChecked="{Binding IsBowPositon}" Background="White"/> | |||
<CheckBox Content="启用本地模拟功能" Style="{StaticResource CheckBox}" IsChecked="{Binding LocalSimOrder}" Background="White" Command="{Binding EnableLacalSimOrder}"/> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal"> | |||
<Button | |||
Grid.Row="0" | |||
Width="170" | |||
HorizontalAlignment="Left" | |||
Command="{Binding SimOrderRandomCommand}" | |||
Content="启动随机模拟订单" | |||
Style="{StaticResource ButtonStyle}" | |||
Visibility="{Binding VisibilitySimOrder}" | |||
/> | |||
<Button | |||
Grid.Row="0" | |||
Width="170" | |||
HorizontalAlignment="Left" | |||
Command="{Binding SimOrderRandomCloseCommand}" | |||
Content="关闭随机模拟订单" | |||
Style="{StaticResource ButtonStyle}" | |||
Visibility="{Binding VisibilitySimOrder}" | |||
/> | |||
<Button | |||
Grid.Row="0" | |||
Width="130" | |||
HorizontalAlignment="Left" | |||
Command="{Binding SimOrderCommand}" | |||
Content="模拟订单" | |||
Style="{StaticResource ButtonStyle}" /> | |||
Style="{StaticResource ButtonStyle}" | |||
Visibility="{Binding VisibilitySimOrder}"/> | |||
<Button | |||
Grid.Row="0" | |||
Width="120" | |||
@@ -9,6 +9,8 @@ using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.EventBus; | |||
using BPASmartClient.MorkS.Model; | |||
using System.Windows; | |||
using BPASmartClient.Message; | |||
namespace BPASmartClient.MorkS.ViewModel | |||
{ | |||
@@ -20,13 +22,38 @@ namespace BPASmartClient.MorkS.ViewModel | |||
SimOrderCommand = new RelayCommand(() => | |||
{ | |||
new MorksSimorderModel() { Bowloc = this.BowlLoc, NoodleLoc = this.NoodleLoc }.Publish(); | |||
}); | |||
SimOrderRandomCommand = new RelayCommand(() => | |||
{ | |||
int NoodPosition = 0; | |||
int BowPosion = 0; | |||
NoodPosition = IsNoodPositon == true ? 0 : NoodleLoc; | |||
BowPosion = IsBowPositon == true ? 0 : BowlLoc; | |||
ActionManage.GetInstance.Send("EnableForOrder", new object[] { NoodPosition, BowPosion }); | |||
}); | |||
SimOrderRandomCloseCommand = new RelayCommand(() => | |||
{ | |||
ThreadManage.GetInstance().StopTask("ForOrder"); | |||
MessageLog.GetInstance.Show("停止模拟随机订单"); | |||
}); | |||
EnableLacalSimOrder = new RelayCommand(() => | |||
{ | |||
Global.EnableLocalSimOrder = LocalSimOrder; | |||
VisibilitySimOrder = LocalSimOrder == true ? Visibility.Visible : Visibility.Collapsed; | |||
}); | |||
VisibilitySimOrder = LocalSimOrder == true? Visibility.Visible : Visibility.Collapsed; | |||
} | |||
public RelayCommand InitCommand { get; set; } | |||
public RelayCommand SimOrderCommand { get; set; } | |||
public RelayCommand SimOrderRandomCommand { get; set; } | |||
public RelayCommand SimOrderRandomCloseCommand { get; set; } | |||
public RelayCommand EnableLacalSimOrder { get; set; } | |||
public int NoodleLoc { get { return _mNoodleLoc; } set { _mNoodleLoc = value; OnPropertyChanged(); } } | |||
private int _mNoodleLoc = 1; | |||
@@ -34,5 +61,16 @@ namespace BPASmartClient.MorkS.ViewModel | |||
public int BowlLoc { get { return _mBowlLoc; } set { _mBowlLoc = value; OnPropertyChanged(); } } | |||
private int _mBowlLoc = 10; | |||
public bool IsNoodPositon { get { return _isNoodPositon; } set { _isNoodPositon = value; OnPropertyChanged(); } } | |||
private bool _isNoodPositon = false; | |||
public bool IsBowPositon { get { return _isBowPositon; } set { _isBowPositon = value; OnPropertyChanged(); } } | |||
private bool _isBowPositon = false; | |||
public bool LocalSimOrder { get { return _localSimOrder; } set { _localSimOrder = value; OnPropertyChanged(); } } | |||
private bool _localSimOrder = Global.EnableLocalSimOrder; | |||
public Visibility VisibilitySimOrder { get { return _visibilitySimOrder; } set { _visibilitySimOrder = value; OnPropertyChanged(); } } | |||
private Visibility _visibilitySimOrder; | |||
} | |||
} |
@@ -0,0 +1,42 @@ | |||
using BPASmartClient.Message; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Runtime.InteropServices; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkS | |||
{ | |||
public class VoiceAPI | |||
{ | |||
public VoiceAPI() | |||
{ | |||
} | |||
[DllImport("winmm.dll")] | |||
public static extern bool PlaySound(string pszSound, int hmod, int fdwSound); | |||
// 系统播放wav格式的文件 | |||
public static void m_SystemPlayWav(string strPlayFile) | |||
{ | |||
try | |||
{ | |||
if (strPlayFile.Trim() == "") | |||
{ return; }//为空不放 | |||
string strPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; | |||
strPath = strPath + strPlayFile; | |||
int SND_FILENAME = 0x00020000; | |||
int SND_ASYNC = 0x0001; | |||
PlaySound(strPath, 0, SND_ASYNC | SND_FILENAME);//播放音乐 | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx(ex.Message); | |||
} | |||
} | |||
} | |||
} |
@@ -13,6 +13,7 @@ using BPASmartClient.Model.乐白机器人.Enum; | |||
using BPASmartClient.Model.冰淇淋.Enum; | |||
using BPASmartClient.Model.单片机; | |||
using BPASmartClient.Model.单片机.Enum; | |||
using BPASmartClient.MorkT.Model; | |||
using BPASmartClient.Peripheral; | |||
using Robotc; | |||
using System; | |||
@@ -31,6 +32,8 @@ namespace BPASmartClient.MorkT | |||
GLV_MorkT morkT = new GLV_MorkT(); | |||
DateTime morkTime = DateTime.Now; | |||
public override void DoMain() | |||
{ | |||
@@ -48,9 +51,9 @@ namespace BPASmartClient.MorkT | |||
}); | |||
int i = 0; | |||
EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 }); | |||
PreventSleep.SleepControl(true);//防止电脑休眠 | |||
MessageLog.GetInstance.Show("MORKT 设备初始化完成"); | |||
} | |||
public override void ResetProgram() | |||
@@ -73,35 +76,51 @@ namespace BPASmartClient.MorkT | |||
public override void MainTask() | |||
{ | |||
if (morkT.waitMorkOrder != null)//更新订单取走状态 | |||
if (morkTime.AddMinutes(Global.TimeInterval).Minute == DateTime.Now.Minute) | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent() { DeviceId = DeviceId, Pin = 0 }, (o) => | |||
morkTime = DateTime.Now; | |||
if ((ELebaiRModel)peripheralStatus["RobotMode"] == ELebaiRModel.空闲状态) | |||
{ | |||
if (o != null && o.Length > 0 && o[0] is bool res) | |||
{ | |||
if (!res) | |||
{ | |||
OrderChange(morkT.waitMorkOrder.SuborderId, ORDER_STATUS.COMPLETED_TAKE); | |||
DeviceProcessLogShow("订单取餐完成"); | |||
morkT.waitMorkOrder = null; | |||
} | |||
} | |||
}); | |||
} | |||
MakeCoffeeProcess(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 0 }, (o) => | |||
{ | |||
if (o != null && o.Length > 0 && o[0] is bool resultValue) | |||
{ | |||
if (!resultValue)//取餐口有空余位置 | |||
{ | |||
MakeIceCreamProcess(); | |||
MakeCoffeeComplete(); | |||
} | |||
} | |||
}); | |||
MessageLog.GetInstance.Show("机器人开始自嗨!"); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { }); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_自嗨 }); | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
Thread.Sleep(50); | |||
} | |||
} | |||
else if (morkTime.AddMinutes(Global.TimeInterval) < DateTime.Now) morkTime = DateTime.Now; | |||
#region morkt流程 | |||
//if (morkT.waitMorkOrder != null)//更新订单取走状态 | |||
//{ | |||
// EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent() { DeviceId = DeviceId, Pin = 0 }, (o) => | |||
// { | |||
// if (o != null && o.Length > 0 && o[0] is bool res) | |||
// { | |||
// if (!res) | |||
// { | |||
// OrderChange(morkT.waitMorkOrder.SuborderId, ORDER_STATUS.COMPLETED_TAKE); | |||
// DeviceProcessLogShow("订单取餐完成"); | |||
// morkT.waitMorkOrder = null; | |||
// } | |||
// } | |||
// }); | |||
//} | |||
//MakeCoffeeProcess(); | |||
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 0 }, (o) => | |||
// { | |||
// if (o != null && o.Length > 0 && o[0] is bool resultValue) | |||
// { | |||
// if (!resultValue)//取餐口有空余位置 | |||
// { | |||
// MakeIceCreamProcess(); | |||
// MakeCoffeeComplete(); | |||
// } | |||
// } | |||
// }); | |||
#endregion | |||
} | |||
public override void ReadData() | |||
@@ -187,6 +206,14 @@ namespace BPASmartClient.MorkT | |||
} | |||
})); | |||
GetStatus("IceCreamError", new Action<object>((o) => | |||
{ | |||
if (o is string error) | |||
{ | |||
morkT.IceCreamError = error; | |||
} | |||
})); | |||
GetStatus("IceCreamDLCompleted", new Action<object>((o) => | |||
{ | |||
if (o is bool b) | |||
@@ -399,7 +426,7 @@ namespace BPASmartClient.MorkT | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_接咖啡后回原点 }); //接咖啡后回原点 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
EventBus.EventBus.GetInstance().Publish(new DRCoffee_MakeCoffeeEvent() {DeviceId = DeviceId, DrinkCode = (Model.咖啡机.Enum.DrCoffeeDrinksCode)int.Parse(orderLoc.Loc) });//接咖啡控制 | |||
EventBus.EventBus.GetInstance().Publish(new DRCoffee_MakeCoffeeEvent() {DeviceId = DeviceId, DrinkCode = (BPASmartClient.Model.咖啡机.Enum.DrCoffeeDrinksCode)int.Parse(orderLoc.Loc) });//接咖啡控制 | |||
DeviceProcessLogShow($"发送咖啡机制作{orderLoc.Loc}!"); | |||
morkT.IsCoffeeMake = true; morkT.MakeCoffeeOrder = orderLoc; | |||
} | |||
@@ -432,7 +459,7 @@ namespace BPASmartClient.MorkT | |||
/// </summary> | |||
private void DoCoffeeQC(OrderLocInfo order) | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10052 }); //SENCE_取咖啡出餐 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_取咖啡出餐 }); //SENCE_取咖啡出餐 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
//订单状态改变:完成 | |||
@@ -451,7 +478,7 @@ namespace BPASmartClient.MorkT | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 },(o)=>{ }); | |||
OrderChange(order.SuborderId, ORDER_STATUS.COOKING); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10031 }); //SENCE_取咖啡杯 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_取咖啡杯 }); //SENCE_取咖啡杯 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制 | |||
@@ -461,7 +488,7 @@ namespace BPASmartClient.MorkT | |||
int count = 1; | |||
bool result = true; | |||
p: | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10033 }); //SENCE_咖啡杯检测 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_咖啡杯检测 }); //SENCE_咖啡杯检测 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetTCPInputEvent { DeviceId = DeviceId, Pin = 1 }, (o)=> | |||
@@ -478,16 +505,16 @@ namespace BPASmartClient.MorkT | |||
{ | |||
//退出循环回到初始位置 | |||
DeviceProcessLogShow($"执行{count}次取咖啡杯,仍为成功,订单默认废弃,机器人回到初始位置!"); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10050 }); //SENCE_咖啡杯回原点 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_咖啡杯回原点 }); //SENCE_咖啡杯回原点 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
morkT.GetCoffeeCup = false; | |||
return; | |||
} | |||
DeviceProcessLogShow("执行二次取咖啡杯"); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10035 }); //SENCE_二次取咖啡杯 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_二次取咖啡杯 }); //SENCE_二次取咖啡杯 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Equals(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制 | |||
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
count++; | |||
goto p; | |||
@@ -511,45 +538,45 @@ namespace BPASmartClient.MorkT | |||
/// </summary> | |||
private void MakeIceCreamProcess() | |||
{ | |||
//if (IceCreamCanMake()) | |||
//{ | |||
if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order)) | |||
if (IceCreamCanMake()) | |||
{ | |||
DoIceCream(order); | |||
} | |||
//if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order)) | |||
//{ | |||
// DoIceCream(order); | |||
//} | |||
//if(peripheralStatus.ContainsKey("IceCreamCurrentMode")) | |||
//{ | |||
// if ((MORKI_MODE)peripheralStatus["IceCreamCurrentMode"] != MORKI_MODE.制冷模式) EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 }); | |||
//} | |||
if (peripheralStatus.ContainsKey("IceCreamCurrentMode")) | |||
{ | |||
if ((MORKI_MODE)peripheralStatus["IceCreamCurrentMode"] != MORKI_MODE.制冷模式) EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 }); | |||
} | |||
//if(peripheralStatus.ContainsKey("IceCreamCXB")) | |||
//{ | |||
// if ((byte)peripheralStatus["IceCreamCXB"] >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作 | |||
// { | |||
// bool result = true; | |||
// EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 }, (res) => | |||
// { | |||
// if (res[0] is bool resultValue) | |||
// { | |||
// result = resultValue; | |||
// } | |||
// }); | |||
// if (result) | |||
// { | |||
// if (morkT.IceIsOK) DeviceProcessLogShow("请检查冰淇淋出料口有无遮挡"); | |||
// morkT.IceIsOK = false; | |||
// } | |||
// else if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order)) | |||
// { | |||
// morkT.IceIsOK = true; | |||
// DeviceProcessLogShow($"开始制作 [冰淇淋] 订单[{order.SortNum}]"); | |||
// DoIceCream(order); | |||
// } | |||
// } | |||
//} | |||
if (peripheralStatus.ContainsKey("IceCreamCXB")) | |||
{ | |||
if ((byte)peripheralStatus["IceCreamCXB"] >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作 | |||
{ | |||
bool result = true; | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 }, (res) => | |||
{ | |||
if (res[0] is bool resultValue) | |||
{ | |||
result = resultValue; | |||
} | |||
}); | |||
if (result) | |||
{ | |||
if (morkT.IceIsOK) DeviceProcessLogShow("请检查冰淇淋出料口有无遮挡"); | |||
morkT.IceIsOK = false; | |||
} | |||
else if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order)) | |||
{ | |||
morkT.IceIsOK = true; | |||
DeviceProcessLogShow($"开始制作 [冰淇淋] 订单[{order.SortNum}]"); | |||
DoIceCream(order); | |||
} | |||
} | |||
} | |||
//} | |||
} | |||
} | |||
@@ -575,7 +602,7 @@ namespace BPASmartClient.MorkT | |||
{ | |||
MessageLog.GetInstance.Show("准备开始制作冰淇淋"); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { }); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10032 }); //SENCE_取冰淇淋杯 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_取冰淇淋杯 }); //SENCE_取冰淇淋杯 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_ICECREAM });//落碗控制 | |||
Thread.Sleep(500); | |||
@@ -592,7 +619,7 @@ namespace BPASmartClient.MorkT | |||
bool result = true; | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
p: | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10034 }); //SENCE_冰淇淋杯检测 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_冰淇淋杯检测 }); //SENCE_冰淇淋杯检测 | |||
Wait(); | |||
Thread.Sleep(500); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => | |||
@@ -627,14 +654,14 @@ namespace BPASmartClient.MorkT | |||
{ | |||
//退出循环回到初始位置 | |||
DeviceProcessLogShow($"执行{count}次取冰淇淋杯,仍未成功,订单默认废弃,机器人回到初始位置!"); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10049 }); //SENCE_冰淇淋杯回原点 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_冰淇淋杯回原点 }); //SENCE_冰淇淋杯回原点 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 },(o) => { }); | |||
morkT.GetIceCreamCup = false; | |||
return; | |||
} | |||
DeviceProcessLogShow($"执行{count}次取冰淇淋杯!"); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10036 }); //SENCE_二次取冰淇淋杯 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_二次取冰淇淋杯 }); //SENCE_二次取冰淇淋杯 | |||
EventBus.EventBus.GetInstance().Equals(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_ICECREAM });//落碗控制 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
@@ -652,10 +679,10 @@ namespace BPASmartClient.MorkT | |||
private void GetIceCream(OrderLocInfo order) | |||
{ | |||
//制冷模式 | |||
//EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent {DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 }); | |||
EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 }); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { }); | |||
OrderChange(order.SuborderId, ORDER_STATUS.COOKING); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10055 }); //SENCE_接1号冰淇淋 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_接1号冰淇淋 }); //SENCE_接1号冰淇淋 | |||
Wait(); | |||
bool doItResult = true; | |||
@@ -663,35 +690,37 @@ namespace BPASmartClient.MorkT | |||
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true }); | |||
//Thread.Sleep(500); | |||
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false }); | |||
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId=DeviceId,}) | |||
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, bDO = true ,pin = 1}); | |||
//Thread.Sleep(500); | |||
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, bDO = false, pin = 1 }); | |||
Thread.Sleep(500); | |||
EventBus.EventBus.GetInstance().Publish(new SCChip_MakeIceCreamEvent { DeviceId = DeviceId, SteeringEngine = IC_SE.SE_2 });//冰淇淋出料 | |||
DeviceProcessLogShow("开始等待6s"); | |||
Thread.Sleep(5000); | |||
//Thread.Sleep(500); | |||
//EventBus.EventBus.GetInstance().Publish(new SCChip_MakeIceCreamEvent { DeviceId = DeviceId, SteeringEngine = IC_SE.SE_2 });//冰淇淋出料 | |||
//DeviceProcessLogShow("开始等待6s"); | |||
//Thread.Sleep(5000); | |||
//出料 | |||
//EventBus.EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId },(o)=> | |||
//{ | |||
// doItResult = (bool)o[0]; | |||
//}); | |||
//if (doItResult) | |||
//{ | |||
// IceCreamCookCheck(); | |||
//} | |||
//else | |||
//{ | |||
// int count_1 = 0; | |||
EventBus.EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId }, (o) => | |||
{ | |||
doItResult = (bool)o[0]; | |||
}); | |||
if (doItResult) | |||
{ | |||
IceCreamCookCheck(); | |||
} | |||
else | |||
{ | |||
int count_1 = 0; | |||
// while ((byte)peripheralStatus["IceCreamCXB"] <= 86) | |||
// { | |||
// Thread.Sleep(5); | |||
// count_1++; | |||
// if (count_1 >= 2000) | |||
// break; | |||
// } | |||
// IceCreamCookCheck(); | |||
//} | |||
while ((byte)peripheralStatus["IceCreamCXB"] <= 86) | |||
{ | |||
Thread.Sleep(5); | |||
count_1++; | |||
if (count_1 >= 2000) | |||
break; | |||
} | |||
IceCreamCookCheck(); | |||
} | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
} | |||
@@ -714,7 +743,7 @@ namespace BPASmartClient.MorkT | |||
Thread.Sleep(500); | |||
} | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10056 }); //SENCE_放冰淇淋位置 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_放冰淇淋位置 }); //SENCE_放冰淇淋位置 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
//订单状态改变:完成 | |||
@@ -92,6 +92,9 @@ namespace BPASmartClient.MorkT | |||
[VariableMonitor("冰淇淋机器故障")] | |||
public MORKI_FAULT IceCreamFault { get; set; } | |||
[VariableMonitor("冰淇淋机器异常")] | |||
public string? IceCreamError { get; set; } | |||
[VariableMonitor("冰淇淋机器打料完成")] | |||
public bool DLCompleted { get; set; } | |||
@@ -0,0 +1,13 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkT.Model | |||
{ | |||
public class Global | |||
{ | |||
public static int TimeInterval { get; set; } = 15; | |||
} | |||
} |
@@ -0,0 +1,30 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Runtime.InteropServices; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkT | |||
{ | |||
public class PreventSleep | |||
{ | |||
[DllImport("kernel32.dll")] | |||
static extern uint SetThreadExecutionState(uint dwThreadId); | |||
const uint ES_SYSTEM_REQUIRED = 0x00000001; | |||
const uint ES_DISPLAY_REQUIRED = 0x00000002; | |||
const uint ES_CONTINUOUS = 0x80000000; | |||
public static void SleepControl(bool isSleep) | |||
{ | |||
if (isSleep) | |||
{ | |||
SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED); | |||
} | |||
else | |||
{ | |||
SetThreadExecutionState(ES_CONTINUOUS); | |||
} | |||
} | |||
} | |||
} |
@@ -25,7 +25,7 @@ | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="14*"/> | |||
<RowDefinition Height="0.1*"/> | |||
<RowDefinition Height="8*"/> | |||
<RowDefinition Height="20*"/> | |||
</Grid.RowDefinitions> | |||
@@ -46,6 +46,9 @@ | |||
<TextBlock Text="机器人模式:"/> | |||
<TextBlock Text="{Binding RobotMode}" | |||
Margin="40,0"/> | |||
<TextBlock Text="机器人自嗨时间间隔:"/> | |||
<TextBox Text="{Binding TimeInterval}" Width="40" Margin="10,0,5,0"/> | |||
<TextBlock Text="分"/> | |||
</StackPanel> | |||
<TextBlock Text="连接状态" /> | |||
<TextBlock Text="{Binding RobotConnected}" | |||
@@ -79,10 +82,16 @@ | |||
Command="{Binding Button_RobotControlCommand}" | |||
CommandParameter="机器人急停"/> | |||
<!--<Button Content="机器人回原点" | |||
Margin="20,5" Width="110" Height="60" | |||
Command="{Binding Button_GoToHomeCommand}" | |||
CommandParameter="机器人急停">--> | |||
<!--</Button>--> | |||
</ListBox> | |||
</Grid> | |||
</GroupBox> | |||
<!--<GroupBox Grid.Row="2" | |||
<GroupBox Grid.Row="2" | |||
FontFamily="楷体" | |||
FontSize="20" | |||
Header=" 冰淇淋机器 "> | |||
@@ -172,8 +181,8 @@ | |||
</StackPanel> | |||
</StackPanel> | |||
</Grid> | |||
</GroupBox>--> | |||
<GroupBox Grid.Row="2" Grid.Column="0" | |||
</GroupBox> | |||
<!--<GroupBox Grid.Row="2" Grid.Column="0" | |||
FontSize="20" FontFamily="楷体" | |||
Header="单片机冰淇淋" > | |||
<Grid> | |||
@@ -214,7 +223,7 @@ | |||
</ListBox> | |||
</Grid> | |||
</GroupBox> | |||
</GroupBox>--> | |||
<GroupBox Grid.Row="2" Grid.Column="1" | |||
FontFamily="楷体" | |||
@@ -277,7 +286,7 @@ | |||
Content="制作"/> | |||
<Button Margin="10,0" | |||
Command="{}" | |||
Content="停止制作"/> | |||
Content="停止制作" Cursor="Hand"/> | |||
</StackPanel> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<TextBlock>模式</TextBlock> | |||
@@ -295,11 +304,18 @@ | |||
<GroupBox Header="单片机控制" | |||
FontSize="18" | |||
Grid.Row="1" Grid.ColumnSpan="2" | |||
Margin="0,0,0,10" HorizontalAlignment="Right" Width="1000"> | |||
Margin="0,0,0,10" HorizontalAlignment="Left" Width="1000"> | |||
<StackPanel Orientation="Horizontal" | |||
VerticalAlignment="Center" > | |||
<Button Content="咖啡杯落杯" Height="30" Width="120" | |||
Command="{Binding Button_CupControlCommand}" | |||
CommandParameter="CUP_COFFEE" | |||
Margin="10,10,50,10" Cursor="Hand"/> | |||
<Button Content="冰淇淋杯落杯" Height="30" Width="120" | |||
Command="{Binding Button_CupControlCommand}" | |||
CommandParameter="CUP_ICECREAM" Margin="10,10,50,10" | |||
/> | |||
</StackPanel> | |||
</GroupBox> | |||
@@ -8,10 +8,12 @@ using BPASmartClient.LebaiRobot; | |||
using BPASmartClient.Message; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.Model.乐白机器人; | |||
using BPASmartClient.Model.乐白机器人.Enum; | |||
using BPASmartClient.Model.冰淇淋.Enum; | |||
using BPASmartClient.Model.单片机; | |||
using BPASmartClient.Model.单片机.Enum; | |||
using BPASmartClient.Model.咖啡机.Enum; | |||
using BPASmartClient.MorkT.Model; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
@@ -36,6 +38,12 @@ namespace BPASmartClient.MorkT.ViewModel | |||
/// </summary> | |||
public string RobotMode { get { return _robotMode; } set { _robotMode = value; OnPropertyChanged(); } } | |||
private string _robotMode { get; set; } | |||
/// <summary> | |||
/// 乐白机器人自嗨时间间隔 | |||
/// </summary> | |||
public int TimeInterval { get { return Global.TimeInterval; } set { Global.TimeInterval = value; OnPropertyChanged(); } } | |||
//private int _timeInterval { get; set; } = Global.TimeInterval; | |||
/// <summary> | |||
/// 机器人控制指令 | |||
/// </summary> | |||
@@ -44,9 +52,12 @@ namespace BPASmartClient.MorkT.ViewModel | |||
/// 机器人控制 | |||
/// </summary> | |||
/// <param name="o"></param> | |||
public RelayCommand Button_SetValueCommand { get; set; } | |||
public RelayCommand Button_GoToHomeCommand { get; set; } | |||
private void Button_SetValue() | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }); | |||
@@ -56,6 +67,14 @@ namespace BPASmartClient.MorkT.ViewModel | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiControlEvent { DeviceId = DeviceId, LebaiControl = o.ToString() }); | |||
} | |||
private void Button_GoToHome() | |||
{ | |||
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { }); | |||
//MessageLog.GetInstance.Show("开始执行乐白机器人回原点"); | |||
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_机器人回原点 }); | |||
//MessageLog.GetInstance.Show("开始执行乐白机器人回原点-----"); | |||
} | |||
#endregion | |||
#region 冰淇淋机器 | |||
@@ -124,12 +143,12 @@ namespace BPASmartClient.MorkT.ViewModel | |||
private void Button_MakeIceCream() | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId }); | |||
} | |||
private void Button_SetIceCreamModel() | |||
{ | |||
MORKI_MODE mORKI_MODE = (MORKI_MODE)Enum.Parse(typeof(MORKI_MODE), SelecteIceCreamdMode); | |||
new GSIceCream_ModeSetEvent() { DeviceId = DeviceId, Mode = mORKI_MODE }.Publish(); | |||
EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = mORKI_MODE }); | |||
} | |||
#endregion | |||
@@ -222,10 +241,13 @@ namespace BPASmartClient.MorkT.ViewModel | |||
private void Button_SCChipRefrigeration() | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true }); | |||
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true }); | |||
//Thread.Sleep(500); | |||
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false }); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, Value = true, Pin = 1 }); | |||
Thread.Sleep(500); | |||
EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false }); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, Value = false, Pin = 1 }); | |||
} | |||
private void Button_SCChipDischarge() | |||
@@ -248,6 +270,7 @@ namespace BPASmartClient.MorkT.ViewModel | |||
{ | |||
Button_RobotControlCommand = new RelayCommand<object>(Button_RobotControl); | |||
Button_SetValueCommand = new RelayCommand(Button_SetValue); | |||
Button_GoToHomeCommand = new RelayCommand(Button_GoToHome); | |||
Button_MakeIceCreamCommand = new RelayCommand(Button_MakeIceCream); | |||
Button_SetIceCreamModelCommand = new RelayCommand(Button_SetIceCreamModel); | |||
@@ -313,7 +336,7 @@ namespace BPASmartClient.MorkT.ViewModel | |||
DL = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器电流").CurrentValue; | |||
DY = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器电压").CurrentValue; | |||
CurrentMode = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器模式").CurrentValue; | |||
IceCreamFault = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器故障").CurrentValue; | |||
IceCreamFault = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器异常").CurrentValue; | |||
CXB = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器成型比").CurrentValue; | |||
DLCompleted = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器打料完成")?.CurrentValue == "True" ? "打料完成" : "打料中"; | |||
} | |||
@@ -0,0 +1,15 @@ | |||
using BPASmartClient.Device; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkTM | |||
{ | |||
public class Alarm: IAlarm | |||
{ | |||
[Alarm("报警")] | |||
public string Name { get; set; } | |||
} | |||
} |
@@ -0,0 +1,48 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0-windows</TargetFramework> | |||
<ImplicitUsings>enable</ImplicitUsings> | |||
<Nullable>enable</Nullable> | |||
<UseWPF>true</UseWPF> | |||
<OutputType>Library</OutputType> | |||
<UseWindowsForms>False</UseWindowsForms> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Update="Properties\Resources.Designer.cs"> | |||
<DesignTime>True</DesignTime> | |||
<AutoGen>True</AutoGen> | |||
<DependentUpon>Resources.resx</DependentUpon> | |||
</Compile> | |||
<Compile Update="Properties\Settings.Designer.cs"> | |||
<DesignTimeSharedInput>True</DesignTimeSharedInput> | |||
<AutoGen>True</AutoGen> | |||
<DependentUpon>Settings.settings</DependentUpon> | |||
</Compile> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<EmbeddedResource Update="Properties\Resources.resx"> | |||
<Generator>ResXFileCodeGenerator</Generator> | |||
<LastGenOutput>Resources.Designer.cs</LastGenOutput> | |||
</EmbeddedResource> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<None Update="Properties\Settings.settings"> | |||
<Generator>SettingsSingleFileGenerator</Generator> | |||
<LastGenOutput>Settings.Designer.cs</LastGenOutput> | |||
</None> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Folder Include="Control\" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,169 @@ | |||
using BPA.Message; | |||
using BPA.Message.Enum; | |||
using BPASmartClient.Device; | |||
using BPASmartClient.EventBus; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Message; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.Model.PLC; | |||
using BPASmartClient.MorkTM.Model; | |||
using System.Collections.Concurrent; | |||
using static BPASmartClient.EventBus.EventBus; | |||
namespace BPASmartClient.MorkTM | |||
{ | |||
public class Control_MorkTM : BaseDevice | |||
{ | |||
public override DeviceClientType DeviceType => throw new NotImplementedException(); | |||
GVL_MorkTM morkTM = new GVL_MorkTM(); | |||
public override void DoMain() | |||
{ | |||
ServerInit(); | |||
DataParse(); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value); | |||
}), "WriteVW"); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value); | |||
}), "WriteBools"); | |||
DeviceProcessLogShow("设备初始化完成"); | |||
} | |||
private void ServerInit() | |||
{ | |||
//物料信息 | |||
EventBus.EventBus.GetInstance().Subscribe<MaterialDeliveryEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if (@event == null) return; | |||
if (@event is MaterialDeliveryEvent material) | |||
{ | |||
orderMaterialDelivery = material.orderMaterialDelivery; | |||
} | |||
}); | |||
//配方数据信息 | |||
EventBus.EventBus.GetInstance().Subscribe<RecipeBomEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if (@event == null) return; | |||
if (@event is RecipeBomEvent recipe) | |||
{ | |||
recipeBoms = recipe.recipeBoms; | |||
} | |||
}); | |||
} | |||
private void DataParse() | |||
{ | |||
EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if(@event == null) return; | |||
if(@event is DoOrderEvent order) | |||
{ | |||
if (order.MorkOrder.GoodBatchings == null) return; | |||
OrderCount++; | |||
OrderChange(order.MorkOrder, ORDER_STATUS.WAIT); | |||
DeviceProcessLogShow($"接收到{OrderCount}次订单"); | |||
Dictionary<string, int> OrderPushes = new Dictionary<string, int>(); | |||
foreach (var item in order.MorkOrder.GoodBatchings) | |||
{ | |||
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId); | |||
if (res != null) | |||
{ | |||
OrderPushes.TryAdd(res.BatchingLoc, item.BatchingCount); | |||
} | |||
} | |||
morkTM.morkOrderPushesTeaWithMilk.Enqueue(new OrderLocInfo() | |||
{ | |||
GoodName = order.MorkOrder.GoodsName, | |||
SuborderId = order.MorkOrder.SuborderId, | |||
GoodPushes = OrderPushes | |||
}); | |||
} | |||
}); | |||
} | |||
private void OrderChange(MorkOrderPush orderPush, ORDER_STATUS oRDER_STATUS) | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() | |||
{ | |||
SortNum = orderPush.SortNum.ToString(), | |||
GoodName = orderPush.GoodsName, | |||
Status = oRDER_STATUS, | |||
SubOrderId = orderPush.SuborderId, | |||
deviceClientType = DeviceType | |||
}); | |||
} | |||
public override void MainTask() | |||
{ | |||
IsHealth = true; | |||
MakeTeaWithMilkProcess(); | |||
} | |||
private void MakeTeaWithMilkProcess() | |||
{ | |||
if(morkTM.morkOrderPushesTeaWithMilk.Count > 0) | |||
{ | |||
if(morkTM.morkOrderPushesTeaWithMilk.TryDequeue(out OrderLocInfo orderLoc)) | |||
{ | |||
morkTM.RecipesPushes.Clear(); | |||
morkTM.RecipesPushes = orderLoc.GoodPushes; | |||
foreach(var item in morkTM.RecipesPushes) | |||
{ | |||
WriteData(item.Key,item.Value); | |||
while (!RTrig.GetInstance("OutMaterialComplete").Start(morkTM.OutMaterialComplete)) | |||
{ | |||
Thread.Sleep(100); | |||
} | |||
DeviceProcessLogShow($"奶茶{orderLoc.GoodName}:配料{item.Key}:添加量{item.Value}"); | |||
} | |||
} | |||
} | |||
} | |||
public override void ReadData() | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
public override void ResetProgram() | |||
{ | |||
morkTM = null; | |||
morkTM = new GVL_MorkTM(); | |||
} | |||
private void WriteData(string address, object value) | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value }); | |||
} | |||
private void GetStatus(string key, Action<object> action) | |||
{ | |||
if (peripheralStatus.ContainsKey(key)) | |||
{ | |||
if (peripheralStatus[key] != null) | |||
{ | |||
action?.Invoke(peripheralStatus[key]); | |||
} | |||
} | |||
} | |||
public override void SimOrder() | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
public override void Stop() | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,33 @@ | |||
using BPA.Models; | |||
using BPASmartClient.Device; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkTM | |||
{ | |||
public class GVL_MorkTM: IStatus | |||
{ | |||
/// <summary> | |||
/// 奶茶订单队列 | |||
/// </summary> | |||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesTeaWithMilk = new ConcurrentQueue<OrderLocInfo>(); | |||
/// <summary> | |||
/// 当前正在制作的奶茶订单 | |||
/// </summary> | |||
public OrderLocInfo CurrentOrderLoc = new OrderLocInfo(); | |||
/// <summary> | |||
/// 奶茶配料的队列 | |||
/// </summary> | |||
public Dictionary<string, int> RecipesPushes = new Dictionary<string, int>(); | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
[VariableMonitor("出料完成", "", "")] | |||
public bool OutMaterialComplete { get; set; } | |||
} | |||
} |
@@ -0,0 +1,31 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkTM.Model | |||
{ | |||
public class Alarms : ObservableObject | |||
{ | |||
private string _id; | |||
public string ID { get { return _id; } set { _id = value; OnPropertyChanged(); } } | |||
private string _varName; | |||
public string VarName { get { return _varName; } set { _varName = value; OnPropertyChanged(); } } | |||
private string _plcAddress; | |||
public string PLCAddress { get { return _plcAddress; } set { _plcAddress = value; OnPropertyChanged(); } } | |||
private string _modbusTCP; | |||
public string ModbusTCP { get { return _modbusTCP; } set { _modbusTCP = value; OnPropertyChanged(); } } | |||
private string _value; | |||
public string Value { get { return _value; } set { _value = value; OnPropertyChanged(); } } | |||
private string _notes; | |||
public string Notes { get { return _notes; } set { _notes = value; OnPropertyChanged(); } } | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkTM.Model | |||
{ | |||
public class WritePar | |||
{ | |||
public string Address { get; set; } | |||
public object Value { get; set; } | |||
} | |||
} |
@@ -0,0 +1,18 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkTM | |||
{ | |||
public class OrderLocInfo | |||
{ | |||
public string SuborderId { get; set; } | |||
public ushort RecipeNumber { get; set; } | |||
public string GoodName { get; set; } | |||
public Dictionary<string, int> GoodPushes { get; set; } | |||
} | |||
} |
@@ -0,0 +1,24 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkTM | |||
{ | |||
public enum Material | |||
{ | |||
Material_Top_1, Material_Top_2, Material_Top_3, Material_Top_4, Material_Top_5, Material_Top_6, | |||
Material_Mid_1, Material_Mid_2, Material_Mid_3, Material_Mid_4, Material_Mid_5, Material_Mid_6, Material_Mid_7, Material_Mid_8, Material_Mid_9, Material_Mid_10, | |||
Marerial_Bottom_1, Marerial_Bottom_2, Marerial_Bottom_3, Marerial_Top_4,Marerial_Bottom_5, Marerial_Bottom_6 | |||
} | |||
public enum TeaStorageBox | |||
{ | |||
TeaStorageBox_1, TeaStorageBox_2, TeaStorageBox_3, TeaStorageBox_4, TeaStorageBox_5, TeaStorageBox_6 | |||
} | |||
public class PolymerBatching | |||
{ | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
using System.Runtime.InteropServices; | |||
[assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] | |||
// 在此类的 SDK 样式项目中,现在,在此文件中早前定义的几个程序集属性将在生成期间自动添加,并使用在项目属性中定义的值进行填充。有关包含的属性以及如何定制此过程的详细信息,请参阅 | |||
// https://aka.ms/assembly-info-properties | |||
// 将 ComVisible 设置为 false 会使此程序集中的类型对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,请将该类型的 ComVisible | |||
// 属性设置为 true。 | |||
[assembly: ComVisible(false)] | |||
// 如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID。 | |||
[assembly: Guid("a100db3c-23af-4bd5-991e-224a062d4f2d")] |
@@ -0,0 +1,63 @@ | |||
//------------------------------------------------------------------------------ | |||
// <auto-generated> | |||
// 此代码由工具生成。 | |||
// 运行时版本:4.0.30319.42000 | |||
// | |||
// 对此文件的更改可能会导致不正确的行为,并且如果 | |||
// 重新生成代码,这些更改将会丢失。 | |||
// </auto-generated> | |||
//------------------------------------------------------------------------------ | |||
namespace BPASmartClient.MorkTM.Properties { | |||
using System; | |||
/// <summary> | |||
/// 一个强类型的资源类,用于查找本地化的字符串等。 | |||
/// </summary> | |||
// 此类是由 StronglyTypedResourceBuilder | |||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 | |||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen | |||
// (以 /str 作为命令选项),或重新生成 VS 项目。 | |||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | |||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | |||
internal class Resources { | |||
private static global::System.Resources.ResourceManager resourceMan; | |||
private static global::System.Globalization.CultureInfo resourceCulture; | |||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] | |||
internal Resources() { | |||
} | |||
/// <summary> | |||
/// 返回此类使用的缓存的 ResourceManager 实例。 | |||
/// </summary> | |||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | |||
internal static global::System.Resources.ResourceManager ResourceManager { | |||
get { | |||
if (object.ReferenceEquals(resourceMan, null)) { | |||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BPASmartClient.MorkTM.Properties.Resources", typeof(Resources).Assembly); | |||
resourceMan = temp; | |||
} | |||
return resourceMan; | |||
} | |||
} | |||
/// <summary> | |||
/// 重写当前线程的 CurrentUICulture 属性,对 | |||
/// 使用此强类型资源类的所有资源查找执行重写。 | |||
/// </summary> | |||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | |||
internal static global::System.Globalization.CultureInfo Culture { | |||
get { | |||
return resourceCulture; | |||
} | |||
set { | |||
resourceCulture = value; | |||
} | |||
} | |||
} | |||
} |