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/LoginView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs
new file mode 100644
index 00000000..7e6147e7
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs
@@ -0,0 +1,90 @@
+using BPASmartClient.Helper;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace BPASmartClient.CustomResource.Pages.View
+{
+ ///
+ /// LoginView.xaml 的交互逻辑
+ ///
+ public partial class LoginView : Window
+ {
+ public LoginView()
+ {
+ InitializeComponent();
+ grid.Visibility = Visibility.Collapsed;
+ Username.Focus();
+ Username.SelectionStart = Username.Text.Trim().Length;
+ this.Loaded += LoginView_Loaded;
+ ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "LoginOk", true);
+ ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "ExitAction", true);
+ }
+
+ private void LoginView_Loaded(object sender, RoutedEventArgs e)
+ {
+ string path = $"{AppDomain.CurrentDomain.BaseDirectory}Videos\\Login.mp4";
+ if (File.Exists(path))
+ {
+ player.Source = new Uri(path); // 绑定视频文件
+ this.WindowState = WindowState.Maximized;
+ player.LoadedBehavior = MediaState.Manual; // 交互式控制
+ player.Loaded += new RoutedEventHandler(media_Loaded); // 添加元素加载完成事件 -- 自动开始播放
+ player.MediaEnded += new RoutedEventHandler(media_MediaEnded); // 添加媒体播放结束事件 -- 重新播放
+ player.Unloaded += new RoutedEventHandler(media_Unloaded);// 添加元素卸载完成事件 -- 停止播放
+ player.MediaOpened += Player_MediaOpened;//已播放事件
+ }
+ }
+
+ private void Player_MediaOpened(object sender, RoutedEventArgs e)
+ {
+ grid.Visibility = Visibility.Visible;
+ }
+
+ private void media_Loaded(object sender, RoutedEventArgs e)
+ {
+ (sender as MediaElement).Play();
+ }
+
+ private void media_MediaEnded(object sender, RoutedEventArgs e)
+ {
+ // MediaElement需要先停止播放才能再开始播放,
+ // 否则会停在最后一帧不动
+ (sender as MediaElement).Stop();
+ (sender as MediaElement).Play();
+ }
+
+ private void media_Unloaded(object sender, RoutedEventArgs e)
+ {
+ (sender as MediaElement).Stop();
+ }
+
+ private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
+ {
+ this.markText.Visibility = this.pb.Password.Length > 0 ? Visibility.Collapsed : Visibility.Visible;
+ }
+
+ private void TextBox_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Enter) pb.Focus();
+ }
+
+ private void pb_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Enter) ActionManage.GetInstance.Send("EnterLogin");
+ }
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/View/MainView.xaml b/BPASmartClient.CustomResource/Pages/View/MainView.xaml
new file mode 100644
index 00000000..76baebcb
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/MainView.xaml
@@ -0,0 +1,567 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DosingSystem/View/MainWindow.xaml.cs b/BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs
similarity index 64%
rename from DosingSystem/View/MainWindow.xaml.cs
rename to BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs
index ae40a08b..f47c3783 100644
--- a/DosingSystem/View/MainWindow.xaml.cs
+++ b/BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@@ -10,25 +11,23 @@ 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 DosingSystem.View
+namespace BPASmartClient.CustomResource.Pages.View
{
///
- /// Interaction logic for MainWindow.xaml
+ /// MainView.xaml 的交互逻辑
///
- public partial class MainWindow : Window
+ public partial class MainView : Window
{
- public MainWindow()
+ public MainView()
{
InitializeComponent();
+ this.WindowState = WindowState.Maximized;
+ this.ButMin.Click += (o, e) => { this.WindowState = WindowState.Minimized; };
+ this.ButMax.Click += (o, e) => { this.WindowState = this.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; };
this.ButClose.Click += (o, e) => { this.Close(); };
-
- this.MaxWidth = SystemParameters.WorkArea.Width;
- this.MaxHeight = SystemParameters.WorkArea.Height;
-
- this.br.MouseLeftButtonDown += (o, e) =>
+ this.MoveBorder.MouseLeftButtonDown += (o, e) =>
{
if (e.ClickCount > 1)
{
diff --git a/BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml b/BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml
new file mode 100644
index 00000000..85932a81
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml
@@ -0,0 +1,348 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml.cs
new file mode 100644
index 00000000..9e8ca1d0
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml.cs
@@ -0,0 +1,72 @@
+using BPASmartClient.Helper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace BPASmartClient.CustomResource.Pages.View
+{
+ ///
+ /// PasswordChangeView.xaml 的交互逻辑
+ ///
+ public partial class PasswordChangeView : Window
+ {
+ public PasswordChangeView()
+ {
+ InitializeComponent();
+ this.br.MouseLeftButtonDown += (o, e) =>
+ {
+ if (e.LeftButton == MouseButtonState.Pressed) this.DragMove();
+ };
+ ActionManage.GetInstance.CancelRegister("PasswordChangeViewconfirm");
+ ActionManage.GetInstance.CancelRegister("PasswordChangeViewCancel");
+ ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "PasswordChangeViewconfirm");
+ ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "PasswordChangeViewCancel");
+ }
+
+ private void newpb2_PasswordChanged(object sender, RoutedEventArgs e)
+ {
+ if (this.newpb2.Password.Length > 0)
+ {
+ this.newmarkText2.Visibility = Visibility.Collapsed;
+ }
+ else
+ {
+ this.newmarkText2.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void newpb1_PasswordChanged(object sender, RoutedEventArgs e)
+ {
+ if (this.newpb1.Password.Length > 0)
+ {
+ this.newmarkText1.Visibility = Visibility.Collapsed;
+ }
+ else
+ {
+ this.newmarkText1.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void oldpb_PasswordChanged(object sender, RoutedEventArgs e)
+ {
+ if (this.oldpb.Password.Length > 0)
+ {
+ this.oldmarkText.Visibility = Visibility.Collapsed;
+ }
+ else
+ {
+ this.oldmarkText.Visibility = Visibility.Visible;
+ }
+ }
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml b/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml
new file mode 100644
index 00000000..8a0f69a5
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml
@@ -0,0 +1,372 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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/SubPagLoginView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml.cs
new file mode 100644
index 00000000..835e2dc0
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml.cs
@@ -0,0 +1,47 @@
+using BPASmartClient.Helper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace BPASmartClient.CustomResource.Pages.View
+{
+ ///
+ /// SubPagLoginView.xaml 的交互逻辑
+ ///
+ public partial class SubPagLoginView : Window
+ {
+ public SubPagLoginView()
+ {
+ InitializeComponent();
+ Username.Focus();
+ Username.SelectionStart = Username.Text.Trim().Length;
+ ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "LoginOk", true);
+ ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "ExitAction", true);
+ }
+
+ private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
+ {
+ this.markText.Visibility = this.pb.Password.Length > 0 ? Visibility.Collapsed : Visibility.Visible;
+ }
+
+ private void TextBox_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Enter) pb.Focus();
+ }
+
+ private void pb_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Enter) ActionManage.GetInstance.Send("EnterLogin");
+ }
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/View/UserLogView.xaml b/BPASmartClient.CustomResource/Pages/View/UserLogView.xaml
new file mode 100644
index 00000000..dc8eb9c9
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/UserLogView.xaml
@@ -0,0 +1,442 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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
diff --git a/BPASmartClient/Control/GYLCControl.xaml b/BPASmartClient/Control/GYLCControl.xaml
new file mode 100644
index 00000000..0e415989
--- /dev/null
+++ b/BPASmartClient/Control/GYLCControl.xaml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DosingSystem/View/AlarmRecordView.xaml.cs b/BPASmartClient/Control/GYLCControl.xaml.cs
similarity index 75%
rename from DosingSystem/View/AlarmRecordView.xaml.cs
rename to BPASmartClient/Control/GYLCControl.xaml.cs
index 3843f3e4..cbe4884a 100644
--- a/DosingSystem/View/AlarmRecordView.xaml.cs
+++ b/BPASmartClient/Control/GYLCControl.xaml.cs
@@ -13,14 +13,14 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
-namespace DosingSystem.View
+namespace BPASmartClient.Control
{
///
- /// AlarmRecordView.xaml 的交互逻辑
+ /// GYLCControl.xaml 的交互逻辑
///
- public partial class AlarmRecordView : UserControl
+ public partial class GYLCControl : UserControl
{
- public AlarmRecordView()
+ public GYLCControl()
{
InitializeComponent();
}
diff --git a/BPASmartClient/MainWindow.xaml b/BPASmartClient/MainWindow.xaml
index f78ced08..5a7f237d 100644
--- a/BPASmartClient/MainWindow.xaml
+++ b/BPASmartClient/MainWindow.xaml
@@ -116,7 +116,7 @@
@@ -152,6 +152,12 @@
Header="IOT监视"
Tag="IOTView" />
+
+
-
-
- $(DefaultXamlRuntime)
-
-
-
diff --git a/DosingSystem/Model/ActionMenu.cs b/DosingSystem/Model/ActionMenu.cs
index 1313a488..00113337 100644
--- a/DosingSystem/Model/ActionMenu.cs
+++ b/DosingSystem/Model/ActionMenu.cs
@@ -6,18 +6,23 @@ using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
-namespace DosingSystem.Model
+namespace BPASmartClient.DosingSystem.Model
{
public class ActionMenu : ObservableObject
{
public string CommandParameter { get { return _mCommandParameter; } set { _mCommandParameter = value; OnPropertyChanged(); } }
private string _mCommandParameter;
- public Permission[] permission { get { return _mpermission; } set { _mpermission = value; OnPropertyChanged(); } }
- private Permission[] _mpermission;
+ //public Permission[] permission { get { return _mpermission; } set { _mpermission = value; OnPropertyChanged(); } }
+ //private Permission[] _mpermission;
public string MenuName { get { return _mMenuName; } set { _mMenuName = value; OnPropertyChanged(); } }
private string _mMenuName;
+
+ //public string NameSpace { get { return _mNameSpace; } set { _mNameSpace = value; OnPropertyChanged(); } }
+ //private string _mNameSpace;
+
+
}
}
diff --git a/DosingSystem/Model/DeviceAddress.cs b/DosingSystem/Model/DeviceAddress.cs
new file mode 100644
index 00000000..7c57aaa8
--- /dev/null
+++ b/DosingSystem/Model/DeviceAddress.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.DosingSystem.Model
+{
+ public class DeviceAddress
+ {
+ ///
+ /// 设备名称起始地址
+ ///
+ public static string DeviceName { get; set; } = "LW0";
+
+ ///
+ /// 料仓重量反馈起始地址
+ ///
+ public static string WeightFeedback { get; set; } = "LW204";
+
+ ///
+ /// 重量设置地址
+ ///
+ public static string WeightSet { get; set; } = "LW200";
+
+ ///
+ /// 启动信号地址
+ ///
+ public static string Start { get; set; } = "LW210";
+
+ ///
+ /// 下料重量反馈地址
+ ///
+ public static string CutWeightFeedback { get; set; } = "LW202";
+
+ ///
+ /// 设备运行状态地址
+ ///
+ public static string RunStatus { get; set; } = "LW206";
+ }
+
+
+
+}
diff --git a/DosingSystem/Model/DeviceInquire.cs b/DosingSystem/Model/DeviceInquire.cs
index f1c0671d..181abeda 100644
--- a/DosingSystem/Model/DeviceInquire.cs
+++ b/DosingSystem/Model/DeviceInquire.cs
@@ -1,67 +1,76 @@
using BPASmartClient.Helper;
+using BPASmartClient.Message;
using BPASmartClient.Modbus;
-using DosingSystem.ViewModel;
+using BPASmartClient.DosingSystem.ViewModel;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
-namespace DosingSystem.Model
+namespace BPASmartClient.DosingSystem.Model
{
public class DeviceInquire
{
-
private volatile static DeviceInquire _Instance;
public static DeviceInquire GetInstance => _Instance ?? (_Instance = new DeviceInquire());
private DeviceInquire() { }
- string IPSegment = "192.168.1.";
- string NameAddress = "VW5000";
- int count = 0;
- private static readonly object _lock = new object();
- ConcurrentDictionary modbusTcps = new ConcurrentDictionary();
- List InvalidIP = new List();
+ string IPSegment = "192.168.0.";
+
+ ConcurrentDictionary DeviceLists = new ConcurrentDictionary();
+ List InvalidIP = new List();//无效 IP 集合
+ List IPLists = new List();//启动 Ping 任务IP集合
+ ConcurrentQueue IPQueues = new ConcurrentQueue();//pincomplete 完成队列
public void Init()
{
IpAddressLines();
ThreadManage.GetInstance().StartLong(new Action(() =>
{
- if (count >= 255) IpAddressLines();
+ if (IPQueues.Count >= IPLists.Count)
+ IpAddressLines();
Thread.Sleep(5000);
}), "配料机设备上线监听", true);
}
- public ModbusTcp GetModbusTcp(string ip)
+ public void Rescan()
+ {
+ InvalidIP.Clear();
+ }
+
+ public DeviceStatus GetDevice(string ip)
{
- if (modbusTcps.ContainsKey(ip)) return modbusTcps[ip];
- else return default;
+ if (ip != null)
+ {
+ var res = DeviceLists.Values.FirstOrDefault(p => p.IpAddress == ip);
+ if (res != null) return res;
+ }
+ return new DeviceStatus();
}
private void IpAddressLines()
{
+ IPLists.Clear();
+ IPQueues.Clear();
for (int i = 1; i <= 255; i++)
{
- if (!InvalidIP.Contains($"{IPSegment}{i}"))
+ if (!InvalidIP.Contains($"{IPSegment}{i}") && !DeviceLists.ContainsKey($"{IPSegment}{i}"))
{
- Ping myPing;
- myPing = new Ping();
- myPing.PingCompleted += new PingCompletedEventHandler(_myPing_PingCompleted);
- string pingIP = $"{IPSegment}{i}";
- myPing.SendAsync(pingIP, 1000, null);
+ IPLists.Add($"{IPSegment}{i}");
}
}
- count = 0;
- }
- private void CompleteCount()
- {
- lock (_lock)
- count++;
+ IPLists.ForEach((item) =>
+ {
+ Ping myPing = new Ping();
+ myPing.PingCompleted += new PingCompletedEventHandler(_myPing_PingCompleted);
+ myPing.SendAsync(item, 1000, null);
+ });
}
private void _myPing_PingCompleted(object sender, PingCompletedEventArgs e)
@@ -69,17 +78,19 @@ namespace DosingSystem.Model
if (e.Reply.Status == IPStatus.Success)
{
string ip = e.Reply.Address.ToString();
- if (!modbusTcps.ContainsKey(ip))
+ if (!DeviceLists.ContainsKey(ip))
{
- modbusTcps.TryAdd(ip, new ModbusTcp());
- modbusTcps[ip].IsReconnect = false;
- Task.Run(new Action(() => { modbusTcps[ip].ModbusTcpConnect(ip); }));
+ DeviceStatus DS = new DeviceStatus();
+ DS.modbusTcp.IsReconnect = false;
- modbusTcps[ip].ConnectOk = new Action(() =>
+ DS.modbusTcp.ConnectOk = new Action(() =>
{
- string DeviceName = modbusTcps[ip].GetString(NameAddress, 10);
+ string DeviceName = DS.modbusTcp.GetString(DeviceAddress.DeviceName, 20);
if (DeviceName.Length > 0)
{
+ DeviceLists.TryAdd(ip, DS);
+ DeviceLists[ip].Init(DeviceName);
+ DeviceLists[ip].modbusTcp.IsReconnect = false;
App.Current.Dispatcher.Invoke(new Action(() =>
{
DeviceListViewModel.devices.Add(new Devices()
@@ -87,6 +98,21 @@ namespace DosingSystem.Model
DeviceName = DeviceName,
IpAddress = ip
});
+
+ for (int i = 0; i < Json.Data.Recipes.Count; i++)
+ {
+ for (int m = 0; m < Json.Data.Recipes.ElementAt(i).RawMaterials.Count; m++)
+ {
+ if (Json.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp == ip)
+ {
+ Json.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName;
+ }
+ }
+ }
+
+ if (!NewRecipeViewModel.RawMaterialNames.Contains(DeviceName))
+ NewRecipeViewModel.RawMaterialNames.Add(DeviceName);
+
}));
}
else
@@ -95,23 +121,101 @@ namespace DosingSystem.Model
}
});
- modbusTcps[ip].ConnectFail = new Action(() =>
+ DS.modbusTcp.ConnectFail = new Action(() =>
{
if (!InvalidIP.Contains(ip)) InvalidIP.Add(ip);
+ MessageLog.GetInstance.Show($"{ip}连接失败");
});
- modbusTcps[ip].Disconnect = new Action(() =>
+ DS.modbusTcp.Disconnect = new Action(() =>
{
if (InvalidIP.Contains(ip)) InvalidIP.Remove(ip);
var res = DeviceListViewModel.devices.FirstOrDefault(P => P.IpAddress == ip);
if (res != null && DeviceListViewModel.devices.Contains(res))
- App.Current.Dispatcher.Invoke(new Action(() => { DeviceListViewModel.devices.Remove(res); }));
+ App.Current.Dispatcher.Invoke(new Action(() =>
+ {
+ DeviceListViewModel.devices.Remove(res);
+ if (!NewRecipeViewModel.RawMaterialNames.Contains(res.DeviceName))
+ NewRecipeViewModel.RawMaterialNames.Remove(res.DeviceName);
+ }));
+ if (DeviceLists.ContainsKey(ip)) DeviceLists[ip].Dispose();
});
+
+ Task.Run(new Action(() =>
+ {
+ DS.modbusTcp.ModbusTcpConnect(ip, 502);
+ IPQueues.Enqueue(e.Reply.Address.ToString());
+ }));
}
+ else IPQueues.Enqueue(e.Reply.Address.ToString());
+ }
+ else IPQueues.Enqueue(e.Reply.Address.ToString());
+ }
+ }
+
+ public class DeviceStatus
+ {
+
+ #region 对象属性声明
+ public string DeviceName = String.Empty;
+ public string IpAddress => modbusTcp.IPAdress;
+
+ ///
+ /// 设备状态
+ ///
+ public RawMaterialDeviceStatus deviceStatus { get; set; } = new RawMaterialDeviceStatus();
+
+ public ModbusTcp modbusTcp = new ModbusTcp();
+
+ public bool IsConnected => modbusTcp.Connected;
+ #endregion
+
+ public void Init(string DeviceName)
+ {
+ this.DeviceName = DeviceName;
+ if (modbusTcp.Connected)
+ {
+ ThreadManage.GetInstance().StartLong(new Action(() =>
+ {
+ //获取设备运行状态
+ var res = this.modbusTcp.Read(DeviceAddress.RunStatus);
+ if (res != null && res is ushort[] ushortValue)
+ {
+ if (ushortValue.Length >= 1) deviceStatus.RunStatus = ushortValue[0];
+ }
+
+ //获取设备料仓剩余重量
+ deviceStatus.WeightFeedback = this.modbusTcp.GetUint(DeviceAddress.WeightFeedback) * 10;
+
+ Thread.Sleep(100);
+ }), $"{DeviceName} 开始监听", true);
}
- CompleteCount();
}
+ public void SetDeviceName(string name)
+ {
+ this.modbusTcp.Write(DeviceAddress.DeviceName, new ushort[20]);
+ this.modbusTcp.SetString(DeviceAddress.DeviceName, name);
+ }
+
+ public void StatusReset()
+ {
+ this.modbusTcp.Write(DeviceAddress.RunStatus, (ushort)0);
+ }
+
+ public void Dispose()
+ {
+ ThreadManage.GetInstance().StopTask($"{DeviceName} 开始监听");
+ }
+ public void Start(uint Value)
+ {
+ if (modbusTcp.Connected)
+ {
+ modbusTcp.SetUint(DeviceAddress.WeightSet, Value);//写入配方量
+ modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
+ }
+ }
}
+
}
diff --git a/DosingSystem/Model/LocaPar.cs b/DosingSystem/Model/LocaPar.cs
new file mode 100644
index 00000000..31815e0c
--- /dev/null
+++ b/DosingSystem/Model/LocaPar.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Collections.ObjectModel;
+using BPASmartClient.DosingSystem.ViewModel;
+
+namespace BPASmartClient.DosingSystem.Model
+{
+ public class LocaPar
+ {
+ public ObservableCollection Recipes { get; set; } = new ObservableCollection();
+ }
+}
diff --git a/DosingSystem/Model/RawMaterialDeviceStatus.cs b/DosingSystem/Model/RawMaterialDeviceStatus.cs
new file mode 100644
index 00000000..1febc8a9
--- /dev/null
+++ b/DosingSystem/Model/RawMaterialDeviceStatus.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.DosingSystem.Model
+{
+ public class RawMaterialDeviceStatus
+ {
+
+ ///
+ /// 原料类型
+ /// 1:液体
+ /// 2:膏体
+ /// 3:粉体
+ ///
+ public ushort RawMaterialType { get; set; }
+
+ ///
+ /// 料仓重量反馈
+ ///
+ public float WeightFeedback { get; set; }
+
+ ///
+ /// 上限反馈
+ ///
+ public bool UpLimitFeedback { get; set; }
+
+ ///
+ /// 下限反馈
+ ///
+ public bool DownLimitFeedback { get; set; }
+
+ ///
+ /// 下料重量反馈
+ ///
+ public float CutWeightFeedback { get; set; }
+
+ ///
+ /// 设备运行状态
+ ///
+ public ushort RunStatus { get; set; }
+ }
+}
diff --git a/DosingSystem/Model/RawMaterialModel.cs b/DosingSystem/Model/RawMaterialModel.cs
new file mode 100644
index 00000000..7b5f3eb5
--- /dev/null
+++ b/DosingSystem/Model/RawMaterialModel.cs
@@ -0,0 +1,88 @@
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.DosingSystem.Model
+{
+ ///
+ /// 原料模块
+ ///
+ public class RawMaterialModel : ObservableObject
+ {
+ ///
+ /// 原料名称
+ ///
+ public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } }
+ private string _mRawMaterialName;
+
+ ///
+ /// 原料设备IP
+ ///
+ public string DeviceIp { get; set; }
+
+ ///
+ /// 原料重量设置
+ ///
+ public uint RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } }
+ private uint _mRawMaterialWeight;
+
+ ///
+ /// 原料类型 MW18
+ /// 1:液体
+ /// 2:膏体
+ /// 3:粉体
+ ///
+ [Newtonsoft.Json.JsonIgnore]
+ public ushort RawMaterialType { get { return _mRawMaterialType; } set { _mRawMaterialType = value; OnPropertyChanged(); } }
+ private ushort _mRawMaterialType;
+
+ ///
+ /// 料仓重量反馈 MD40
+ ///
+ [Newtonsoft.Json.JsonIgnore]
+ public float WeightFeedback { get { return _mWeightFeedback; } set { _mWeightFeedback = value; OnPropertyChanged(); } }
+ private float _mWeightFeedback;
+
+ ///
+ /// 上限反馈
+ ///
+ [Newtonsoft.Json.JsonIgnore]
+ public bool UpLimtFeedback { get { return _mUpLimtFeedback; } set { _mUpLimtFeedback = value; OnPropertyChanged(); } }
+ private bool _mUpLimtFeedback;
+
+ ///
+ /// 下限反馈
+ ///
+ [Newtonsoft.Json.JsonIgnore]
+ public bool DownLimtFeedback { get { return _mDownLimtFeedback; } set { _mDownLimtFeedback = value; OnPropertyChanged(); } }
+ private bool _mDownLimtFeedback;
+
+ ///
+ /// 下料重量反馈 MD52
+ ///
+ [Newtonsoft.Json.JsonIgnore]
+ public float UpLimtWeightFeedback { get { return _mUpLimtWeightFeedback; } set { _mUpLimtWeightFeedback = value; OnPropertyChanged(); } }
+ private float _mUpLimtWeightFeedback;
+
+
+ ///
+ /// 原料ID
+ ///
+ public string RawMaterialId { get { return _mRawMaterialId; } set { _mRawMaterialId = value; OnPropertyChanged(); } }
+ private string _mRawMaterialId;
+
+ ///
+ /// 原料设备执行状态
+ /// 1:空闲状态
+ /// 2:下料中
+ /// 3:下料完成
+ ///
+ [Newtonsoft.Json.JsonIgnore]
+ public ushort RecipeStatus { get { return _mRecipeStatus; } set { _mRecipeStatus = value; OnPropertyChanged(); } }
+ private ushort _mRecipeStatus = 1;
+
+ }
+}
diff --git a/DosingSystem/Model/RecipeModel.cs b/DosingSystem/Model/RecipeModel.cs
new file mode 100644
index 00000000..203d4658
--- /dev/null
+++ b/DosingSystem/Model/RecipeModel.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using BPASmartClient.DosingSystem.ViewModel;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+
+namespace BPASmartClient.DosingSystem.Model
+{
+ ///
+ /// 配方模块
+ ///
+ public class RecipeModel : ObservableObject
+ {
+ [Newtonsoft.Json.JsonIgnore]
+ public bool IsEnable { get { return _mIsEnable; } set { _mIsEnable = value; OnPropertyChanged(); } }
+ private bool _mIsEnable = true;
+
+ ///
+ /// 序号
+ ///
+ public int SerialNum { get { return _mSerialNum; } set { _mSerialNum = value; OnPropertyChanged(); } }
+ private int _mSerialNum;
+
+ ///
+ /// 配方名称
+ ///
+ public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } }
+ private string _mRecipeName;
+
+ ///
+ /// 配方编码
+ ///
+ public string RecipCode { get { return _mRecipCode; } set { _mRecipCode = value; OnPropertyChanged(); } }
+ private string _mRecipCode;
+
+ [Newtonsoft.Json.JsonIgnore]
+ public AutoResetEvent Are { get; set; } = new AutoResetEvent(false);
+
+ ///
+ /// 原料集合
+ ///
+ public ObservableCollection RawMaterials { get; set; } = new ObservableCollection();
+
+
+
+ }
+}
diff --git a/DosingSystem/View/AlarmRecordView.xaml b/DosingSystem/View/AlarmRecordView.xaml
deleted file mode 100644
index 61550b78..00000000
--- a/DosingSystem/View/AlarmRecordView.xaml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/DosingSystem/View/ChangeDeviceNameView.xaml b/DosingSystem/View/ChangeDeviceNameView.xaml
new file mode 100644
index 00000000..5538aa49
--- /dev/null
+++ b/DosingSystem/View/ChangeDeviceNameView.xaml
@@ -0,0 +1,122 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DosingSystem/View/ChangeDeviceNameView.xaml.cs b/DosingSystem/View/ChangeDeviceNameView.xaml.cs
new file mode 100644
index 00000000..d8ecd4ac
--- /dev/null
+++ b/DosingSystem/View/ChangeDeviceNameView.xaml.cs
@@ -0,0 +1,31 @@
+using BPASmartClient.Helper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace BPASmartClient.DosingSystem.View
+{
+ ///
+ /// ChangeDeviceNameView.xaml 的交互逻辑
+ ///
+ public partial class ChangeDeviceNameView : Window
+ {
+ public ChangeDeviceNameView()
+ {
+ InitializeComponent();
+ ActionManage.GetInstance.CancelRegister("ChangeDeviceNameViewClose");
+ ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "ChangeDeviceNameViewClose");
+ this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
+ }
+ }
+}
diff --git a/DosingSystem/View/DeviceListView.xaml b/DosingSystem/View/DeviceListView.xaml
index 765fbe2f..f232d604 100644
--- a/DosingSystem/View/DeviceListView.xaml
+++ b/DosingSystem/View/DeviceListView.xaml
@@ -1,13 +1,13 @@
@@ -16,59 +16,128 @@
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
+
-
-
-
-
+
+
-
-
-
+
+
+
+
diff --git a/DosingSystem/View/DeviceListView.xaml.cs b/DosingSystem/View/DeviceListView.xaml.cs
index 5c57d6ad..16366e98 100644
--- a/DosingSystem/View/DeviceListView.xaml.cs
+++ b/DosingSystem/View/DeviceListView.xaml.cs
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
-namespace DosingSystem.View
+namespace BPASmartClient.DosingSystem.View
{
///
/// DeviceListView.xaml 的交互逻辑
diff --git a/DosingSystem/View/HardwareStatusView.xaml b/DosingSystem/View/HardwareStatusView.xaml
index ecf4e484..347782e3 100644
--- a/DosingSystem/View/HardwareStatusView.xaml
+++ b/DosingSystem/View/HardwareStatusView.xaml
@@ -1,13 +1,13 @@
diff --git a/DosingSystem/View/HardwareStatusView.xaml.cs b/DosingSystem/View/HardwareStatusView.xaml.cs
index a98e5ed5..c0faa0fd 100644
--- a/DosingSystem/View/HardwareStatusView.xaml.cs
+++ b/DosingSystem/View/HardwareStatusView.xaml.cs
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
-namespace DosingSystem.View
+namespace BPASmartClient.DosingSystem.View
{
///
/// HardwareStatusView.xaml 的交互逻辑
diff --git a/DosingSystem/View/NewRecipeView.xaml b/DosingSystem/View/NewRecipeView.xaml
new file mode 100644
index 00000000..c017cb65
--- /dev/null
+++ b/DosingSystem/View/NewRecipeView.xaml
@@ -0,0 +1,222 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DosingSystem/View/NewRecipeView.xaml.cs b/DosingSystem/View/NewRecipeView.xaml.cs
new file mode 100644
index 00000000..180cdbf7
--- /dev/null
+++ b/DosingSystem/View/NewRecipeView.xaml.cs
@@ -0,0 +1,32 @@
+using BPASmartClient.Helper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace BPASmartClient.DosingSystem.View
+{
+ ///
+ /// NewRecipeView.xaml 的交互逻辑
+ ///
+ public partial class NewRecipeView : Window
+ {
+ public NewRecipeView()
+ {
+ InitializeComponent();
+ this.btClose.Click += (o, e) => { this.Close(); };
+ this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
+ ActionManage.GetInstance.CancelRegister("CloseNewRecipeView");
+ ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseNewRecipeView");
+ }
+ }
+}
diff --git a/DosingSystem/View/RecipeControlView.xaml b/DosingSystem/View/RecipeControlView.xaml
index 4f37f811..d705a4bc 100644
--- a/DosingSystem/View/RecipeControlView.xaml
+++ b/DosingSystem/View/RecipeControlView.xaml
@@ -1,27 +1,188 @@
-
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DosingSystem/View/RecipeControlView.xaml.cs b/DosingSystem/View/RecipeControlView.xaml.cs
index 4baeac2e..6e9330e3 100644
--- a/DosingSystem/View/RecipeControlView.xaml.cs
+++ b/DosingSystem/View/RecipeControlView.xaml.cs
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
-namespace DosingSystem.View
+namespace BPASmartClient.DosingSystem.View
{
///
/// RecipeControlView.xaml 的交互逻辑
diff --git a/DosingSystem/View/RecipeSettingsView.xaml b/DosingSystem/View/RecipeSettingsView.xaml
index bcb1d1b6..b1fcdd49 100644
--- a/DosingSystem/View/RecipeSettingsView.xaml
+++ b/DosingSystem/View/RecipeSettingsView.xaml
@@ -1,27 +1,246 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DosingSystem/View/RecipeSettingsView.xaml.cs b/DosingSystem/View/RecipeSettingsView.xaml.cs
index a269ad62..3785ab57 100644
--- a/DosingSystem/View/RecipeSettingsView.xaml.cs
+++ b/DosingSystem/View/RecipeSettingsView.xaml.cs
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
-namespace DosingSystem.View
+namespace BPASmartClient.DosingSystem.View
{
///
/// RecipeSettingsView.xaml 的交互逻辑
diff --git a/DosingSystem/ViewModel/AdminstratorsViewModel.cs b/DosingSystem/ViewModel/AdminstratorsViewModel.cs
deleted file mode 100644
index fb826d22..00000000
--- a/DosingSystem/ViewModel/AdminstratorsViewModel.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-using BPASmartClient.Helper;
-using Microsoft.Toolkit.Mvvm.ComponentModel;
-using Microsoft.Toolkit.Mvvm.Input;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Collections.ObjectModel;
-
-namespace DosingSystem.ViewModel
-{
- public class AdminstratorsViewModel : ObservableObject
- {
- public string Admin { get { return _admin; } set { _admin = value; OnPropertyChanged(); } }
- private string _admin;
-
- public string Password { get { return _password; } set { _password = value; OnPropertyChanged(); } }
- private string _password;
-
- public string ErrorMessage { get { return _errorMessage; } set { _errorMessage = value; OnPropertyChanged(); } }
- private string _errorMessage;
-
- public string SelectText { get { return _mSelectText; } set { _mSelectText = value; OnPropertyChanged(); } }
- private string _mSelectText;
-
-
- public RelayCommand AdminLoginCommand { get; set; }
-
- public ObservableCollection permission { get; set; } = new ObservableCollection();
-
- public AdminstratorsViewModel()
- {
- AdminLoginCommand = new RelayCommand(() =>
- {
- var rest = ActionManage.GetInstance.SendResult("LoginDosingSystem", $"{Admin}-={Password}-={SelectText}");
- if (rest != null && rest is string str)
- {
- ErrorMessage = str;
- }
- });
- permission.Add("管理员");
- permission.Add("操作员");
- permission.Add("观察员");
- permission.Add("技术员");
- SelectText = permission[0];
- }
- }
-}
diff --git a/DosingSystem/ViewModel/AlarmRecordViewModel.cs b/DosingSystem/ViewModel/AlarmRecordViewModel.cs
deleted file mode 100644
index f81769ad..00000000
--- a/DosingSystem/ViewModel/AlarmRecordViewModel.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Microsoft.Toolkit.Mvvm.ComponentModel;
-using System.Collections.Concurrent;
-using System.Collections.ObjectModel;
-using System.Windows;
-using BPASmartClient.Helper;
-using Microsoft.Toolkit.Mvvm.Input;
-
-namespace DosingSystem.ViewModel
-{
- public class AlarmRecordViewModel : ObservableObject
- {
- }
-}
diff --git a/DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs b/DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
new file mode 100644
index 00000000..3344882e
--- /dev/null
+++ b/DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using BPASmartClient.Helper;
+using BPASmartClient.DosingSystem.Model;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+
+namespace BPASmartClient.DosingSystem.ViewModel
+{
+ public class ChangeDeviceNameViewModel : ObservableObject
+ {
+ public ChangeDeviceNameViewModel()
+ {
+ ActionManage.GetInstance.Register(new Action((o) =>
+ {
+ if (o != null && o is string str) IpAddress = str;
+ }), "ChangeDeviceNameViewOpen");
+
+ CancleCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); });
+ ConfirmCommand = new RelayCommand(() =>
+ {
+ if (string.IsNullOrEmpty(DeviceName))
+ {
+ ErrorInfo = "设备名称不能为空";
+ return;
+ }
+ int index = Array.FindIndex(DeviceListViewModel.devices.ToArray(), p => p.IpAddress == IpAddress);
+ if (index >= 0 && index < DeviceListViewModel.devices.Count)
+ {
+ if (DeviceListViewModel.devices.FirstOrDefault(p => p.DeviceName == DeviceName) != null)
+ ErrorInfo = "设备名称已存在";
+ else
+ {
+ NewRecipeViewModel.RawMaterialNames.Remove(DeviceListViewModel.devices.ElementAt(index).DeviceName);
+ NewRecipeViewModel.RawMaterialNames.Add(DeviceName);
+ DeviceListViewModel.devices.ElementAt(index).DeviceName = DeviceName;
+
+ DeviceInquire.GetInstance.GetDevice(IpAddress).SetDeviceName(DeviceName);//设置PLC名称
+ for (int i = 0; i < Json.Data.Recipes.Count; i++)
+ {
+ for (int m = 0; m < Json.Data.Recipes.ElementAt(i).RawMaterials.Count; m++)
+ {
+ Json.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName;
+ }
+ }
+ ActionManage.GetInstance.Send("ChangeDeviceNameViewClose");
+ }
+ }
+
+ });
+ }
+
+ private static string IpAddress = string.Empty;
+
+ public RelayCommand ConfirmCommand { get; set; }
+
+ public RelayCommand CancleCommand { get; set; }
+
+
+ public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
+ private string _mErrorInfo;
+
+
+ public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } }
+ private string _mDeviceName;
+
+ }
+}
diff --git a/DosingSystem/ViewModel/DeviceListViewModel.cs b/DosingSystem/ViewModel/DeviceListViewModel.cs
index bf578c85..1823e92e 100644
--- a/DosingSystem/ViewModel/DeviceListViewModel.cs
+++ b/DosingSystem/ViewModel/DeviceListViewModel.cs
@@ -9,19 +9,27 @@ using System.Collections.ObjectModel;
using System.Windows;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
+using BPASmartClient.DosingSystem.View;
-namespace DosingSystem.ViewModel
+namespace BPASmartClient.DosingSystem.ViewModel
{
public class DeviceListViewModel : ObservableObject
{
public DeviceListViewModel()
{
- for (int i = 0; i < 10; i++)
+ ChangeNameCommand = new RelayCommand((o) =>
{
- devices.Add(new Devices() { IpAddress = $"192.168.1.{i + 10}", DeviceName = $"Device_{i}" });
- }
+ if (o != null && o is string str)
+ {
+ ChangeDeviceNameView cdn = new ChangeDeviceNameView();
+ ActionManage.GetInstance.Send("ChangeDeviceNameViewOpen", str);
+ cdn.ShowDialog();
+ }
+ });
}
+ public RelayCommand ChangeNameCommand { get; set; }
+
public static ObservableCollection devices { get; set; } = new ObservableCollection();
}
diff --git a/DosingSystem/ViewModel/HardwareStatusViewModel.cs b/DosingSystem/ViewModel/HardwareStatusViewModel.cs
index e48e3e3f..acedf8fa 100644
--- a/DosingSystem/ViewModel/HardwareStatusViewModel.cs
+++ b/DosingSystem/ViewModel/HardwareStatusViewModel.cs
@@ -10,7 +10,7 @@ using System.Windows;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
-namespace DosingSystem.ViewModel
+namespace BPASmartClient.DosingSystem.ViewModel
{
public class HardwareStatusViewModel : ObservableObject
{
diff --git a/DosingSystem/ViewModel/MainViewModel.cs b/DosingSystem/ViewModel/MainViewModel.cs
deleted file mode 100644
index db25e56d..00000000
--- a/DosingSystem/ViewModel/MainViewModel.cs
+++ /dev/null
@@ -1,152 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Microsoft.Toolkit.Mvvm.ComponentModel;
-using System.Collections.Concurrent;
-using System.Collections.ObjectModel;
-using System.Windows;
-using BPASmartClient.Helper;
-using Microsoft.Toolkit.Mvvm.Input;
-using DosingSystem.Model;
-using Newtonsoft.Json;
-using System.IO;
-
-namespace DosingSystem.ViewModel
-{
- public class MainViewModel : ObservableObject
- {
- ObservableCollection menus = new ObservableCollection();
-
- private Permission _permission;
- public Permission permission
- {
- get { return _permission; }
- set
- {
- var res = menus.Where(p => Array.FindIndex(p.permission, s => s == value) >= 0).ToList();
- if (res != null && res.Count > 0)
- {
- Menus.Clear();
- res.ForEach((item) => { Menus.Add(item); });
- }
- _permission = value;
- }
- }
-
-
- public MainViewModel()
- {
- TogglePag = new RelayCommand(DoNavChanged);
- Login = new RelayCommand(() => { DoNavChanged("AdminstratorsView.用户登录"); UserManagement = false; });
- PasswordChange = new RelayCommand(() =>
- {
- //DoNavChanged("PasswordChangeView.密码修改");
- UserManagement = false;
- });
- ExitLogin = new RelayCommand(() =>
- {
- //DoNavChanged("LoginView.退出登录");
- UserManagement = false;
- });
- Config.GetInstance.Init();
- LoginRegister();
- MenuInit();
- permission = Permission.观察员;
- if (Menus.Count > 0) DoNavChanged(Menus.ElementAt(0).CommandParameter);
-
- }
-
- private void LoginRegister()
- {
- ActionManage.GetInstance.Register(new Func((o) =>
- {
- if (o != null && o is string str)
- {
- var strs = str.Split("-=");
- if (strs != null && strs.Length == 3)
- {
- var us = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == strs[0]);
- if (us != null && strs[1] == us.Password && strs[2] == us.permission.ToString())
- {
- permission = us.permission;
- return string.Empty;
- }
- }
- }
- return "用户名或密码错误";
- }), "LoginDosingSystem");
- }
-
- private void MenuInit()
- {
- menus.Add(new ActionMenu()
- {
- MenuName = "配方设置",
- CommandParameter = "RecipeSettingsView.配方设置",
- permission = new Permission[] { Permission.管理员, Permission.技术员 },
- });
- menus.Add(new ActionMenu()
- {
- MenuName = "设备列表",
- CommandParameter = "DeviceListView.设备列表",
- permission = new Permission[] { Permission.管理员, Permission.技术员 },
- });
- menus.Add(new ActionMenu()
- {
- MenuName = "硬件状态",
- CommandParameter = "HardwareStatusView.硬件状态",
- permission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
- });
- menus.Add(new ActionMenu()
- {
- MenuName = "报警记录",
- CommandParameter = "AlarmRecordView.报警记录",
- permission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
- });
- menus.Add(new ActionMenu()
- {
- MenuName = "配方下发",
- CommandParameter = "RecipeControlView.配方控制",
- permission = new Permission[] { Permission.管理员, Permission.操作员 },
- });
- }
-
- public void DoNavChanged(object obj)
- {
- if (obj != null && obj is string stobj)
- {
- var strs = stobj.Split('.');
- if (strs != null && strs.Length == 2)
- {
- Type type = Type.GetType($"DosingSystem.View.{strs[0]}");
- var res = type?.GetConstructor(System.Type.EmptyTypes)?.Invoke(null);
- if (res != null && res is FrameworkElement fe) MyWindow = fe;
- WindowTitleName = strs[1];
- }
- }
- }
-
- public RelayCommand TogglePag { get; set; }
-
- public RelayCommand Login { get; set; }
-
- public RelayCommand PasswordChange { get; set; }
-
- public RelayCommand ExitLogin { get; set; }
-
- public ObservableCollection Menus { get; set; } = new ObservableCollection();
-
- public FrameworkElement MyWindow { get { return _mMyWindow; } set { _mMyWindow = value; OnPropertyChanged(); } }
- private FrameworkElement _mMyWindow;
-
- public string WindowTitleName { get { return _mWindowTitleName; } set { _mWindowTitleName = value; OnPropertyChanged(); } }
- private string _mWindowTitleName;
-
- public bool UserManagement { get { return _mUserManagement; } set { _mUserManagement = value; OnPropertyChanged(); } }
- private bool _mUserManagement;
-
- public bool AutoStart { get { return SystemHelper.GetInstance.IsAutoStart(); } set { SystemHelper.GetInstance.AutoStart(value); OnPropertyChanged(); } }
- }
-}
diff --git a/DosingSystem/ViewModel/NewRecipeViewModel.cs b/DosingSystem/ViewModel/NewRecipeViewModel.cs
new file mode 100644
index 00000000..03e6712c
--- /dev/null
+++ b/DosingSystem/ViewModel/NewRecipeViewModel.cs
@@ -0,0 +1,131 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System.Collections.ObjectModel;
+using Microsoft.Toolkit.Mvvm.Input;
+using BPASmartClient.Helper;
+using BPASmartClient.DosingSystem.Model;
+
+namespace BPASmartClient.DosingSystem.ViewModel
+{
+ public class NewRecipeViewModel : ObservableObject
+ {
+ public NewRecipeViewModel()
+ {
+ ActionManage.GetInstance.Register(new Action((o) =>
+ {
+ if (o != null && o is RecipeModel rm)
+ {
+ RecipeName = rm.RecipeName;
+ foreach (var item in rm.RawMaterials)
+ {
+ RawMaterials.Add(item);
+ }
+ RecipCode = rm.RecipCode;
+ }
+ }), "Details");
+
+ AddCommand = new RelayCommand(() =>
+ {
+ p:
+ string guid = Guid.NewGuid().ToString();
+ if (RawMaterials.FirstOrDefault(p => p.RawMaterialId == guid) == null)
+ {
+ RawMaterials.Add(new RawMaterialModel()
+ {
+ RawMaterialId = guid
+ });
+ }
+ else goto p;
+ });
+
+ RemoveCommand = new RelayCommand((obj) =>
+ {
+ if (obj is string rm)
+ {
+ var res = RawMaterials.FirstOrDefault(p => p.RawMaterialId == rm);
+ if (res != null) RawMaterials.Remove(res);
+ }
+ });
+
+ SaveCommand = new RelayCommand(() =>
+ {
+ for (int i = 0; i < RawMaterials.Count; i++)
+ {
+ var res = DeviceListViewModel.devices.FirstOrDefault(p => p.DeviceName == RawMaterials.ElementAt(i).RawMaterialName);
+ if (res != null) RawMaterials.ElementAt(i).DeviceIp = res.IpAddress;
+ }
+
+ if (RecipCode.Length <= 0)
+ {
+ var res = Array.FindIndex(Json.Data.Recipes.ToArray(), p => p.RecipeName == RecipeName);
+
+ if (res >= 0 && res < Json.Data.Recipes.Count)
+ {
+ ErrorInfo = "该配方已存在,请重新输入";
+ }
+ else
+ {
+ AddRecipes();
+ }
+ }
+ else
+ {
+ var res = Array.FindIndex(Json.Data.Recipes.ToArray(), p => p.RecipCode == RecipCode);
+ if (res >= 0 && res < Json.Data.Recipes.Count)
+ {
+ Json.Data.Recipes.ElementAt(res).RecipeName = RecipeName;
+ Json.Data.Recipes.ElementAt(res).RawMaterials.Clear();
+ foreach (var item in RawMaterials)
+ {
+ Json.Data.Recipes.ElementAt(res).RawMaterials.Add(item);
+ }
+ }
+ }
+
+ ActionManage.GetInstance.Send("CloseNewRecipeView");
+ });
+ }
+
+ private void AddRecipes()
+ {
+ string date = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
+ var dates = date.Split("-").ToList();
+ StringBuilder sb = new StringBuilder();
+ dates?.ForEach((item) => { sb.Append(item); });
+ Json.Data.Recipes.Add(new RecipeModel()
+ {
+ SerialNum = Json.Data.Recipes.Count + 1,
+ RawMaterials = RawMaterials,
+ RecipCode = sb.ToString(),
+ RecipeName = RecipeName,
+ });
+ }
+
+ static NewRecipeViewModel()
+ {
+ RawMaterialNames.Clear();
+ }
+
+ private string RecipCode = string.Empty;
+
+ public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } }
+ private string _mRecipeName;
+
+ public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
+ private string _mErrorInfo;
+
+ public RelayCommand AddCommand { get; set; }
+
+ public RelayCommand RemoveCommand { get; set; }
+
+ public RelayCommand SaveCommand { get; set; }
+
+ public ObservableCollection RawMaterials { get; set; } = new ObservableCollection();
+
+ public static ObservableCollection RawMaterialNames { get; set; } = new ObservableCollection();
+ }
+}
diff --git a/DosingSystem/ViewModel/RecipeControlViewModel.cs b/DosingSystem/ViewModel/RecipeControlViewModel.cs
index 526d96f8..a1a3536b 100644
--- a/DosingSystem/ViewModel/RecipeControlViewModel.cs
+++ b/DosingSystem/ViewModel/RecipeControlViewModel.cs
@@ -9,10 +9,84 @@ using System.Collections.ObjectModel;
using System.Windows;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
+using BPASmartClient.DosingSystem.Model;
+using System.Threading;
+using BPASmartClient.CustomResource.Pages.Model;
-namespace DosingSystem.ViewModel
+namespace BPASmartClient.DosingSystem.ViewModel
{
public class RecipeControlViewModel : ObservableObject
{
+ ConcurrentQueue devices = new ConcurrentQueue();
+
+ public RecipeControlViewModel()
+ {
+ Recipes = Json.Data.Recipes;
+ StartCommand = new RelayCommand((o) =>
+ {
+ //if (o != null && o is string deviceName)
+ //{
+ // int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == deviceName);
+ // if (index >= 0 && index < Recipes.Count)
+ // {
+ // Recipes.ElementAt(index).IsEnable = false;
+ // }
+ // MessageLog.GetInstance.ShowUserLog($"下发工单 { Recipes.ElementAt(index).RecipeName}");
+ // devices.Enqueue(deviceName);
+ //}
+
+ MessageLog.GetInstance.ShowUserLog($"下发工单 { Guid.NewGuid().ToString()}");
+ });
+
+
+ ThreadManage.GetInstance().StartLong(new Action(() =>
+ {
+ if (devices.Count > 0)
+ {
+ int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == devices.ElementAt(0));
+ if (index >= 0 && index < Recipes.Count)
+ {
+ Recipes.ElementAt(index).Are.Reset();
+ Recipes.ElementAt(index).IsEnable = false;
+ foreach (var item in Recipes.ElementAt(index).RawMaterials)
+ {
+ DeviceInquire.GetInstance.GetDevice(item.DeviceIp)?.Start(item.RawMaterialWeight);//启动写入
+ }
+ Recipes.ElementAt(index).Are.WaitOne();
+ devices.TryDequeue(out string deviceName);
+ }
+
+ }
+ Thread.Sleep(100);
+ }), "启动配发下发");
+
+
+ ThreadManage.GetInstance().StartLong(new Action(() =>
+ {
+ for (int i = 0; i < Recipes.Count; i++)
+ {
+ for (int m = 0; m < Recipes.ElementAt(i).RawMaterials.Count; m++)
+ {
+ var RunStatus = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp).deviceStatus.RunStatus;
+ Recipes.ElementAt(i).RawMaterials.ElementAt(m).RecipeStatus = RunStatus;
+ var res = Recipes.ElementAt(i).RawMaterials.Where(p => p.RecipeStatus == 3).ToList();
+ if (res != null && res.Count == Recipes.ElementAt(i).RawMaterials.Count)
+ {
+ for (int r = 0; r < Recipes.ElementAt(i).RawMaterials.Count; r++)
+ {
+ DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(r).DeviceIp).StatusReset();
+ }
+ Recipes.ElementAt(i).IsEnable = true;
+ Recipes.ElementAt(i).Are.Set();
+ }
+ }
+ }
+ Thread.Sleep(100);
+ }), "RecipeControlViewModelStatusInquire");
+
+ }
+
+ public RelayCommand StartCommand { get; set; }
+ public ObservableCollection Recipes { get; set; }
}
}
diff --git a/DosingSystem/ViewModel/RecipeSettingsViewModel.cs b/DosingSystem/ViewModel/RecipeSettingsViewModel.cs
index 64465d5a..28b41889 100644
--- a/DosingSystem/ViewModel/RecipeSettingsViewModel.cs
+++ b/DosingSystem/ViewModel/RecipeSettingsViewModel.cs
@@ -9,9 +9,55 @@ using System.Collections.ObjectModel;
using System.Windows;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
-namespace DosingSystem.ViewModel
+using BPASmartClient.DosingSystem.Model;
+using BPASmartClient.DosingSystem.View;
+
+namespace BPASmartClient.DosingSystem.ViewModel
{
public class RecipeSettingsViewModel : ObservableObject
{
+ public RecipeSettingsViewModel()
+ {
+ //Json.Read();
+ Recipes = Json.Data.Recipes;
+ NewRecipe = new Action(() =>
+ {
+ NewRecipeView nrv = new NewRecipeView();
+ nrv.ShowDialog();
+ });
+ SaveRecipe = new Action(() => { Json.Save(); });
+ RemoveCommand = new RelayCommand((o) =>
+ {
+ if (o is string str)
+ {
+ var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipCode == str);
+ if (res != null) Json.Data.Recipes.Remove(res);
+ }
+ });
+
+ DetailsCommand = new RelayCommand((o) =>
+ {
+ if (o != null && o is string str)
+ {
+ ActionManage.GetInstance.CancelRegister("Details");
+ NewRecipeView nrv = new NewRecipeView();
+ ActionManage.GetInstance.Send("Details", Json.Data.Recipes.FirstOrDefault(p => p.RecipCode == str));
+ nrv.ShowDialog();
+
+ }
+ });
+ }
+
+ public Action NewRecipe { get; set; }
+
+ public Action SaveRecipe { get; set; }
+
+ public RelayCommand EditCommand { get; set; }
+
+ public RelayCommand DetailsCommand { get; set; }
+
+ public RelayCommand RemoveCommand { get; set; }
+
+ public ObservableCollection Recipes { get; set; }
}
}
diff --git a/FryPot_DosingSystem/App.xaml b/FryPot_DosingSystem/App.xaml
new file mode 100644
index 00000000..b23b0141
--- /dev/null
+++ b/FryPot_DosingSystem/App.xaml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FryPot_DosingSystem/App.xaml.cs b/FryPot_DosingSystem/App.xaml.cs
new file mode 100644
index 00000000..ec22c536
--- /dev/null
+++ b/FryPot_DosingSystem/App.xaml.cs
@@ -0,0 +1,202 @@
+using BPASmartClient.AGV.Feedback;
+using BPASmartClient.CustomResource.Pages.Enums;
+using BPASmartClient.CustomResource.Pages.Model;
+using BPASmartClient.CustomResource.Pages.View;
+using BPASmartClient.Helper;
+using BPASmartClient.HubHelper;
+using FryPot_DosingSystem.Control;
+using FryPot_DosingSystem.Model;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace FryPot_DosingSystem
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ protected override void OnStartup(StartupEventArgs e)
+ {
+ base.OnStartup(e);
+ MenuInite();
+ LoginDataInite();
+
+ MainView mv = new MainView();
+ LoginView lv = new LoginView();
+ var res = lv.ShowDialog();
+ if (res != null && res == true)
+ {
+ mv.Show();
+ DeviceOperate deviceOperate = DeviceOperate.GetInstance;//开启实时PLC数据读取
+ DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序
+ }
+ else
+ mv.Close();
+
+
+ HubHelper.GetInstance.Report = new Action((o) =>
+ {
+ var res = JsonConvert.DeserializeObject(o.ToString());
+ });
+
+ HubHelper.GetInstance.Upstreamrequest = new Action((o) =>
+ {
+ var res = JsonConvert.DeserializeObject(o.ToString());
+ });
+
+ HubHelper.GetInstance.Connect("192.168.1.99", 8089);
+
+ }
+ protected override void OnExit(ExitEventArgs e)
+ {
+ base.OnExit(e);
+ Json.Save();
+ MessageLog.GetInstance.LogSave();
+ }
+ private void MenuInite()
+ {
+ #region 配方管理菜单
+ ObservableCollection RecipeManage = new ObservableCollection();
+ RecipeManage.Add(new SubMenumodel()
+ {
+ SubMenuName = "配方管理",
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
+ AssemblyName = "FryPot_DosingSystem",
+ ToggleWindowPath = "View.RecipeSetView"
+ });
+
+ RecipeManage.Add(new SubMenumodel()
+ {
+ SubMenuName = "配方下发",
+ SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
+ AssemblyName = "FryPot_DosingSystem",
+ ToggleWindowPath = "View.RecipeSendDownView"
+ });
+
+ MenuManage.GetInstance.menuModels.Add(new MenuModel()
+ {
+ MainMenuIcon = "",
+ MainMenuName = "配方管理",
+ Alias = "Recipe Management",
+ MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
+ subMenumodels = RecipeManage,
+ });
+ #endregion
+
+ #region 消息日志
+ ObservableCollection InfoLog = new ObservableCollection();
+ InfoLog.Add(new SubMenumodel()
+ {
+ SubMenuName = "操作日志",
+ SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
+ AssemblyName = "BPASmartClient.CustomResource",
+ ToggleWindowPath = "Pages.View.UserLogView"
+ });
+
+ InfoLog.Add(new SubMenumodel()
+ {
+ SubMenuName = "运行日志",
+ SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
+ AssemblyName = "BPASmartClient.CustomResource",
+ ToggleWindowPath = "Pages.View.RunLogView"
+ });
+
+ InfoLog.Add(new SubMenumodel()
+ {
+ SubMenuName = "报警记录",
+ SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
+ AssemblyName = "BPASmartClient.CustomResource",
+ ToggleWindowPath = "Pages.View.AlarmView"
+ });
+
+ MenuManage.GetInstance.menuModels.Add(new MenuModel()
+ {
+ MainMenuIcon = "",
+ MainMenuName = "消息日志",
+ Alias = "Message Log",
+ MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
+ subMenumodels = InfoLog,
+ });
+ #endregion
+
+ #region 硬件设备监控
+ ObservableCollection DeviceMonitor = new ObservableCollection();
+ DeviceMonitor.Add(new SubMenumodel()
+ {
+ SubMenuName = "PLC通讯设置",
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
+ AssemblyName = "FryPot_DosingSystem",
+ ToggleWindowPath = "View.DeviceListVIew"
+ });
+
+ DeviceMonitor.Add(new SubMenumodel()
+ {
+ SubMenuName = "滚筒线运行状态",
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员, Permission.观察员 },
+ AssemblyName = "FryPot_DosingSystem",
+ ToggleWindowPath = "View.HardWareStatusView"
+
+ });
+
+ DeviceMonitor.Add(new SubMenumodel()
+ {
+ SubMenuName = "AGV视图",
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
+ AssemblyName = "FryPot_DosingSystem",
+ ToggleWindowPath = "View.AgvView"
+ });
+
+ MenuManage.GetInstance.menuModels.Add(new MenuModel()
+ {
+ MainMenuIcon = "",
+ MainMenuName = "设备监控",
+ Alias = "Device Monitor",
+ MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员, Permission.观察员 },
+ subMenumodels = DeviceMonitor,
+ });
+ #endregion
+
+ #region 用户管理
+ ObservableCollection UserManager = new ObservableCollection();
+ UserManager.Add(new SubMenumodel()
+ {
+ SubMenuName = "用户登录",
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
+ AssemblyName = "BPASmartClient.CustomResource",
+ ToggleWindowPath = "Pages.View.LoginView"
+ });
+
+ UserManager.Add(new SubMenumodel()
+ {
+ SubMenuName = "密码修改",
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
+ AssemblyName = "BPASmartClient.CustomResource",
+ ToggleWindowPath = "Pages.View.PasswordChangeView"
+ });
+
+
+ MenuManage.GetInstance.menuModels.Add(new MenuModel()
+ {
+ MainMenuIcon = "",
+ MainMenuName = "用户管理",
+ Alias = "User Management",
+ MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
+ subMenumodels = UserManager,
+ });
+ #endregion
+ }
+ private void LoginDataInite()
+ {
+ Config.GetInstance.Init();//用户数据初始化
+ Json.Read();
+ }
+ }
+}
diff --git a/FryPot_DosingSystem/AssemblyInfo.cs b/FryPot_DosingSystem/AssemblyInfo.cs
new file mode 100644
index 00000000..8b5504ec
--- /dev/null
+++ b/FryPot_DosingSystem/AssemblyInfo.cs
@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/FryPot_DosingSystem/Control/DeviceOperate.cs b/FryPot_DosingSystem/Control/DeviceOperate.cs
new file mode 100644
index 00000000..821a9793
--- /dev/null
+++ b/FryPot_DosingSystem/Control/DeviceOperate.cs
@@ -0,0 +1,106 @@
+using BPASmartClient.Helper;
+using BPASmartClient.Message;
+using BPASmartClient.Modbus;
+using FryPot_DosingSystem.Model;
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.Control
+{
+ internal class DeviceOperate
+ {
+ private static DeviceOperate _instance;
+ public static DeviceOperate GetInstance=>_instance ??= new DeviceOperate();
+ ModbusTcp modbus = new ModbusTcp();
+ private string Ip { get; set; }
+ private string Port { get; set; }
+ private bool Connected { get; set; }
+
+ private string DeviceName { get; set; }
+
+ public ConcurrentDictionary Data { get; set; } = new ConcurrentDictionary();
+ public ObservableCollection Variables { get; set; }=new ObservableCollection();
+ public DeviceOperate()
+ {
+ Init();
+ Connect();
+ ReadData();
+ }
+ public void Init()
+ {
+ if (Variables.Count > 0)
+ {
+ Variables.Clear();
+ }
+ Variables.Add(new PlcVariableModel() { Address = "D2001", Length = 8 });//1号线体滚筒工位号
+ Variables.Add(new PlcVariableModel() { Address = "D2011", Length = 8 });//2号线体滚筒工位号
+ Variables.Add(new PlcVariableModel() { Address = "D2021", Length = 8 });//3号线体滚筒工位号
+ Variables.Add(new PlcVariableModel() { Address = "D2031", Length = 9 });//输送线出料状态
+ Variables.Add(new PlcVariableModel() { Address = "D2040", Length = 5 });//炒锅1-5进料滚筒运行
+ Variables.Add(new PlcVariableModel() { Address = "D2045", Length = 5 });//炒锅1-5进料到位信号
+ Variables.Add(new PlcVariableModel() { Address = "D2050", Length = 5 });//炒锅1-5空桶到位信号
+ Variables.Add(new PlcVariableModel() { Address = "D2055", Length = 5 });//炒锅1-5空桶呼叫AGV
+ Variables.Add(new PlcVariableModel() { Address = "D2060", Length = 5 });//炒锅1空桶洗桶呼叫AGV
+ Variables.Add(new PlcVariableModel() { Address = "D2065", Length = 5 });//炒锅1-5空桶滚筒运行
+ Variables.Add(new PlcVariableModel() { Address = "D2070", Length = 5 });//炒锅1-5滚筒故障信号
+ Variables.Add(new PlcVariableModel() { Address = "D2075", Length = 1 });//洗桶进桶滚筒运行信号
+ Variables.Add(new PlcVariableModel() { Address = "D2076", Length = 1 });//洗桶出桶呼叫AGV
+ Variables.Add(new PlcVariableModel() { Address = "D2077", Length = 1 });// 洗桶出桶滚筒运行信号
+ Variables.Add(new PlcVariableModel() { Address = "D2078", Length = 3 });//1-3滚筒线体配方完成信号
+ }
+ public void Connect()
+ {
+ Json.Read();
+ DeviceManage devices = Json.Data;
+ if (devices != null)
+ {
+ if (devices.Devices.Count > 0)
+ {
+ Ip = devices.Devices[0].Ip;
+ Port = devices.Devices[0].Port;
+ DeviceName = devices.Devices[0].DeviceName;
+ Task.Run(() => { modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); });
+ }
+ }
+ }
+ public void ReadData()
+ {
+ ThreadManage.GetInstance().StartLong(new Action(() =>
+ {
+ Connected = modbus.Connected;
+ while (Connected)
+ {
+ foreach (var item in Variables)
+ {
+ var res = modbus.Read(item.Address, item.Length, "180项目");
+ if (Data.ContainsKey(item.Address))
+ {
+ Data[item.Address] = res;
+ }
+ else
+ {
+ Data.TryAdd(item.Address, res);
+ }
+ }
+ Thread.Sleep(500);
+
+ }
+ Thread.Sleep(1000);
+ }),$"设备【{DeviceName}】PLC实时数据读取线程");
+ }
+ public void WritePlcData(string address,ushort value)
+ {
+ modbus.Write(address, value,"180项目");
+ }
+ public ConcurrentDictionary GetAllData()
+ {
+ return Data;
+ }
+ }
+}
diff --git a/FryPot_DosingSystem/Control/DosingLogicControl.cs b/FryPot_DosingSystem/Control/DosingLogicControl.cs
new file mode 100644
index 00000000..d3296f70
--- /dev/null
+++ b/FryPot_DosingSystem/Control/DosingLogicControl.cs
@@ -0,0 +1,1187 @@
+using BPASmartClient.AGV;
+using BPASmartClient.AGV.Enums;
+using BPASmartClient.AGV.Feedback;
+using BPASmartClient.CustomResource.Pages.Model;
+using BPASmartClient.Helper;
+using BPASmartClient.HubHelper;
+using FryPot_DosingSystem.Model;
+using FryPot_DosingSystem.ViewModel;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows.Media;
+using System.Windows;
+
+namespace FryPot_DosingSystem.Control
+{
+ internal class DosingLogicControl
+ {
+ public static DosingLogicControl _instance;
+ public static DosingLogicControl GetInstance => _instance ??= new DosingLogicControl();
+ public ConcurrentDictionary PlcReadData = new ConcurrentDictionary();
+ ///
+ /// 配方队列
+ ///
+ public ConcurrentQueue RecipeQuene = new ConcurrentQueue();
+ ///
+ /// 进料原料队列
+ ///
+ public ConcurrentQueue InputMaterialQuene = new ConcurrentQueue();
+ ///
+ /// 出料原料队列
+ ///
+ public ConcurrentQueue OutputMaterialQuene = new ConcurrentQueue();
+ ///
+ /// 全局变量对象声明
+ ///
+ GlobalVariable globalVar;
+ ///
+ /// 线体状态对象声明
+ ///
+ HardWareStatusViewModel hardWareStatusModel;
+
+ #region 上位机内部变量
+ //int lineAlarm = 0;//线体故障信号 1:无故障 -1:故障
+ int FryPotAlarm = 0;//炒锅滚筒故障信号 1:无故障 -1:故障
+ int ReicpeNum = 0;//记录接收到的配方数
+ #endregion
+ #region agv临时变量
+ bool agvArriveUpLoad = false;//agv是否到达线体装料位置
+ bool agvArriveUnLoad = false;//agv是否到达炒锅送料位置
+ bool agvFryPotEmptyRollerArrive = false;//agv是否拿到炒锅空桶
+ string robotJobId = String.Empty;//当前上游系统任务号,全局唯一
+ //List robotJobIds = new List();//存储当前上游系统任务号,全局唯一
+ bool loadInteractive = false;// fasle:不需要上料交互 true:需要上料交互
+ #endregion
+ public DosingLogicControl()
+ {
+ globalVar = new GlobalVariable();
+ hardWareStatusModel = HardWareStatusViewModel.GetInstance;
+ ActionManage.GetInstance.Register(new Action(RecipeDataParse), "RecipeSetDown");
+ ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); }), "ClearRecipes");
+ ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 1; }), "StartPlcInite");
+ ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 0; }), "EndPlcInite");
+ ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitMainTask = true; }), "FryPotDosingMainTaskExit");
+ HubHelper.GetInstance.Report = new Action(AgvTaskUpReportDataAnalysis);
+ HubHelper.GetInstance.Upstreamrequest = new Action(AgvFeedBackUpReportDataAnalysis);
+ ResetProgram();
+ ReadPlcData();
+ IniteTask();
+ }
+
+ ///
+ /// AGV上下料上报数据解析
+ ///
+ ///
+ private void AgvFeedBackUpReportDataAnalysis(object obj)
+ {
+ if (obj != null && obj is byte[] datas)
+ {
+ string strData = Encoding.UTF8.GetString(datas);
+ object objData = JsonConvert.DeserializeObject(strData);
+ if (objData != null && objData is Upstreamrequest upDownReportData)
+ {
+ //if (upDownReportData.body != null && upDownReportData.body is UpstreamrequestBody body)
+ //{
+ // if (body.robotJobId == robotJobId && body.command == "LOAD")//同一任务号且处于上料阶段
+ // {
+ // agvArriveUpLoad = true;//AGV到达上料位置
+ // }
+ // if (body.robotJobId == robotJobId && body.command == "UNLOAD")//同一任务号且处于下料阶段
+ // {
+ // agvArriveUnLoad = true;//AGV到达下料位置
+ // }
+
+ //}
+ }
+ }
+ }
+
+ ///
+ /// AGV搬运任务上报数据解析
+ ///
+ ///
+ private void AgvTaskUpReportDataAnalysis(object obj)
+ {
+ if (obj != null && obj is byte[] datas)
+ {
+ string strData = Encoding.UTF8.GetString(datas);
+ object objData = JsonConvert.DeserializeObject(strData);
+ if (objData != null && objData is AGVToUpSystem agvUpReportData)
+ {
+ //if (agvUpReportData.body != null && agvUpReportData.body is AGVToUpSystemBody body)
+ //{
+ // if (body.state == "ROLLER_LOAD_FINISH" && body.jobData.startPointCode == "")//上料完成以及到达指定上料点位
+ // {
+ // agvFryPotEmptyRollerArrive = true;
+ // }
+ //}
+ }
+ }
+ }
+
+ ///
+ /// 主任务重启
+ ///
+ private void ResetProgram()
+ {
+ ThreadManage.GetInstance().StartLong(new Action(() =>
+ {
+ if (RTrig.GetInstance("ResetProgram").Start(globalVar.PlcInite == 1))//判断是否初始化 一初始化就重启主任务
+ {
+ MessageLog.GetInstance.ShowRunLog("主任务正在重启");
+ ThreadManage.GetInstance().StopTask("MainTask", new Action(() =>
+ {
+ ThreadManage.GetInstance().StopTask("MainViewReadPlcData", new Action(() =>
+ {
+ globalVar = null;
+ globalVar = new GlobalVariable();
+ ReicpeNum = 0;
+ ActionManage.GetInstance.CancelRegister("RecipeSetDown");
+ ActionManage.GetInstance.Register(new Action(RecipeDataParse), "RecipeSetDown");
+ ActionManage.GetInstance.Send("ClearRecipes");
+ ReadPlcData();
+ IniteTask();
+ MessageLog.GetInstance.ShowRunLog("主任务重启完成");
+ }));
+ }));
+ }
+
+ Thread.Sleep(10);
+ }), "ResetProgram");
+ }
+ ///
+ /// 实时获取plc数据
+ ///
+ public void ReadPlcData()
+ {
+ ThreadManage.GetInstance().StartLong(new Action(() =>
+ {
+ GetAddressData("D2001", new Action((data) =>
+ {
+ globalVar.rollerLineOne.StationOne = data[0];
+ globalVar.rollerLineOne.StationTwo = data[1];
+ globalVar.rollerLineOne.StationThree = data[2];
+ globalVar.rollerLineOne.StationFour = data[3];
+ globalVar.rollerLineOne.StationFive = data[4];
+ globalVar.rollerLineOne.StationSix = data[5];
+ globalVar.rollerLineOne.StationSeven = data[6];
+ globalVar.rollerLineOne.StationEight = data[7];
+ }));
+ GetAddressData("D2011", new Action((data) =>
+ {
+ globalVar.rollerLineTwo.StationOne = data[0];
+ globalVar.rollerLineTwo.StationTwo = data[1];
+ globalVar.rollerLineTwo.StationThree = data[2];
+ globalVar.rollerLineTwo.StationFour = data[3];
+ globalVar.rollerLineTwo.StationFive = data[4];
+ globalVar.rollerLineTwo.StationSix = data[5];
+ globalVar.rollerLineTwo.StationSeven = data[6];
+ globalVar.rollerLineTwo.StationEight = data[7];
+ }));
+ GetAddressData("D2021", new Action((data) =>
+ {
+ globalVar.rollerLineThree.StationOne = data[0];
+ globalVar.rollerLineThree.StationTwo = data[1];
+ globalVar.rollerLineThree.StationThree = data[2];
+ globalVar.rollerLineThree.StationFour = data[3];
+ globalVar.rollerLineThree.StationFive = data[4];
+ globalVar.rollerLineThree.StationSix = data[5];
+ globalVar.rollerLineThree.StationSeven = data[6];
+ globalVar.rollerLineThree.StationEight = data[7];
+ }));
+ GetAddressData("D2031", new Action((data) =>
+ {
+ globalVar.rollerLineOne.OutMaterialingSingle = data[3];
+ globalVar.rollerLineTwo.OutMaterialingSingle = data[4];
+ globalVar.rollerLineThree.OutMaterialingSingle = data[5];
+ globalVar.rollerLineOne.OutMaterialingTroubleSingle = data[6];
+ globalVar.rollerLineTwo.OutMaterialingTroubleSingle = data[7];
+ globalVar.rollerLineThree.OutMaterialingTroubleSingle = data[8];
+ }));
+ GetAddressData("D2040", new Action((data) =>
+ {
+ globalVar.fryPotOne.InputMaterialRollerRunningSingle = data[0];
+ globalVar.fryPotTwo.InputMaterialRollerRunningSingle = data[1];
+ globalVar.fryPotThree.InputMaterialRollerRunningSingle = data[2];
+ globalVar.fryPotFour.InputMaterialRollerRunningSingle = data[3];
+ globalVar.fryPotFive.InputMaterialRollerRunningSingle = data[4];
+ }));
+ GetAddressData("D2045", new Action((data) =>
+ {
+ globalVar.fryPotOne.InputMaterialArrivedSingle = data[0];
+ globalVar.fryPotTwo.InputMaterialArrivedSingle = data[1];
+ globalVar.fryPotThree.InputMaterialArrivedSingle = data[2];
+ globalVar.fryPotFour.InputMaterialArrivedSingle = data[3];
+ globalVar.fryPotFive.InputMaterialArrivedSingle = data[4];
+ }));
+ GetAddressData("D2050", new Action((data) =>
+ {
+ globalVar.fryPotOne.EmptyBarrelArrivedSingle = data[0];
+ globalVar.fryPotTwo.EmptyBarrelArrivedSingle = data[1];
+ globalVar.fryPotThree.EmptyBarrelArrivedSingle = data[2];
+ globalVar.fryPotFour.EmptyBarrelArrivedSingle = data[3];
+ globalVar.fryPotFive.EmptyBarrelArrivedSingle = data[4];
+ }));
+ GetAddressData("D2065", new Action((data) =>
+ {
+ globalVar.fryPotOne.EmptyBarrelRollerRunningSingle = data[0];
+ globalVar.fryPotTwo.EmptyBarrelRollerRunningSingle = data[1];
+ globalVar.fryPotThree.EmptyBarrelRollerRunningSingle = data[2];
+ globalVar.fryPotFour.EmptyBarrelRollerRunningSingle = data[3];
+ globalVar.fryPotFive.EmptyBarrelRollerRunningSingle = data[4];
+ }));
+ GetAddressData("D2070", new Action((data) =>
+ {
+ globalVar.fryPotOne.RollerTroubleSingle = data[0];
+ globalVar.fryPotTwo.RollerTroubleSingle = data[1];
+ globalVar.fryPotThree.RollerTroubleSingle = data[2];
+ globalVar.fryPotFour.RollerTroubleSingle = data[3];
+ globalVar.fryPotFive.RollerTroubleSingle = data[4];
+ }));
+ GetAddressData("D2078", new Action(data =>
+ {
+ globalVar.rollerLineOne.RecipeCompleteSingle = data[0];
+ globalVar.rollerLineTwo.RecipeCompleteSingle = data[1];
+ globalVar.rollerLineThree.RecipeCompleteSingle = data[2];
+ }));
+ GetAddressData("D2075", new Action(data =>
+ {
+
+ globalVar.CleadBarrelEnterSingle = data[0];
+ }));
+ GetAddressData("D2077", new Action(data =>
+ {
+
+ globalVar.CleadBarrelExitSingle = data[0];
+ }));
+ //globalVar.rollerLineOne.OutMaterialingSingle = 0;
+ //globalVar.rollerLineOne.StationOne = 401;
+ //globalVar.rollerLineOne.StationTwo = 402;
+ //globalVar.rollerLineOne.OutMaterialingTroubleSingle = 1;
+ RollerLineStatusDisplay();
+ Thread.Sleep(10);
+ }), "MainViewReadPlcData");
+
+ }
+ ///
+ /// 滚筒线运行状态显示
+ ///
+ private void RollerLineStatusDisplay()
+ {
+ hardWareStatusModel.RollerOneModel.LocOneRollerSerial = globalVar.rollerLineOne.StationOne;
+ hardWareStatusModel.RollerOneModel.LocTwoRollerSerial = globalVar.rollerLineOne.StationTwo;
+ hardWareStatusModel.RollerOneModel.LocThreeRollerSerial = globalVar.rollerLineOne.StationThree;
+ hardWareStatusModel.RollerOneModel.LocFourRollerSerial = globalVar.rollerLineOne.StationFour;
+ hardWareStatusModel.RollerOneModel.LocFiveRollerSerial = globalVar.rollerLineOne.StationFive;
+ hardWareStatusModel.RollerOneModel.LocSixRollerSerial = globalVar.rollerLineOne.StationSix;
+ hardWareStatusModel.RollerOneModel.LocSevenRollerSerial = globalVar.rollerLineOne.StationSeven;
+ hardWareStatusModel.RollerOneModel.LocEightRollerSerial = globalVar.rollerLineOne.StationEight;
+ if (globalVar.rollerLineOne.OutMaterialingTroubleSingle == 0)
+ {
+
+ hardWareStatusModel.RollerOneModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
+ }
+ else
+ {
+
+ hardWareStatusModel.RollerOneModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
+ }
+ if (globalVar.rollerLineOne.OutMaterialingSingle == 1)//运行中
+ {
+
+ hardWareStatusModel.RollerOneModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
+ }
+ else
+ {
+
+ hardWareStatusModel.RollerOneModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
+ }
+ hardWareStatusModel.RollerTwoModel.LocOneRollerSerial = globalVar.rollerLineTwo.StationOne;
+ hardWareStatusModel.RollerTwoModel.LocTwoRollerSerial = globalVar.rollerLineTwo.StationTwo;
+ hardWareStatusModel.RollerTwoModel.LocThreeRollerSerial = globalVar.rollerLineTwo.StationThree;
+ hardWareStatusModel.RollerTwoModel.LocFourRollerSerial = globalVar.rollerLineTwo.StationFour;
+ hardWareStatusModel.RollerTwoModel.LocFiveRollerSerial = globalVar.rollerLineTwo.StationFive;
+ hardWareStatusModel.RollerTwoModel.LocSixRollerSerial = globalVar.rollerLineTwo.StationSix;
+ hardWareStatusModel.RollerTwoModel.LocSevenRollerSerial = globalVar.rollerLineTwo.StationSeven;
+ hardWareStatusModel.RollerTwoModel.LocEightRollerSerial = globalVar.rollerLineTwo.StationEight;
+ if (globalVar.rollerLineTwo.OutMaterialingTroubleSingle == 0)
+ {
+ hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
+ }
+ else
+ {
+
+ hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
+ }
+ if (globalVar.rollerLineTwo.OutMaterialingSingle == 1)//运行中
+ {
+
+ hardWareStatusModel.RollerTwoModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
+
+ }
+ else
+ {
+ hardWareStatusModel.RollerTwoModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
+ }
+ hardWareStatusModel.RollerThreeModel.LocOneRollerSerial = globalVar.rollerLineThree.StationOne;
+ hardWareStatusModel.RollerThreeModel.LocTwoRollerSerial = globalVar.rollerLineThree.StationTwo;
+ hardWareStatusModel.RollerThreeModel.LocThreeRollerSerial = globalVar.rollerLineThree.StationThree;
+ hardWareStatusModel.RollerThreeModel.LocFourRollerSerial = globalVar.rollerLineThree.StationFour;
+ hardWareStatusModel.RollerThreeModel.LocFiveRollerSerial = globalVar.rollerLineThree.StationFive;
+ hardWareStatusModel.RollerThreeModel.LocSixRollerSerial = globalVar.rollerLineThree.StationSix;
+ hardWareStatusModel.RollerThreeModel.LocSevenRollerSerial = globalVar.rollerLineThree.StationSeven;
+ hardWareStatusModel.RollerThreeModel.LocEightRollerSerial = globalVar.rollerLineThree.StationEight;
+ if (globalVar.rollerLineThree.OutMaterialingTroubleSingle == 0)
+ {
+ hardWareStatusModel.RollerThreeModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障
+ }
+ else
+ {
+ hardWareStatusModel.RollerThreeModel.RollerAlarmState = Color.FromRgb(255, 51, 153);//有故障
+ }
+ if (globalVar.rollerLineThree.OutMaterialingSingle == 1)//运行中
+ {
+ hardWareStatusModel.RollerThreeModel.RollerRunState = Color.FromRgb(130, 232, 139);//运行中
+ }
+ else
+ {
+ hardWareStatusModel.RollerThreeModel.RollerRunState = Color.FromRgb(84, 84, 84);//未运行
+ }
+ //滚筒线4
+
+ }
+ ///
+ /// 返回指定地址指定长度的数据
+ ///
+ ///
+ ///
+ public void GetAddressData(string address, Action action)
+ {
+ PlcReadData = DeviceOperate.GetInstance.GetAllData();
+ if (PlcReadData.ContainsKey(address))
+ {
+ action((ushort[])(PlcReadData[address]));
+ }
+ }
+ ///
+ /// 写Plc数据
+ ///
+ ///
+ ///
+ public void WritePlcData(string address, ushort Value)
+ {
+ DeviceOperate.GetInstance.WritePlcData(address, Value);
+ }
+ ///
+ /// 初始化任务
+ ///
+ public void IniteTask()
+ {
+ ThreadManage.GetInstance().StartLong(new Action(() =>
+ {
+ MainTask();
+ }), "MainTask");
+ }
+ ///
+ /// 配方数据接收
+ ///
+ public void RecipeDataParse(object obj)
+ {
+ Task.Run(new Action(() =>
+ {
+ if (obj != null && obj is NewRecipeModel recipe)
+ {
+ RecipeQuene.Enqueue(recipe);
+ ReicpeNum++;
+ MessageLog.GetInstance.ShowRunLog($"接收到第{ReicpeNum}个配方");
+ }
+
+ }));
+
+
+
+ }
+ ///
+ /// 开启主任务
+ ///
+ public void MainTask()
+ {
+ RecipeDataToPlc();
+ AgvLoadRoller();
+ FryPotInputMaterial();
+ FryPotOutputMaterial();
+ }
+ ///
+ /// 数据下发PLC
+ ///
+ public void RecipeDataToPlc()
+ {
+ if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0)//后续添加其它限制条件
+ {
+ //NewRecipeModel newRecipe = new NewRecipeModel();
+ MaterialType material = new MaterialType();
+ if (RecipeQuene.TryDequeue(out NewRecipeModel result))
+ {
+ MessageLog.GetInstance.ShowRunLog($"开始制作【{result.RecipeName}】 配方");
+ //for (int k = 0; k < result.materialCollection.Count-1; k++)
+ //{
+ // for (int j = 0; j < result.materialCollection.Count-1-k; j++)
+ // {
+ // if (result.materialCollection[j].MaterialLoc > result.materialCollection[j + 1].MaterialLoc)
+ // {
+ // material = result.materialCollection[j];
+ // result.materialCollection[j] = result.materialCollection[j + 1];
+ // result.materialCollection[j + 1] = material;
+ // }
+ // }
+ //}
+ for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
+ {
+ //将配方中原料加入新的队列
+ InputMaterialQuene.Enqueue(new MaterialInfo()
+ {
+ materialType = result.materialCollection[i],
+ materialId = result.RecipeId
+ });
+ ushort n = result.materialCollection[i].MaterialLoc;
+ switch (n / 100)
+ {
+ case 1:
+ case 4: RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//1号滚筒线桶号以及重量数据下发
+ case 2:
+ case 5: RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//2号滚筒线桶号以及重量数据下发
+ case 3: RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//3号滚筒线桶号以及重量数据下发
+ }
+ }
+ switch (result.materialCollection[0].MaterialLoc / 100)
+ {
+ case 1:
+ DeviceOperate.GetInstance.WritePlcData("D1009", (ushort)result.materialCollection.Count); break;//发送1号滚筒线工序数据
+ case 2:
+ DeviceOperate.GetInstance.WritePlcData("D1026", (ushort)result.materialCollection.Count); break;//发送2号滚筒线工序数据
+ case 3:
+ DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count); break;//发送3号滚筒线工序数据
+ }
+ }
+ }
+
+ }
+ ///
+ /// AGV到配方对应线体装桶以及出料到炒锅
+ ///
+ public void AgvLoadRoller()
+ {
+ //lineAlarm = 0;
+ if (InputMaterialQuene.Count > 0)
+ {
+ switch (InputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
+ {
+ case 1:
+ case 4: AgvToLineOneLoadRoller(); AgvFromLineOneToFryPot(); break;//AGV到1号线体装桶
+ case 2:
+ case 5: AgvToLineTwoLoadRoller(); AgvFromLineTwoToFryPot(); break;//AGV到2号线体装桶
+ case 3: AgvToLineThreeLoadRoller(); AgvFromLineThreeToFryPot(); break;//AGV到3号线体装桶
+ }
+ }
+
+ }
+ ///
+ /// AGV从炒锅送料位置到倒料过程处理
+ ///
+ public void FryPotInputMaterial()
+ {
+ if (OutputMaterialQuene.Count > 0 && !globalVar.InOrOutputLock)
+ {
+
+ while (!agvArriveUnLoad)//等待agv到达炒锅位置
+ {
+ Thread.Sleep(5);
+ if (globalVar.ExitMainTask)
+ return;
+ }
+ AgvArriveFryPotSingleSetDown();
+ FryPotRollerTroubleCheck();
+ if (FryPotAlarm == 1)//炒锅滚筒无故障
+ {
+ //炒锅滚筒进料运行到位处理
+ FryPotInputMaterialRollerOperate();
+ globalVar.InOrOutputLock = true;
+ }
+
+ }
+
+ }
+ ///
+ /// 炒锅出桶
+ ///
+ public void FryPotOutputMaterial()
+ {
+ if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock)
+ {
+ AgvFromFryPotToClean();//上游下发搬运任务给AGV
+ while (!agvArriveUpLoad)//等待agv到达炒锅位置
+ {
+ Thread.Sleep(5);
+ if (globalVar.ExitMainTask)
+ return;
+ }
+ agvArriveUpLoad = false;
+ AgvArriveFryPotOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
+ FryPotRollerTroubleCheck();
+ if (FryPotAlarm == 1)//无故障
+ {
+ FryPotOutEmpetyRollerOperate();
+ if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
+ {
+ while (!agvFryPotEmptyRollerArrive)//等待AGV拿到出桶空桶
+ {
+ Thread.Sleep(5);
+ if (globalVar.ExitMainTask)
+ return;
+ }
+ //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅
+ globalVar.AllowAgvToLineLoadRoller = true;
+ globalVar.InOrOutputLock = false;
+ }
+ }
+
+ }
+ }
+ ///
+ /// 炒锅滚筒进料运行到位处理
+ ///
+ public void FryPotInputMaterialRollerOperate()
+ {
+ switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
+ {
+ case 1:
+ while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0)
+ {
+ Thread.Sleep(5); if (globalVar.ExitMainTask)
+ return;
+ }
+ MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
+ case 2:
+ while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0)
+ {
+ Thread.Sleep(5); if (globalVar.ExitMainTask)
+ return;
+ }
+ MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
+ case 3:
+ while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0)
+ {
+ Thread.Sleep(5); if (globalVar.ExitMainTask)
+ return;
+ }
+ MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
+ case 4:
+ while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0)
+ {
+ Thread.Sleep(5); if (globalVar.ExitMainTask)
+ return;
+ }
+ MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
+ case 5:
+ while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0)
+ {
+ Thread.Sleep(5); if (globalVar.ExitMainTask)
+ return;
+ }
+ MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
+ }
+
+ }
+ ///
+ /// 炒锅滚筒空桶出桶处理
+ ///
+ public void FryPotOutEmpetyRollerOperate()
+ {
+ switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
+ {
+ case 1:
+ while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0)
+ {
+ Thread.Sleep(5); if (globalVar.ExitMainTask)
+ return;
+ }
+ MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
+ case 2:
+ while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0)
+ {
+ Thread.Sleep(5); if (globalVar.ExitMainTask)
+ return;
+ }
+ MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
+ case 3:
+ while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0)
+ {
+ Thread.Sleep(5); if (globalVar.ExitMainTask)
+ return;
+ }
+ MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
+ case 4:
+ while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0)
+ {
+ Thread.Sleep(5); if (globalVar.ExitMainTask)
+ return;
+ }
+ MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
+ case 5:
+ while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0)
+ {
+ Thread.Sleep(5); if (globalVar.ExitMainTask)
+ return;
+ }
+ MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
+
+ }
+ }
+ ///
+ /// 发送agv送料就位信号至PLC(线体到炒锅)
+ ///
+ public void AgvArriveFryPotSingleSetDown()
+ {
+ switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
+ {
+ case 1: DeviceOperate.GetInstance.WritePlcData("D1055", 1); break;//agv到炒锅1送料就位信号
+ case 2: DeviceOperate.GetInstance.WritePlcData("D1056", 1); break;//agv到炒锅2送料就位信号
+ case 3: DeviceOperate.GetInstance.WritePlcData("D1057", 1); break;//agv到炒锅3送料就位信号
+ case 4: DeviceOperate.GetInstance.WritePlcData("D1058", 1); break;//agv到炒锅4送料就位信号
+ case 5: DeviceOperate.GetInstance.WritePlcData("D1059", 1); break;//agv到炒锅5送料就位信号
+ }
+ }
+ ///
+ /// 发送agv回桶就位信号至PLC
+ ///
+ public void AgvArriveFryPotOutEmptyRollerSingleSetDown()
+ {
+ switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
+ {
+ case 1: DeviceOperate.GetInstance.WritePlcData("D1060", 1); break;//agv到炒锅1送料就位信号
+ case 2: DeviceOperate.GetInstance.WritePlcData("D1061", 1); break;//agv到炒锅2送料就位信号
+ case 3: DeviceOperate.GetInstance.WritePlcData("D1062", 1); break;//agv到炒锅3送料就位信号
+ case 4: DeviceOperate.GetInstance.WritePlcData("D1063", 1); break;//agv到炒锅4送料就位信号
+ case 5: DeviceOperate.GetInstance.WritePlcData("D1064", 1); break;//agv到炒锅5送料就位信号
+ }
+ }
+ ///
+ /// AGV离开炒锅运送空桶任务
+ ///
+ public void AgvFromFryPotToClean()
+ {
+ switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
+ {
+ case 1:
+ erp: string id = Guid.NewGuid().ToString("N");//上游唯一ID
+ if (id == robotJobId)
+ {
+ goto erp;
+ }
+ string info = AGVHelper.GetInstance.AgvLeaveFryPotOne(id);
+ robotJobId = id;
+ FryCarryTaskErrorCodeAnalysis(info, 1); break;
+ case 2:
+ erp1: string id1 = Guid.NewGuid().ToString("N");//上游唯一ID
+ if (id1 == robotJobId)
+ {
+ goto erp1;
+ }
+ string info1 = AGVHelper.GetInstance.AgvLeaveFryPotTwo(id1);
+ robotJobId = id1;
+ FryCarryTaskErrorCodeAnalysis(info1, 2); break;
+ case 3:
+ erp2: string id2 = Guid.NewGuid().ToString("N");//上游唯一ID
+ if (id2 == robotJobId)
+ {
+ goto erp2;
+ }
+ string info2 = AGVHelper.GetInstance.AgvLeaveFryPotThree(id2);
+ robotJobId = id2;
+ FryCarryTaskErrorCodeAnalysis(info2, 3); break;
+ case 4:
+ erp3: string id3 = Guid.NewGuid().ToString("N");//上游唯一ID
+ if (id3 == robotJobId)
+ {
+ goto erp3;
+ }
+ string info3 = AGVHelper.GetInstance.AgvLeaveFryPotFour(id3);
+ robotJobId = id3;
+ FryCarryTaskErrorCodeAnalysis(info3, 4); break;
+ case 5:
+ erp4: string id4 = Guid.NewGuid().ToString("N");//上游唯一ID
+ if (id4 == robotJobId)
+ {
+ goto erp4;
+ }
+ string info4 = AGVHelper.GetInstance.AgvLeaveFryPotFive(id4);
+ robotJobId = id4;
+ FryCarryTaskErrorCodeAnalysis(info4, 5); break;
+ }
+ }
+ ///
+ /// 处理agv从线体1到送料到炒锅的条件
+ ///
+ ///
+ public void AgvFromLineOneToFryPot()
+ {
+ erp: if (globalVar.rollerLineOne.OutMaterialingTroubleSingle == 0)//无故障
+ {
+ while (!agvArriveUpLoad)//等待AGV到线体装料位置
+ {
+ Thread.Sleep(5);
+ if (globalVar.ExitMainTask)
+ return;
+ }
+ agvArriveUpLoad = false;
+ AgvArriveLineSingelSetDown();
+ if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
+ {
+ while (!(globalVar.rollerLineOne.StationEight == materialInfo.materialType.MaterialLoc))//等待线体工号位8存放对应原料桶号
+ {
+ Thread.Sleep(5);
+ if (globalVar.ExitMainTask)
+ return;
+ }
+ OutputMaterialQuene.Enqueue(materialInfo);
+ //原料到位,agv到位,agv自行运料到炒锅
+ }
+
+ }
+ else//有故障
+ {
+ while (globalVar.rollerLineOne.OutMaterialingTroubleSingle == 1)
+ {
+ Thread.Sleep(50);
+ if (globalVar.ExitMainTask)
+ return;
+ }
+ MessageLog.GetInstance.ShowRunLog("线体【1】滚筒故障解除,继续运行");
+ //lineAlarm = 1;
+ goto erp;
+ }
+ }
+ ///
+ /// 处理agv从线体2到送料到炒锅的条件
+ ///
+ ///
+ public void AgvFromLineTwoToFryPot()
+ {
+ erp: if (globalVar.rollerLineTwo.OutMaterialingTroubleSingle == 0)//无故障
+ {
+ while (!agvArriveUpLoad)//等待AGV到线体装料位置
+ {
+ Thread.Sleep(5);
+ if (globalVar.ExitMainTask)
+ return;
+ }
+ agvArriveUpLoad = false;
+ AgvArriveLineSingelSetDown();
+ if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
+ {
+ while (!(globalVar.rollerLineTwo.StationEight == materialInfo.materialType.MaterialLoc))//等待线体工号位8存放对应原料桶号
+ {
+ Thread.Sleep(5);
+ if (globalVar.ExitMainTask)
+ return;
+ }
+ OutputMaterialQuene.Enqueue(materialInfo);
+ //原料到位,agv到位,agv运料到炒锅
+ }
+
+ }
+ else//有故障
+ {
+ while (globalVar.rollerLineTwo.OutMaterialingTroubleSingle == 1)
+ {
+ Thread.Sleep(50);
+ if (globalVar.ExitMainTask)
+ return;
+ }
+ MessageLog.GetInstance.ShowRunLog("线体【2】滚筒故障解除,继续运行");
+ // lineAlarm = 1;
+ goto erp;
+ }
+ }
+ ///
+ /// 处理agv从线体3到送料到炒锅的条件
+ ///
+ ///
+ public void AgvFromLineThreeToFryPot()
+ {
+ erp: if (globalVar.rollerLineThree.OutMaterialingTroubleSingle == 0)//无故障
+ {
+ while (!agvArriveUpLoad)//等待AGV到线体装料位置
+ {
+ Thread.Sleep(5);
+ if (globalVar.ExitMainTask)
+ return;
+ }
+ agvArriveUpLoad = false;
+ AgvArriveLineSingelSetDown();
+ if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
+ {
+ while (!(globalVar.rollerLineThree.StationEight == materialInfo.materialType.MaterialLoc))//等待线体工号位8存放对应原料桶号
+ {
+ Thread.Sleep(5);
+ if (globalVar.ExitMainTask)
+ return;
+ }
+ OutputMaterialQuene.Enqueue(materialInfo);
+ //原料到位,agv到位,agv运料到炒锅
+ }
+
+ }
+ else //有故障
+ {
+ while (globalVar.rollerLineThree.OutMaterialingTroubleSingle == 1)
+ {
+ Thread.Sleep(50);
+ if (globalVar.ExitMainTask)
+ return;
+ }
+ MessageLog.GetInstance.ShowRunLog("线体【3】滚筒故障解除,继续运行");
+ // lineAlarm = 1;
+ goto erp;
+ }
+ }
+ ///
+ /// 线体搬运任务错误码分析
+ ///
+ ///
+ ///
+ public void LineCarryTaskErrorCodeAnalysis(string errorCode, int num)
+ {
+ if (errorCode == "SUCCESS")
+ {
+ MessageLog.GetInstance.ShowRunLog($"AGV去{num}号线体");
+ globalVar.AllowAgvToLineLoadRoller = false;
+ }
+ else if (errorCode == "Analysis Error")
+ {
+ MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号线体接口调用失败,请检查");
+ }
+ else
+ {
+ MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号线体失败,错误码:{errorCode}");
+ }
+ }
+ ///
+ /// 炒锅搬运任务错误码分析
+ ///
+ ///
+ ///
+ public void FryCarryTaskErrorCodeAnalysis(string errorCode, int num)
+ {
+ if (errorCode == "SUCCESS")
+ {
+ MessageLog.GetInstance.ShowRunLog($"AGV离开{num}号炒锅");
+ }
+ else if (errorCode == "Analysis Error")
+ {
+ MessageLog.GetInstance.ShowRunLog($"提示:AGV离开{num}号炒锅接口调用失败,请检查");
+ }
+ else
+ {
+ MessageLog.GetInstance.ShowRunLog($"提示:AGV离开{num}号炒锅失败,错误码:{errorCode}");
+ }
+ }
+
+ public void AgvToLineOneLoadRoller()
+ {
+ if (globalVar.rollerLineOne.OutMaterialingTroubleSingle == 0)//输送线无故障
+ {
+ if (InputMaterialQuene.Count > 0)
+ {
+ while (!globalVar.AllowAgvToLineLoadRoller || globalVar.rollerLineOne.OutMaterialingSingle == 0)
+ {
+ Thread.Sleep(5);
+ if (globalVar.ExitMainTask)
+ return;
+ }
+ e: string id = Guid.NewGuid().ToString("N");
+ if (id == robotJobId)
+ goto e;
+ string info = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id);
+ robotJobId = id;
+ Thread.Sleep(500);
+ LineCarryTaskErrorCodeAnalysis(info, 1);
+ }
+ }
+ else
+ {
+ MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【1】故障!!!");
+ // lineAlarm = -1;
+ }
+ // lineAlarm = 1;
+ }
+ public void AgvToLineTwoLoadRoller()
+ {
+ if (globalVar.rollerLineTwo.OutMaterialingTroubleSingle == 0)//输送线无故障
+ {
+ if (InputMaterialQuene.Count > 0)
+ {
+ while (!globalVar.AllowAgvToLineLoadRoller || globalVar.rollerLineOne.OutMaterialingSingle == 0) //后续考虑是否用while
+ {
+ Thread.Sleep(5);
+ if (globalVar.ExitMainTask)
+ return;
+ }
+ p: string id = Guid.NewGuid().ToString();
+ if (id == robotJobId)
+ goto p;
+ string info = AGVHelper.GetInstance.AgvToLineTwoLoadRoller(id);
+ robotJobId = id;
+ Thread.Sleep(500);
+ LineCarryTaskErrorCodeAnalysis(info, 2);
+ }
+
+ }
+ else
+ {
+ MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【2】故障!!!");
+ //lineAlarm = -1;
+ }
+ // lineAlarm = 1;
+ }
+ public void AgvToLineThreeLoadRoller()
+ {
+ if (globalVar.rollerLineThree.OutMaterialingTroubleSingle == 0)//输送线无故障
+ {
+ if (InputMaterialQuene.Count > 0)
+ {
+ while (!globalVar.AllowAgvToLineLoadRoller || globalVar.rollerLineOne.OutMaterialingSingle == 0) //后续考虑是否用while
+ {
+ Thread.Sleep(5);
+ if (globalVar.ExitMainTask)
+ return;
+ }
+ g: string id = Guid.NewGuid().ToString();
+ if (id == robotJobId)
+ goto g;
+ string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id);
+ robotJobId = id;
+ Thread.Sleep(500);
+ LineCarryTaskErrorCodeAnalysis(info, 3);
+ }
+
+ }
+ else
+ {
+ MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【3】故障!!!");
+ // lineAlarm = -1;
+ }
+ // lineAlarm = 1;
+ }
+ ///
+ /// 1号线体数据下发
+ ///
+ ///
+ ///
+ ///
+ public void RollerOneDataWrite(int count, ushort materialLoc, ushort materialWeight)
+ {
+ switch (count)
+ {
+ case 0:
+ DeviceOperate.GetInstance.WritePlcData("D1001", materialLoc);//桶1位置
+ DeviceOperate.GetInstance.WritePlcData("D1010", materialWeight);//桶2重量
+ break;
+ case 1:
+ DeviceOperate.GetInstance.WritePlcData("D1002", materialLoc);//桶2位置
+ DeviceOperate.GetInstance.WritePlcData("D1011", materialWeight);//桶2重量
+ break;
+ case 2:
+ DeviceOperate.GetInstance.WritePlcData("D1003", materialLoc);//桶3位置
+ DeviceOperate.GetInstance.WritePlcData("D1012", materialWeight);//桶3重量
+ break;
+ case 3:
+ DeviceOperate.GetInstance.WritePlcData("D1004", materialLoc);//桶4位置
+ DeviceOperate.GetInstance.WritePlcData("D1013", materialWeight);//桶4重量
+ break;
+ case 4:
+ DeviceOperate.GetInstance.WritePlcData("D1005", materialLoc);//桶5位置
+ DeviceOperate.GetInstance.WritePlcData("D1014", materialWeight);//桶5重量
+ break;
+ case 5:
+ DeviceOperate.GetInstance.WritePlcData("D1006", materialLoc);//桶6位置
+ DeviceOperate.GetInstance.WritePlcData("D1015", materialWeight);//桶6重量
+ break;
+ case 6:
+ DeviceOperate.GetInstance.WritePlcData("D1007", materialLoc);//桶7位置
+ DeviceOperate.GetInstance.WritePlcData("D1016", materialWeight);//桶7重量
+ break;
+ case 7:
+ DeviceOperate.GetInstance.WritePlcData("D1008", materialLoc);//桶8位置
+ DeviceOperate.GetInstance.WritePlcData("D1017", materialWeight);//桶8重量
+ break;
+
+ }
+ }
+ ///
+ /// 2号线体数据下发
+ ///
+ ///
+ ///
+ ///
+ public void RollerTwoDataWrite(int count, ushort materialLoc, ushort materialWeight)
+ {
+ switch (count)
+ {
+ case 0:
+ DeviceOperate.GetInstance.WritePlcData("D1018", materialLoc);//桶1位置
+ DeviceOperate.GetInstance.WritePlcData("D1027", materialWeight);//桶2重量
+ break;
+ case 1:
+ DeviceOperate.GetInstance.WritePlcData("D1019", materialLoc);//桶2位置
+ DeviceOperate.GetInstance.WritePlcData("D1028", materialWeight);//桶2重量
+ break;
+ case 2:
+ DeviceOperate.GetInstance.WritePlcData("D1020", materialLoc);//桶3位置
+ DeviceOperate.GetInstance.WritePlcData("D1029", materialWeight);//桶3重量
+ break;
+ case 3:
+ DeviceOperate.GetInstance.WritePlcData("D1021", materialLoc);//桶4位置
+ DeviceOperate.GetInstance.WritePlcData("D1030", materialWeight);//桶4重量
+ break;
+ case 4:
+ DeviceOperate.GetInstance.WritePlcData("D1022", materialLoc);//桶5位置
+ DeviceOperate.GetInstance.WritePlcData("D1031", materialWeight);//桶5重量
+ break;
+ case 5:
+ DeviceOperate.GetInstance.WritePlcData("D1023", materialLoc);//桶6位置
+ DeviceOperate.GetInstance.WritePlcData("D1032", materialWeight);//桶6重量
+ break;
+ case 6:
+ DeviceOperate.GetInstance.WritePlcData("D1024", materialLoc);//桶7位置
+ DeviceOperate.GetInstance.WritePlcData("D1033", materialWeight);//桶7重量
+ break;
+ case 7:
+ DeviceOperate.GetInstance.WritePlcData("D1025", materialLoc);//桶8位置
+ DeviceOperate.GetInstance.WritePlcData("D1034", materialWeight);//桶8重量
+ break;
+
+ }
+ }
+ ///
+ /// 3号线体数据下发
+ ///
+ ///
+ ///
+ ///
+ public void RollerThreeDataWrite(int count, ushort materialLoc, ushort materialWeight)
+ {
+ switch (count)
+ {
+ case 0:
+ DeviceOperate.GetInstance.WritePlcData("D1035", materialLoc);//桶1位置
+ DeviceOperate.GetInstance.WritePlcData("D1044", materialWeight);//桶2重量
+ break;
+ case 1:
+ DeviceOperate.GetInstance.WritePlcData("D1036", materialLoc);//桶2位置
+ DeviceOperate.GetInstance.WritePlcData("D1045", materialWeight);//桶2重量
+ break;
+ case 2:
+ DeviceOperate.GetInstance.WritePlcData("D1037", materialLoc);//桶3位置
+ DeviceOperate.GetInstance.WritePlcData("D1046", materialWeight);//桶3重量
+ break;
+ case 3:
+ DeviceOperate.GetInstance.WritePlcData("D1038", materialLoc);//桶4位置
+ DeviceOperate.GetInstance.WritePlcData("D1047", materialWeight);//桶4重量
+ break;
+ case 4:
+ DeviceOperate.GetInstance.WritePlcData("D1039", materialLoc);//桶5位置
+ DeviceOperate.GetInstance.WritePlcData("D1048", materialWeight);//桶5重量
+ break;
+ case 5:
+ DeviceOperate.GetInstance.WritePlcData("D1040", materialLoc);//桶6位置
+ DeviceOperate.GetInstance.WritePlcData("D1049", materialWeight);//桶6重量
+ break;
+ case 6:
+ DeviceOperate.GetInstance.WritePlcData("D1041", materialLoc);//桶7位置
+ DeviceOperate.GetInstance.WritePlcData("D1050", materialWeight);//桶7重量
+ break;
+ case 7:
+ DeviceOperate.GetInstance.WritePlcData("D1042", materialLoc);//桶8位置
+ DeviceOperate.GetInstance.WritePlcData("D1051", materialWeight);//桶8重量
+ break;
+
+ }
+
+ }
+ ///
+ /// AGV进料就位信号下发至PLC
+ ///
+ public void AgvArriveLineSingelSetDown()
+ {
+ switch (InputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
+ {
+ case 1:
+ case 4: DeviceOperate.GetInstance.WritePlcData("D1052", 1); break;//AGV进料就位信号1
+ case 2:
+ case 5: DeviceOperate.GetInstance.WritePlcData("D1053", 1); break;//AGV进料就位信号2
+ case 3: DeviceOperate.GetInstance.WritePlcData("D1054", 1); break;//AGV进料就位信号3
+ }
+
+ }
+ ///
+ /// 炒锅滚筒信号检测
+ ///
+ public void FryPotRollerTroubleCheck()
+ {
+ FryPotAlarm = 0;
+ switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
+ {
+ case 1:
+ if (globalVar.fryPotOne.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotOne.RollerTroubleSingle == 1)
+ {
+ Thread.Sleep(50); if (globalVar.ExitMainTask)
+ return;
+ }
+ MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
+ FryPotAlarm = 1; break;
+ case 2:
+ if (globalVar.fryPotTwo.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【2】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotTwo.RollerTroubleSingle == 1)
+ {
+ Thread.Sleep(50); if (globalVar.ExitMainTask)
+ return;
+ }
+ MessageLog.GetInstance.ShowRunLog("炒锅【2】输送滚筒故障解除,继续运行");
+ FryPotAlarm = 1; break;
+ case 3:
+ if (globalVar.fryPotThree.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotThree.RollerTroubleSingle == 1)
+ {
+ Thread.Sleep(50); if (globalVar.ExitMainTask)
+ return;
+ }
+ MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行");
+ FryPotAlarm = 1; break;
+ case 4:
+ if (globalVar.fryPotFour.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotFour.RollerTroubleSingle == 1)
+ {
+ Thread.Sleep(50); if (globalVar.ExitMainTask)
+ return;
+ }
+ MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
+ FryPotAlarm = 1; break;
+ case 5:
+ if (globalVar.fryPotFive.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【5】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotFive.RollerTroubleSingle == 1)
+ {
+ Thread.Sleep(50); if (globalVar.ExitMainTask)
+ return;
+ }
+ MessageLog.GetInstance.ShowRunLog("炒锅【5】输送滚筒故障解除,继续运行");
+ FryPotAlarm = 1; break;
+
+ }
+ }
+
+ }
+}
diff --git a/FryPot_DosingSystem/Control/GlobalVariable.cs b/FryPot_DosingSystem/Control/GlobalVariable.cs
new file mode 100644
index 00000000..90119a8e
--- /dev/null
+++ b/FryPot_DosingSystem/Control/GlobalVariable.cs
@@ -0,0 +1,410 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.Control
+{
+ ///
+ /// plc变量
+ ///
+ internal class GlobalVariable
+ {
+ ///
+ /// 滚筒线1
+ ///
+ public RollerLineOne rollerLineOne = new RollerLineOne();
+ ///
+ /// 滚筒线2
+ ///
+ public RollerLineTwo rollerLineTwo = new RollerLineTwo();
+ ///
+ /// 滚筒线3
+ ///
+ public RollerLineThree rollerLineThree = new RollerLineThree();
+ ///
+ /// 炒锅1
+ ///
+ public FryPotOne fryPotOne= new FryPotOne();
+ ///
+ /// 炒锅2
+ ///
+ public FryPotTwo fryPotTwo= new FryPotTwo();
+ ///
+ /// 炒锅3
+ ///
+ public FryPotThree fryPotThree= new FryPotThree();
+ ///
+ /// 炒锅4
+ ///
+ public FryPotFour fryPotFour= new FryPotFour();
+ ///
+ /// 炒锅5
+ ///
+ public FryPotFive fryPotFive= new FryPotFive();
+ ///
+ /// 洗桶进桶滚筒运行信号
+ ///
+ public ushort CleadBarrelEnterSingle { get; set; }
+ ///
+ /// 洗桶出桶滚筒运行信号
+ ///
+ public ushort CleadBarrelExitSingle { get; set; }
+ ///
+ /// PLC初始化状态
+ ///
+ public ushort PlcInite { get; set; }
+ #region 上位机内部逻辑条件
+ ///
+ /// 退出主任务循环
+ ///
+ public bool ExitMainTask { get; set; }
+ ///
+ /// 允许AGV去线体装桶条件
+ ///
+ public bool AllowAgvToLineLoadRoller { get; set; } = true;
+ ///
+ /// 配方唯一ID
+ ///
+ public string RecipeId { get; set; }
+ ///
+ /// 进桶出桶互锁
+ ///
+ public bool InOrOutputLock { get; set; }
+ #endregion
+
+ }
+ ///
+ /// 滚筒线1相关变量
+ ///
+ public class RollerLineOne
+ {
+ ///
+ /// 工位号1
+ ///
+ public ushort StationOne { get; set; }
+ ///
+ /// 工位号2
+ ///
+ public ushort StationTwo { get; set; }
+ ///
+ /// 工位号3
+ ///
+ public ushort StationThree { get; set; }
+ ///
+ /// 工位号4
+ ///
+ public ushort StationFour { get; set; }
+ ///
+ /// 工位号5
+ ///
+ public ushort StationFive { get; set; }
+ ///
+ /// 工位号6
+ ///
+ public ushort StationSix { get; set; }
+ ///
+ /// 工位号7
+ ///
+ public ushort StationSeven { get; set; }
+ ///
+ /// 工位号8
+ ///
+ public ushort StationEight { get; set; }
+ ///
+ /// 输送出料滚筒运行信号
+ ///
+ public ushort OutMaterialingSingle { get; set; }
+ ///
+ /// 输送出料滚筒运行故障信号
+ ///
+ public ushort OutMaterialingTroubleSingle { get; set; }
+ ///
+ /// 当前线体配方完成信号
+ ///
+ public ushort RecipeCompleteSingle { get; set; }
+
+
+ }
+ ///
+ /// 滚筒线2相关变量
+ ///
+ public class RollerLineTwo
+ {
+ ///
+ /// 工位号1
+ ///
+ public ushort StationOne { get; set; }
+ ///
+ /// 工位号2
+ ///
+ public ushort StationTwo { get; set; }
+ ///
+ /// 工位号3
+ ///
+ public ushort StationThree { get; set; }
+ ///
+ /// 工位号4
+ ///
+ public ushort StationFour { get; set; }
+ ///
+ /// 工位号5
+ ///
+ public ushort StationFive { get; set; }
+ ///
+ /// 工位号6
+ ///
+ public ushort StationSix { get; set; }
+ ///
+ /// 工位号7
+ ///
+ public ushort StationSeven { get; set; }
+ ///
+ /// 工位号8
+ ///
+ public ushort StationEight { get; set; }
+ ///
+ /// 输送出料滚筒运行信号
+ ///
+ public ushort OutMaterialingSingle { get; set; }
+ ///
+ /// 输送出料滚筒运行故障信号
+ ///
+ public ushort OutMaterialingTroubleSingle { get; set; }
+ ///
+ /// 当前线体配方完成信号
+ ///
+ public ushort RecipeCompleteSingle { get; set; }
+ }
+ ///
+ /// 滚筒线3相关变量
+ ///
+ public class RollerLineThree
+ {
+ ///
+ /// 工位号1
+ ///
+ public ushort StationOne { get; set; }
+ ///
+ /// 工位号2
+ ///
+ public ushort StationTwo { get; set; }
+ ///
+ /// 工位号3
+ ///
+ public ushort StationThree { get; set; }
+ ///
+ /// 工位号4
+ ///
+ public ushort StationFour { get; set; }
+ ///
+ /// 工位号5
+ ///
+ public ushort StationFive { get; set; }
+ ///
+ /// 工位号6
+ ///
+ public ushort StationSix { get; set; }
+ ///
+ /// 工位号7
+ ///
+ public ushort StationSeven { get; set; }
+ ///
+ /// 工位号8
+ ///
+ public ushort StationEight { get; set; }
+ ///
+ /// 输送出料滚筒运行信号
+ ///
+ public ushort OutMaterialingSingle { get; set; }
+ ///
+ /// 输送出料滚筒运行故障信号
+ ///
+ public ushort OutMaterialingTroubleSingle { get; set; }
+ ///
+ /// 当前线体配方完成信号
+ ///
+ public ushort RecipeCompleteSingle { get; set; }
+ }
+ ///
+ /// 滚筒线4相关变量
+ ///
+ public class RollerLineFour
+ {
+ ///
+ /// 工位号1
+ ///
+ public ushort StationOne { get; set; }
+ ///
+ /// 工位号2
+ ///
+ public ushort StationTwo { get; set; }
+ ///
+ /// 工位号3
+ ///
+ public ushort StationThree { get; set; }
+ ///
+ /// 工位号4
+ ///
+ public ushort StationFour { get; set; }
+ ///
+ /// 工位号5
+ ///
+ public ushort StationFive { get; set; }
+ ///
+ /// 工位号6
+ ///
+ public ushort StationSix { get; set; }
+ ///
+ /// 工位号7
+ ///
+ public ushort StationSeven { get; set; }
+ ///
+ /// 工位号8
+ ///
+ public ushort StationEight { get; set; }
+ ///
+ /// 输送出料滚筒运行信号
+ ///
+ public ushort OutMaterialingSingle { get; set; }
+ ///
+ /// 输送出料滚筒运行故障信号
+ ///
+ public ushort OutMaterialingTroubleSingle { get; set; }
+ ///
+ /// 当前线体配方完成信号
+ ///
+ public ushort RecipeCompleteSingle { get; set; }
+ }
+ ///
+ /// 炒锅1相关变量
+ ///
+ public class FryPotOne
+ {
+ ///
+ /// 进料滚筒运行信号
+ ///
+ public ushort InputMaterialRollerRunningSingle { get; set; }
+ ///
+ /// 进料到位信号
+ ///
+ public ushort InputMaterialArrivedSingle { get; set; }
+ ///
+ /// 空桶到位信号
+ ///
+ public ushort EmptyBarrelArrivedSingle { get; set; }
+ ///
+ /// 空桶滚筒运行信号
+ ///
+ public ushort EmptyBarrelRollerRunningSingle { get; set; }
+ ///
+ /// 滚筒故障信号
+ ///
+ public ushort RollerTroubleSingle { get; set; }
+ }
+ ///
+ /// 炒锅2相关变量
+ ///
+ public class FryPotTwo
+ {
+ ///
+ /// 进料滚筒运行信号
+ ///
+ public ushort InputMaterialRollerRunningSingle { get; set; }
+ ///
+ /// 进料到位信号
+ ///
+ public ushort InputMaterialArrivedSingle { get; set; }
+ ///
+ /// 空桶到位信号
+ ///
+ public ushort EmptyBarrelArrivedSingle { get; set; }
+ ///
+ /// 空桶滚筒运行信号
+ ///
+ public ushort EmptyBarrelRollerRunningSingle { get; set; }
+ ///
+ /// 滚筒故障信号
+ ///
+ public ushort RollerTroubleSingle { get; set; }
+ }
+ ///
+ /// 炒锅3相关变量
+ ///
+ public class FryPotThree
+ {
+ ///
+ /// 进料滚筒运行信号
+ ///
+ public ushort InputMaterialRollerRunningSingle { get; set; }
+ ///
+ /// 进料到位信号
+ ///
+ public ushort InputMaterialArrivedSingle { get; set; }
+ ///
+ /// 空桶到位信号
+ ///
+ public ushort EmptyBarrelArrivedSingle { get; set; }
+ ///
+ /// 空桶滚筒运行信号
+ ///
+ public ushort EmptyBarrelRollerRunningSingle { get; set; }
+ ///
+ /// 滚筒故障信号
+ ///
+ public ushort RollerTroubleSingle { get; set; }
+ }
+ ///
+ /// 炒锅4相关变量
+ ///
+ public class FryPotFour
+ {
+ ///
+ /// 进料滚筒运行信号
+ ///
+ public ushort InputMaterialRollerRunningSingle { get; set; }
+ ///
+ /// 进料到位信号
+ ///
+ public ushort InputMaterialArrivedSingle { get; set; }
+ ///
+ /// 空桶到位信号
+ ///
+ public ushort EmptyBarrelArrivedSingle { get; set; }
+ ///
+ /// 空桶滚筒运行信号
+ ///
+ public ushort EmptyBarrelRollerRunningSingle { get; set; }
+ ///
+ /// 滚筒故障信号
+ ///
+ public ushort RollerTroubleSingle { get; set; }
+ }
+ ///
+ /// 炒锅5相关变量
+ ///
+ public class FryPotFive
+ {
+ ///
+ /// 进料滚筒运行信号
+ ///
+ public ushort InputMaterialRollerRunningSingle { get; set; }
+ ///
+ /// 进料到位信号
+ ///
+ public ushort InputMaterialArrivedSingle { get; set; }
+ ///
+ /// 空桶到位信号
+ ///
+ public ushort EmptyBarrelArrivedSingle { get; set; }
+ ///
+ /// 空桶滚筒运行信号
+ ///
+ public ushort EmptyBarrelRollerRunningSingle { get; set; }
+ ///
+ /// 滚筒故障信号
+ ///
+ public ushort RollerTroubleSingle { get; set; }
+ }
+}
diff --git a/FryPot_DosingSystem/Control/MaterialInfo.cs b/FryPot_DosingSystem/Control/MaterialInfo.cs
new file mode 100644
index 00000000..d01c47e1
--- /dev/null
+++ b/FryPot_DosingSystem/Control/MaterialInfo.cs
@@ -0,0 +1,15 @@
+using FryPot_DosingSystem.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.Control
+{
+ internal class MaterialInfo
+ {
+ public MaterialType materialType { get; set;}
+ public string materialId { get; set; }//原料所属配方的唯一ID
+ }
+}
diff --git a/FryPot_DosingSystem/FryPot_DosingSystem.csproj b/FryPot_DosingSystem/FryPot_DosingSystem.csproj
new file mode 100644
index 00000000..8b928b34
--- /dev/null
+++ b/FryPot_DosingSystem/FryPot_DosingSystem.csproj
@@ -0,0 +1,32 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DosingSystem/View/Helper/PasswordBoxHelper.cs b/FryPot_DosingSystem/Helper/PasswordBoxHelper.cs
similarity index 88%
rename from DosingSystem/View/Helper/PasswordBoxHelper.cs
rename to FryPot_DosingSystem/Helper/PasswordBoxHelper.cs
index e6c4ec6a..61bdf2ce 100644
--- a/DosingSystem/View/Helper/PasswordBoxHelper.cs
+++ b/FryPot_DosingSystem/Helper/PasswordBoxHelper.cs
@@ -6,12 +6,9 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
-namespace DosingSystem.View.Helper
+namespace FryPot_DosingSystem.Helper
{
- ///
- /// 为PasswordBox控件的Password增加绑定功能
- ///
- public static class PasswordBoxHelper
+ public class PasswordBoxHelper
{
public static string GetPasswordContent(DependencyObject obj) => (string)obj.GetValue(PasswordContentProperty);
diff --git a/FryPot_DosingSystem/Model/ActionMenu.cs b/FryPot_DosingSystem/Model/ActionMenu.cs
new file mode 100644
index 00000000..41aca262
--- /dev/null
+++ b/FryPot_DosingSystem/Model/ActionMenu.cs
@@ -0,0 +1,22 @@
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.Model
+{
+ public class ActionMenu:ObservableObject
+ {
+ private string commandParmeter;
+ public string CommandParameter { get { return commandParmeter; }set { commandParmeter = value; OnPropertyChanged(); } }
+
+ private string menuName;
+ public string MenuName { get { return menuName; } set { menuName = value;OnPropertyChanged(); } }
+
+ private Authority[] authority;
+ public Authority[] Authority { get { return authority; } set { authority = value; OnPropertyChanged(); } }
+ }
+}
diff --git a/FryPot_DosingSystem/Model/DeviceInfo.cs b/FryPot_DosingSystem/Model/DeviceInfo.cs
new file mode 100644
index 00000000..4415a4f0
--- /dev/null
+++ b/FryPot_DosingSystem/Model/DeviceInfo.cs
@@ -0,0 +1,24 @@
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.Model
+{
+ internal class DeviceInfo : ObservableObject
+ {
+ private string _deviceNum;
+ public string DeviceNum { get { return _deviceNum; }set { _deviceNum = value;OnPropertyChanged(); } }
+
+ private string _deviceName;
+ public string DeviceName { get { return _deviceName; } set { _deviceName = value; OnPropertyChanged(); } }
+
+ private string _ip;
+ public string Ip { get { return _ip; } set { _ip = value; OnPropertyChanged(); } }
+
+ private string _port;
+ public string Port { get { return _port; } set { _port = value; OnPropertyChanged(); } }
+ }
+}
diff --git a/FryPot_DosingSystem/Model/DeviceManage.cs b/FryPot_DosingSystem/Model/DeviceManage.cs
new file mode 100644
index 00000000..48f4ee2e
--- /dev/null
+++ b/FryPot_DosingSystem/Model/DeviceManage.cs
@@ -0,0 +1,15 @@
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.Model
+{
+ internal class DeviceManage:ObservableObject
+ {
+ public ObservableCollection Devices { get; set; } = new ObservableCollection();
+ }
+}
diff --git a/FryPot_DosingSystem/Model/Global.cs b/FryPot_DosingSystem/Model/Global.cs
new file mode 100644
index 00000000..313ac728
--- /dev/null
+++ b/FryPot_DosingSystem/Model/Global.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.Model
+{
+ internal class Global
+ {
+ public static UserManage userManager { get; set; } = new UserManage();
+ }
+}
diff --git a/FryPot_DosingSystem/Model/LogModel.cs b/FryPot_DosingSystem/Model/LogModel.cs
new file mode 100644
index 00000000..2ae71166
--- /dev/null
+++ b/FryPot_DosingSystem/Model/LogModel.cs
@@ -0,0 +1,30 @@
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+
+namespace FryPot_DosingSystem.Model
+{
+ internal class LogModel:ObservableObject
+ {
+ private string _logTime;
+ public string LogTime { get { return _logTime; } set { _logTime = value; OnPropertyChanged(); } }
+
+ private string _logType;
+ public string LogType { get { return _logType; } set { _logType = value; OnPropertyChanged(); } }
+
+ private string _logMessage;
+ public string LogMessage { get { return _logMessage; } set { _logMessage = value; OnPropertyChanged(); } }
+
+ private Brush _foreColor;
+ public Brush ForeColor { get { return _foreColor; } set { _foreColor = value; OnPropertyChanged(); } }
+ public LogModel()
+ {
+ ForeColor = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#21bb2e"));
+ LogTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ }
+ }
+}
diff --git a/FryPot_DosingSystem/Model/LoginInfoConfig.cs b/FryPot_DosingSystem/Model/LoginInfoConfig.cs
new file mode 100644
index 00000000..b976cf4a
--- /dev/null
+++ b/FryPot_DosingSystem/Model/LoginInfoConfig.cs
@@ -0,0 +1,48 @@
+using BPA.Message;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.Model
+{
+ internal class LoginInfoConfig
+ {
+ private volatile static LoginInfoConfig _Instance;
+ public static LoginInfoConfig GetInstance => _Instance ?? (_Instance = new LoginInfoConfig());
+ private LoginInfoConfig() { }
+
+
+ public void Init()
+ {
+ if (File.Exists("LoginUp.hbl"))
+ {
+ var result = JsonConvert.DeserializeObject(File.ReadAllText("LoginUp.hbl").AESDecrypt());
+ if (result == null || (result != null && result.userInfos.Count <= 0))//无用户登陆相关信息
+ {
+
+ }
+ else
+ {
+ Global.userManager = result;
+ }
+ }
+ else
+ {
+ AddData();
+ }
+ }
+
+ private void AddData()
+ {
+ Global.userManager.userInfos.Add(new UserInfo() { Authority = Authority.管理员, UserName = "admin", Password = "123456",UserId="123" });
+ //Global.userManager.userInfos.Add(new UserInfo() { Authority = Authority.操作员, UserName = "czy", Password = "123456" });
+ //Global.userManager.userInfos.Add(new UserInfo() { Authority = Authority.观察员, UserName = "gcy", Password = "123456" });
+ //Global.userManager.userInfos.Add(new UserInfo() { Authority = Authority.技术员, UserName = "jsy", Password = "123456" });
+ File.WriteAllText("LoginUp.hbl", JsonConvert.SerializeObject(Global.userManager).AESEncrypt());
+ }
+ }
+}
diff --git a/FryPot_DosingSystem/Model/MaterialType.cs b/FryPot_DosingSystem/Model/MaterialType.cs
new file mode 100644
index 00000000..8da0a32d
--- /dev/null
+++ b/FryPot_DosingSystem/Model/MaterialType.cs
@@ -0,0 +1,35 @@
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.Model
+{
+ internal class MaterialType:ObservableObject
+ {
+ ///
+ /// 原料名称
+ ///
+ private string _materialName;
+ public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } }
+ ///
+ /// 原料编码
+ ///
+ private string _materialCode;
+ public string MaterialCode { get { return _materialCode; } set { _materialCode = value; OnPropertyChanged(); } }
+ ///
+ /// 原料重量
+ ///
+ private ushort _materialWeight;
+ public ushort MaterialWeight { get { return _materialWeight; }set { _materialWeight = value;OnPropertyChanged(); } }
+ ///
+ /// 原料对应桶位置
+ ///
+ private ushort _materialLoc;
+ public ushort MaterialLoc { get { return _materialLoc; } set { _materialLoc = value; OnPropertyChanged(); } }
+
+
+ }
+}
diff --git a/FryPot_DosingSystem/Model/PlcVariableModel.cs b/FryPot_DosingSystem/Model/PlcVariableModel.cs
new file mode 100644
index 00000000..45266bc3
--- /dev/null
+++ b/FryPot_DosingSystem/Model/PlcVariableModel.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.Model
+{
+ internal class PlcVariableModel
+ {
+ public string Address { get; set; }
+ public ushort Length { get; set;}
+ }
+}
diff --git a/FryPot_DosingSystem/Model/RecipeManage.cs b/FryPot_DosingSystem/Model/RecipeManage.cs
new file mode 100644
index 00000000..b4b29e3d
--- /dev/null
+++ b/FryPot_DosingSystem/Model/RecipeManage.cs
@@ -0,0 +1,16 @@
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.Model
+{
+ internal class RecipeManage:ObservableObject
+ {
+
+ public ObservableCollection Recipes { get; set; }=new ObservableCollection();
+ }
+}
diff --git a/FryPot_DosingSystem/Model/RecipeModel.cs b/FryPot_DosingSystem/Model/RecipeModel.cs
new file mode 100644
index 00000000..053bab08
--- /dev/null
+++ b/FryPot_DosingSystem/Model/RecipeModel.cs
@@ -0,0 +1,32 @@
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.Model
+{
+ internal class NewRecipeModel:ObservableObject
+ {
+ ///
+ /// 配方唯一ID
+ ///
+ private string _recipeId;
+ public string RecipeId { get { return _recipeId; }set { _recipeId = value; OnPropertyChanged(); } }
+ ///
+ /// 配方名称
+ ///
+ private string _recipeName;
+ public string RecipeName { get { return _recipeName; } set { _recipeName = value;OnPropertyChanged(); } }
+
+ ///
+ /// 配方下发状况信息
+ ///
+ private string _recipeSetInfo;
+ public string RecipeSetInfo { get { return _recipeSetInfo; } set { _recipeSetInfo = value; OnPropertyChanged(); } }
+
+ public ObservableCollection materialCollection { get; set; } = new ObservableCollection();
+ }
+}
diff --git a/FryPot_DosingSystem/Model/RollerLineBarrelSerialModel.cs b/FryPot_DosingSystem/Model/RollerLineBarrelSerialModel.cs
new file mode 100644
index 00000000..3f01b166
--- /dev/null
+++ b/FryPot_DosingSystem/Model/RollerLineBarrelSerialModel.cs
@@ -0,0 +1,44 @@
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+
+namespace FryPot_DosingSystem.Model
+{
+ internal class RollerLineBarrelSerialModel:ObservableObject
+ {
+ private ushort _locOneRollerSerial;
+ public ushort LocOneRollerSerial { get { return _locOneRollerSerial; } set { _locOneRollerSerial = value;OnPropertyChanged(); } }
+
+ private ushort _locTwoRollerSerial;
+ public ushort LocTwoRollerSerial { get { return _locTwoRollerSerial; } set { _locTwoRollerSerial = value; OnPropertyChanged(); } }
+
+ private ushort _locThreeRollerSerial;
+ public ushort LocThreeRollerSerial { get { return _locThreeRollerSerial; } set { _locThreeRollerSerial = value; OnPropertyChanged(); } }
+
+ private ushort _locFourRollerSerial;
+ public ushort LocFourRollerSerial { get { return _locFourRollerSerial; } set { _locFourRollerSerial = value; OnPropertyChanged(); } }
+
+ private ushort _locFiveRollerSerial;
+ public ushort LocFiveRollerSerial { get { return _locFiveRollerSerial; } set { _locFiveRollerSerial = value; OnPropertyChanged(); } }
+
+ private ushort _locSixRollerSerial;
+ public ushort LocSixRollerSerial { get { return _locSixRollerSerial; } set { _locSixRollerSerial = value; OnPropertyChanged(); } }
+
+ private ushort _locSevenRollerSerial;
+ public ushort LocSevenRollerSerial { get { return _locSevenRollerSerial; } set { _locSevenRollerSerial = value; OnPropertyChanged(); } }
+
+ private ushort _locEightRollerSerial;
+ public ushort LocEightRollerSerial { get { return _locEightRollerSerial; } set { _locEightRollerSerial = value; OnPropertyChanged(); } }
+
+ private Color _rollerRunState;
+ public Color RollerRunState { get { return _rollerRunState; } set { _rollerRunState = value; OnPropertyChanged(); } }
+
+
+ private Color _rollerAlarmState;
+ public Color RollerAlarmState { get { return _rollerAlarmState; } set { _rollerAlarmState = value; OnPropertyChanged(); } }
+ }
+}
diff --git a/DosingSystem/Model/UserManager.cs b/FryPot_DosingSystem/Model/UserManage.cs
similarity index 66%
rename from DosingSystem/Model/UserManager.cs
rename to FryPot_DosingSystem/Model/UserManage.cs
index 6c2fc247..3cb4ea34 100644
--- a/DosingSystem/Model/UserManager.cs
+++ b/FryPot_DosingSystem/Model/UserManage.cs
@@ -4,27 +4,25 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace DosingSystem.Model
+namespace FryPot_DosingSystem.Model
{
- public class UserManager
+ internal class UserManage
{
public List userInfos { get; set; } = new List();
}
-
public class UserInfo
- {
- public Permission permission { get; set; }
+ {
+ public Authority Authority { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
-
+ public string UserId { get; set; }
}
- public enum Permission : int
+ public enum Authority
{
管理员 = 1,
操作员 = 2,
观察员 = 3,
- 技术员=4
+ 技术员 = 4
}
-
}
diff --git a/FryPot_DosingSystem/View/AdministratorLoginView.xaml b/FryPot_DosingSystem/View/AdministratorLoginView.xaml
new file mode 100644
index 00000000..b96f6a17
--- /dev/null
+++ b/FryPot_DosingSystem/View/AdministratorLoginView.xaml
@@ -0,0 +1,187 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DosingSystem/View/AdminstratorsView.xaml.cs b/FryPot_DosingSystem/View/AdministratorLoginView.xaml.cs
similarity index 85%
rename from DosingSystem/View/AdminstratorsView.xaml.cs
rename to FryPot_DosingSystem/View/AdministratorLoginView.xaml.cs
index 9e89cd89..281a1b33 100644
--- a/DosingSystem/View/AdminstratorsView.xaml.cs
+++ b/FryPot_DosingSystem/View/AdministratorLoginView.xaml.cs
@@ -1,4 +1,5 @@
-using System;
+using BPASmartClient.Helper;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -10,82 +11,85 @@ using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
using System.Windows.Shapes;
using static BPASmartClient.CustomResource.UserControls.UserKeyBoard;
-namespace DosingSystem.View
+namespace FryPot_DosingSystem.View
{
///
- /// AdministratorsView.xaml 的交互逻辑
+ /// AdministratorLoginView.xaml 的交互逻辑
///
- public partial class AdminstratorsView : UserControl
+ public partial class AdministratorLoginView : UserControl
{
- public AdminstratorsView()
+ public AdministratorLoginView()
{
InitializeComponent();
-
- }
- private void UserControl_Loaded(object sender, RoutedEventArgs e)
- {
- this.tbx_admin.Focus();
+
}
- private void MyKeyDown_Admin(object _key)
+
+
+
+ private void MyKeyDown_Password(object _key)
{
EKeyitem key = EKeyitem.A;
if (_key.GetType() == typeof(EKeyitem)) key = (EKeyitem)_key;
switch (key)
{
case EKeyitem.DEL:
- if (tbx_admin.Text.Length > 0)
+ if (password.Password.Length > 0)
{
- tbx_admin.Text = tbx_admin.Text.Substring(0, tbx_admin.Text.Length - 1);
+ password.Password = password.Password.Substring(0, password.Password.Length - 1);
}
break;
case EKeyitem.AC:
- tbx_admin.Text = string.Empty;
+ password.Password = string.Empty;
break;
case EKeyitem.OK:
break;
default:
- tbx_admin.Text += _key.ToString();
+ password.Password += _key.ToString();
break;
}
- this.tbx_admin.Focus();
+
+ }
+ private void tbx_admin_GotFocus(object sender, RoutedEventArgs e)
+ {
+ myKeyboard.MyKeyDown = MyKeyDown_Admin;
}
- private void MyKeyDown_Password(object _key)
+ private void password_GotFocus(object sender, RoutedEventArgs e)
+ {
+ myKeyboard.MyKeyDown = MyKeyDown_Password;
+ }
+
+
+ private void MyKeyDown_Admin(object _key)
{
EKeyitem key = EKeyitem.A;
if (_key.GetType() == typeof(EKeyitem)) key = (EKeyitem)_key;
switch (key)
{
case EKeyitem.DEL:
- if (password.Password.Length > 0)
+ if (tbx_admin.Text.Length > 0)
{
- password.Password = password.Password.Substring(0, password.Password.Length - 1);
+ tbx_admin.Text = tbx_admin.Text.Substring(0, tbx_admin.Text.Length - 1);
}
break;
case EKeyitem.AC:
- password.Password = string.Empty;
+ tbx_admin.Text = string.Empty;
break;
case EKeyitem.OK:
break;
default:
- password.Password += _key.ToString();
+ tbx_admin.Text += _key.ToString();
break;
}
-
- }
-
- private void TextBox_GotFocus(object sender, RoutedEventArgs e)
- {
- myKeyboard.MyKeyDown = MyKeyDown_Admin;
+ this.tbx_admin.Focus();
}
- private void Password_GotFocus(object sender, RoutedEventArgs e)
+ private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
- myKeyboard.MyKeyDown = MyKeyDown_Password;
+ this.tbx_admin.Focus();
}
}
}
diff --git a/DosingSystem/View/AdminstratorsView.xaml b/FryPot_DosingSystem/View/AdministratorPasswordChangeView.xaml
similarity index 77%
rename from DosingSystem/View/AdminstratorsView.xaml
rename to FryPot_DosingSystem/View/AdministratorPasswordChangeView.xaml
index 208b641a..05c0879f 100644
--- a/DosingSystem/View/AdminstratorsView.xaml
+++ b/FryPot_DosingSystem/View/AdministratorPasswordChangeView.xaml
@@ -1,19 +1,15 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 炒锅(1)号
+
+
+ 炒锅(2)号
+
+
+ 炒锅(3)号
+
+
+ 炒锅(4)号
+
+
+ 炒锅(5)号
+
+
+
+
+
+
+ 满料桶滚筒线
+
+
+
+
+ 空桶滚筒线
+
+
+
+
+
+
+ 停车桩(1号)
+
+
+ 停车桩(2号)
+
+
+ 停车桩(3号)
+
+
+ 停车桩(4号)
+
+
+ 充电桩(1号)
+
+
+ 充电桩(2号)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FryPot_DosingSystem/View/AgvView.xaml.cs b/FryPot_DosingSystem/View/AgvView.xaml.cs
new file mode 100644
index 00000000..5792930a
--- /dev/null
+++ b/FryPot_DosingSystem/View/AgvView.xaml.cs
@@ -0,0 +1,67 @@
+using FryPot_DosingSystem.ViewModel;
+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.Animation;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace FryPot_DosingSystem.View
+{
+ ///
+ /// AgvView.xaml 的交互逻辑
+ ///
+ public partial class AgvView : UserControl
+ {
+ public AgvView()
+ {
+ InitializeComponent();
+ this.DataContext = AgvViewModel.GetInstance();
+ }
+
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ AnimationByPath(yunshuche,qc_1);
+ }
+
+ ///
+ /// 路径动画
+ ///
+ /// 画板
+ /// 路径
+ /// 动画对象
+ /// 时间
+ private void AnimationByPath(TextBox target, Path path, int duration = 5)
+ {
+ target.RenderTransformOrigin = new Point(0.5, 0.5);
+
+ MatrixTransform matrix = new MatrixTransform();
+ TransformGroup groups = new TransformGroup();
+ groups.Children.Add(matrix);
+ target.RenderTransform = groups;
+ string registname = "matrix" + Guid.NewGuid().ToString().Replace("-", "");
+ this.RegisterName(registname, matrix);
+ MatrixAnimationUsingPath matrixAnimation = new MatrixAnimationUsingPath();
+ matrixAnimation.PathGeometry = PathGeometry.CreateFromGeometry(Geometry.Parse(path.Data.ToString()));
+ matrixAnimation.Duration = new Duration(TimeSpan.FromSeconds(duration));
+ matrixAnimation.DoesRotateWithTangent = true;//跟随路径旋转
+ matrixAnimation.RepeatBehavior = RepeatBehavior.Forever;//循环
+ Storyboard story = new Storyboard();
+ story.Children.Add(matrixAnimation);
+ Storyboard.SetTargetName(matrixAnimation, registname);
+ Storyboard.SetTargetProperty(matrixAnimation, new PropertyPath(MatrixTransform.MatrixProperty));
+
+ story.FillBehavior = FillBehavior.Stop;
+ story.Begin(target, true);
+ }
+ }
+}
diff --git a/FryPot_DosingSystem/View/AlarmInfoView.xaml b/FryPot_DosingSystem/View/AlarmInfoView.xaml
new file mode 100644
index 00000000..b4cb047c
--- /dev/null
+++ b/FryPot_DosingSystem/View/AlarmInfoView.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/FryPot_DosingSystem/View/AlarmInfoView.xaml.cs b/FryPot_DosingSystem/View/AlarmInfoView.xaml.cs
new file mode 100644
index 00000000..d855e06d
--- /dev/null
+++ b/FryPot_DosingSystem/View/AlarmInfoView.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 FryPot_DosingSystem.View
+{
+ ///
+ /// AlarmInfoView.xaml 的交互逻辑
+ ///
+ public partial class AlarmInfoView : UserControl
+ {
+ public AlarmInfoView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/FryPot_DosingSystem/View/DeviceListVIew.xaml b/FryPot_DosingSystem/View/DeviceListVIew.xaml
new file mode 100644
index 00000000..7652df36
--- /dev/null
+++ b/FryPot_DosingSystem/View/DeviceListVIew.xaml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FryPot_DosingSystem/View/DeviceListVIew.xaml.cs b/FryPot_DosingSystem/View/DeviceListVIew.xaml.cs
new file mode 100644
index 00000000..2a26d676
--- /dev/null
+++ b/FryPot_DosingSystem/View/DeviceListVIew.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 FryPot_DosingSystem.View
+{
+ ///
+ /// DeviceListVIew.xaml 的交互逻辑
+ ///
+ public partial class DeviceListVIew : UserControl
+ {
+ public DeviceListVIew()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/FryPot_DosingSystem/View/EditRecipeView.xaml b/FryPot_DosingSystem/View/EditRecipeView.xaml
new file mode 100644
index 00000000..4c6c7640
--- /dev/null
+++ b/FryPot_DosingSystem/View/EditRecipeView.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/FryPot_DosingSystem/View/EditRecipeView.xaml.cs b/FryPot_DosingSystem/View/EditRecipeView.xaml.cs
new file mode 100644
index 00000000..fb3e0f1e
--- /dev/null
+++ b/FryPot_DosingSystem/View/EditRecipeView.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 FryPot_DosingSystem.View
+{
+ ///
+ /// EditRecipeView.xaml 的交互逻辑
+ ///
+ public partial class EditRecipeView : UserControl
+ {
+ public EditRecipeView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/FryPot_DosingSystem/View/HardWareStatusView.xaml b/FryPot_DosingSystem/View/HardWareStatusView.xaml
new file mode 100644
index 00000000..8ad623d3
--- /dev/null
+++ b/FryPot_DosingSystem/View/HardWareStatusView.xaml
@@ -0,0 +1,644 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FryPot_DosingSystem/View/HardWareStatusView.xaml.cs b/FryPot_DosingSystem/View/HardWareStatusView.xaml.cs
new file mode 100644
index 00000000..8e1ec40d
--- /dev/null
+++ b/FryPot_DosingSystem/View/HardWareStatusView.xaml.cs
@@ -0,0 +1,76 @@
+using BPASmartClient.Helper;
+using FryPot_DosingSystem.ViewModel;
+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 FryPot_DosingSystem.View
+{
+ ///
+ /// HardWareStatusView.xaml 的交互逻辑
+ ///
+ public partial class HardWareStatusView : UserControl
+ {
+ public HardWareStatusView()
+ {
+ InitializeComponent();
+ this.DataContext = HardWareStatusViewModel.GetInstance;
+ //ActionManage.GetInstance.Register(new Action((a) =>
+ //{
+ // switch (a)
+ // {
+ // case 1: gsGreen1.Color = Color.FromRgb(130, 232, 139);break;
+ // case 2: gsGreen2.Color = Color.FromRgb(130, 232, 139); break;
+ // case 3: gsGreen3.Color = Color.FromRgb(130, 232, 139); break;
+ // case 4: gsGreen4.Color = Color.FromRgb(130, 232, 139); break;
+ // }
+
+ //}), "ToGreen");
+ //ActionManage.GetInstance.Register(new Action((a) =>
+ //{
+ // switch (a)
+ // {
+ // case 1: gsRed1.Color = Color.FromRgb(243, 165, 230); break;
+ // case 2: gsRed2.Color = Color.FromRgb(243, 165, 230); break;
+ // case 3: gsRed3.Color = Color.FromRgb(243, 165, 230); break;
+ // case 4: gsRed4.Color = Color.FromRgb(243, 165, 230); break;
+ // }
+
+ //}), "ToRed");
+ //ActionManage.GetInstance.Register(new Action((a) =>
+ //{
+ // switch (a)
+ // {
+ // case 1: gsGreen1.Color = Color.FromRgb(84,84,84); break;
+ // case 2: gsGreen2.Color = Color.FromRgb(84,84,84); break;
+ // case 3: gsGreen3.Color = Color.FromRgb(84,84,84); break;
+ // case 4: gsGreen4.Color = Color.FromRgb(84,84,84); break;
+ // }
+
+ //}), "GreenToGray");
+ //ActionManage.GetInstance.Register(new Action((a) =>
+ //{
+ // switch (a)
+ // {
+ // case 1: gsRed1.Color = Color.FromRgb(84,84,84); break;
+ // case 2: gsRed2.Color = Color.FromRgb(84,84,84); break;
+ // case 3: gsRed3.Color = Color.FromRgb(84,84,84); break;
+ // case 4: gsRed4.Color = Color.FromRgb(84,84,84); break;
+ // }
+
+ //}), "RedToGray");
+
+ }
+ }
+}
diff --git a/FryPot_DosingSystem/View/LogView.xaml b/FryPot_DosingSystem/View/LogView.xaml
new file mode 100644
index 00000000..1c8e6c68
--- /dev/null
+++ b/FryPot_DosingSystem/View/LogView.xaml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FryPot_DosingSystem/View/LogView.xaml.cs b/FryPot_DosingSystem/View/LogView.xaml.cs
new file mode 100644
index 00000000..5aa62b7c
--- /dev/null
+++ b/FryPot_DosingSystem/View/LogView.xaml.cs
@@ -0,0 +1,30 @@
+using FryPot_DosingSystem.ViewModel;
+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 FryPot_DosingSystem.View
+{
+ ///
+ /// LogView.xaml 的交互逻辑
+ ///
+ public partial class LogView : UserControl
+ {
+ public LogView()
+ {
+ InitializeComponent();
+ this.DataContext = LogViewModel.GetInstance;
+ }
+ }
+}
diff --git a/DosingSystem/View/MainWindow.xaml b/FryPot_DosingSystem/View/MainWindow.xaml
similarity index 56%
rename from DosingSystem/View/MainWindow.xaml
rename to FryPot_DosingSystem/View/MainWindow.xaml
index 901dea26..42eaebc4 100644
--- a/DosingSystem/View/MainWindow.xaml
+++ b/FryPot_DosingSystem/View/MainWindow.xaml
@@ -1,29 +1,25 @@
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FryPot_DosingSystem/View/NewRecipeView.xaml.cs b/FryPot_DosingSystem/View/NewRecipeView.xaml.cs
new file mode 100644
index 00000000..d9a62b9c
--- /dev/null
+++ b/FryPot_DosingSystem/View/NewRecipeView.xaml.cs
@@ -0,0 +1,36 @@
+using BPASmartClient.Helper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace FryPot_DosingSystem.View
+{
+ ///
+ /// NewRecipeView.xaml 的交互逻辑
+ ///
+ public partial class NewRecipeView : Window
+ {
+ public NewRecipeView()
+ {
+ InitializeComponent();
+ this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
+ ActionManage.GetInstance.CancelRegister("CloseNewRecipeView");
+ ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseNewRecipeView");
+ }
+
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
+ }
+}
diff --git a/FryPot_DosingSystem/View/RecipeSendDownView.xaml b/FryPot_DosingSystem/View/RecipeSendDownView.xaml
new file mode 100644
index 00000000..7681694a
--- /dev/null
+++ b/FryPot_DosingSystem/View/RecipeSendDownView.xaml
@@ -0,0 +1,125 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FryPot_DosingSystem/View/RecipeSendDownView.xaml.cs b/FryPot_DosingSystem/View/RecipeSendDownView.xaml.cs
new file mode 100644
index 00000000..e8d7dc97
--- /dev/null
+++ b/FryPot_DosingSystem/View/RecipeSendDownView.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 FryPot_DosingSystem.View
+{
+ ///
+ /// RecipeSendDownView.xaml 的交互逻辑
+ ///
+ public partial class RecipeSendDownView : UserControl
+ {
+ public RecipeSendDownView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/FryPot_DosingSystem/View/RecipeSetView.xaml b/FryPot_DosingSystem/View/RecipeSetView.xaml
new file mode 100644
index 00000000..ce5cdd80
--- /dev/null
+++ b/FryPot_DosingSystem/View/RecipeSetView.xaml
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FryPot_DosingSystem/View/RecipeSetView.xaml.cs b/FryPot_DosingSystem/View/RecipeSetView.xaml.cs
new file mode 100644
index 00000000..d8a3a8ff
--- /dev/null
+++ b/FryPot_DosingSystem/View/RecipeSetView.xaml.cs
@@ -0,0 +1,30 @@
+using FryPot_DosingSystem.ViewModel;
+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 FryPot_DosingSystem.View
+{
+ ///
+ /// RecipeSetView.xaml 的交互逻辑
+ ///
+ public partial class RecipeSetView : UserControl
+ {
+ public RecipeSetView()
+ {
+ InitializeComponent();
+
+ }
+ }
+}
diff --git a/FryPot_DosingSystem/ViewModel/AdministratorLoginViewModel.cs b/FryPot_DosingSystem/ViewModel/AdministratorLoginViewModel.cs
new file mode 100644
index 00000000..deb6f065
--- /dev/null
+++ b/FryPot_DosingSystem/ViewModel/AdministratorLoginViewModel.cs
@@ -0,0 +1,172 @@
+using BPA.Message;
+using BPASmartClient.Helper;
+using FryPot_DosingSystem.Model;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+using Newtonsoft.Json;
+using System;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Windows;
+
+namespace FryPot_DosingSystem.ViewModel
+{
+ public class AdministratorLoginViewModel : ObservableObject
+ {
+ ///
+ /// 按钮内容修改:注册/修改
+ ///
+ private string _registOrChange;
+ public string RegistOrChange { get { return _registOrChange; } set { _registOrChange = value; OnPropertyChanged(); } }
+ public string Admin { get { return _admin; } set { _admin = value; OnPropertyChanged(); } }
+ private string _admin;
+
+ public string Password { get { return _password; } set { _password = value; OnPropertyChanged(); } }
+ private string _password;
+
+ public string ErrorMessage { get { return _errorMessage; } set { _errorMessage = value; OnPropertyChanged(); } }
+ private string _errorMessage;
+
+ public string SelectText { get { return _mSelectText; } set { _mSelectText = value; OnPropertyChanged(); } }
+ private string _mSelectText;
+
+ private UserInfo _userInfo;
+ public UserInfo UserInfo { get { return _userInfo; }set { _userInfo = value;OnPropertyChanged(); } }
+
+ private string _account;
+ public string Account { get { return _account; } set { _account = value;OnPropertyChanged(); } }
+
+ private string _txtpassword;
+ public string Txtpassword { get { return _txtpassword; } set { _txtpassword = value; OnPropertyChanged(); } }
+
+ public RelayCommand AdminLoginCommand { get; set; }
+ public RelayCommand RegistCommand { get; set; }
+
+ public ObservableCollection permission { get; set; } = new ObservableCollection();
+
+ public AdministratorLoginViewModel()
+ {
+ permission.Add("管理员");
+ permission.Add("操作员");
+ permission.Add("观察员");
+ permission.Add("技术员");
+ SelectText = permission[0];
+ var content = ActionManage.GetInstance.SendResult("ContentUpdate");
+ if (content != null && content is string strContent)
+ {
+ RegistOrChange = strContent;
+ }
+ var loginInfo = ActionManage.GetInstance.SendResult("LoginInfo");
+ if (loginInfo != null && loginInfo is UserInfo LoginInfo)
+ {
+ UserInfo = LoginInfo;
+ if (UserInfo != null)
+ {
+ switch (UserInfo.Authority)
+ {
+ case Authority.管理员: SelectText = permission[0]; break;
+ case Authority.操作员: SelectText = permission[1]; break;
+ case Authority.观察员: SelectText = permission[2]; break;
+ case Authority.技术员: SelectText = permission[3]; break;
+ }
+ Account = UserInfo.UserName;
+ Txtpassword = UserInfo.Password;
+ }
+ }
+ RegistCommand = new RelayCommand(() =>
+ {
+ if (RegistOrChange != null)
+ {
+ if (RegistOrChange == "注册")
+ {
+ if (Admin == null || Admin == string.Empty || Password == null || Password == string.Empty)
+ {
+ ErrorMessage = "注册信息不能为空!!!";
+ }
+ else
+ {
+ ep:
+ string guid=Guid.NewGuid().ToString();//用户唯一ID
+ var resultManage = JsonConvert.DeserializeObject(File.ReadAllText("LoginUp.hbl").AESDecrypt());
+ if (resultManage != null && resultManage is UserManage manage)
+ {
+ int a= manage.userInfos.FindIndex(p => p.UserId == guid);
+ if (a == -1)
+ {
+ switch (SelectText)
+ {
+ case "管理员": Global.userManager.userInfos.Add(new UserInfo() { Authority = Authority.管理员, UserName = Admin, Password = Password,UserId=guid }); break;
+ case "技术员": Global.userManager.userInfos.Add(new UserInfo() { Authority = Authority.技术员, UserName = Admin, Password = Password,UserId = guid }); break;
+ case "操作员": Global.userManager.userInfos.Add(new UserInfo() { Authority = Authority.操作员, UserName = Admin, Password = Password, UserId = guid }); break;
+ case "观察员": Global.userManager.userInfos.Add(new UserInfo() { Authority = Authority.观察员, UserName = Admin, Password = Password, UserId = guid }); break;
+ }
+ File.WriteAllText("LoginUp.hbl", JsonConvert.SerializeObject(Global.userManager).AESEncrypt());
+ var result = JsonConvert.DeserializeObject(File.ReadAllText("LoginUp.hbl").AESDecrypt());
+ Global.userManager = result;
+ ErrorMessage = "注册成功";
+ }
+ else
+ {
+ goto ep;
+
+ }
+ }
+
+ }
+ }
+ if (RegistOrChange == "修改")
+ {
+ //执行密码修改操作
+ try
+ {
+ if (UserInfo != null)
+ {
+ UserInfo info = Global.userManager.userInfos.Find(p => p.UserId == UserInfo.UserId);
+ if (info != null)
+ {
+ switch (SelectText)
+ {
+ case "管理员": info.Authority = Authority.管理员; info.UserName = Admin; info.Password = Password; break;
+ case "技术员": info.Authority = Authority.技术员; info.UserName = Admin; info.Password = Password; break;
+ case "操作员": info.Authority = Authority.操作员; info.UserName = Admin; info.Password = Password; break;
+ case "观察员": info.Authority = Authority.观察员; info.UserName = Admin; info.Password = Password; break;
+ }
+ File.WriteAllText("LoginUp.hbl", JsonConvert.SerializeObject(Global.userManager).AESEncrypt());
+ var result = JsonConvert.DeserializeObject(File.ReadAllText("LoginUp.hbl").AESDecrypt());
+ Global.userManager = result;
+ ErrorMessage = "修改成功";
+ }
+ else
+ {
+ ErrorMessage = "修改失败";
+ }
+ }
+ else
+ {
+ ErrorMessage = "修改失败";
+ }
+ }
+ catch (Exception)
+ {
+ ErrorMessage = "修改失败";
+ }
+ }
+ }
+
+ });
+ AdminLoginCommand = new RelayCommand(() =>
+ {
+ var rest = ActionManage.GetInstance.SendResult("LoginDosingSystem", $"{Admin}-={Password}-={SelectText}");
+ if (rest != null && rest is string str)
+ {
+ Account = String.Empty;
+ Txtpassword = String.Empty;
+ ErrorMessage = str;
+
+ }
+ });
+
+
+ }
+ }
+}
diff --git a/FryPot_DosingSystem/ViewModel/AdministratorPasswordChangeViewModel.cs b/FryPot_DosingSystem/ViewModel/AdministratorPasswordChangeViewModel.cs
new file mode 100644
index 00000000..db3f9682
--- /dev/null
+++ b/FryPot_DosingSystem/ViewModel/AdministratorPasswordChangeViewModel.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.ViewModel
+{
+ internal class AdministratorPasswordChangeViewModel
+ {
+
+ }
+}
diff --git a/FryPot_DosingSystem/ViewModel/AgvViewModel.cs b/FryPot_DosingSystem/ViewModel/AgvViewModel.cs
new file mode 100644
index 00000000..a13e0d1c
--- /dev/null
+++ b/FryPot_DosingSystem/ViewModel/AgvViewModel.cs
@@ -0,0 +1,27 @@
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.ViewModel
+{
+ ///
+ /// AGV 视图
+ ///
+ public class AgvViewModel : ObservableObject
+ {
+ #region 单例模式
+ private volatile static AgvViewModel _Instance;
+ public static AgvViewModel GetInstance() => _Instance ?? (_Instance = new AgvViewModel());
+ public AgvViewModel()
+ {
+
+ }
+ #endregion
+
+ //public ObservableCollection menus { get; set; } = new ObservableCollection();
+
+ }
+}
diff --git a/FryPot_DosingSystem/ViewModel/DeviceListViewModel.cs b/FryPot_DosingSystem/ViewModel/DeviceListViewModel.cs
new file mode 100644
index 00000000..bb33d1ba
--- /dev/null
+++ b/FryPot_DosingSystem/ViewModel/DeviceListViewModel.cs
@@ -0,0 +1,61 @@
+using BPASmartClient.Helper;
+using FryPot_DosingSystem.Model;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.ViewModel
+{
+ internal class DeviceListViewModel : ObservableObject
+ {
+ public ObservableCollection DeviceName { get; set; } = new ObservableCollection();
+ public ObservableCollection devices { get; set; } = new ObservableCollection();
+ public RelayCommand AddDeviceCommand { get; set; }
+ public RelayCommand SaveDeviceConfig { get; set; }
+ public RelayCommand DeleteDevice { get; set; }
+ public DeviceListViewModel()
+ {
+ //Json.Read();
+ devices = Json.Data.Devices;
+ DeviceName.Add("滚筒输送线");
+ DeviceName.Add("炒锅1");
+ DeviceName.Add("炒锅2");
+ DeviceName.Add("炒锅3");
+ DeviceName.Add("炒锅4");
+ DeviceName.Add("炒锅5");
+ AddDeviceCommand = new RelayCommand(() =>
+ {
+ erp:
+ string guid = Guid.NewGuid().ToString();
+ DeviceInfo info = devices.FirstOrDefault(p => p.DeviceNum == guid);
+ if (info == null)
+ {
+ devices.Add(new DeviceInfo() { DeviceNum = guid });
+ }
+ else
+ {
+ goto erp;
+ }
+ });
+ DeleteDevice = new RelayCommand((str) =>
+ {
+ DeviceInfo device = devices.FirstOrDefault(p => p.DeviceNum == str);
+ if (device != null)
+ {
+ devices.Remove(device);
+ }
+ });
+ SaveDeviceConfig = new RelayCommand(() =>
+ {
+ Json.Data.Devices = devices;
+ Json.Save();
+ });
+ }
+
+ }
+}
diff --git a/FryPot_DosingSystem/ViewModel/HardWareStatusViewModel.cs b/FryPot_DosingSystem/ViewModel/HardWareStatusViewModel.cs
new file mode 100644
index 00000000..44bd2bdd
--- /dev/null
+++ b/FryPot_DosingSystem/ViewModel/HardWareStatusViewModel.cs
@@ -0,0 +1,52 @@
+using BPASmartClient.Helper;
+using FryPot_DosingSystem.Model;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.ViewModel
+{
+ internal class HardWareStatusViewModel:ObservableObject
+ {
+ private static HardWareStatusViewModel _instance;
+ public static HardWareStatusViewModel GetInstance => _instance ??= new HardWareStatusViewModel();
+ public HardWareStatusViewModel()
+ {
+ RollerOneModel = new RollerLineBarrelSerialModel();
+ RollerTwoModel = new RollerLineBarrelSerialModel();
+ RollerThreeModel = new RollerLineBarrelSerialModel();
+
+ }
+
+ private int _lineOneOne;
+ public int LineOneOne { get { return _lineOneOne; }set { _lineOneOne = value;OnPropertyChanged(); } }
+
+ ///
+ /// 线体1 工位->桶号
+ ///
+ private RollerLineBarrelSerialModel _rollerOneModel;
+ public RollerLineBarrelSerialModel RollerOneModel { get { return _rollerOneModel; }set { _rollerOneModel = value;OnPropertyChanged(); } }
+
+
+ ///
+ /// 线体2 工位->桶号
+ ///
+ private RollerLineBarrelSerialModel _rollerTwoModel;
+ public RollerLineBarrelSerialModel RollerTwoModel { get { return _rollerTwoModel; } set { _rollerTwoModel = value; OnPropertyChanged(); } }
+
+ ///
+ /// 线体3 工位->桶号
+ ///
+ private RollerLineBarrelSerialModel _rollerThreeModel;
+ public RollerLineBarrelSerialModel RollerThreeModel { get { return _rollerThreeModel; } set { _rollerThreeModel = value; OnPropertyChanged(); } }
+ ///
+ /// 线体4 工位->桶号s
+ ///
+ private RollerLineBarrelSerialModel _rollerFourModel;
+ public RollerLineBarrelSerialModel RollerFourModel { get { return _rollerFourModel; } set { _rollerFourModel = value; OnPropertyChanged(); } }
+ }
+}
diff --git a/FryPot_DosingSystem/ViewModel/LogViewModel.cs b/FryPot_DosingSystem/ViewModel/LogViewModel.cs
new file mode 100644
index 00000000..15a23294
--- /dev/null
+++ b/FryPot_DosingSystem/ViewModel/LogViewModel.cs
@@ -0,0 +1,76 @@
+using BPASmartClient.Message;
+using FryPot_DosingSystem.Model;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+
+namespace FryPot_DosingSystem.ViewModel
+{
+ internal class LogViewModel:ObservableObject
+ {
+ public static LogViewModel _instance;
+ public static LogViewModel GetInstance=>_instance?? (_instance = new LogViewModel());
+ private string _logTime;
+ public string LogTime { get { return _logTime; } set { _logTime = value; OnPropertyChanged(); } }
+
+ private string _logType;
+ public string LogType { get { return _logType; } set { _logType = value; OnPropertyChanged(); } }
+
+ private string _logMessage;
+ public string LogMessage { get { return _logMessage; } set { _logMessage = value; OnPropertyChanged(); } }
+
+ private Brush _foreColor;
+ public Brush ForeColor { get { return _foreColor; } set { _foreColor = value; OnPropertyChanged(); } }
+
+ public ObservableCollection LogDatas { get; set; } = new ObservableCollection();
+
+ public LogViewModel()
+ {
+ Inite();
+ }
+ public void Inite()
+ {
+ //一般日志 MessageLog.GetInstance.Show("");
+ MessageLog.GetInstance.InfoNotify = new Action((s) =>
+ {
+ System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
+ {
+ LogModel logModel = new LogModel { LogMessage= s, LogType = "一般日志" };
+ LogDatas.Add(logModel);
+ }));
+ });
+ //设备日志 MessageLog.GetInstance.DeviceProcessLogShow(id,message)
+ MessageLog.GetInstance.DeviceProcessLogNotify = new Action((id, s) =>
+ {
+ System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
+ {
+ LogModel logModel = new LogModel { LogMessage = s, LogType = "设备日志" };
+ LogDatas.Add(logModel);
+ }));
+ });
+ //设备告警日志 MessageLog.GetInstance.AddDeviceAlarmLogShow(id,message)
+ MessageLog.GetInstance.DeviceAlarmLogNotify = new Action((id, s) =>
+ {
+ System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
+ {
+ LogModel logModel = new LogModel { LogMessage = id, LogType = "报警日志" };
+ LogDatas.Add(logModel);
+ }));
+ });
+ //错误日志MessageLog.GetInstance.ShowEx(message)
+ MessageLog.GetInstance.ExInfoNotify = new Action((s) =>
+ {
+ System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
+ {
+ LogModel logModel = new LogModel { LogMessage = s, LogType = "错误日志" };
+ LogDatas.Add(logModel);
+ }));
+ });
+ }
+ }
+}
diff --git a/FryPot_DosingSystem/ViewModel/MainViewModel.cs b/FryPot_DosingSystem/ViewModel/MainViewModel.cs
new file mode 100644
index 00000000..517a2094
--- /dev/null
+++ b/FryPot_DosingSystem/ViewModel/MainViewModel.cs
@@ -0,0 +1,173 @@
+
+using BPASmartClient.Helper;
+using FryPot_DosingSystem.Control;
+using FryPot_DosingSystem.Model;
+using FryPot_DosingSystem.View;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Forms;
+
+namespace FryPot_DosingSystem.ViewModel
+{
+ internal class MainViewModel : ObservableObject
+ {
+ public ObservableCollection menus { get; set; } = new ObservableCollection();
+
+ public RelayCommand Login { get; set; }
+ public RelayCommand PasswordChange { get; set; }
+
+ public RelayCommand ExitLogin { get; set; }
+ public RelayCommand TogglePag { get; set; }
+ public bool UserManagement { get { return _mUserManagement; } set { _mUserManagement = value; OnPropertyChanged(); } }
+ private bool _mUserManagement;
+ ///
+ /// 当前登陆信息
+ ///
+ private UserInfo _currentLoginAccount;
+ public UserInfo CurrentLoginAccount { get { return _currentLoginAccount; } set { _currentLoginAccount = value; OnPropertyChanged(); } }
+ ///
+ /// 不同权限显示不同菜单
+ ///
+ public ObservableCollection DisplayMenus { get; set; } = new ObservableCollection();
+ public FrameworkElement MyWindow { get { return _mMyWindow; } set { _mMyWindow = value; OnPropertyChanged(); } }
+ private FrameworkElement _mMyWindow;
+
+ public string WindowTitleName { get { return _mWindowTitleName; } set { _mWindowTitleName = value; OnPropertyChanged(); } }
+ private string _mWindowTitleName;
+ ///
+ /// 开机自启
+ ///
+ public bool AutoStart { get { return SystemHelper.GetInstance.IsAutoStart(); } set { SystemHelper.GetInstance.AutoStart(value); OnPropertyChanged(); } }
+
+ private bool _status;
+ ///
+ /// 设备初始化状态
+ ///
+ public bool Status
+ {
+ get { return _status; }
+ set
+ {
+ if (value)
+ {
+ ActionManage.GetInstance.Send("StartPlcInite");
+ }
+ else
+ {
+ ActionManage.GetInstance.Send("EndPlcInite");
+ }
+ _status = value;
+ OnPropertyChanged();
+ }
+ }
+
+ private Authority authority;
+ public Authority Authority
+ {
+ get { return authority; }
+ set
+ {
+ var res = menus.Where(p => Array.FindIndex(p.Authority, au => au == value) >= 0).ToList();
+ if (res != null && res.Count > 0)
+ {
+ DisplayMenus.Clear();
+ res.ForEach(p => DisplayMenus.Add(p));
+ DoNavChanged(res[0].CommandParameter);
+ }
+ authority = value;
+ }
+ }
+ public MainViewModel()
+ {
+ LogViewModel model = LogViewModel.GetInstance;
+ DeviceOperate deviceOperate = DeviceOperate.GetInstance;//开启实时PLC数据读取
+ DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序
+ TogglePag = new RelayCommand(DoNavChanged);
+ Login = new RelayCommand(() =>
+ {
+ ActionManage.GetInstance.CancelRegister("ContentUpdate");
+ ActionManage.GetInstance.Register(new Func(() => { return "注册"; }), "ContentUpdate");
+ DoNavChanged("AdministratorLoginView.用户登陆");
+ UserManagement = false;
+ });
+ PasswordChange = new RelayCommand(() =>
+ {
+ ActionManage.GetInstance.CancelRegister("ContentUpdate");
+ ActionManage.GetInstance.Register(new Func(() => { return "修改"; }), "ContentUpdate");
+ ActionManage.GetInstance.CancelRegister("LoginInfo");
+ ActionManage.GetInstance.Register(new Func(() => { return CurrentLoginAccount; }), "LoginInfo");
+ DoNavChanged("AdministratorLoginView.密码修改");
+ UserManagement = false;
+ });
+ ExitLogin = new RelayCommand(() =>
+ {
+ //DoNavChanged("LoginView.退出登录");
+ CurrentLoginAccount = null;
+ Authority = Authority.观察员;
+ UserManagement = false;
+ });
+ LoginInfoConfig.GetInstance.Init();//用户数据初始化
+ LoginRegister();
+ MenusDefaultInit();
+ Authority = Authority.管理员;
+ }
+
+ private void MenusDefaultInit()
+ {
+ menus.Add(new ActionMenu() { MenuName = "配方设置", CommandParameter = "RecipeSetView.配方设置", Authority = new Authority[] { Authority.管理员, Authority.技术员 } });
+ menus.Add(new ActionMenu() { MenuName = "配方下发", CommandParameter = "RecipeSendDownView.配方下发", Authority = new Authority[] { Authority.管理员, Authority.技术员, Authority.操作员 } });
+ menus.Add(new ActionMenu() { MenuName = "设备列表", CommandParameter = "DeviceListVIew.设备列表", Authority = new Authority[] { Authority.管理员, Authority.技术员, Authority.操作员, Authority.观察员 } });
+ menus.Add(new ActionMenu() { MenuName = "状态监测", CommandParameter = "HardWareStatusView.状态监测", Authority = new Authority[] { Authority.管理员, Authority.技术员, Authority.操作员, Authority.观察员 } });
+ menus.Add(new ActionMenu() { MenuName = "日志信息", CommandParameter = "LogView.日志信息", Authority = new Authority[] { Authority.管理员, Authority.技术员, Authority.操作员, Authority.观察员 } });
+ menus.Add(new ActionMenu() { MenuName = "报警记录", CommandParameter = "", Authority = new Authority[] { Authority.管理员, Authority.技术员, Authority.操作员, Authority.观察员 } });
+
+ }
+
+ public void DoNavChanged(object obj)
+ {
+ if (obj != null && obj is string stobj)
+ {
+ var strs = stobj.Split('.');
+ if (strs != null && strs.Length == 2)
+ {
+ Type type = Type.GetType($"FryPot_DosingSystem.View.{strs[0]}");
+ var res = type?.GetConstructor(System.Type.EmptyTypes)?.Invoke(null);
+ if (res != null && res is FrameworkElement fe) MyWindow = fe;
+ WindowTitleName = strs[1];
+ }
+ }
+ }
+ ///
+ /// 登陆验证
+ ///
+ private void LoginRegister()
+ {
+ ActionManage.GetInstance.Register(new Func((o) =>
+ {
+ if (o != null && o is string str)
+ {
+ var strs = str.Split("-=");
+ if (strs != null && strs.Length == 3)
+ {
+ var us = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == strs[0] && p.Password == strs[1] && strs[2] == p.Authority.ToString());
+ if (us != null)
+ {
+ Authority = us.Authority;
+ CurrentLoginAccount = us;//记录当前登陆信息
+ return string.Empty;
+ }
+ }
+ }
+ return "用户名或密码错误";
+ }), "LoginDosingSystem");
+ }
+ }
+}
diff --git a/FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs b/FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs
new file mode 100644
index 00000000..53440266
--- /dev/null
+++ b/FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs
@@ -0,0 +1,98 @@
+using BPASmartClient.Helper;
+using FryPot_DosingSystem.Model;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.ViewModel
+{
+ internal class NewRecipeViewModel : ObservableObject
+ {
+ ///
+ /// 配方唯一编码,用于编辑配方
+ ///
+ public string recipeId { get; set; }
+ ///
+ /// 配料名称
+ ///
+ private string _recipeName;
+ public string RecipeName { get { return _recipeName; } set { _recipeName = value; OnPropertyChanged(); } }
+
+ public ObservableCollection materials { get; set; } = new ObservableCollection();
+
+ public ObservableCollection materialNames { get; set; } = new ObservableCollection() { "肉","葱","蒜"};
+
+ public RelayCommand AddRecipe { get; set; }
+ public RelayCommand RemoveRecipe { get; set; }
+ public RelayCommand Comfirm { get; set; }
+ public NewRecipeViewModel()
+ {
+ ActionManage.GetInstance.Register(new Action(Id => {
+ if (Id != null && Id is string strId)
+ {
+ var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipeId == strId);
+ if (res != null && res is NewRecipeModel rom)
+ {
+ RecipeName = rom.RecipeName;
+ foreach (var item in rom.materialCollection)
+ {
+ materials.Add(item);
+ }
+ recipeId = strId;
+ }
+ }
+ }),"EditRecipe");
+ AddRecipe = new RelayCommand(() =>
+ {
+ pr:
+ string materialCode = Guid.NewGuid().ToString();//原料唯一ID ,后期需要根据实际要求更改
+ var res = materials.FirstOrDefault(p => p.MaterialCode == materialCode);
+ if (res == null)
+ {
+ materials.Add(new MaterialType() { MaterialCode = materialCode });
+ }
+ else
+ {
+ goto pr;
+ }
+ });
+ RemoveRecipe = new RelayCommand(code =>
+ {
+ var res = materials.FirstOrDefault(m => m.MaterialCode == code);
+ if (res != null)
+ materials.Remove(res);
+ });
+ Comfirm = new RelayCommand(() =>
+ {
+ var bom = Json.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeId);
+ if (bom == null)//新配方
+ {
+ prop: string recipeID = Guid.NewGuid().ToString();//配方唯一ID,后期根据实际要求更改
+ var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID);
+ if (res == null)
+ {
+ Json.Data.Recipes.Add(new NewRecipeModel { RecipeId = recipeID, RecipeName = RecipeName, materialCollection = materials });//配方添加
+
+ }
+ else
+ {
+ goto prop;
+ }
+ ActionManage.GetInstance.Send("CloseNewRecipeView");
+ }
+ else //已有配方,用于编辑
+ {
+ bom.materialCollection= materials;
+ bom.RecipeName = RecipeName;
+ ActionManage.GetInstance.Send("CloseNewRecipeView");
+ }
+ });
+
+ }
+ }
+}
diff --git a/FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs b/FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs
new file mode 100644
index 00000000..16f1bfb1
--- /dev/null
+++ b/FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs
@@ -0,0 +1,63 @@
+using BPASmartClient.Helper;
+using BPASmartClient.Message;
+using FryPot_DosingSystem.Model;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.ViewModel
+{
+ internal class RecipeSetDownViewModel : ObservableObject
+ {
+
+
+ ///
+ /// 配方下发
+ ///
+ public RelayCommand RecipeSetDownCommand { get; set; }
+ ///
+ /// 配方一键下发
+ ///
+ public RelayCommand AllRecipeSetDownCommand { get; set; }
+ public ObservableCollection Recipes { get; set; } = new ObservableCollection();
+ public RecipeSetDownViewModel()
+ {
+ Json.Read();
+ Recipes = Json.Data.Recipes;
+ RecipeSetDownCommand = new RelayCommand((Id) =>
+ {
+ if (Id != null && Id is string strId)
+ {
+ var res = Recipes.FirstOrDefault(p => p.RecipeId == strId);
+ if (res != null)
+ {
+ RecipeSetDown(res);
+ }
+ }
+ });
+ AllRecipeSetDownCommand = new RelayCommand(() =>
+ {
+ if (Recipes!=null)
+ {
+ foreach (var recipeModel in Recipes)
+ {
+ RecipeSetDown(recipeModel);
+ }
+ }
+
+ });
+ }
+ ///
+ /// 数据下发方法
+ ///
+ public void RecipeSetDown(NewRecipeModel recipeModel)
+ {
+ ActionManage.GetInstance.Send("RecipeSetDown",recipeModel);
+ }
+ }
+}
diff --git a/FryPot_DosingSystem/ViewModel/RecipeSetViewModel.cs b/FryPot_DosingSystem/ViewModel/RecipeSetViewModel.cs
new file mode 100644
index 00000000..be2f8d68
--- /dev/null
+++ b/FryPot_DosingSystem/ViewModel/RecipeSetViewModel.cs
@@ -0,0 +1,80 @@
+using BPASmartClient.Helper;
+using BPASmartClient.Message;
+using FryPot_DosingSystem.Model;
+using FryPot_DosingSystem.View;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FryPot_DosingSystem.ViewModel
+{
+ internal class RecipeSetViewModel : ObservableObject
+ {
+ /////
+ ///// 配方编号
+ /////
+ //private int _serialNumber;
+ //public int SerialNumber { get { return _serialNumber; } set { _serialNumber = value;OnPropertyChanged(); } }
+ /////
+ ///// 配方名称
+ /////
+ //private string _recipeName;
+ //public string RecipeName { get { return _recipeName; } set { _recipeName = value; OnPropertyChanged(); } }
+
+ public ObservableCollection recipeModels { get; set; } = new ObservableCollection();
+
+ public Action NewRecipe { get; set; }
+
+ public Action SaveRecipe { get; set; }
+ ///
+ /// 编辑配方
+ ///
+ public RelayCommand EditRecipeCommand { get; set; }
+ ///
+ /// 删除配方
+ ///
+ public RelayCommand DeleteRecipeCommand { get; set; }
+
+ public RecipeSetViewModel()
+ {
+ Json.Read();
+ recipeModels = Json.Data.Recipes;
+ NewRecipe = new Action(() =>
+ {
+ NewRecipeView nrv = new NewRecipeView();
+ nrv.ShowDialog();
+ MessageLog.GetInstance.Show("新建配方");
+ });
+ SaveRecipe = new Action(() => {
+ Json.Save();
+ });
+ EditRecipeCommand = new RelayCommand((Id) =>
+ {
+ if (Id != null)
+ {
+ ActionManage.GetInstance.CancelRegister("EditRecipe");
+ NewRecipeView nrv = new NewRecipeView();
+ ActionManage.GetInstance.Send("EditRecipe", Id);
+ nrv.ShowDialog();
+ }
+ });
+ DeleteRecipeCommand = new RelayCommand((Id) =>
+ {
+ if (Id != null && Id is String strId)
+ {
+ var res= recipeModels.FirstOrDefault(p => p.RecipeId == strId);
+ if (res != null && res is NewRecipeModel nes)
+ {
+ recipeModels.Remove(res);//删除配方
+ Json.Save();//保存配方
+ }
+ }
+ });
+ }
+ }
+}
diff --git a/FryPot_DosingSystem/hbl.ico b/FryPot_DosingSystem/hbl.ico
new file mode 100644
index 00000000..cf89051a
Binary files /dev/null and b/FryPot_DosingSystem/hbl.ico differ
diff --git a/HBLConsole.MORKIC/BPASmartClient.MORKIC.csproj b/HBLConsole.MORKIC/BPASmartClient.MORKIC.csproj
deleted file mode 100644
index a6768c85..00000000
--- a/HBLConsole.MORKIC/BPASmartClient.MORKIC.csproj
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
- net6.0
- bin\
- portable
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/HBLConsole.MORKIC/Control_MORKIC.cs b/HBLConsole.MORKIC/Control_MORKIC.cs
deleted file mode 100644
index 97b7743b..00000000
--- a/HBLConsole.MORKIC/Control_MORKIC.cs
+++ /dev/null
@@ -1,644 +0,0 @@
-using BPA.Message;
-using BPA.Message.Enum;
-using BPA.Message.IOT;
-using BPASmartClient.Device;
-using BPASmartClient.DRCoffee;
-using BPASmartClient.EventBus;
-using BPASmartClient.GSIceCream;
-using BPASmartClient.Helper;
-using BPASmartClient.Lebai;
-using BPASmartClient.Message;
-using BPASmartClient.Model;
-using BPASmartClient.Model.冰淇淋.Enum;
-using BPASmartClient.Model.单片机;
-using BPASmartClient.Model.单片机.Enum;
-using BPASmartClient.Model.咖啡机.Enum;
-using BPASmartClient.SCChip;
-using Robotc;
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using static BPASmartClient.EventBus.EventBus;
-
-namespace BPASmartClient.MORKIC
-{
- /*
- * 冰淇淋咖啡机组合套装
- * 物料位置:
- * 1:冰淇料
- * 2:冰淇淋杯
- * 5:咖啡
- * 6:咖啡杯
- */
- public class Control_MORKIC : BaseDevice
- {
-
- //咖啡机主控程序
- private CoffeeMachine coffeeMachine;
- //单片机主控程序
- private ICChipMachine icchipMachine;
- //广绅单口冰淇淋机
- private IceCreamMachine iceCreamMachine;
- //物料存放位置
- private Dictionary batchings = new Dictionary();
- ///
- /// 获取乐百机器人的数据
- ///
- SignalResult lebai = new SignalResult();
- ///
- /// 咖啡位置是否有东西
- ///
- private bool IsCoffeeMake = false;
-
- private bool enableFunny = false;
- private DateTime lastRecvdOrder = DateTime.Now;
- private bool working = false;
- private bool IceIsOK = true;
-
- public void ConnectOk()
- {
-
- }
- ///
- /// 当前正在制作咖啡
- ///
- SimOrderData MakeCoffeeOrder = new SimOrderData();
- ///
- /// 咖啡订单队列
- ///
- ConcurrentQueue morkOrderPushesCoffee = new ConcurrentQueue();
- ///
- /// 冰淇淋订单队列
- ///
- ConcurrentQueue morkOrderPushesIceCream = new ConcurrentQueue();
- ///
- /// 等待取餐的订单,只有一个
- ///
- ConcurrentQueue WaitTakeMealOrder = new ConcurrentQueue();
-
- public void Init()
- {
-
- ActionManage.GetInstance.Register(new Action((s) =>
- {
- if (s is DrCoffeeDrinksCode cf)
- {
- DoCoffee(new SimOrderData { Loc = ((int)cf).ToString() });
- }
- else if (s is Dictionary ms)
- {
- if (ms.ContainsKey("Button"))
- {
- switch (ms["Button"])
- {
- case "启动示教":
- LebaiRobot.GetInstance.StartTeachMode();
- break;
- case "停止示教":
- LebaiRobot.GetInstance.EndtTeachMode();
- break;
- case "启动机器人":
- LebaiRobot.GetInstance.StartRobot();
- break;
- case "急停":
- LebaiRobot.GetInstance.EStopRobot();
- break;
- default:
- break;
- }
- }
- }
- }), "SimCoffee");
-
- //构建所有商品物料信息
- batchings = PolymerBatching.BuildAll();
-
- EventBus.EventBus.GetInstance().Subscribe(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
- {
- if (MakeCoffeeOrder != null)
- MakeCoffeeOrder.OrderStatus = 1;
- });
-
- System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);
- //一系列外围基础配置
- var com_Coffee = config.AppSettings.Settings["COM_Coffee"].Value;
- var baud_Coffee = config.AppSettings.Settings["BAUD_Coffee"].Value;
- var com_IceCream = config.AppSettings.Settings["COM_IceCream"].Value;
- var baud_IceCream = config.AppSettings.Settings["BAUD_IceCream"].Value;
- var iceCreamCXBThreshold = int.Parse(config.AppSettings.Settings["IceCream_CXB_Threshold"].Value);
-
- var com_ICChip = config.AppSettings.Settings["COM_ICChip"].Value;
- var baud_ICChip = config.AppSettings.Settings["BAUD_IChip"].Value;
-
-
- if (iceCreamCXBThreshold > 0)
- {
- //设置冰淇淋成型比
- MorkIStatus.GetInstance().CXB_Threshold = (byte)iceCreamCXBThreshold;
- }
- //咖啡机创建
- coffeeMachine = new CoffeeMachine();
- //单片机机创建
- icchipMachine = new ICChipMachine();
- //冰淇淋机创建
- iceCreamMachine = new IceCreamMachine();
-
- Main();
- ReadRobotData();
- OrderMake();
- }
-
- private int NoOrderTime = 0;
-
- public override DeviceClientType DeviceType => DeviceClientType.MORKT;
-
- //订单制作
- public void OrderMake()
- {
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- while (IsHealth && (morkOrderPushesCoffee.Count > 0 || morkOrderPushesIceCream.Count > 0 || IsCoffeeMake))
- {
- working = true; NoOrderTime = 0;
- //1.有咖啡订单 取杯去制作
- if (!IsCoffeeMake)//位置无杯子
- {
- if (morkOrderPushesCoffee.Count > 0 && morkOrderPushesCoffee.TryDequeue(out SimOrderData simOrder))
- {
- IsCoffeeMake = true; MakeCoffeeOrder = simOrder;
- MessageLog.GetInstance.Show($"开始制作 [咖啡] 订单[{simOrder.morkOrder.SortNum}]");
- DoCoffee(simOrder);
- }
- }
-
- if (!LebaiRobot.GetInstance.GetInput())//取餐口是否有餐饮
- {
- //取餐位的订单完成
- if (WaitTakeMealOrder.TryDequeue(out SimOrderData waitOrder)) OrderChange(waitOrder.morkOrder.SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
-
-
- //1.制作冰淇淋
- if (morkOrderPushesIceCream.Count > 0 && MorkIStatus.GetInstance().CurrentMode != MORKI_MODE.制冷模式) new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish();
-
- if (MorkIStatus.GetInstance().CXB >= 86 && morkOrderPushesIceCream.Count > 0)//成型比大于80 我才会制作
- {
- if (LebaiRobot.GetInstance.GetInput(3))
- {
- if (IceIsOK) MessageLog.GetInstance.Show("请擦拭冰淇淋机出口");
- IceIsOK = false;
-
- }
- else if (morkOrderPushesIceCream.TryDequeue(out SimOrderData order))
- {
- IceIsOK = true;
- MessageLog.GetInstance.Show($"开始制作 [冰淇淋] 订单[{order.morkOrder.SortNum}]");
- DoIceCream(order);
- }
- }
-
- //2.取咖啡到取餐口
- if (IsCoffeeMake)
- {
- if (MakeCoffeeOrder != null && MakeCoffeeOrder.OrderStatus == 1)
- {
- MessageLog.GetInstance.Show($"将咖啡移动到取餐位 [咖啡] 订单[{MakeCoffeeOrder.morkOrder.SortNum}]");
- DoCoffeeQC(MakeCoffeeOrder);
- MakeCoffeeOrder = null;
- IsCoffeeMake = false;
- }
- }
- }
- working = false;
- lastRecvdOrder = DateTime.Now;
- }
-
- if (IsHealth == false && (morkOrderPushesCoffee.Count > 0 || morkOrderPushesIceCream.Count > 0 || IsCoffeeMake))
- {
- MessageLog.GetInstance.Show($"机器连接问题 订单,不允许制作,请检查设备连接后尝试," +
- $"乐白:{LebaiRobot.GetInstance.IsConnected}咖啡机:{MorkIStatus.GetInstance().CanDo}单片机:{ChipStatus.GetInstance().CanDo}");
-
- if (LebaiRobot.GetInstance.IsConnected && IsCoffeeMake && !LebaiRobot.GetInstance.GetInput())//乐白有订单
- {
- MessageLog.GetInstance.Show($"将咖啡移动到取餐位 [咖啡] 订单[{MakeCoffeeOrder.morkOrder.SortNum}]");
- DoCoffeeQC(MakeCoffeeOrder);
- MakeCoffeeOrder = null;
- IsCoffeeMake = false;
- }
- }
-
- if (!LebaiRobot.GetInstance.GetInput())
- {
- if (WaitTakeMealOrder.TryDequeue(out SimOrderData waitOrder)) OrderChange(waitOrder.morkOrder.SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
- }
-
-
- Thread.Sleep(1000);
- }), "订单制作");
- }
-
- private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
- {
- EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });
- }
-
- public void Main()
- {
- //咖啡机开启主线程
- coffeeMachine.Start();
- //单片机开启主线程
- icchipMachine.Start();
- //冰淇淋机开启主线程
- iceCreamMachine.Start();
- new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish();
- //开始心跳刷新,根据咖啡机及冰淇淋机来判断
- //ThreadManage.GetInstance().StartLong(new Action(() =>
- //{
- // GeneralConfig.Healthy =
- // LebaiRobot.GetInstance.IsConnected &&
- // MorkCStatus.GetInstance().CanDo &&
- // ChipStatus.GetInstance().CanDo;
- // //GeneralConfig.Healthy = true;
- // Thread.Sleep(100);
- //}), "MORK-IC心跳刷新");
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- while (!LebaiRobot.GetInstance.IsConnected)
- {
- Thread.Sleep(10);
- }
- //LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_欢迎);
- }), "MORK-IC欢迎");
-
- }
-
- public void DataParse(T order)
- {
- if (order is MorkOrderPush morkOrderPush)
- {
- //商品类型
- GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER;
- string loc_coffe = string.Empty;
- string loc_cup = string.Empty;
- #region 订单分类
- //遍历物料
- foreach (var item in morkOrderPush.GoodBatchings)
- {
- var res = Json.Data.orderMaterialDelivery.BatchingInfo.FirstOrDefault(p => p.BatchingId == item.BatchingId);
- if (res != null)
- {
- //验证商品是咖啡还是冰淇淋
- if (ValidateGoodsByBatching(res.BatchingLoc) != GOODS_TYPE.NEITHER)
- {
- //获取当前物料所属商品类型
- currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc);
- }
- //获取主料和容器位置
- switch (batchings[res.BatchingLoc].BatchingClass)
- {
- case BATCHING_CLASS.HOLDER:
- loc_cup = res.BatchingLoc;
- break;
- case BATCHING_CLASS.MAIN_MATERIAL:
- loc_coffe = res.BatchingLoc;
- break;
- }
- }
- }
- //根据商品类型执行具体制作流程
- switch (currentGoodsType)
- {
- case GOODS_TYPE.COFFEE:
- morkOrderPushesCoffee.Enqueue(new SimOrderData { Loc = loc_coffe, morkOrder = morkOrderPush });
- break;
- case GOODS_TYPE.ICECREAM:
- morkOrderPushesIceCream.Enqueue(new SimOrderData { Loc = loc_coffe, morkOrder = morkOrderPush });
- break;
- case GOODS_TYPE.NEITHER:
- MessageLog.GetInstance.Show("未知的商品类型");
- break;
- }
- #endregion
-
-
- }
- }
-
- ///
- /// 验证当前是做咖啡还是做冰淇淋
- ///
- /// 物料位置
- private GOODS_TYPE ValidateGoodsByBatching(string batchingLoc)
- {
- if (batchings.ContainsKey(batchingLoc))
- return batchings[batchingLoc].GoodsType;
- return GOODS_TYPE.NEITHER;
- }
-
- private void Wait(int value = 101)
- {
- while (!(lebai.Ok && lebai.Value == value))
- {
- Thread.Sleep(5);
- }
- }
-
- ///
- /// 做咖啡-接杯子 并且 回到 安全位置
- ///
- private void DoCoffee(SimOrderData order)
- {
- #region 且时且多入场设备程序
- int checkeNum = 0;
- // are.Reset();
- LebaiRobot.GetInstance.SetValue(0);
- OrderChange(order.morkOrder.SuborderId, ORDER_STATUS.COOKING);
- //SimpleFactory.GetInstance.OrderChanged(order.morkOrder.SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
- LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_取咖啡杯);
- Wait();
- new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();//落碗控制
- Thread.Sleep(500);
- MessageLog.GetInstance.Show("尝试取咖啡杯!");
- LebaiRobot.GetInstance.SetValue(1);
-
- int count = 2;
- p:
- LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_咖啡杯检测);
- Wait();
- LebaiRobot.GetInstance.SetValue(1);
-
- if (!LebaiRobot.GetInstance.GetInput())
- {
- if (count >= 3)
- {
- //退出循环回到初始位置
- DeviceProcessLogShow($"执行{count}次取咖啡杯,仍为成功,订单默认废弃,机器人回到初始位置!");
- LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_咖啡杯回原点);
- Wait();
- LebaiRobot.GetInstance.SetValue(1);
- return;
- }
- DeviceProcessLogShow("执行二次取咖啡杯");
- LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_二次取咖啡杯);
- Wait();
- new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();//落碗控制
- LebaiRobot.GetInstance.SetValue(1);
- count++;
- goto p;
- }
-
- DeviceProcessLogShow("咖啡杯取杯完成");
- LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_接咖啡后回原点);
- Wait();
- LebaiRobot.GetInstance.SetValue(1);
- //加场景 回初始位置
- new DRCoffee_MakeCoffeeEvent() { DrinkCode = (Model.咖啡机.Enum.DrCoffeeDrinksCode)int.Parse(order.Loc) }.Publish(); //接咖啡控制
- DeviceProcessLogShow($"发送咖啡机制作{order.Loc}!");
- #endregion
-
- }
-
- ///
- /// 将咖啡杯子 取走到 取餐口
- ///
- private void DoCoffeeQC(SimOrderData order)
- {
- LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_取咖啡出餐);
- Wait();
- LebaiRobot.GetInstance.SetValue(1);
- //订单状态改变:完成
- OrderChange(order.morkOrder.SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK);
- //SimpleFactory.GetInstance.OrderChanged(order.morkOrder.SuborderId,BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK);
- DeviceProcessLogShow($"{order.morkOrder.GoodsName}等待取餐");
- WaitTakeMealOrder.Enqueue(order);
- }
-
- ///
- /// 做冰淇淋
- ///
- private void DoIceCream(SimOrderData order)
- {
- //if (LebaiRobot.GetInstance.GetInput(3))
- //{
- // MessageLog.GetInstance.Show("请擦拭冰淇淋机出口");
- // return;
- //}
-
- #region 且时且多入场设备程序
- int checkeNum = 0;
- //are.Reset();
- LebaiRobot.GetInstance.SetValue(0);
- LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_取冰淇淋杯);
- Wait();
- new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_ICECREAM }.Publish();//落碗控制
- Thread.Sleep(500);
- MessageLog.GetInstance.Show("尝试取冰淇淋杯!");
- LebaiRobot.GetInstance.SetValue(1);
-
- int count = 2;
- p:
- LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_冰淇淋杯检测);
- Wait();
-
- LebaiRobot.GetInstance.SetValue(1);
- if (!LebaiRobot.GetInstance.GetInput())
- {
- if (count >= 3)
- {
- //退出循环回到初始位置
- MessageLog.GetInstance.Show($"执行{count}次取冰淇淋杯,仍未成功,订单默认废弃,机器人回到初始位置!");
- LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_冰淇淋杯回原点);
- Wait();
- LebaiRobot.GetInstance.SetValue(1);
- return;
- }
- MessageLog.GetInstance.Show($"执行{count}次取冰淇淋杯!");
- LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_二次取冰淇淋杯);
- new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_ICECREAM }.Publish();//落碗控制
- Wait();
- LebaiRobot.GetInstance.SetValue(1);
- count++;
- goto p;
- }
- MessageLog.GetInstance.Show("冰淇淋杯检测完成");
-
- #region 通讯冰淇淋机
-
- //制冷模式
- new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish();
- LebaiRobot.GetInstance.SetValue(0);
- OrderChange(order.morkOrder.SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
- //SimpleFactory.GetInstance.OrderChanged(order.morkOrder.SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
- LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_接1号冰淇淋);
- Wait();
- bool doItResult = true;
- //出料
- new GSIceCream_DischargeEvent().Publish(delegate (object[] args)
- {
- doItResult = (bool)args[0];
- });
- if (doItResult)
- {
- IceCreamCookCheck();
- }
- else
- {
- int count_1 = 0;
- while (MorkIStatus.GetInstance().CXB <= 86)
- {
- Thread.Sleep(5);
- count_1++;
- if (count_1 >= 2000)
- break;
- }
- IceCreamCookCheck();
- }
- LebaiRobot.GetInstance.SetValue(1);
- #endregion
-
- while (LebaiRobot.GetInstance.GetInput())
- {
- Thread.Sleep(500);
- }
- LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_放冰淇淋位置);
-
- Wait();
- LebaiRobot.GetInstance.SetValue(1);
- //订单状态改变:完成
- OrderChange(order.morkOrder.SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK);
- //SimpleFactory.GetInstance.OrderChanged(order.morkOrder.SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK);
- MessageLog.GetInstance.Show($"{order.morkOrder.GoodsName}等待取餐");
- WaitTakeMealOrder.Enqueue(order);
- #endregion
-
- }
-
- ///
- /// 冰淇淋制作
- ///
- public void IceCreamCookCheck()
- {
-
- int retry = 3;
- DateTime beginTime = DateTime.Now;
- while (!LebaiRobot.GetInstance.GetInput(3))
- {
- if (retry <= 0 && DateTime.Now.Subtract(beginTime).TotalSeconds >= 10)
- {
- MessageLog.GetInstance.Show("超时未出料,重试次数用尽");
- break;
- }
- if (DateTime.Now.Subtract(beginTime).TotalSeconds > 5)
- {
- MessageLog.GetInstance.Show("超时未出料,重新发送打料指令");
- new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.打料 }.Publish();
- beginTime = DateTime.Now;
- retry--;
- }
- Thread.Sleep(10);
- }
- MessageLog.GetInstance.Show("开始等待6s");
- Thread.Sleep(5000);
-
- }
-
- //private void CoffeEndCookHandle(IEvent @event, EventBus.EventCallBackHandle callBack)
- //{
- // //are.Set();
- // if(MakeCoffeeOrder!=null)
- // MakeCoffeeOrder.OrderStatus = 1;
- //}
-
- public void ReadRobotData()
- {
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- lebai = LebaiRobot.GetInstance.GetValueAsync();
- LebaiRobot.GetInstance.GetRobotModeStatus();
- //LebaiRobot.GetInstance.GetInput();
-
-
- Thread.Sleep(100);
- }), "乐百机器人数据读取", true);
- }
-
- public void SimOrder(T simOrder)
- {
-
- }
-
- ///
- /// IOT 广播消息命令
- ///
- public void IotBroadcast(T broadcast)
- {
- if (broadcast != null && broadcast is IOTCommandModel iOTCommand)
- {
- switch (iOTCommand.CommandName)
- {
- case 0://控制类
- if (iOTCommand.CommandValue != null)
- {
- if (iOTCommand.CommandValue.ContainsKey("SimOrder"))
- {
- //SimOrder(new SimOrderData { NoodleLoc = 1, BowlLoc = 10 });
- }
- }
- break;
- case 1://设置属性
-
- break;
- case 2://通知消息
-
- break;
- default:
- break;
- }
- }
- }
-
- public override void DoMain()
- {
-
- }
-
- public override void Stop()
- {
-
- }
-
- public override void ReadData()
- {
-
- }
-
- public override void MainTask()
- {
-
- }
-
- public override void ResetProgram()
- {
-
- }
- }
-
-
- public class SimOrderData
- {
- public string id { get; set; }
-
- public int OrderStatus { get; set; }
-
- public string Loc { get; set; }
-
- public MorkOrderPush morkOrder { get; set; }
-
- public SimOrderData()
- {
- id = Guid.NewGuid().ToString();
- OrderStatus = 0;
- }
- }
-}
diff --git a/LoginUp.hbl b/LoginUp.hbl
new file mode 100644
index 00000000..993e1cd1
--- /dev/null
+++ b/LoginUp.hbl
@@ -0,0 +1 @@
+deac37237d550f2bb590b1d004aab120f4401e4504fd380cf9afa150f1f019d624ce5842ec9c5a8b2120413b2d623477a5b1c93800f28232dfcce895649de806a90a33c6aa3e437981381bb5e28745b8c5a9df97b8b94372d1b9dcac16580901
\ No newline at end of file
diff --git a/SmartClient.sln b/SmartClient.sln
index 5a83489f..8be1190e 100644
--- a/SmartClient.sln
+++ b/SmartClient.sln
@@ -94,11 +94,27 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Juicer", "BP
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTHQ", "BPASmartClient.MorkT_HQ\BPASmartClient.MorkTHQ.csproj", "{00C17D87-A323-4A97-BC21-7039E55614DE}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DosingSystem", "DosingSystem\DosingSystem.csproj", "{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.DosingSystem", "DosingSystem\BPASmartClient.DosingSystem.csproj", "{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTJuicer", "BPASmartClient.MorkTJuicer\BPASmartClient.MorkTJuicer.csproj", "{724087A3-E7E7-4494-B844-414FF5CD1D40}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkTM", "BPASmartClient.MorkTM\BPASmartClient.MorkTM.csproj", "{C404A775-A36C-4A0A-B25B-C4212DC2293D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.AGV", "BPASmartClient.AGV\BPASmartClient.AGV.csproj", "{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.IceMaker", "BPASmartClient.IceMaker\BPASmartClient.IceMaker.csproj", "{F61AC179-156D-4075-BFEB-355862231F48}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkT_BarCounter", "BPASmartClient.MorkT_BarCounter\BPASmartClient.MorkT_BarCounter.csproj", "{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkT_Container", "BPASmartClient.MorkT_Container\BPASmartClient.MorkT_Container.csproj", "{1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.AgvApi", "BPASmartClient.AgvApi\BPASmartClient.AgvApi.csproj", "{8B1C64F3-A52C-480F-8262-50F824136CF3}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FryPot_DosingSystem", "FryPot_DosingSystem\FryPot_DosingSystem.csproj", "{2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.ZhuoDian", "BPASmartClient.ZhuoDian\BPASmartClient.ZhuoDian.csproj", "{E7168B03-68E5-4285-BB95-5660F877577A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestDemo", "TestDemo\TestDemo.csproj", "{A49E1C5A-9489-451C-9CE6-CEA586234B84}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.HubHelper", "BPASmartClient.HubHelper\BPASmartClient.HubHelper.csproj", "{099E047C-F40E-47A3-A5BA-81FC1500D5E8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -894,26 +910,186 @@ Global
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|x64.Build.0 = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|x86.ActiveCfg = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|x86.Build.0 = Release|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|ARM.ActiveCfg = Debug|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|ARM.Build.0 = Debug|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|ARM64.ActiveCfg = Debug|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|ARM64.Build.0 = Debug|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|x64.ActiveCfg = Debug|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|x64.Build.0 = Debug|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|x86.ActiveCfg = Debug|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|x86.Build.0 = Debug|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|Any CPU.Build.0 = Release|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|ARM.ActiveCfg = Release|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|ARM.Build.0 = Release|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|ARM64.ActiveCfg = Release|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|ARM64.Build.0 = Release|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|x64.ActiveCfg = Release|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|x64.Build.0 = Release|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|x86.ActiveCfg = Release|Any CPU
- {C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|x86.Build.0 = Release|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Debug|ARM.Build.0 = Debug|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Debug|x64.Build.0 = Debug|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Debug|x86.Build.0 = Debug|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Release|ARM.ActiveCfg = Release|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Release|ARM.Build.0 = Release|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Release|ARM64.Build.0 = Release|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Release|x64.ActiveCfg = Release|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Release|x64.Build.0 = Release|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Release|x86.ActiveCfg = Release|Any CPU
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Release|x86.Build.0 = Release|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Debug|ARM.Build.0 = Debug|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Debug|x64.Build.0 = Debug|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Debug|x86.Build.0 = Debug|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Release|ARM.ActiveCfg = Release|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Release|ARM.Build.0 = Release|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Release|ARM64.Build.0 = Release|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Release|x64.ActiveCfg = Release|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Release|x64.Build.0 = Release|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Release|x86.ActiveCfg = Release|Any CPU
+ {F61AC179-156D-4075-BFEB-355862231F48}.Release|x86.Build.0 = Release|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|ARM.Build.0 = Debug|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|x64.Build.0 = Debug|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Debug|x86.Build.0 = Debug|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|Any CPU.Build.0 = Release|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|ARM.ActiveCfg = Release|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|ARM.Build.0 = Release|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|ARM64.Build.0 = Release|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|x64.ActiveCfg = Release|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|x64.Build.0 = Release|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|x86.ActiveCfg = Release|Any CPU
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|x86.Build.0 = Release|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|ARM.Build.0 = Debug|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|x64.Build.0 = Debug|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|x86.Build.0 = Debug|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|ARM.ActiveCfg = Release|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|ARM.Build.0 = Release|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|ARM64.Build.0 = Release|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|x64.ActiveCfg = Release|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|x64.Build.0 = Release|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|x86.ActiveCfg = Release|Any CPU
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|x86.Build.0 = Release|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Debug|ARM.Build.0 = Debug|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Debug|x64.Build.0 = Debug|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Debug|x86.Build.0 = Debug|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Release|ARM.ActiveCfg = Release|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Release|ARM.Build.0 = Release|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Release|ARM64.Build.0 = Release|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Release|x64.ActiveCfg = Release|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Release|x64.Build.0 = Release|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Release|x86.ActiveCfg = Release|Any CPU
+ {8B1C64F3-A52C-480F-8262-50F824136CF3}.Release|x86.Build.0 = Release|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Debug|ARM.Build.0 = Debug|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Debug|x64.Build.0 = Debug|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Debug|x86.Build.0 = Debug|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Release|ARM.ActiveCfg = Release|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Release|ARM.Build.0 = Release|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Release|ARM64.Build.0 = Release|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Release|x64.ActiveCfg = Release|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Release|x64.Build.0 = Release|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Release|x86.ActiveCfg = Release|Any CPU
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214}.Release|x86.Build.0 = Release|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Debug|ARM.Build.0 = Debug|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Debug|x64.Build.0 = Debug|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Debug|x86.Build.0 = Debug|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Release|ARM.ActiveCfg = Release|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Release|ARM.Build.0 = Release|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Release|ARM64.Build.0 = Release|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Release|x64.ActiveCfg = Release|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Release|x64.Build.0 = Release|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Release|x86.ActiveCfg = Release|Any CPU
+ {E7168B03-68E5-4285-BB95-5660F877577A}.Release|x86.Build.0 = Release|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Debug|ARM.Build.0 = Debug|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Debug|x64.Build.0 = Debug|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Debug|x86.Build.0 = Debug|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Release|ARM.ActiveCfg = Release|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Release|ARM.Build.0 = Release|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Release|ARM64.Build.0 = Release|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Release|x64.ActiveCfg = Release|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Release|x64.Build.0 = Release|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Release|x86.ActiveCfg = Release|Any CPU
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84}.Release|x86.Build.0 = Release|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Debug|ARM.Build.0 = Debug|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Debug|x64.Build.0 = Debug|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Debug|x86.Build.0 = Debug|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|ARM.ActiveCfg = Release|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|ARM.Build.0 = Release|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|ARM64.Build.0 = Release|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x64.ActiveCfg = Release|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x64.Build.0 = Release|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x86.ActiveCfg = Release|Any CPU
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -958,7 +1134,15 @@ Global
{00C17D87-A323-4A97-BC21-7039E55614DE} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{724087A3-E7E7-4494-B844-414FF5CD1D40} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
- {C404A775-A36C-4A0A-B25B-C4212DC2293D} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
+ {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625}
+ {F61AC179-156D-4075-BFEB-355862231F48} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}
+ {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
+ {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
+ {8B1C64F3-A52C-480F-8262-50F824136CF3} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
+ {2A1F6798-7BD3-42C9-BC30-F6D9D59E7214} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
+ {E7168B03-68E5-4285-BB95-5660F877577A} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
+ {A49E1C5A-9489-451C-9CE6-CEA586234B84} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
+ {099E047C-F40E-47A3-A5BA-81FC1500D5E8} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}
diff --git a/TestDemo/Form1.Designer.cs b/TestDemo/Form1.Designer.cs
new file mode 100644
index 00000000..384634cd
--- /dev/null
+++ b/TestDemo/Form1.Designer.cs
@@ -0,0 +1,73 @@
+namespace TestDemo
+{
+ partial class Form1
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.button1 = new System.Windows.Forms.Button();
+ this.button2 = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(12, 12);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(97, 43);
+ this.button1.TabIndex = 0;
+ this.button1.Text = "button1";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+ //
+ // button2
+ //
+ this.button2.Location = new System.Drawing.Point(137, 12);
+ this.button2.Name = "button2";
+ this.button2.Size = new System.Drawing.Size(88, 43);
+ this.button2.TabIndex = 1;
+ this.button2.Text = "button2";
+ this.button2.UseVisualStyleBackColor = true;
+ this.button2.Click += new System.EventHandler(this.button2_Click);
+ //
+ // Form1
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(641, 298);
+ this.Controls.Add(this.button2);
+ this.Controls.Add(this.button1);
+ this.Name = "Form1";
+ this.Text = "Form1";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private Button button1;
+ private Button button2;
+ }
+}
\ No newline at end of file
diff --git a/TestDemo/Form1.cs b/TestDemo/Form1.cs
new file mode 100644
index 00000000..5777866f
--- /dev/null
+++ b/TestDemo/Form1.cs
@@ -0,0 +1,32 @@
+using BPASmartClient.AGV.Feedback;
+using BPASmartClient.Helper;
+using BPASmartClient.Http;
+using Newtonsoft.Json;
+
+namespace TestDemo
+{
+ public partial class Form1 : Form
+ {
+ public Form1()
+ {
+ InitializeComponent();
+ }
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ AGVToUpSystem aGVToUpSystem = new AGVToUpSystem();
+ string value = JsonConvert.SerializeObject(aGVToUpSystem);
+ string url = $"http://192.168.1.99:8089/apicallback/quicktron/robotjob/report?sign={value}";
+ var res = APIHelper.GetInstance.HttpRequest(url, "", aGVToUpSystem, RequestType.POST);
+ }
+
+ private void button2_Click(object sender, EventArgs e)
+ {
+
+ Upstreamrequest aGVToUpSystem = new Upstreamrequest();
+ string value = JsonConvert.SerializeObject(aGVToUpSystem);
+ string url = $"http://192.168.1.99:8089/apicallback/quicktron/robotjob/upstreamrequest?sign={value}";
+ var res = APIHelper.GetInstance.HttpRequest(url, "", aGVToUpSystem, RequestType.POST);
+ }
+ }
+}
\ No newline at end of file
diff --git a/TestDemo/Form1.resx b/TestDemo/Form1.resx
new file mode 100644
index 00000000..f298a7be
--- /dev/null
+++ b/TestDemo/Form1.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/TestDemo/Program.cs b/TestDemo/Program.cs
new file mode 100644
index 00000000..7b502c42
--- /dev/null
+++ b/TestDemo/Program.cs
@@ -0,0 +1,17 @@
+namespace TestDemo
+{
+ internal static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ // To customize application configuration such as set high DPI settings or default font,
+ // see https://aka.ms/applicationconfiguration.
+ ApplicationConfiguration.Initialize();
+ Application.Run(new Form1());
+ }
+ }
+}
\ No newline at end of file
diff --git a/TestDemo/TestDemo.csproj b/TestDemo/TestDemo.csproj
new file mode 100644
index 00000000..78ae5a43
--- /dev/null
+++ b/TestDemo/TestDemo.csproj
@@ -0,0 +1,17 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+ enable
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/up.hbl b/up.hbl
new file mode 100644
index 00000000..304f1618
--- /dev/null
+++ b/up.hbl
@@ -0,0 +1 @@
+deac37237d550f2bb590b1d004aab120481999a41282f0d8eed6fa9049bb2b58cf766ac542f7a79f9082f942d0190d731890e60eebc260ec3b9e76773b3e4e83443ee7e834210c4de2f560a9b4a6dffbc2a95b696b61aa07653dc4afdd31b551dc9f238426fc95486e3cf08d9387518bf125481cbfd4003d593f7f0c83167badfca9e6b0e585bf724542d50252bd672d2650e1146dd47b395b9b5d22b4fba4e75f528e15f91b5eb98112d2b1a3d5b1e1305cd1a1086a71336213e2a7cf83b262e36d4f33428a80c089f2f1ed81695a6c2d431dd7aaf64d71262dd132539e26900ebb7a6d1cc5923550c6612fdfee2a0a
\ No newline at end of file