diff --git a/BPASmartClient.AGV/AGVHelper.cs b/BPASmartClient.AGV/AGVHelper.cs new file mode 100644 index 00000000..cf6204c5 --- /dev/null +++ b/BPASmartClient.AGV/AGVHelper.cs @@ -0,0 +1,533 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Net; +using System.Web; +using Newtonsoft.Json; +using System.Net.Http; +using System.Configuration; + +namespace BPASmartClient.AGV +{ + public class AGVHelper + { + public static AGVHelper _Instance { get; set; } + public static AGVHelper GetInstance => _Instance ?? (_Instance = new AGVHelper()); + + public AGVHelper() + { + + } + /// + /// 获取配置文件信息 + /// + /// + /// + 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); + } + public string PostData(string url, string head, string body) + { + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + request.Method = "POST"; + request.Headers["header"] = head; + //request.Proxy = new WebProxy("192.168.1.12",80); + byte[] bytes = Encoding.UTF8.GetBytes(body); + request.ContentType = "application/json; charset=UTF-8"; ;//窗体数据被编码为名称/值对形式 + //request.ContentType = "application/json"; + request.ContentLength = bytes.Length; + Stream myResponseStream = request.GetRequestStream(); + myResponseStream.Write(bytes, 0, bytes.Length); + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); + string retString = myStreamReader.ReadToEnd(); + myStreamReader.Close(); + myResponseStream.Close(); + + if (response != null) + { + response.Close(); + } + if (request != null) + { + request.Abort(); + } + return retString;//返回响应报文 + } + /// + /// AGV去1号线体装桶 + /// + /// + public string AgvToLineOneLoadRoller(string robotJobId) + { + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel.GetInstance.appKey = ""; + HttpRequestHeaderModel.GetInstance.appSecret = ""; + HttpRequestHeaderModel.GetInstance.requestId = ""; + HttpRequestHeaderModel.GetInstance.timestamp = ""; + HttpRequestHeaderModel.GetInstance.version = "2.8"; + string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); + //请求报文体 + AGVModel.GetInstance.robotJobId =robotJobId ;//上游提供 + AGVModel.GetInstance.warehouseId = 123; //仓库编号 + AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 + AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 + AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 + AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 + AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 + AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; + string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + // 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"; + } + /// + /// AGV去2号线体装桶 + /// + /// + public string AgvToLineTwoLoadRoller(string robotJobId) + { + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel.GetInstance.appKey = ""; + HttpRequestHeaderModel.GetInstance.appSecret = ""; + HttpRequestHeaderModel.GetInstance.requestId = ""; + HttpRequestHeaderModel.GetInstance.timestamp = ""; + HttpRequestHeaderModel.GetInstance.version = "2.8"; + string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); + //请求报文体 + AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 + AGVModel.GetInstance.warehouseId = 123; //仓库编号 + AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 + AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 + AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 + AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 + AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 + AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; + string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + //货位到货位 + //AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 + //AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 + //AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + 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"; + } + /// + /// AGV去3号线体装桶 + /// + /// + public string AgvToLineThreeLoadRoller(string robotJobId) + { + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel.GetInstance.appKey = ""; + HttpRequestHeaderModel.GetInstance.appSecret = ""; + HttpRequestHeaderModel.GetInstance.requestId = ""; + HttpRequestHeaderModel.GetInstance.timestamp = ""; + HttpRequestHeaderModel.GetInstance.version = "2.8"; + string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); + //请求报文体 + AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 + AGVModel.GetInstance.warehouseId = 123; //仓库编号 + AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 + AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 + AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 + AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 + AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 + AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; + string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + //货位到货位 + //AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 + //AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 + //AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + 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"; + } + /// + /// AGV离开炒锅1 + /// + /// + public string AgvLeaveFryPotOne(string robotJobId) + { + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel.GetInstance.appKey = ""; + HttpRequestHeaderModel.GetInstance.appSecret = ""; + HttpRequestHeaderModel.GetInstance.requestId = ""; + HttpRequestHeaderModel.GetInstance.timestamp = ""; + HttpRequestHeaderModel.GetInstance.version = "2.8"; + string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); + //请求报文体 + AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 + AGVModel.GetInstance.warehouseId = 123; //仓库编号 + AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 + AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 + AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 + AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 + AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 + AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; + string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + //货位到货位 + //AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 + //AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 + //AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + 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"; + } + /// + /// AGV离开炒锅2 + /// + /// + public string AgvLeaveFryPotTwo(string robotJobId) + { + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel.GetInstance.appKey = ""; + HttpRequestHeaderModel.GetInstance.appSecret = ""; + HttpRequestHeaderModel.GetInstance.requestId = ""; + HttpRequestHeaderModel.GetInstance.timestamp = ""; + HttpRequestHeaderModel.GetInstance.version = "2.8"; + string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); + //请求报文体 + AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 + AGVModel.GetInstance.warehouseId = 123; //仓库编号 + AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 + AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 + AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 + AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 + AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 + AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; + string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + //货位到货位 + //AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 + //AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 + //AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + 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"; + } + /// + /// AGV离开炒锅3 + /// + /// + public string AgvLeaveFryPotThree(string robotJobId) + { + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel.GetInstance.appKey = ""; + HttpRequestHeaderModel.GetInstance.appSecret = ""; + HttpRequestHeaderModel.GetInstance.requestId = ""; + HttpRequestHeaderModel.GetInstance.timestamp = ""; + HttpRequestHeaderModel.GetInstance.version = "2.8"; + string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); + //请求报文体 + AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 + AGVModel.GetInstance.warehouseId = 123; //仓库编号 + AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 + AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 + AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 + AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 + AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 + AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; + string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + //货位到货位 + //AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 + //AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 + //AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + 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"; + } + /// + /// AGV离开炒锅4 + /// + /// + public string AgvLeaveFryPotFour(string robotJobId) + { + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel.GetInstance.appKey = ""; + HttpRequestHeaderModel.GetInstance.appSecret = ""; + HttpRequestHeaderModel.GetInstance.requestId = ""; + HttpRequestHeaderModel.GetInstance.timestamp = ""; + HttpRequestHeaderModel.GetInstance.version = "2.8"; + string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); + //请求报文体 + AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 + AGVModel.GetInstance.warehouseId = 123; //仓库编号 + AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 + AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 + AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 + AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 + AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 + AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; + string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + //货位到货位 + //AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 + //AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 + //AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + 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"; + } + /// + /// AGV离开炒锅5 + /// + /// + public string AgvLeaveFryPotFive(string robotJobId) + { + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel.GetInstance.appKey = ""; + HttpRequestHeaderModel.GetInstance.appSecret = ""; + HttpRequestHeaderModel.GetInstance.requestId = ""; + HttpRequestHeaderModel.GetInstance.timestamp = ""; + HttpRequestHeaderModel.GetInstance.version = "2.8"; + string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); + //请求报文体 + AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 + AGVModel.GetInstance.warehouseId = 123; //仓库编号 + AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 + AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 + AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 + AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 + AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 + AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; + string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + //货位到货位 + //AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 + //AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 + //AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + 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"; + } + /// + /// 任务取消 + /// + /// 上游系统任务号,全局唯一 + 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"; + } + /// + /// 实操任务完成通知 + /// + /// + 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"; + } + /// + /// AGV上下料交互反馈 + /// + /// AGV编号 + /// 任务编号 + /// 消息编号 + /// + 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"; + } + } +} diff --git a/BPASmartClient.AGV/AGVLoadInteracteModel.cs b/BPASmartClient.AGV/AGVLoadInteracteModel.cs new file mode 100644 index 00000000..ec1c6a8c --- /dev/null +++ b/BPASmartClient.AGV/AGVLoadInteracteModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.AGV +{ + /// + /// AGV上下料交互反馈接口(上游系统->快仓系统) + /// + 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; } + public bool? complete { get; set; } + } +} diff --git a/BPASmartClient.AGV/AGVModel.cs b/BPASmartClient.AGV/AGVModel.cs new file mode 100644 index 00000000..e58a17ff --- /dev/null +++ b/BPASmartClient.AGV/AGVModel.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.AGV +{ + /// + /// AGV任务下发 + /// + internal class AGVModel + { + private static AGVModel _instance; + public static AGVModel GetInstance => _instance ??= new AGVModel(); + + /// + /// 必填项 + /// + public string robotJobId { get; set; } + /// + /// 必填项 + /// + public long warehouseId { get; set; } + public string? robotJobGroupId { get; set; } + public int? sequence { get; set; } + /// + /// 必填项 + /// + public int jobPriority { get; set; } + /// + /// 必填项 + /// + public int jobPriorityType { get; set; } + public string? deadline { get; set; } + public string? agvType { get; set; } + public string? agvEndPoint { get; set; } + public bool? needOperation { get; set; } + public string? agvCode { get; set; } + public int? taskCountDown { get; set; } + public string? businessType { get; set; } + /// + /// 必填项 + /// + public string jobType { get; set; } + /// + /// 必填项 + /// + public IJobData jobData { get; set; } + + } +} diff --git a/BPASmartClient.AGV/AGVRequestUrl.cs b/BPASmartClient.AGV/AGVRequestUrl.cs new file mode 100644 index 00000000..c1b758e2 --- /dev/null +++ b/BPASmartClient.AGV/AGVRequestUrl.cs @@ -0,0 +1,43 @@ +namespace BPASmartClient.AGV +{ + public class AGVRequestUrl + { + 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"; + AGVInteracteUrl= $"http://{IpAddress}/api/quicktron/wcs/standardized.roller.job.upstream.response"; + } + + + #region Url汇总 + //各种AGV的移动及搬运任务。 + // 本接口请求参数包含公共字段及具体任务字段两部分组成。 + //支持批量任务下发。 + public string TaskSendUrl { get; set; } + + //货架搬运任务指令下发后,允许上游系统调用该接口取消移位任务,支持取消策略。不同车型允许取消的任务节点不同,具体信息见API文档 + public string TaskCancelUrl { get; set; } + + //工作站任务实操完成后调用该接口。如果bucket有其他任务去执行其他任务。在线工作站货架直接回库,离线工作站分配AGV回库。 + public string TaskCompleteUrl { get; set; } + + //1.辊筒AGV在手动上下料时请求上游交互后,上游下发的反馈接口 + //2.料箱AGV在任务下发需要和上游进行交互时调用此接口 + //3.翻板车AGV在投递点前确认时上游反馈接口 + public string AGVInteracteUrl { get; set; } + #endregion + } +} + + + + + + + + diff --git a/BPASmartClient.AGV/AGVTaskCancelModel.cs b/BPASmartClient.AGV/AGVTaskCancelModel.cs new file mode 100644 index 00000000..b1a0edf1 --- /dev/null +++ b/BPASmartClient.AGV/AGVTaskCancelModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.AGV +{ + /// + /// AGV任务取消 + /// + 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; } + public string? reason { get; set; } + } +} diff --git a/BPASmartClient.AGV/AGVTaskCompleteNotifyModel.cs b/BPASmartClient.AGV/AGVTaskCompleteNotifyModel.cs new file mode 100644 index 00000000..80f918f3 --- /dev/null +++ b/BPASmartClient.AGV/AGVTaskCompleteNotifyModel.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.AGV +{ + /// + /// AGV任务完成通知 + /// + 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; } + public long warehouseId { get; set; } + public bool? nullFlag { get; set; } + public string? jobId { get; set; } + } +} diff --git a/BPASmartClient.AGV/AGV_PointRollerJobData.cs b/BPASmartClient.AGV/AGV_PointRollerJobData.cs new file mode 100644 index 00000000..c54766ed --- /dev/null +++ b/BPASmartClient.AGV/AGV_PointRollerJobData.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.AGV +{ + /// + /// 辊筒点到点搬运 + /// + 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; } + public bool autoLoad { get; set; } + public bool enableIOLoad { get; set; } + public bool autoUnload { get; set; } + public bool enableIOUnload { get; set; } + public long? loadEquipmentId { get; set; } = null; + public long? unloadEquipmentId { get; set; } = null; + public bool? loadInteractive { get; set; } + public int? loadHeight { get; set; } + public int? unloadHeight { get; set; } + } +} diff --git a/BPASmartClient.AGV/AGV_SlotRollerJobData.cs b/BPASmartClient.AGV/AGV_SlotRollerJobData.cs new file mode 100644 index 00000000..28aab53d --- /dev/null +++ b/BPASmartClient.AGV/AGV_SlotRollerJobData.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.AGV +{ + /// + /// 辊筒货位到货位搬运 + /// + 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 startSlotCode { get; set; } + public string endSlotCode { get; set; } + public bool autoLoad { get; set; } + public bool enableIOLoad { get; set; } + public bool autoUnload { get; set; } + public bool enableIOUnload { get; set; } + public long? loadEquipmentId { get; set; } = null; + public long? unLoadEquipmentId { get; set; } = null; + + public bool? loadInteractive { get; set; } + } +} diff --git a/BPASmartClient.AGV/App.config b/BPASmartClient.AGV/App.config new file mode 100644 index 00000000..68751874 --- /dev/null +++ b/BPASmartClient.AGV/App.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/BPASmartClient.AGV/BPASmartClient.AGV.csproj b/BPASmartClient.AGV/BPASmartClient.AGV.csproj new file mode 100644 index 00000000..6d1c8e2b --- /dev/null +++ b/BPASmartClient.AGV/BPASmartClient.AGV.csproj @@ -0,0 +1,14 @@ + + + + net6.0 + enable + enable + + + + + + + + diff --git a/BPASmartClient.AGV/Enums/AGVMove.cs b/BPASmartClient.AGV/Enums/AGVMove.cs new file mode 100644 index 00000000..74a1b645 --- /dev/null +++ b/BPASmartClient.AGV/Enums/AGVMove.cs @@ -0,0 +1,25 @@ +namespace BPASmartClient.AGV.Enums +{ + /// + /// AGV移动任务枚举 + /// + public enum AGVMove + { + /// + /// 任务完成 + /// + DONE, + /// + /// 任务取消 + /// + CANCEL, + /// + /// 任务异常取消 + /// + ABNORMAL_CANCEL, + /// + /// 任务异常完成 + /// + ABNORMAL_COMPLETED + } +} diff --git a/BPASmartClient.AGV/Enums/BinTask.cs b/BPASmartClient.AGV/Enums/BinTask.cs new file mode 100644 index 00000000..e327c374 --- /dev/null +++ b/BPASmartClient.AGV/Enums/BinTask.cs @@ -0,0 +1,37 @@ +namespace BPASmartClient.AGV.Enums +{ + /// + /// 纯料箱任务枚举 + /// + public enum BinTask + { + /// + /// 开始移动(仅单插臂或单夹报,2.8.1后) + /// + MOVE_BEGIN, + /// + /// 到站 + /// + ENTER_STATION, + /// + /// 任务完成 + /// + DONE, + /// + /// 取料完成 + /// + LOAD_COMPLETED, + /// + /// 放料完成 + /// + UNLOAD_COMPLETED, + /// + /// 任务异常取消 + /// + ABNORMAL_CANCEL, + /// + /// 任务异常完成 + /// + ABNORMAL_COMPLETED, + } +} diff --git a/BPASmartClient.AGV/Enums/CTC.cs b/BPASmartClient.AGV/Enums/CTC.cs new file mode 100644 index 00000000..81eac3d9 --- /dev/null +++ b/BPASmartClient.AGV/Enums/CTC.cs @@ -0,0 +1,33 @@ +namespace BPASmartClient.AGV.Enums +{ + /// + /// 货位到货位/点到点辊筒料箱搬运任务枚举 + /// + public enum CTC + { + /// + /// 正在上料 + /// + ROLLER_LOAD_DOING, + /// + /// 上料完成 + /// + ROLLER_LOAD_FINISH, + /// + /// 正在下料 + /// + ROLLER_UNLOAD_DOING, + /// + /// 下料完成 + /// + DONE, + /// + /// 任务异常取消 + /// + ABNORMAL_CANCEL, + /// + /// 任务异常完成 + /// + ABNORMAL_COMPLETED, + } +} diff --git a/BPASmartClient.AGV/Enums/JobType.cs b/BPASmartClient.AGV/Enums/JobType.cs new file mode 100644 index 00000000..186da4f3 --- /dev/null +++ b/BPASmartClient.AGV/Enums/JobType.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.AGV.Enums +{ + public enum JobType + { + /// + /// 货位到货位搬运 + /// + SLOT_ROLLER_MOVE, + /// + /// 点到点搬运 + /// + POINT_ROLLER_MOVE + } +} diff --git a/BPASmartClient.AGV/Enums/QuickPickTask.cs b/BPASmartClient.AGV/Enums/QuickPickTask.cs new file mode 100644 index 00000000..a7eace63 --- /dev/null +++ b/BPASmartClient.AGV/Enums/QuickPickTask.cs @@ -0,0 +1,29 @@ +namespace BPASmartClient.AGV.Enums +{ + /// + /// QuickPick任务枚举 + /// + public enum QuickPickTask + { + /// + /// 到站 + /// + ENTER_STATION, + /// + /// 任务完成 + /// + DONE, + /// + /// 任务取消 + /// + CANCEL, + /// + /// 离站 + /// + LEAVE_STATION, + /// + /// 回滚(有其他任务,当前任务可不执行) + /// + ROLLBACK + } +} diff --git a/BPASmartClient.AGV/Enums/STC.cs b/BPASmartClient.AGV/Enums/STC.cs new file mode 100644 index 00000000..a4d56a40 --- /dev/null +++ b/BPASmartClient.AGV/Enums/STC.cs @@ -0,0 +1,37 @@ +namespace BPASmartClient.AGV.Enums +{ + /// + /// 货架/货位/点到点货架搬运任务枚举 + /// + public enum STC + { + /// + /// //顶升完成 + /// + LIFT_UP_DONE, + /// + /// 开始移动 + /// + MOVE_BEGIN, + /// + /// 放下完成 + /// + PUT_DOWN_DONE, + /// + /// 任务完成 + /// + DONE, + /// + /// 任务取消 + /// + CANCEL, + /// + /// 任务异常取消 + /// + ABNORMAL_CANCEL, + /// + /// 任务异常完成 + /// + ABNORMAL_COMPLETED, + } +} diff --git a/BPASmartClient.AGV/Enums/SmallBelt.cs b/BPASmartClient.AGV/Enums/SmallBelt.cs new file mode 100644 index 00000000..f7797dfe --- /dev/null +++ b/BPASmartClient.AGV/Enums/SmallBelt.cs @@ -0,0 +1,13 @@ +namespace BPASmartClient.AGV.Enums +{ + /// + /// 小皮带任务枚举 + /// + public enum SmallBelt + { + /// + /// 任务完成 + /// + DONE + } +} diff --git a/BPASmartClient.AGV/Feedback/AGVToUpSystem.cs b/BPASmartClient.AGV/Feedback/AGVToUpSystem.cs new file mode 100644 index 00000000..41315450 --- /dev/null +++ b/BPASmartClient.AGV/Feedback/AGVToUpSystem.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.AGV.Feedback +{ + public class AGVToUpSystem + { + /// + /// 上游系统任务号,全局唯一 + /// + public string robotJobId { get; set; } + + /// + /// 仓库编号 + /// + public int warehouseId { get; set; } + + /// + /// 任务快仓系统编号 + /// + public string jobId { get; set; } + + /// + /// 任务状态 + /// + public string state { get; set; } + + /// + /// 内部任务类型 + /// + public string jobType { get; set; } + + /// + /// 数据字段 + /// + public JobData jobData { get; set; } = new JobData(); + } +} diff --git a/BPASmartClient.AGV/Feedback/AGVUpReportHeader.cs b/BPASmartClient.AGV/Feedback/AGVUpReportHeader.cs new file mode 100644 index 00000000..5c3864d8 --- /dev/null +++ b/BPASmartClient.AGV/Feedback/AGVUpReportHeader.cs @@ -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; } + } +} diff --git a/BPASmartClient.AGV/Feedback/JobData.cs b/BPASmartClient.AGV/Feedback/JobData.cs new file mode 100644 index 00000000..1eddc7ff --- /dev/null +++ b/BPASmartClient.AGV/Feedback/JobData.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.AGV.Feedback +{ + public class JobData + { + /// + /// AGV编号 + /// + public string agvCode { get; set; } + + /// + /// 容器编号 + /// + public string containerCode { get; set; } + + /// + /// 上料点位 + /// + public string startPointCode { get; set; } + + /// + /// 上料货位编号 + /// + public string startSlotCode { get; set; } + + /// + /// 下料点位 + /// + public string targetPointCode { get; set; } + + /// + /// 下料货位编号 + /// + public string targetSlotCode { get; set; } + + /// + /// 是否需要上料交互 + /// + public bool loadInteractive { get; set; } + } +} diff --git a/BPASmartClient.AGV/Feedback/Upstreamrequest.cs b/BPASmartClient.AGV/Feedback/Upstreamrequest.cs new file mode 100644 index 00000000..411189a1 --- /dev/null +++ b/BPASmartClient.AGV/Feedback/Upstreamrequest.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.AGV.Feedback +{ + public class Upstreamrequest + { + /// + /// AGV编号 + /// + public string agvCode { get; set; } + + /// + /// 容器编号,如果一次上/下多个容器,则多个容器用英文逗号分隔 + /// + public string containerCode { get; set; } + + /// + /// 上游设备ID 本字段适用于只有一个辊筒设备的时候使用 + /// + public long equipmentId { get; set; } + + /// + /// 上游设备ID,多个用英文逗号分隔 本字段适用于多辊筒同时上下料的时候使用 + /// + public string equipmentIds { get; set; } + + /// + /// 快仓任务编号 + /// + public string jobId { get; set; } + + /// + /// 消息ID + /// + public string msgId { get; set; } + + /// + /// 交互阶段 + /// LOAD:上料阶段 + /// UNLOAD:下料阶段 + /// + public string command { get; set; } + + /// + /// 上游任务号 + /// + public string robotJobId { get; set; } + } +} diff --git a/BPASmartClient.AGV/HttpRequestHeaderModel.cs b/BPASmartClient.AGV/HttpRequestHeaderModel.cs new file mode 100644 index 00000000..f512f103 --- /dev/null +++ b/BPASmartClient.AGV/HttpRequestHeaderModel.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.AGV +{ + internal class HttpRequestHeaderModel + { + 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; } + } +} diff --git a/BPASmartClient.AGV/HttpResponseBodyModel.cs b/BPASmartClient.AGV/HttpResponseBodyModel.cs new file mode 100644 index 00000000..c0cafc58 --- /dev/null +++ b/BPASmartClient.AGV/HttpResponseBodyModel.cs @@ -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; } + } +} diff --git a/BPASmartClient.AGV/HttpResponseData.cs b/BPASmartClient.AGV/HttpResponseData.cs new file mode 100644 index 00000000..9e843d58 --- /dev/null +++ b/BPASmartClient.AGV/HttpResponseData.cs @@ -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 HttpResponseData + { + public string code { get; set; } + public bool message { get; set; } + public string robotJobId { get; set; } + } +} diff --git a/BPASmartClient.AGV/HttpResponseHeaderModel.cs b/BPASmartClient.AGV/HttpResponseHeaderModel.cs new file mode 100644 index 00000000..5ff914d8 --- /dev/null +++ b/BPASmartClient.AGV/HttpResponseHeaderModel.cs @@ -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; } + } +} diff --git a/BPASmartClient.AGV/HttpResponseModel.cs b/BPASmartClient.AGV/HttpResponseModel.cs new file mode 100644 index 00000000..40ed05ed --- /dev/null +++ b/BPASmartClient.AGV/HttpResponseModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.AGV +{ + internal class HttpResponseModel + { + public HttpResponseHeaderModel? Header { get; set; } + public HttpResponseBodyModel? Body { get; set; } + } +} diff --git a/BPASmartClient.AGV/JobData.cs b/BPASmartClient.AGV/JobData.cs new file mode 100644 index 00000000..6e482e07 --- /dev/null +++ b/BPASmartClient.AGV/JobData.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.AGV +{ + public interface IJobData + { + + } +} diff --git a/BPASmartClient.AgvApi/BPASmartClient.AgvApi.csproj b/BPASmartClient.AgvApi/BPASmartClient.AgvApi.csproj new file mode 100644 index 00000000..598b0935 --- /dev/null +++ b/BPASmartClient.AgvApi/BPASmartClient.AgvApi.csproj @@ -0,0 +1,17 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + diff --git a/BPASmartClient.AgvApi/Controllers/WeatherForecastController.cs b/BPASmartClient.AgvApi/Controllers/WeatherForecastController.cs new file mode 100644 index 00000000..60eaac99 --- /dev/null +++ b/BPASmartClient.AgvApi/Controllers/WeatherForecastController.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Mvc; + +namespace BPASmartClient.AgvApi.Controllers +{ + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateTime.Now.AddDays(index), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } + } +} \ No newline at end of file diff --git a/BPASmartClient.AgvApi/Controllers/robotjobController.cs b/BPASmartClient.AgvApi/Controllers/robotjobController.cs new file mode 100644 index 00000000..a0c6865d --- /dev/null +++ b/BPASmartClient.AgvApi/Controllers/robotjobController.cs @@ -0,0 +1,69 @@ +using BPASmartClient.AGV.Feedback; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.SignalR; +using Newtonsoft.Json; + +namespace BPASmartClient.AgvApi.Controllers +{ + [ApiController] + [Route("apicallback/quicktron/[Controller]")] + public class robotjobController : ControllerBase + { + /// + /// 搬运任务状态上报 + /// + /// + /// + [HttpPost("report")] + public string report(string sign) + { + if (sign != null) + { + try + { + var res = JsonConvert.DeserializeObject(sign); + if (res != null) + { + Factory.GetInstance.SendReport(res); + return "SUCCESS"; + } + } + catch (Exception ex) + { + return ex.ToString(); + } + + } + return "Error"; + } + + /// + /// AGV上下料交互请求接口 + /// + /// + /// + [HttpPost("upstreamrequest")] + public string upstreamrequest(string sign) + { + if (sign != null) + { + try + { + var res = JsonConvert.DeserializeObject(sign); + if (res != null) + { + Factory.GetInstance.SendUpstreamrequest(sign); + return "SUCCESS"; + } + } + catch (Exception ex) + { + return ex.ToString(); + } + + } + return "Error"; + } + + } +} diff --git a/BPASmartClient.AgvApi/Factory.cs b/BPASmartClient.AgvApi/Factory.cs new file mode 100644 index 00000000..80054d82 --- /dev/null +++ b/BPASmartClient.AgvApi/Factory.cs @@ -0,0 +1,25 @@ +using Microsoft.AspNetCore.SignalR; + +namespace BPASmartClient.AgvApi +{ + public class Factory + { + + private volatile static Factory _Instance; + public static Factory GetInstance => _Instance ?? (_Instance = new Factory()); + private Factory() { } + + public IHubCallerClients HubCallerClient { get; set; } + + public Task SendReport(object obj) + { + return HubCallerClient?.Caller.SendAsync("Report", obj); + } + + public Task SendUpstreamrequest(object obj) + { + return HubCallerClient?.Caller.SendAsync("Upstreamrequest", obj); + } + + } +} diff --git a/BPASmartClient.AgvApi/PersonHub.cs b/BPASmartClient.AgvApi/PersonHub.cs new file mode 100644 index 00000000..15c8dce4 --- /dev/null +++ b/BPASmartClient.AgvApi/PersonHub.cs @@ -0,0 +1,34 @@ +using Microsoft.AspNetCore.SignalR; + +namespace BPASmartClient.AgvApi +{ + public class PersonHub : Hub + { + + public override Task OnConnectedAsync() + { + Console.WriteLine($"{Context.ConnectionId}:= 连接成功"); + Factory.GetInstance.HubCallerClient = Clients; + return base.OnConnectedAsync(); + } + + public override Task OnDisconnectedAsync(Exception? exception) + { + Console.WriteLine($"{Context.ConnectionId}:= 断开连接"); + return base.OnDisconnectedAsync(exception); + } + + /// + /// 接收客户端发来的信息,并向客户端发送信息 + /// + /// + /// + public Task Send(object str) + { + return Clients.Caller.SendAsync("SendMessage", str); + } + + + + } +} diff --git a/BPASmartClient.AgvApi/Program.cs b/BPASmartClient.AgvApi/Program.cs new file mode 100644 index 00000000..353c3635 --- /dev/null +++ b/BPASmartClient.AgvApi/Program.cs @@ -0,0 +1,40 @@ +using BPASmartClient.AgvApi; +using Microsoft.AspNetCore.Cors.Infrastructure; + + + +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); +builder.Services.AddSignalR(); +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.Use(async (context, next) => +{ + context.Request.Headers["appKey"] = "0123456789abcdef"; + context.Response.Headers["appSecret"] = "0123456789abcdef"; + context.Response.Headers["requestId"] = "5f643ece-dc53-4d55-8e5f-d1e2dfd6a6d0"; + context.Response.Headers["timestamp"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + context.Response.Headers["version"] = "2.8"; + await next(); +}); + + +app.UseAuthorization(); + +app.MapControllers(); +app.MapHub("/personhub"); + +app.Run(); diff --git a/BPASmartClient.AgvApi/Properties/launchSettings.json b/BPASmartClient.AgvApi/Properties/launchSettings.json new file mode 100644 index 00000000..821e5716 --- /dev/null +++ b/BPASmartClient.AgvApi/Properties/launchSettings.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:38659", + "sslPort": 0 + } + }, + "profiles": { + "BPASmartClient.AgvApi": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5175", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/BPASmartClient.AgvApi/WeatherForecast.cs b/BPASmartClient.AgvApi/WeatherForecast.cs new file mode 100644 index 00000000..d2bb41ee --- /dev/null +++ b/BPASmartClient.AgvApi/WeatherForecast.cs @@ -0,0 +1,13 @@ +namespace BPASmartClient.AgvApi +{ + public class WeatherForecast + { + public DateTime Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } + } +} \ No newline at end of file diff --git a/BPASmartClient.AgvApi/appsettings.Development.json b/BPASmartClient.AgvApi/appsettings.Development.json new file mode 100644 index 00000000..0c208ae9 --- /dev/null +++ b/BPASmartClient.AgvApi/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/BPASmartClient.AgvApi/appsettings.json b/BPASmartClient.AgvApi/appsettings.json new file mode 100644 index 00000000..10f68b8c --- /dev/null +++ b/BPASmartClient.AgvApi/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/BPASmartClient.Business/BPASmartClient.Business.csproj b/BPASmartClient.Business/BPASmartClient.Business.csproj index a6ae8690..5acb186c 100644 --- a/BPASmartClient.Business/BPASmartClient.Business.csproj +++ b/BPASmartClient.Business/BPASmartClient.Business.csproj @@ -8,7 +8,7 @@ - + diff --git a/BPASmartClient.Business/Plugin/DeviceMgr.cs b/BPASmartClient.Business/Plugin/DeviceMgr.cs index cc2245e9..3a81e207 100644 --- a/BPASmartClient.Business/Plugin/DeviceMgr.cs +++ b/BPASmartClient.Business/Plugin/DeviceMgr.cs @@ -5,6 +5,7 @@ using BPASmartClient.Helper; using BPASmartClient.Http; using BPASmartClient.Message; using BPASmartClient.Model; +using BPASmartClient.Model.小炒机; using BPASmartClient.Peripheral; using Newtonsoft.Json; using System; @@ -128,6 +129,15 @@ namespace BPASmartClient.Business MessageLog.GetInstance.Show($"物料ID:=[{x.BatchingId}],{x.BatchingLoc}号位置:{x.BatchingCount}"); }); } + else if (PushType == 2)//小炒API流程获取,待定 + { + new StirFryGoodsEvent() + { + DeviceId = device.DeviceId, + stirFrymessage = JsonConvert.DeserializeObject(result) + }.Publish(); + MessageLog.GetInstance.Show("接收到【 API 】获取的小炒流程信息"); + } } catch (Exception ex) { diff --git a/BPASmartClient.Business/Plugin/MQTTMgr.cs b/BPASmartClient.Business/Plugin/MQTTMgr.cs index 9dbb18f7..6f8765c9 100644 --- a/BPASmartClient.Business/Plugin/MQTTMgr.cs +++ b/BPASmartClient.Business/Plugin/MQTTMgr.cs @@ -46,12 +46,11 @@ namespace BPASmartClient.Business mqttProxy.Connected = new Action(() => { mqttProxy.Subscrib(TopicDefine.GetInstance().SubscribTopics.ToArray()); - MessageLog.GetInstance.Show("MQTT 连接成功"); }); //MQTT 连接成功 mqttProxy.LostConnect = new Action(() => { - MqttHelper.GetInstance().MqttSubscriptionAsync(TopicDefine.GetInstance().SubscribTopics.ToArray()); + mqttProxy.Subscrib(TopicDefine.GetInstance().SubscribTopics.ToArray()); }); //MQTT 数据接收 mqttProxy.MessageRecive = new Action((message) => diff --git a/BPASmartClient.Business/Plugin/OrderProxy.cs b/BPASmartClient.Business/Plugin/OrderProxy.cs index 04903d74..7e3b4e34 100644 --- a/BPASmartClient.Business/Plugin/OrderProxy.cs +++ b/BPASmartClient.Business/Plugin/OrderProxy.cs @@ -1,11 +1,14 @@ //#define test using BPA.Message; using BPA.Message.Enum; +using BPA.Models; +using BPASmartClient.Device; using BPASmartClient.EventBus; using BPASmartClient.Helper; using BPASmartClient.Http; using BPASmartClient.Message; using BPASmartClient.Model; +using BPASmartClient.Model.小炒机; using Newtonsoft.Json; using System; using System.Collections.Concurrent; @@ -99,6 +102,18 @@ namespace BPASmartClient.Business MessageLog.GetInstance.Show($"物料ID:=[{x.BatchingId}],{x.BatchingLoc}号位置:{x.BatchingCount}"); }); } + //小炒流程信息 + else if (message is StirFryPushMessage frybom) + { + IDevice device = deviceMgr.GetDevices().FirstOrDefault(x => x.DeviceId == 28); + new StirFryGoodsEvent() { + DeviceId = device.DeviceId, + stirFrymessage =frybom + }.Publish(); + MessageLog.GetInstance.Show("接受到【MQTT】的小炒流程信息"); + + + } }); EventBus.EventBus.GetInstance().Subscribe(0, OrderStatusChangedHandle); diff --git a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj index b726d000..becbdc01 100644 --- a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj +++ b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj @@ -19,8 +19,18 @@ + + + + + + + + + + @@ -93,12 +103,16 @@ + + + + @@ -107,6 +121,8 @@ + + @@ -144,6 +160,7 @@ + @@ -173,6 +190,7 @@ + @@ -196,7 +214,24 @@ + + PreserveNewest + + + + + + + + + + + + + + + @@ -214,11 +249,18 @@ + + + + PreserveNewest + + + @@ -232,6 +274,7 @@ + @@ -240,11 +283,16 @@ - + + + + + + + - diff --git a/BPASmartClient.CustomResource/Converters/StatusConverter.cs b/BPASmartClient.CustomResource/Converters/StatusConverter.cs new file mode 100644 index 00000000..f84cf7b8 --- /dev/null +++ b/BPASmartClient.CustomResource/Converters/StatusConverter.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Media; + +namespace BPASmartClient.CustomResource.Converters +{ + public class StatusConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + SolidColorBrush returnValue = Brushes.SandyBrown; + if (value != null && value is ushort statusValue) + { + switch (statusValue) + { + case 0: + returnValue = Brushes.SandyBrown; + break; + case 1: + returnValue = Brushes.Green; + break; + case 2: + returnValue = Brushes.Yellow; + break; + case 3: + returnValue = Brushes.Aqua; + break; + case 4: + returnValue = Brushes.Red; + break; + default: + break; + } + } + return returnValue; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/BPASmartClient.CustomResource/Fonts/80号-萌趣小鱼体.ttf b/BPASmartClient.CustomResource/Fonts/80号-萌趣小鱼体.ttf new file mode 100644 index 00000000..c846b3b6 Binary files /dev/null and b/BPASmartClient.CustomResource/Fonts/80号-萌趣小鱼体.ttf differ diff --git a/BPASmartClient.CustomResource/Fonts/iconfont.ttf b/BPASmartClient.CustomResource/Fonts/iconfont.ttf index a7a3e323..cfd9141e 100644 Binary files a/BPASmartClient.CustomResource/Fonts/iconfont.ttf and b/BPASmartClient.CustomResource/Fonts/iconfont.ttf differ diff --git a/BPASmartClient.CustomResource/Image/AGV/停车位.png b/BPASmartClient.CustomResource/Image/AGV/停车位.png new file mode 100644 index 00000000..12e0e689 Binary files /dev/null and b/BPASmartClient.CustomResource/Image/AGV/停车位.png differ diff --git a/BPASmartClient.CustomResource/Image/AGV/充电桩.png b/BPASmartClient.CustomResource/Image/AGV/充电桩.png new file mode 100644 index 00000000..9931a41b Binary files /dev/null and b/BPASmartClient.CustomResource/Image/AGV/充电桩.png differ diff --git a/BPASmartClient.CustomResource/Image/AGV/墙.png b/BPASmartClient.CustomResource/Image/AGV/墙.png new file mode 100644 index 00000000..cf81aade Binary files /dev/null and b/BPASmartClient.CustomResource/Image/AGV/墙.png differ diff --git a/BPASmartClient.CustomResource/Image/AGV/汤碗.png b/BPASmartClient.CustomResource/Image/AGV/汤碗.png new file mode 100644 index 00000000..99cb5e69 Binary files /dev/null and b/BPASmartClient.CustomResource/Image/AGV/汤碗.png differ diff --git a/BPASmartClient.CustomResource/Image/AGV/炒锅.png b/BPASmartClient.CustomResource/Image/AGV/炒锅.png new file mode 100644 index 00000000..cb917fd9 Binary files /dev/null and b/BPASmartClient.CustomResource/Image/AGV/炒锅.png differ diff --git a/BPASmartClient.CustomResource/Image/AGV/物流车.png b/BPASmartClient.CustomResource/Image/AGV/物流车.png new file mode 100644 index 00000000..5ce43fe9 Binary files /dev/null and b/BPASmartClient.CustomResource/Image/AGV/物流车.png differ diff --git a/BPASmartClient.CustomResource/Image/AGV/砖块.png b/BPASmartClient.CustomResource/Image/AGV/砖块.png new file mode 100644 index 00000000..1de8c586 Binary files /dev/null and b/BPASmartClient.CustomResource/Image/AGV/砖块.png differ diff --git a/BPASmartClient.CustomResource/Image/AGV/蔬菜.png b/BPASmartClient.CustomResource/Image/AGV/蔬菜.png new file mode 100644 index 00000000..4a4b57cd Binary files /dev/null and b/BPASmartClient.CustomResource/Image/AGV/蔬菜.png differ diff --git a/BPASmartClient.CustomResource/Image/AGV/语音箭头.png b/BPASmartClient.CustomResource/Image/AGV/语音箭头.png new file mode 100644 index 00000000..af6d5b03 Binary files /dev/null and b/BPASmartClient.CustomResource/Image/AGV/语音箭头.png differ diff --git a/BPASmartClient.CustomResource/Image/工艺流程.jpg b/BPASmartClient.CustomResource/Image/工艺流程.jpg new file mode 100644 index 00000000..7863056e Binary files /dev/null and b/BPASmartClient.CustomResource/Image/工艺流程.jpg differ diff --git a/BPASmartClient.CustomResource/Image/工艺流程.png b/BPASmartClient.CustomResource/Image/工艺流程.png new file mode 100644 index 00000000..8a0e23ec Binary files /dev/null and b/BPASmartClient.CustomResource/Image/工艺流程.png differ diff --git a/BPASmartClient.CustomResource/Image/智慧城市科技风登录页面.png b/BPASmartClient.CustomResource/Image/智慧城市科技风登录页面.png new file mode 100644 index 00000000..b731d72f Binary files /dev/null and b/BPASmartClient.CustomResource/Image/智慧城市科技风登录页面.png differ diff --git a/BPASmartClient.CustomResource/Image/智慧城市科技风登录页面边框.png b/BPASmartClient.CustomResource/Image/智慧城市科技风登录页面边框.png new file mode 100644 index 00000000..7fc4d56f Binary files /dev/null and b/BPASmartClient.CustomResource/Image/智慧城市科技风登录页面边框.png differ diff --git a/BPASmartClient.CustomResource/Image/登录界面背景.jpg b/BPASmartClient.CustomResource/Image/登录界面背景.jpg new file mode 100644 index 00000000..ca2431ce Binary files /dev/null and b/BPASmartClient.CustomResource/Image/登录界面背景.jpg differ diff --git a/BPASmartClient.CustomResource/Image/登录界面背景1.jpg b/BPASmartClient.CustomResource/Image/登录界面背景1.jpg new file mode 100644 index 00000000..1eab1f9f Binary files /dev/null and b/BPASmartClient.CustomResource/Image/登录界面背景1.jpg differ diff --git a/BPASmartClient.CustomResource/Image/背景3.jpg b/BPASmartClient.CustomResource/Image/背景3.jpg new file mode 100644 index 00000000..c94e3e9c Binary files /dev/null and b/BPASmartClient.CustomResource/Image/背景3.jpg differ diff --git a/BPASmartClient.CustomResource/Image/顶部切图/自动化产线上位机控制系统.png b/BPASmartClient.CustomResource/Image/顶部切图/自动化产线上位机控制系统.png new file mode 100644 index 00000000..245dd258 Binary files /dev/null and b/BPASmartClient.CustomResource/Image/顶部切图/自动化产线上位机控制系统.png differ diff --git a/BPASmartClient.CustomResource/Pages/Enums/Permission.cs b/BPASmartClient.CustomResource/Pages/Enums/Permission.cs new file mode 100644 index 00000000..04c560f9 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Enums/Permission.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.CustomResource.Pages.Enums +{ + public enum Permission : int + { + 管理员 = 1, + 操作员 = 2, + 观察员 = 3, + 技术员 = 4 + } +} diff --git a/BPASmartClient.CustomResource/Pages/Model/AlarmAttribute.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmAttribute.cs new file mode 100644 index 00000000..391c0941 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Model/AlarmAttribute.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.CustomResource.Pages.Model +{ + [AttributeUsage(AttributeTargets.Property)] + public class AlarmAttribute : Attribute + { + public AlarmAttribute(string Info, AlarmTriggerType alarmTriggerType = AlarmTriggerType.Rising, AlarmLevel alarmLevel = AlarmLevel.一般报警) + { + AlarmInfo = Info; + AlarmType = alarmTriggerType; + @AlarmLevel = alarmLevel; + } + + /// + /// 报警信息 + /// + public string AlarmInfo { get; set; } + + /// + /// 告警类型 + /// + public AlarmTriggerType AlarmType { get; set; } + + /// + /// 告警级别 + /// + public AlarmLevel @AlarmLevel { get; set; } + } +} diff --git a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs new file mode 100644 index 00000000..f24df307 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs @@ -0,0 +1,125 @@ +using BPASmartClient.Helper; +//using BPASmartClient.Message; +using BPASmartClient.Model; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Collections.ObjectModel; +using System.Windows; + +namespace BPASmartClient.CustomResource.Pages.Model +{ + public class AlarmHelper where AlarmT : class, new() + { + public static ObservableCollection Alarms { get; set; } = new ObservableCollection(); + public static List HistoryAlarms { get; set; } = new List(); + static ConcurrentDictionary flagbit = new ConcurrentDictionary(); + static ConcurrentDictionary delays = new ConcurrentDictionary(); + public static Action AddAction { get; set; } + public static Action RemoveAction { get; set; } + public static Action ChangeAction { get; set; } + + public static AlarmT Alarm { get; set; } = new AlarmT(); + + public static void Init() + { + ThreadManage.GetInstance().StartLong(new Action(() => + { + foreach (var item in Alarm.GetType().GetProperties()) + { + if (item.CustomAttributes.Count() > 0) + { + var AlarmModel = item.GetCustomAttribute(); + if (AlarmModel != null) + { + bool value = Convert.ToBoolean(Alarm.GetType().GetProperty(item.Name)?.GetValue(Alarm)); + EdgeAlarm(value, AlarmModel.AlarmInfo, 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType); + } + } + } + Thread.Sleep(100); + }), "报警通用模块监听"); + + } + + /// + /// 沿报警检测 + /// + /// 触发变量 + /// 报警信息 + /// 触发类型,上升沿 或 下降沿 + private static void EdgeAlarm(bool Trigger, string text, int delay = 2, AlarmLevel alarmLevel = AlarmLevel.一般报警, AlarmTriggerType edgeType = AlarmTriggerType.Rising) + { + if (!flagbit.ContainsKey(text)) flagbit.TryAdd(text, false); + if (!delays.ContainsKey(text)) delays.TryAdd(text, Delay.GetInstance(text)); + if (edgeType == AlarmTriggerType.Rising ? delays[text].Start(Trigger, delay) : delays[text].Start(!Trigger, delay)) + { + if (edgeType == AlarmTriggerType.Rising ? !flagbit[text] : flagbit[text]) + { + AddAlarm(Trigger, text, alarmLevel); + flagbit[text] = edgeType == AlarmTriggerType.Rising ? true : false; + } + } + else RemoveAlarm(text); + if (edgeType == AlarmTriggerType.Rising ? flagbit[text] : !flagbit[text]) flagbit[text] = Trigger; + } + + /// + /// 添加报警信息 + /// + /// 报警信息 + private static void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel) + { + Alarm tempAlarm = new Alarm() + { + NumId = Alarms.Count + 1, + Date = DateTime.Now.ToString("yyyy/MM/dd"), + Grade = alarmLevel.ToString(), + Info = AlarmInfo, + Value = value.ToString(), + Time = DateTime.Now.ToString("HH:mm:ss"), + }; + + var res = Sqlite.GetInstance.Base.Add(tempAlarm); + Sqlite.GetInstance.Save(); + + if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null) + { + Application.Current.Dispatcher.Invoke(new Action(() => + { + Alarms.Insert(0, tempAlarm); + for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; } + })); + + AddAction?.Invoke(AlarmInfo);//添加报警通知 + ChangeAction?.Invoke();//更改报警通知 + } + } + + /// + /// 移除报警信息 + /// + /// 报警信息 + private static void RemoveAlarm(string AlarmInfo) + { + var result = Alarms.FirstOrDefault(p => p.Info == AlarmInfo); + if (result != null) + { + Application.Current.Dispatcher.Invoke(new Action(() => + { + Alarms.Remove(result); + for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; } + })); + + if (RemoveAction != null) RemoveAction(AlarmInfo); + if (ChangeAction != null) ChangeAction(); + } + } + + } +} diff --git a/BPASmartClient.CustomResource/Pages/Model/AlarmLevel.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmLevel.cs new file mode 100644 index 00000000..f5e18422 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Model/AlarmLevel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.CustomResource.Pages.Model +{ + public enum AlarmLevel + { + 一般报警, + 严重报警 + } +} diff --git a/BPASmartClient.CustomResource/Pages/Model/AlarmTriggerType.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmTriggerType.cs new file mode 100644 index 00000000..2fdb7e72 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Model/AlarmTriggerType.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.CustomResource.Pages.Model +{ + public enum AlarmTriggerType + { + /// + /// 上升沿 + /// + Rising, + /// + /// 下降沿 + /// + Falling + } +} diff --git a/DosingSystem/Model/Config.cs b/BPASmartClient.CustomResource/Pages/Model/Config.cs similarity index 90% rename from DosingSystem/Model/Config.cs rename to BPASmartClient.CustomResource/Pages/Model/Config.cs index 607e43f8..16abf147 100644 --- a/DosingSystem/Model/Config.cs +++ b/BPASmartClient.CustomResource/Pages/Model/Config.cs @@ -1,4 +1,5 @@ using BPA.Message; +using BPASmartClient.CustomResource.Pages.Enums; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -7,16 +8,14 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace DosingSystem.Model +namespace BPASmartClient.CustomResource.Pages.Model { public class Config { - private volatile static Config _Instance; public static Config GetInstance => _Instance ?? (_Instance = new Config()); private Config() { } - public void Init() { if (File.Exists("up.hbl")) @@ -43,6 +42,11 @@ namespace DosingSystem.Model Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.操作员, UserName = "czy", Password = "123456" }); Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.观察员, UserName = "gcy", Password = "654321" }); Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.技术员, UserName = "jsy", Password = "88888888" }); + SaveUser(); + } + + public void SaveUser() + { File.WriteAllText("up.hbl", JsonConvert.SerializeObject(Global.userManager).AESEncrypt()); } } diff --git a/DosingSystem/Model/Global.cs b/BPASmartClient.CustomResource/Pages/Model/Global.cs similarity index 53% rename from DosingSystem/Model/Global.cs rename to BPASmartClient.CustomResource/Pages/Model/Global.cs index d068c78a..cd0a6548 100644 --- a/DosingSystem/Model/Global.cs +++ b/BPASmartClient.CustomResource/Pages/Model/Global.cs @@ -1,13 +1,17 @@ -using System; +using BPASmartClient.CustomResource.Pages.Enums; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace DosingSystem.Model +namespace BPASmartClient.CustomResource.Pages.Model { public class Global { public static UserManager userManager { get; set; } = new UserManager(); + + public static UserInfo userInfo { get; set; } = new UserInfo(); + } } diff --git a/BPASmartClient.CustomResource/Pages/Model/MenuManage.cs b/BPASmartClient.CustomResource/Pages/Model/MenuManage.cs new file mode 100644 index 00000000..143f5b24 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Model/MenuManage.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Collections.ObjectModel; +using Microsoft.Toolkit.Mvvm.ComponentModel; +using BPASmartClient.CustomResource.Pages.Enums; +using System.Windows; + +namespace BPASmartClient.CustomResource.Pages.Model +{ + /// + /// 在启动界面之前设置菜单项 + /// + public class MenuManage : ObservableObject + { + private volatile static MenuManage _Instance; + public static MenuManage GetInstance => _Instance ?? (_Instance = new MenuManage()); + private MenuManage() { } + + public ObservableCollection menuModels { get; set; } = new ObservableCollection(); + } + + public class MenuModel : ObservableObject + { + /// + /// 主菜单权限 + /// + public Permission[] MainMenuPermission { get { return _mMainMenuPermission; } set { _mMainMenuPermission = value; OnPropertyChanged(); } } + private Permission[] _mMainMenuPermission; + + /// + /// 主菜单图标 + /// + public string MainMenuIcon { get { return _mMainMenuIcon; } set { _mMainMenuIcon = value; OnPropertyChanged(); } } + private string _mMainMenuIcon = string.Empty; + + /// + /// 主菜单名称 + /// + public string MainMenuName { get { return _mMainMenuName; } set { _mMainMenuName = value; OnPropertyChanged(); } } + private string _mMainMenuName = string.Empty; + + /// + /// 别名(英文名) + /// + public string Alias { get { return _mAlias; } set { _mAlias = value; OnPropertyChanged(); } } + private string _mAlias = string.Empty; + + /// + /// 主菜单的显示隐藏设置 + /// + public Visibility MainMenuVisibility { get { return _mMainMenuVisibility; } set { _mMainMenuVisibility = value; OnPropertyChanged(); } } + private Visibility _mMainMenuVisibility; + + /// + /// 子菜单集合 + /// + public ObservableCollection subMenumodels { get; set; } = new ObservableCollection(); + + } + + public class SubMenumodel : ObservableObject + { + /// + /// 子菜单名称 + /// + public string SubMenuName { get { return _mSubMenuName; } set { _mSubMenuName = value; OnPropertyChanged(); } } + private string _mSubMenuName = string.Empty; + + /// + /// 子菜单权限管理 + /// + public Permission[] SubMenuPermission { get { return _mSubMenuPermission; } set { _mSubMenuPermission = value; OnPropertyChanged(); } } + private Permission[] _mSubMenuPermission; + + /// + /// 切换界面路径 + /// + public string ToggleWindowPath { get { return _mToggleWindowPath; } set { _mToggleWindowPath = value; OnPropertyChanged(); } } + private string _mToggleWindowPath = string.Empty; + + /// + /// 程序集名称 + /// + public string AssemblyName { get { return _mAssemblyName; } set { _mAssemblyName = value; OnPropertyChanged(); } } + private string _mAssemblyName = string.Empty; + + /// + /// 子菜单的显示隐藏设置 + /// + public Visibility SubMenuVisibility { get { return _mSubMenuVisibility; } set { _mSubMenuVisibility = value; OnPropertyChanged(); } } + private Visibility _mSubMenuVisibility; + + } + +} diff --git a/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs b/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs new file mode 100644 index 00000000..db603c1c --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs @@ -0,0 +1,68 @@ +using BPASmartClient.Helper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Collections.ObjectModel; +using System.Text; +using System.Threading.Tasks; +using System.Windows; + +namespace BPASmartClient.CustomResource.Pages.Model +{ + public class MessageLog + { + private volatile static MessageLog _Instance; + public static MessageLog GetInstance => _Instance ?? (_Instance = new MessageLog()); + private MessageLog() { } + + public Action UserLog { get; set; } + + public Action RunLog { get; set; } + + public ObservableCollection runLogs { get; set; } = new ObservableCollection(); + + public ObservableCollection userLogs { get; set; } = new ObservableCollection(); + + public void LogSave() + { + Sqlite.GetInstance.Save(); + Sqlite.GetInstance.Save(); + } + + //public void GetLog() + //{ + // Sqlite.GetInstance.GetData(); + // Sqlite.GetInstance.GetData(); + //} + + public void ShowUserLog(string info) + { + UserLog userLog = new UserLog() + { + Date = DateTime.Now.ToString("yyyy-MM-dd"), + Time = DateTime.Now.ToString("HH:mm:ss"), + Permission = Global.userInfo.permission.ToString(), + UserName = Global.userInfo.UserName, + LogInfo = info + }; + Sqlite.GetInstance.Base.Add(userLog); + Application.Current.Dispatcher.Invoke(new Action(() => { userLogs.Insert(0, userLog); })); + UserLog?.Invoke(info); + } + + public void ShowRunLog(string info) + { + RunLog runLog = new RunLog() + { + Date = DateTime.Now.ToString("yyyy-MM-dd"), + Time = DateTime.Now.ToString("HH:mm:ss"), + RunLogInfo = info + }; + Sqlite.GetInstance.Base.Add(runLog); + Application.Current.Dispatcher.Invoke(new Action(() => { runLogs.Insert(0, runLog); })); + RunLog?.Invoke(info); + } + + + } +} diff --git a/BPASmartClient.CustomResource/Pages/Model/PasswordHelper.cs b/BPASmartClient.CustomResource/Pages/Model/PasswordHelper.cs new file mode 100644 index 00000000..5cf350d7 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Model/PasswordHelper.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; + +namespace BPASmartClient.CustomResource.Pages.Model +{ + /// + /// 给PasswordBox添加一个可以绑定的附加类 + /// + public class PasswordHelper + { + + static bool IsUpdete = false; + + #region PasswordProperty + public static readonly DependencyProperty PasswordProperty = DependencyProperty.RegisterAttached("Password", typeof(string), + typeof(PasswordHelper), new FrameworkPropertyMetadata("", new PropertyChangedCallback(OnPropertyChanged))); + + + public static string GetPassword(DependencyObject d) + { + return d.GetValue(PasswordProperty).ToString(); + } + + public static void SetPassword(DependencyObject d, string value) + { + d.SetValue(PasswordProperty, value); + } + + private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + PasswordBox password = d as PasswordBox; + password.PasswordChanged -= password_PasswordChanged; + if (!IsUpdete) password.Password = e.NewValue?.ToString(); + password.PasswordChanged += password_PasswordChanged; + } + #endregion + + #region AttachProperty + public static readonly DependencyProperty AttachProperty = DependencyProperty.RegisterAttached("Attach", typeof(bool), + typeof(PasswordHelper), new FrameworkPropertyMetadata(default(bool), new PropertyChangedCallback(OnAttachChanged))); + + public static bool GetAttach(DependencyObject d) + { + return (bool)d.GetValue(AttachProperty); + } + + public static void SetAttach(DependencyObject d, bool value) + { + d.SetValue(AttachProperty, value); + } + + private static void OnAttachChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + PasswordBox password = d as PasswordBox; + password.PasswordChanged += password_PasswordChanged; + } + + private static void password_PasswordChanged(object sender, RoutedEventArgs e) + { + PasswordBox passwordBox = sender as PasswordBox; + IsUpdete = true; + SetPassword(passwordBox, passwordBox.Password); + IsUpdete = false; + } + + #endregion + } +} diff --git a/BPASmartClient.CustomResource/Pages/Model/RunLog.cs b/BPASmartClient.CustomResource/Pages/Model/RunLog.cs new file mode 100644 index 00000000..f3be25c3 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Model/RunLog.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Toolkit.Mvvm.ComponentModel; + +namespace BPASmartClient.CustomResource.Pages.Model +{ + public class RunLog : ObservableObject + { + [Key] + public int Id { get; set; } + + //public string Date { get { return _mDate; } set { _mDate = value; OnPropertyChanged(); } } + //private string _mDate; + + //public string Time { get { return _mTime; } set { _mTime = value; OnPropertyChanged(); } } + //private string _mTime; + + //public string RunLogInfo { get { return _mRunLogInfo; } set { _mRunLogInfo = value; OnPropertyChanged(); } } + //private string _mRunLogInfo; + + public string Date { get; set; } + + public string Time { get; set; } + + public string RunLogInfo { get; set; } + + } +} diff --git a/BPASmartClient.CustomResource/Pages/Model/UserInfo.cs b/BPASmartClient.CustomResource/Pages/Model/UserInfo.cs new file mode 100644 index 00000000..1164d95f --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Model/UserInfo.cs @@ -0,0 +1,17 @@ +using BPASmartClient.CustomResource.Pages.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.CustomResource.Pages.Model +{ + public class UserInfo + { + public Permission permission { get; set; } + public string UserName { get; set; } + public string Password { get; set; } + + } +} diff --git a/BPASmartClient.CustomResource/Pages/Model/UserLog.cs b/BPASmartClient.CustomResource/Pages/Model/UserLog.cs new file mode 100644 index 00000000..be1d0f31 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Model/UserLog.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Toolkit.Mvvm.ComponentModel; + +namespace BPASmartClient.CustomResource.Pages.Model +{ + public class UserLog : ObservableObject + { + [Key] + public int Id { get; set; } + + //public string Permission { get { return _mPermission; } set { _mPermission = value; OnPropertyChanged(); } } + //private string _mPermission; + + //public string Date { get { return _mDate; } set { _mDate = value; OnPropertyChanged(); } } + //private string _mDate; + + //public string Time { get { return _mTime; } set { _mTime = value; OnPropertyChanged(); } } + //private string _mTime; + + //public string LogInfo { get { return _mLogInfo; } set { _mLogInfo = value; OnPropertyChanged(); } } + //private string _mLogInfo; + + public string Permission { get; set; } + + public string Date { get; set; } + + public string Time { get; set; } + + public string UserName { get; set; } + + public string LogInfo { get; set; } + + } +} diff --git a/BPASmartClient.CustomResource/Pages/Model/UserManager.cs b/BPASmartClient.CustomResource/Pages/Model/UserManager.cs new file mode 100644 index 00000000..258199e9 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Model/UserManager.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.CustomResource.Pages.Model +{ + public class UserManager + { + public List userInfos { get; set; } = new List(); + } +} diff --git a/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml b/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml new file mode 100644 index 00000000..9e780547 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml @@ -0,0 +1,379 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml.cs new file mode 100644 index 00000000..a21a82bf --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BPASmartClient.CustomResource.Pages.View +{ + /// + /// AlarmView.xaml 的交互逻辑 + /// + public partial class AlarmView : UserControl + { + public AlarmView() + { + InitializeComponent(); + } + } +} diff --git a/BPASmartClient.CustomResource/Pages/View/LoginView.xaml b/BPASmartClient.CustomResource/Pages/View/LoginView.xaml new file mode 100644 index 00000000..35c641d5 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/View/LoginView.xaml @@ -0,0 +1,321 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml.cs new file mode 100644 index 00000000..810e1626 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BPASmartClient.CustomResource.Pages.View +{ + /// + /// RunLogView.xaml 的交互逻辑 + /// + public partial class RunLogView : UserControl + { + public RunLogView() + { + InitializeComponent(); + } + } +} diff --git a/BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml b/BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml new file mode 100644 index 00000000..99537e94 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.CustomResource/Pages/View/UserLogView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/UserLogView.xaml.cs new file mode 100644 index 00000000..1149bcbd --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/View/UserLogView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BPASmartClient.CustomResource.Pages.View +{ + /// + /// UserLogView.xaml 的交互逻辑 + /// + public partial class UserLogView : UserControl + { + public UserLogView() + { + InitializeComponent(); + } + } +} diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs new file mode 100644 index 00000000..1238f0c0 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs @@ -0,0 +1,142 @@ +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.Model; +using BPASmartClient.CustomResource.Pages.Model; + +namespace BPASmartClient.CustomResource.Pages.ViewModel +{ + public class AlarmViewModel : ObservableObject + { + public AlarmViewModel() + { + ControlCommand = new RelayCommand(() => + { + if (ControlButText == "报警复位") + { + return; + } + if (ControlButText == "开始查询") + { + var lists = Sqlite.GetInstance.GetData(); + var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList(); + if (res != null) + { + HistoryAlarm.Clear(); + foreach (var item in res) + { + HistoryAlarm.Add(item); + } + } + } + + }); + + SwitchCommand = new RelayCommand(() => + { + if (ButContent == "历史报警") + { + GetHistoryAlarm(); + CurrentDataVis = Visibility.Hidden; + HistoryDataVis = Visibility.Visible; + IsVisibility = Visibility.Visible; + ControlButText = "开始查询"; + ButContent = "实时报警"; + return; + } + + if (ButContent == "实时报警") + { + HistoryDataVis = Visibility.Hidden; + CurrentDataVis = Visibility.Visible; + IsVisibility = Visibility.Hidden; + ControlButText = "报警复位"; + ButContent = "历史报警"; + return; + } + }); + + //AlarmInfos = AlarmHelper.Alarms; + //AlarmHelper.Init(); + } + + private void GetHistoryAlarm() + { + var data = Sqlite.GetInstance.GetData(); + if (data != null) + { + HistoryAlarm.Clear(); + foreach (var item in data) + { + int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days; + if (day == 0) + { + HistoryAlarm.Add(item); + } + } + } + } + + public RelayCommand SwitchCommand { get; set; } + + public RelayCommand ControlCommand { get; set; } + + + public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } } + private Visibility _mCurrentDataVis = Visibility.Visible; + + + public Visibility HistoryDataVis { get { return _mHistoryDataVis; } set { _mHistoryDataVis = value; OnPropertyChanged(); } } + private Visibility _mHistoryDataVis = Visibility.Hidden; + + + /// + /// 是否显示 + /// + public Visibility IsVisibility { get { return _mIsVisibility; } set { _mIsVisibility = value; OnPropertyChanged(); } } + private Visibility _mIsVisibility = Visibility.Hidden; + + /// + /// 文字显示 + /// + public string ButContent { get { return _mButContent; } set { _mButContent = value; OnPropertyChanged(); } } + private string _mButContent = "历史报警"; + + /// + /// 控制按钮文本显示 + /// + public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } } + private string _mControlButText = "报警复位"; + + + /// + /// 开始时间 + /// + public DateTime StartDateTime { get { return _mStartDateTime; } set { _mStartDateTime = value; OnPropertyChanged(); } } + private DateTime _mStartDateTime = DateTime.Now; + + /// + /// 结束时间 + /// + public DateTime EndDateTime { get { return _mEndDateTime; } set { _mEndDateTime = value; OnPropertyChanged(); } } + private DateTime _mEndDateTime = DateTime.Now; + + + public ObservableCollection AlarmInfos { get; set; } + + public ObservableCollection HistoryAlarm { get; set; } = new ObservableCollection(); + + + } + + + +} diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs new file mode 100644 index 00000000..75945eeb --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using BPASmartClient.CustomResource.Pages.Model; +using BPASmartClient.Helper; +using Microsoft.Toolkit.Mvvm.ComponentModel; +using Microsoft.Toolkit.Mvvm.Input; + +namespace BPASmartClient.CustomResource.Pages.ViewModel +{ + public class LoginViewModel : ObservableObject + { + public LoginViewModel() + { + ActionManage.GetInstance.Register(new Action(() => { Login(); }), "EnterLogin", true); + LoginCommand = new RelayCommand(() => { Login(); }); + + ExitCommand = new RelayCommand(() => + { + ActionManage.GetInstance.Send("ExitAction"); + }); + } + + private void Login() + { + var res = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == UserName && p.Password == Password); + if (res != null) + { + Global.userInfo.permission = res.permission; + Global.userInfo.UserName = res.UserName; + Global.userInfo.Password = res.Password; + for (int i = 0; i < MenuManage.GetInstance.menuModels.Count; i++) + { + if (MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuPermission.Contains(res.permission)) + MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Visible; + else + MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed; + + if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.SubMenuPermission.Contains(res.permission)) == null) + MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed; + + for (int m = 0; m < MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.Count; m++) + { + if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuPermission.Contains(res.permission)) + MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Visible; + else + MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Collapsed; + } + } + ActionManage.GetInstance.Send("PermissionChange"); + ActionManage.GetInstance.Send("LoginOk"); + } + else + { + ErrorInfo = "用户名或密码错误!"; + } + } + + public RelayCommand LoginCommand { get; set; } + + public RelayCommand ExitCommand { get; set; } + + + + public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } + private string _mErrorInfo; + + + public string UserName { get { return _mUserName; } set { _mUserName = value; OnPropertyChanged(); } } + private string _mUserName = Global.userInfo.UserName; + + + public string Password { get { return _mPassword; } set { _mPassword = value; OnPropertyChanged(); } } + private string _mPassword; + + + } +} diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs new file mode 100644 index 00000000..bbe6b854 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using BPASmartClient.CustomResource.Pages.Model; +using BPASmartClient.Helper; +using Microsoft.Toolkit.Mvvm.ComponentModel; +using Microsoft.Toolkit.Mvvm.Input; + +namespace BPASmartClient.CustomResource.Pages.ViewModel +{ + public class MainViewModel : ObservableObject + { + public MainViewModel() + { + NavChangedCommand = new RelayCommand(DoNavChanged); + menuModels = MenuManage.GetInstance.menuModels; + PermissionChange(); + ActionManage.GetInstance.Register(new Action(() => + { + PermissionChange(); + }), "PermissionChange"); + + } + + private void PermissionChange() + { + int MainIndex = Array.FindIndex(menuModels.ToArray(), P => P.MainMenuVisibility == Visibility.Visible); + if (MainIndex >= 0 && MainIndex < menuModels.Count) + { + int SubIndex; SubIndex = Array.FindIndex(menuModels.ElementAt(MainIndex).subMenumodels.ToArray(), p => p.SubMenuVisibility == Visibility.Visible); + if (SubIndex >= 0 && SubIndex < menuModels.ElementAt(MainIndex).subMenumodels.Count) + { + DoNavChanged(menuModels.ElementAt(MainIndex).subMenumodels.ElementAt(SubIndex).ToggleWindowPath); + } + } + } + + public ObservableCollection menuModels { get; set; } + + private void DoNavChanged(object obj) + { + for (int i = 0; i < menuModels.Count; i++) + { + var res = menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.ToggleWindowPath == obj.ToString()); + if (res != null) + { + DisplayName = res.SubMenuName; + var end = res.AssemblyName.Substring(res.AssemblyName.Length - 1); + var start = res.ToggleWindowPath.Substring(0, 1); + bool isAddPoint = end != "." && start != "."; + string point = isAddPoint ? "." : ""; + Type type = Assembly.Load(res.AssemblyName)?.GetType($"{res.AssemblyName }{point}{ res.ToggleWindowPath}"); + ConstructorInfo cti = type?.GetConstructor(System.Type.EmptyTypes); + if (type?.BaseType.Name == "Window") + { + ((Window)cti?.Invoke(null)).ShowDialog(); + break; + } + else if (type?.BaseType.Name == "UserControl") + { + //ConstructorInfo cti = type?.GetConstructor(System.Type.EmptyTypes); + MainContent = (FrameworkElement)cti?.Invoke(null); + break; + } + } + } + } + private bool _status; + /// + /// 设备初始化状态 + /// + public bool Status + { + get { return _status; } + set + { + if (value) + { + ActionManage.GetInstance.Send("StartPlcInite"); + } + else + { + ActionManage.GetInstance.Send("EndPlcInite"); + } + _status = value; + OnPropertyChanged(); + } + } + /// + /// 开机自启 + /// + public bool AutoStart { get { return SystemHelper.GetInstance.IsAutoStart(); } set { SystemHelper.GetInstance.AutoStart(value); OnPropertyChanged(); } } + public RelayCommand NavChangedCommand { get; set; } + + public FrameworkElement MainContent { get { return _mMainContent; } set { _mMainContent = value; OnPropertyChanged(); } } + private FrameworkElement _mMainContent; + + public string DisplayName { get { return _mDisplayName; } set { _mDisplayName = value; OnPropertyChanged(); } } + private string _mDisplayName; + + + + } +} diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/PasswordChangeViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/PasswordChangeViewModel.cs new file mode 100644 index 00000000..2acd2f58 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/ViewModel/PasswordChangeViewModel.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BPASmartClient.CustomResource.Pages.Model; +using BPASmartClient.Helper; +using Microsoft.Toolkit.Mvvm.ComponentModel; +using Microsoft.Toolkit.Mvvm.Input; + +namespace BPASmartClient.CustomResource.Pages.ViewModel +{ + public class PasswordChangeViewModel : ObservableObject + { + public PasswordChangeViewModel() + { + LoginCommand = new RelayCommand(() => + { + if (Global.userInfo.Password == OldPassword) + { + if (NewPassword1 == NewPassword2) + { + Global.userInfo.Password = NewPassword2; + int index = Array.FindIndex(Global.userManager.userInfos.ToArray(), p => p.UserName == Global.userInfo.UserName); + if (index >= 0 && index < Global.userManager.userInfos.Count) + Global.userManager.userInfos.ElementAt(index).Password = NewPassword1; + Config.GetInstance.SaveUser(); + ActionManage.GetInstance.Send("PasswordChangeViewconfirm"); + } + else + { + ErrorInfo = "新密码不匹配"; + } + } + else + { + ErrorInfo = "原密码错误"; + } + }); + + ExitCommand = new RelayCommand(() => + { + ActionManage.GetInstance.Send("PasswordChangeViewCancel"); + }); + } + + public RelayCommand LoginCommand { get; set; } + + public RelayCommand ExitCommand { get; set; } + + + + public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } + private string _mErrorInfo; + + public string OldPassword { get { return _mOldPassword; } set { _mOldPassword = value; OnPropertyChanged(); } } + private string _mOldPassword; + + + public string NewPassword1 { get { return _mNewPassword1; } set { _mNewPassword1 = value; OnPropertyChanged(); } } + private string _mNewPassword1; + + + public string NewPassword2 { get { return _mNewPassword2; } set { _mNewPassword2 = value; OnPropertyChanged(); } } + private string _mNewPassword2; + + + } +} diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs new file mode 100644 index 00000000..d70defe2 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Toolkit.Mvvm.ComponentModel; +using Microsoft.Toolkit.Mvvm.Input; +using System.Collections.ObjectModel; +using BPASmartClient.CustomResource.Pages.Model; +using System.Windows; +using BPASmartClient.Helper; + +namespace BPASmartClient.CustomResource.Pages.ViewModel +{ + public class RunLogViewModel : ObservableObject + { + public RunLogViewModel() + { + Sqlite.GetInstance.Save(); + SwitchCommand = new RelayCommand(() => + { + if (ButContent == "历史日志") + { + GetHistoryRunLog(); + CurrentDataVis = Visibility.Hidden; + HistoryDataVis = Visibility.Visible; + IsVisibility = Visibility.Visible; + ControlButText = "开始查询"; + ButContent = "实时日志"; + return; + } + + if (ButContent == "实时日志") + { + HistoryDataVis = Visibility.Hidden; + CurrentDataVis = Visibility.Visible; + IsVisibility = Visibility.Hidden; + ButContent = "历史日志"; + return; + } + + }); + + ControlCommand = new RelayCommand(() => + { + + if (ControlButText == "报警复位") return; + if (ControlButText == "开始查询") + { + var lists = Sqlite.GetInstance.GetData(); + var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList(); + if (res != null) + { + HistoryRunLog.Clear(); + foreach (var item in res) + { + HistoryRunLog.Add(item); + } + } + } + + }); + } + + private void GetHistoryRunLog() + { + var data = Sqlite.GetInstance.GetData(); + if (data != null) + { + HistoryRunLog.Clear(); + foreach (var item in data) + { + int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days; + if (day == 0) + { + HistoryRunLog.Add(item); + } + } + } + } + + public RelayCommand SwitchCommand { get; set; } + + public RelayCommand ControlCommand { get; set; } + + public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } } + private Visibility _mCurrentDataVis = Visibility.Visible; + + public Visibility HistoryDataVis { get { return _mHistoryDataVis; } set { _mHistoryDataVis = value; OnPropertyChanged(); } } + private Visibility _mHistoryDataVis = Visibility.Hidden; + + /// + /// 是否显示 + /// + public Visibility IsVisibility { get { return _mIsVisibility; } set { _mIsVisibility = value; OnPropertyChanged(); } } + private Visibility _mIsVisibility = Visibility.Hidden; + + /// + /// 文字显示 + /// + public string ButContent { get { return _mButContent; } set { _mButContent = value; OnPropertyChanged(); } } + private string _mButContent = "历史日志"; + + /// + /// 控制按钮文本显示 + /// + public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } } + private string _mControlButText = "报警复位"; + + /// + /// 开始时间 + /// + public DateTime StartDateTime { get { return _mStartDateTime; } set { _mStartDateTime = value; OnPropertyChanged(); } } + private DateTime _mStartDateTime = DateTime.Now; + + /// + /// 结束时间 + /// + public DateTime EndDateTime { get { return _mEndDateTime; } set { _mEndDateTime = value; OnPropertyChanged(); } } + private DateTime _mEndDateTime = DateTime.Now; + + public ObservableCollection HistoryRunLog { get; set; } = new ObservableCollection(); + + public ObservableCollection Log { get; set; } = MessageLog.GetInstance.runLogs; + } +} diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs new file mode 100644 index 00000000..227c127f --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs @@ -0,0 +1,134 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Toolkit.Mvvm.ComponentModel; +using System.Collections.ObjectModel; +using BPASmartClient.CustomResource.Pages.Model; +using System.Windows; +using Microsoft.Toolkit.Mvvm.Input; +using BPASmartClient.Helper; + +namespace BPASmartClient.CustomResource.Pages.ViewModel +{ + public class UserLogViewModel : ObservableObject + { + public UserLogViewModel() + { + Sqlite.GetInstance.Save(); + UserLogs = MessageLog.GetInstance.userLogs; + SwitchCommand = new RelayCommand(() => + { + if (ButContent == "历史日志") + { + GetHistoryUserLog(); + CurrentDataVis = Visibility.Hidden; + HistoryDataVis = Visibility.Visible; + IsVisibility = Visibility.Visible; + ControlButText = "开始查询"; + ButContent = "实时日志"; + return; + } + + if (ButContent == "实时日志") + { + HistoryDataVis = Visibility.Hidden; + CurrentDataVis = Visibility.Visible; + IsVisibility = Visibility.Hidden; + ButContent = "历史日志"; + return; + } + + }); + + ControlCommand = new RelayCommand(() => + { + if (ControlButText == "报警复位") return; + if (ControlButText == "开始查询") + { + var lists = Sqlite.GetInstance.GetData(); + var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList(); + var result = res.Where(p => p.UserName == SearchUser && SearchUser != null && SearchUser.Length > 0).ToList(); + var logs = result != null && SearchUser?.Length > 0 ? result : res; + if (logs != null) + { + HistoryUserLog.Clear(); + foreach (var item in logs) + { + HistoryUserLog.Add(item); + } + } + } + }); + } + + private void GetHistoryUserLog() + { + var data = Sqlite.GetInstance.GetData(); + var res = data.Where(p => p.UserName == Global.userInfo.UserName).ToList(); + if (res != null) + { + HistoryUserLog.Clear(); + foreach (var item in res) + { + int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days; + if (day == 0) + { + HistoryUserLog.Add(item); + } + } + } + } + + public RelayCommand SwitchCommand { get; set; } + + public RelayCommand ControlCommand { get; set; } + + public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } } + private Visibility _mCurrentDataVis = Visibility.Visible; + + public Visibility HistoryDataVis { get { return _mHistoryDataVis; } set { _mHistoryDataVis = value; OnPropertyChanged(); } } + private Visibility _mHistoryDataVis = Visibility.Hidden; + + /// + /// 是否显示 + /// + public Visibility IsVisibility { get { return _mIsVisibility; } set { _mIsVisibility = value; OnPropertyChanged(); } } + private Visibility _mIsVisibility = Visibility.Hidden; + + /// + /// 文字显示 + /// + public string ButContent { get { return _mButContent; } set { _mButContent = value; OnPropertyChanged(); } } + private string _mButContent = "历史日志"; + + /// + /// 控制按钮文本显示 + /// + public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } } + private string _mControlButText = "报警复位"; + + /// + /// 开始时间 + /// + public DateTime StartDateTime { get { return _mStartDateTime; } set { _mStartDateTime = value; OnPropertyChanged(); } } + private DateTime _mStartDateTime = DateTime.Now; + + /// + /// 结束时间 + /// + public DateTime EndDateTime { get { return _mEndDateTime; } set { _mEndDateTime = value; OnPropertyChanged(); } } + private DateTime _mEndDateTime = DateTime.Now; + + + public string SearchUser { get { return _mSearchUser; } set { _mSearchUser = value; OnPropertyChanged(); } } + private string _mSearchUser; + + + public ObservableCollection HistoryUserLog { get; set; } = new ObservableCollection(); + + public ObservableCollection UserLogs { get; set; } + + } +} diff --git a/BPASmartClient.CustomResource/RecDictionarys/BeveledRadioButtonStyle.xaml b/BPASmartClient.CustomResource/RecDictionarys/BeveledRadioButtonStyle.xaml index e95bfc8b..79257775 100644 --- a/BPASmartClient.CustomResource/RecDictionarys/BeveledRadioButtonStyle.xaml +++ b/BPASmartClient.CustomResource/RecDictionarys/BeveledRadioButtonStyle.xaml @@ -215,5 +215,4 @@ - \ No newline at end of file diff --git a/BPASmartClient.CustomResource/RecDictionarys/DatePickeerDictionary.xaml b/BPASmartClient.CustomResource/RecDictionarys/DatePickeerDictionary.xaml index 355b5f66..27a5e039 100644 --- a/BPASmartClient.CustomResource/RecDictionarys/DatePickeerDictionary.xaml +++ b/BPASmartClient.CustomResource/RecDictionarys/DatePickeerDictionary.xaml @@ -432,7 +432,7 @@ - + diff --git a/BPASmartClient.CustomResource/Resources/Login.mp4 b/BPASmartClient.CustomResource/Resources/Login.mp4 new file mode 100644 index 00000000..c694db03 Binary files /dev/null and b/BPASmartClient.CustomResource/Resources/Login.mp4 differ diff --git a/BPASmartClient.CustomResource/Themes/Generic.xaml b/BPASmartClient.CustomResource/Themes/Generic.xaml index df62dff6..4bbc2757 100644 --- a/BPASmartClient.CustomResource/Themes/Generic.xaml +++ b/BPASmartClient.CustomResource/Themes/Generic.xaml @@ -15,10 +15,6 @@ BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" /> - + diff --git a/BPASmartClient.CustomResource/Themes/MyStyle.xaml b/BPASmartClient.CustomResource/Themes/MyStyle.xaml index f734aa46..4cf9e73a 100644 --- a/BPASmartClient.CustomResource/Themes/MyStyle.xaml +++ b/BPASmartClient.CustomResource/Themes/MyStyle.xaml @@ -173,6 +173,14 @@ + + + + @@ -348,6 +364,158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 咖啡机状态 + + 应用状态 + + 告警信息 + + 故障信息 + + + + + 饮品 + +