diff --git a/BPASmart.MenuLoad/BPASmart.MenuLoad.csproj b/BPASmart.MenuLoad/BPASmart.MenuLoad.csproj index 15c0fe6e..5ce28106 100644 --- a/BPASmart.MenuLoad/BPASmart.MenuLoad.csproj +++ b/BPASmart.MenuLoad/BPASmart.MenuLoad.csproj @@ -19,6 +19,7 @@ + diff --git a/BPASmart.PageLoad/BPASmart.PageLoad.csproj b/BPASmart.PageLoad/BPASmart.PageLoad.csproj index 4bf1921b..115cd404 100644 --- a/BPASmart.PageLoad/BPASmart.PageLoad.csproj +++ b/BPASmart.PageLoad/BPASmart.PageLoad.csproj @@ -15,7 +15,7 @@ - + diff --git a/BPASmart.VariableManager/ServiceCenter.cs b/BPASmart.VariableManager/ServiceCenter.cs index 03dd6763..a0288969 100644 --- a/BPASmart.VariableManager/ServiceCenter.cs +++ b/BPASmart.VariableManager/ServiceCenter.cs @@ -55,8 +55,8 @@ namespace BPASmart.VariableManager Thread.Sleep(100); }), "客户端管道消息控制"); pipeClient.PushCommand = new Action((s) => { if (pipeClient.IsConnected) msg.Enqueue(s); }); - pipeClient.StartPipeStream(); MessageLog.GetInstance.NotifyShow = new Action((o) => { if (pipeClient.IsConnected) pipeClient.SendCommand(o); }); + pipeClient.StartPipeStream(); } diff --git a/BPASmartClient.AGV/AGVHelper.cs b/BPASmartClient.AGV/AGVHelper.cs index 5d030a3b..ca56e07e 100644 --- a/BPASmartClient.AGV/AGVHelper.cs +++ b/BPASmartClient.AGV/AGVHelper.cs @@ -19,31 +19,34 @@ namespace BPASmartClient.AGV Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); //根据Key读取元素的Value - // string name = config.AppSettings.Settings["name"].Value; + // string name = config.AppSettings.Settings["name"].Value; + public List resId = new List(); public AGVHelper() { } - + 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); + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(url)); request.Method = "POST"; request.Headers["header"] = head; request.Proxy = null; byte[] bytes = Encoding.UTF8.GetBytes(body); - request.ContentType = "application/json; charset=UTF-8"; //窗体数据被编码为名称/值对形式 + request.ContentType = "application/json"; //窗体数据被编码为名称/值对形式 //request.ContentType = "application/json"; request.ContentLength = bytes.Length; + request.ServicePoint.Expect100Continue = false; Stream myResponseStream = request.GetRequestStream(); myResponseStream.Write(bytes, 0, bytes.Length); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);//解码 + Stream stream = response.GetResponseStream(); + StreamReader myStreamReader = new StreamReader(stream);//解码 string retString = myStreamReader.ReadToEnd(); myStreamReader.Close(); myResponseStream.Close(); @@ -51,7 +54,7 @@ namespace BPASmartClient.AGV if (response != null) { response.Close(); - } + } if (request != null) { request.Abort(); @@ -73,43 +76,61 @@ namespace BPASmartClient.AGV { build.Append(bte[i].ToString("X")); } - + return build.ToString(); } + public string ResquestIdGenerate() + { + eq: string reqId = Guid.NewGuid().ToString("D"); + string Id = resId.FirstOrDefault(p => p == reqId); + if (Id != null) + goto eq; + resId.Add(Id); + if (resId.Count > 15) + { + resId.RemoveRange(0,5);//定期清理请求Id + } + return Id; + } /// - /// AGV去1号线体装桶 + /// AGV去1号线体装桶到炒锅1 /// /// public string AgvToLineOneLoadRoller(string robotJobId) { + //bool b = Convert.ToBoolean(config.AppSettings.Settings["appKey"].Value);//配置文件信息读取 string url = AGVRequestUrl.GetInstance.TaskSendUrl; //请求报文头 - HttpRequestHeaderModel httpHeader=new HttpRequestHeaderModel(); - httpHeader.appKey = ""; - httpHeader.appSecret = ""; - httpHeader.requestId = ""; - httpHeader.timestamp = ""; - httpHeader.version = "2.8"; + HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); + httpHeader.appKey = config.AppSettings.Settings["appKey"].Value; + httpHeader.appSecret = config.AppSettings.Settings["appSecret"].Value; + httpHeader.requestId = ResquestIdGenerate(); + httpHeader.timestamp = DateTime.Now.ToString();//时间戳 + httpHeader.version = config.AppSettings.Settings["version"].Value; string head = JsonConvert.SerializeObject(httpHeader); //请求报文体 AGVModel httpModel = new AGVModel(); httpModel.robotJobId = robotJobId;//上游提供 - httpModel.warehouseId = 123; //仓库编号 - httpModel.jobPriority = 1;//任务执行的优先级 - httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号 + httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级 + httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value);//0:根据优先级来执行,1:强制执行 + httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE //详细任务数据 //点到点 AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); - httpJobData.startPoint = "";//起点点位 - httpJobData.endPoint = "";//目的点位 - httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + httpJobData.startPoint = config.AppSettings.Settings["LineOnePoint"].Value;//起点点位 + httpJobData.endPoint = config.AppSettings.Settings["FryPotOnePoint"].Value; ;//目的点位 + + + httpJobData.autoLoad = Convert.ToBoolean(config.AppSettings.Settings["autoLoad"].Value); //是否自动上料 true:自动上料 false:人工上料 + httpJobData.enableIOLoad = Convert.ToBoolean(config.AppSettings.Settings["enableIOLoad"].Value); ;//上料交互方式 false:接口交互 true:光电交互 + httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); ;//是否自动下料 true:自动下料 false:人工下料 + httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 + httpJobData.loadEquipmentId = 1; + httpJobData.unloadEquipmentId = 5; httpModel.jobData = httpJobData; - string body = JsonConvert.SerializeObject(httpModel); + string body = "["+JsonConvert.SerializeObject(httpModel)+"]"; // string newBody = String.Join(",\r\n", body.Split(','));//格式处理,看需求 //货位到货位 @@ -124,65 +145,188 @@ namespace BPASmartClient.AGV //string body = JsonConvert.SerializeObject(httpModel); //启用签名 //url = url + "?sign=" + MD5Deal(body); - string data = HttpRequest(url, head, body); - object objData = JsonConvert.DeserializeObject(data); + + + string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); + object objData = JsonConvert.DeserializeObject(data); if (objData != null && objData is HttpResponseBodyModel response) { return response.code; } return "Analysis Error"; } + /// - /// AGV去2号线体装桶 + /// AGV去1号线体装桶到炒锅4 + /// + /// + public string AgvFromLineOneToFryFourLoadRoller(string robotJobId) + { + + //bool b = Convert.ToBoolean(config.AppSettings.Settings["appKey"].Value);//配置文件信息读取 + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); + httpHeader.appKey = config.AppSettings.Settings["appKey"].Value; + httpHeader.appSecret = config.AppSettings.Settings["appSecret"].Value; + httpHeader.requestId = ResquestIdGenerate(); + httpHeader.timestamp = DateTime.Now.ToString();//时间戳 + httpHeader.version = config.AppSettings.Settings["version"].Value; + string head = JsonConvert.SerializeObject(httpHeader); + //请求报文体 + AGVModel httpModel = new AGVModel(); + httpModel.robotJobId = robotJobId;//上游提供 + httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号 + httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级 + httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value);//0:根据优先级来执行,1:强制执行 + httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); + httpJobData.startPoint = config.AppSettings.Settings["LineOnePoint"].Value; ;//起点点位 + httpJobData.endPoint = config.AppSettings.Settings["FryPotFourPoint"].Value; ;//目的点位 + + //httpJobData.startPoint = config.AppSettings.Settings["FryPotFivePoint"].Value;//起点点位 + //httpJobData.endPoint = config.AppSettings.Settings["FryPotFourPoint"].Value; ;//目的点位 + httpJobData.autoLoad = Convert.ToBoolean(config.AppSettings.Settings["autoLoad"].Value); //是否自动上料 true:自动上料 false:人工上料 + httpJobData.enableIOLoad = Convert.ToBoolean(config.AppSettings.Settings["enableIOLoad"].Value); ;//上料交互方式 false:接口交互 true:光电交互 + httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); ;//是否自动下料 true:自动下料 false:人工下料 + httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 + httpJobData.loadEquipmentId = 1; + httpJobData.unloadEquipmentId = 8; + httpModel.jobData = httpJobData; + string body ="["+ JsonConvert.SerializeObject(httpModel)+"]"; + // string newBody = String.Join(",\r\n", body.Split(','));//格式处理,看需求 + + //货位到货位 + //AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); + //httpSlotJobData.startSlotCode = "";//起点槽位编号 + //httpSlotJobData.endSlotCode = "";//目的槽位编号 + //httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //httpSlotJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 + //httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //httpSlotJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + //httpModel.jobData = httpSlotJobData; + //string body = JsonConvert.SerializeObject(httpModel); + //启用签名 + //url = url + "?sign=" + MD5Deal(body); + string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); + + var objData = JsonConvert.DeserializeObject(data); + if (objData != null && objData is HttpResponseBodyModel response) + { + return response.code; + } + return "Analysis Error"; + } + /// + /// AGV去2号线体装桶到炒锅2 /// /// public string AgvToLineTwoLoadRoller(string robotJobId) { - //string url = AGVRequestUrl.GetInstance.TaskSendUrl; - ////请求报文头 - // HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); - //httpHeader.appKey = ""; - //httpHeader.appSecret = ""; - //httpHeader.requestId = ""; - //httpHeader.timestamp = ""; - //httpHeader.version = "2.8"; - //string head = JsonConvert.SerializeObject(httpHeader); - ////请求报文体 - // AGVModel httpModel = new AGVModel(); - //httpModel.robotJobId = robotJobId;//上游提供 - //httpModel.warehouseId = 123; //仓库编号 - //httpModel.jobPriority = 1;//任务执行的优先级 - //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - ////详细任务数据 - ////点到点 - //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); - //httpJobData.startPoint = "";//起点点位 - //httpJobData.endPoint = "";//目的点位 - //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - //httpModel.jobData = httpJobData; + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); + httpHeader.appKey = config.AppSettings.Settings["appKey"].Value; ; + httpHeader.appSecret = config.AppSettings.Settings["appSecret"].Value; + httpHeader.requestId = ResquestIdGenerate(); + httpHeader.timestamp = DateTime.Now.ToString(); + httpHeader.version = config.AppSettings.Settings["version"].Value; + string head = JsonConvert.SerializeObject(httpHeader); + //请求报文体 + AGVModel httpModel = new AGVModel(); + httpModel.robotJobId = robotJobId;//上游提供 + httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号 + httpModel.jobPriority =Convert.ToInt32( config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级 + httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行 + httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); + httpJobData.startPoint = config.AppSettings.Settings["LineTwoPoint"].Value;//起点点位 + httpJobData.endPoint = config.AppSettings.Settings["FryPotTwoPoint"].Value; ;//目的点位 + httpJobData.autoLoad = Convert.ToBoolean(config.AppSettings.Settings["autoLoad"].Value);//是否自动上料 true:自动上料 false:人工上料 + httpJobData.enableIOLoad = Convert.ToBoolean(config.AppSettings.Settings["enableIOLoad"].Value); //上料交互方式 false:接口交互 true:光电交互 + httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 + httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 + httpJobData.loadEquipmentId = 2; + httpJobData.unloadEquipmentId = 6; + httpModel.jobData = httpJobData; + string body ="["+ JsonConvert.SerializeObject(httpModel)+"]"; + //货位到货位 + //AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); + //httpSlotJobData.startSlotCode = "";//起点槽位编号 + //httpSlotJobData.endSlotCode = "";//目的槽位编号 + //httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //httpModel.jobData = httpSlotJobData; //string body = JsonConvert.SerializeObject(httpModel); - ////货位到货位 - ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); - ////httpSlotJobData.startSlotCode = "";//起点槽位编号 - ////httpSlotJobData.endSlotCode = "";//目的槽位编号 - ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - ////httpModel.jobData = httpSlotJobData; - ////string body = JsonConvert.SerializeObject(httpModel); - ////启用签名 - ////url = url + "?sign=" + MD5Deal(body); - //string data= HttpRequest(url, head, body); - //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseBodyModel response) - //{ - // return response.code; - //} + //启用签名 + //url = url + "?sign=" + MD5Deal(body); + string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); + object objData = JsonConvert.DeserializeObject(data); + if (objData != null && objData is HttpResponseBodyModel response) + { + return response.code; + } + return "Analysis Error"; + } + /// + /// AGV去2号线体装桶到炒锅5 + /// + /// + public string AgvFromLineTwoToFryFiveLoadRoller(string robotJobId) + { + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); + httpHeader.appKey = config.AppSettings.Settings["appKey"].Value; ; + httpHeader.appSecret = config.AppSettings.Settings["appSecret"].Value; + httpHeader.requestId = ResquestIdGenerate(); + httpHeader.timestamp = DateTime.Now.ToString(); + httpHeader.version = config.AppSettings.Settings["version"].Value; + string head = JsonConvert.SerializeObject(httpHeader); + //请求报文体 + AGVModel httpModel = new AGVModel(); + httpModel.robotJobId = robotJobId;//上游提供 + httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号 + httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级 + httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行 + httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); + httpJobData.startPoint = config.AppSettings.Settings["LineTwoPoint"].Value; ;//起点点位 + httpJobData.endPoint = config.AppSettings.Settings["FryPotFivePoint"].Value; ;//目的点位 + httpJobData.autoLoad = Convert.ToBoolean(config.AppSettings.Settings["autoLoad"].Value);//是否自动上料 true:自动上料 false:人工上料 + httpJobData.enableIOLoad = Convert.ToBoolean(config.AppSettings.Settings["enableIOLoad"].Value); //上料交互方式 false:接口交互 true:光电交互 + httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 + httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 + httpJobData.loadEquipmentId = 2; + httpJobData.unloadEquipmentId = 9; + httpModel.jobData = httpJobData; + string body = "["+JsonConvert.SerializeObject(httpModel)+"]"; + //货位到货位 + //AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); + //httpSlotJobData.startSlotCode = "";//起点槽位编号 + //httpSlotJobData.endSlotCode = "";//目的槽位编号 + //httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //httpModel.jobData = httpSlotJobData; + //string body = JsonConvert.SerializeObject(httpModel); + //启用签名 + //url = url + "?sign=" + MD5Deal(body); + string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); + object objData = JsonConvert.DeserializeObject(data); + if (objData != null && objData is HttpResponseBodyModel response) + { + return response.code; + } return "Analysis Error"; } /// @@ -191,51 +335,53 @@ namespace BPASmartClient.AGV /// public string AgvToLineThreeLoadRoller(string robotJobId) { - //string url = AGVRequestUrl.GetInstance.TaskSendUrl; - ////请求报文头 - //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); - //httpHeader.appKey = ""; - //httpHeader.appSecret = ""; - //httpHeader.requestId = ""; - //httpHeader.timestamp = ""; - //httpHeader.version = "2.8"; - //string head = JsonConvert.SerializeObject(httpHeader); - ////请求报文体 - //AGVModel httpModel=new AGVModel(); - //httpModel.robotJobId = robotJobId;//上游提供 - //httpModel.warehouseId = 123; //仓库编号 - //httpModel.jobPriority = 1;//任务执行的优先级 - //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - ////详细任务数据 - ////点到点 - //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); - //httpJobData.startPoint = "";//起点点位 - //httpJobData.endPoint = "";//目的点位 - //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - //httpModel.jobData = httpJobData; + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); + httpHeader.appKey = config.AppSettings.Settings["appKey"].Value; ; + httpHeader.appSecret = config.AppSettings.Settings["appSecret"].Value; + httpHeader.requestId = ResquestIdGenerate(); + httpHeader.timestamp = DateTime.Now.ToString(); + httpHeader.version = config.AppSettings.Settings["version"].Value; + string head = JsonConvert.SerializeObject(httpHeader); + //请求报文体 + AGVModel httpModel = new AGVModel(); + httpModel.robotJobId = robotJobId;//上游提供 + httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号 + httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级 + httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行 + httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); + httpJobData.startPoint = config.AppSettings.Settings["LineThreePoint"].Value;//起点点位 + httpJobData.endPoint = config.AppSettings.Settings["FryPotThreePoint"].Value;//目的点位 + httpJobData.autoLoad = Convert.ToBoolean(config.AppSettings.Settings["autoLoad"].Value);//是否自动上料 true:自动上料 false:人工上料 + httpJobData.enableIOLoad = Convert.ToBoolean(config.AppSettings.Settings["enableIOLoad"].Value); //上料交互方式 false:接口交互 true:光电交互 + httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 + httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 + httpJobData.loadEquipmentId = 3; + httpJobData.unloadEquipmentId = 7; + httpModel.jobData = httpJobData; + string body = "["+JsonConvert.SerializeObject(httpModel)+"]"; + //货位到货位 + //AGV_SlotRollerJobData httpSlotJobData=new AGV_SlotRollerJobData(); + //httpSlotJobData.startSlotCode = "";//起点槽位编号 + //httpSlotJobData.endSlotCode = "";//目的槽位编号 + //httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //httpModel.jobData = httpSlotJobData; //string body = JsonConvert.SerializeObject(httpModel); - ////货位到货位 - ////AGV_SlotRollerJobData httpSlotJobData=new AGV_SlotRollerJobData(); - ////httpSlotJobData.startSlotCode = "";//起点槽位编号 - ////httpSlotJobData.endSlotCode = "";//目的槽位编号 - ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - ////httpModel.jobData = httpSlotJobData; - ////string body = JsonConvert.SerializeObject(httpModel); - ////启用签名 - ////url = url + "?sign=" + MD5Deal(body); - //string data = HttpRequest(url, head, body); - //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseBodyModel response) - //{ - // return response.code; - //} + //启用签名 + //url = url + "?sign=" + MD5Deal(body); + string data = HttpRequest(url, head, body).Replace("[","").Replace("]",""); + object objData = JsonConvert.DeserializeObject(data); + if (objData != null && objData is HttpResponseBodyModel response) + { + return response.code; + } return "Analysis Error"; } /// @@ -244,51 +390,53 @@ namespace BPASmartClient.AGV /// public string AgvFromCleanToLineFourUnLoadRoller(string robotJobId) { - //string url = AGVRequestUrl.GetInstance.TaskSendUrl; - ////请求报文头 - //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); - //httpHeader.appKey = ""; - //httpHeader.appSecret = ""; - //httpHeader.requestId = ""; - //httpHeader.timestamp = ""; - //httpHeader.version = "2.8"; - //string head = JsonConvert.SerializeObject(httpHeader); - ////请求报文体 - //AGVModel httpModel = new AGVModel(); - //httpModel.robotJobId = robotJobId;//上游提供 - //httpModel.warehouseId = 123; //仓库编号 - //httpModel.jobPriority = 1;//任务执行的优先级 - //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - ////详细任务数据 - ////点到点 - //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); - //httpJobData.startPoint = "";//起点点位 - //httpJobData.endPoint = "";//目的点位 - //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - //httpModel.jobData = httpJobData; + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); + httpHeader.appKey = config.AppSettings.Settings["appKey"].Value; ; + httpHeader.appSecret = config.AppSettings.Settings["appSecret"].Value; + httpHeader.requestId = ResquestIdGenerate(); + httpHeader.timestamp = DateTime.Now.ToString(); + httpHeader.version = config.AppSettings.Settings["version"].Value; + string head = JsonConvert.SerializeObject(httpHeader); + //请求报文体 + AGVModel httpModel = new AGVModel(); + httpModel.robotJobId = robotJobId;//上游提供 + httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号 + httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级 + httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行 + httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); + httpJobData.startPoint = config.AppSettings.Settings["CleanPoint"].Value; ;//起点点位 + httpJobData.endPoint = config.AppSettings.Settings["LineFourPoint"].Value; ;//目的点位 + httpJobData.autoLoad = Convert.ToBoolean(config.AppSettings.Settings["autoLoad"].Value);//是否自动上料 true:自动上料 false:人工上料 + httpJobData.enableIOLoad = Convert.ToBoolean(config.AppSettings.Settings["enableIOLoad"].Value); //上料交互方式 false:接口交互 true:光电交互 + httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 + httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 + httpJobData.loadEquipmentId = 10; + httpJobData.unloadEquipmentId = 44; + httpModel.jobData = httpJobData; + string body ="["+ JsonConvert.SerializeObject(httpModel)+"]"; + //货位到货位 + //AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); + //httpSlotJobData.startSlotCode = "";//起点槽位编号 + //httpSlotJobData.endSlotCode = "";//目的槽位编号 + //httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //httpModel.jobData = httpSlotJobData; //string body = JsonConvert.SerializeObject(httpModel); - ////货位到货位 - ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); - ////httpSlotJobData.startSlotCode = "";//起点槽位编号 - ////httpSlotJobData.endSlotCode = "";//目的槽位编号 - ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - ////httpModel.jobData = httpSlotJobData; - ////string body = JsonConvert.SerializeObject(httpModel); - ////启用签名 - ////url = url + "?sign=" + MD5Deal(body); - //string data = HttpRequest(url, head, body); - //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseBodyModel response) - //{ - // return response.code; - //} + //启用签名 + //url = url + "?sign=" + MD5Deal(body); + string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); + object objData = JsonConvert.DeserializeObject(data); + if (objData != null && objData is HttpResponseBodyModel response) + { + return response.code; + } return "Analysis Error"; } /// @@ -297,51 +445,53 @@ namespace BPASmartClient.AGV /// public string AgvLeaveFryPotOne(string robotJobId) { - //string url = AGVRequestUrl.GetInstance.TaskSendUrl; - ////请求报文头 - //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); - //httpHeader.appKey = ""; - //httpHeader.appSecret = ""; - //httpHeader.requestId = ""; - //httpHeader.timestamp = ""; - //httpHeader.version = "2.8"; - //string head = JsonConvert.SerializeObject(httpHeader); - ////请求报文体 - //AGVModel httpModel = new AGVModel(); - //httpModel.robotJobId = robotJobId;//上游提供 - //httpModel.warehouseId = 123; //仓库编号 - //httpModel.jobPriority = 1;//任务执行的优先级 - //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - ////详细任务数据 - ////点到点 - //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); - //httpJobData.startPoint = "";//起点点位 - //httpJobData.endPoint = "";//目的点位 - //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - //httpModel.jobData = httpJobData; + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); + httpHeader.appKey = config.AppSettings.Settings["appKey"].Value; ; + httpHeader.appSecret = config.AppSettings.Settings["appSecret"].Value; + httpHeader.requestId = ResquestIdGenerate(); + httpHeader.timestamp = DateTime.Now.ToString(); + httpHeader.version = config.AppSettings.Settings["version"].Value; + string head = JsonConvert.SerializeObject(httpHeader); + //请求报文体 + AGVModel httpModel = new AGVModel(); + httpModel.robotJobId = robotJobId;//上游提供 + httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号 + httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级 + httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行 + httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); + httpJobData.startPoint = config.AppSettings.Settings["FryPotOnePoint"].Value; ;//起点点位 + httpJobData.endPoint = config.AppSettings.Settings["LineFourPoint"].Value; ;//目的点位 + httpJobData.autoLoad = Convert.ToBoolean(config.AppSettings.Settings["autoLoad"].Value);//是否自动上料 true:自动上料 false:人工上料 + httpJobData.enableIOLoad = Convert.ToBoolean(config.AppSettings.Settings["enableIOLoad"].Value); //上料交互方式 false:接口交互 true:光电交互 + httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 + httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 + httpJobData.loadEquipmentId = 5; + httpJobData.unloadEquipmentId = 4; + httpModel.jobData = httpJobData; + string body = "["+JsonConvert.SerializeObject(httpModel)+"]"; + //货位到货位 + //AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); + //httpSlotJobData.startSlotCode = "";//起点槽位编号 + //httpSlotJobData.endSlotCode = "";//目的槽位编号 + //httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //httpModel.jobData = httpSlotJobData; //string body = JsonConvert.SerializeObject(httpModel); - ////货位到货位 - ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); - ////httpSlotJobData.startSlotCode = "";//起点槽位编号 - ////httpSlotJobData.endSlotCode = "";//目的槽位编号 - ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - ////httpModel.jobData = httpSlotJobData; - ////string body = JsonConvert.SerializeObject(httpModel); - ////启用签名 - ////url = url + "?sign=" + MD5Deal(body); - //string data = HttpRequest(url, head, body); - //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseBodyModel response) - //{ - // return response.code; - //} + //启用签名 + //url = url + "?sign=" + MD5Deal(body); + string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); + object objData = JsonConvert.DeserializeObject(data); + if (objData != null && objData is HttpResponseBodyModel response) + { + return response.code; + } return "Analysis Error"; } /// @@ -350,51 +500,53 @@ namespace BPASmartClient.AGV /// public string AgvLeaveFryPotTwo(string robotJobId) { - //string url = AGVRequestUrl.GetInstance.TaskSendUrl; - ////请求报文头 - //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); - //httpHeader.appKey = ""; - //httpHeader.appSecret = ""; - //httpHeader.requestId = ""; - //httpHeader.timestamp = ""; - //httpHeader.version = "2.8"; - //string head = JsonConvert.SerializeObject(httpHeader); - ////请求报文体 - //AGVModel httpModel = new AGVModel(); - //httpModel.robotJobId = robotJobId;//上游提供 - //httpModel.warehouseId = 123; //仓库编号 - //httpModel.jobPriority = 1;//任务执行的优先级 - //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - ////详细任务数据 - ////点到点 - //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); - //httpJobData.startPoint = "";//起点点位 - //httpJobData.endPoint = "";//目的点位 - //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - //httpModel.jobData = httpJobData; + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); + httpHeader.appKey = config.AppSettings.Settings["appKey"].Value; ; + httpHeader.appSecret = config.AppSettings.Settings["appSecret"].Value; + httpHeader.requestId = ResquestIdGenerate(); + httpHeader.timestamp = DateTime.Now.ToString(); + httpHeader.version = config.AppSettings.Settings["version"].Value; + string head = JsonConvert.SerializeObject(httpHeader); + //请求报文体 + AGVModel httpModel = new AGVModel(); + httpModel.robotJobId = robotJobId;//上游提供 + httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号 + httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级 + httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行 + httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); + httpJobData.startPoint = config.AppSettings.Settings["FryPotTwoPoint"].Value; //起点点位 + httpJobData.endPoint = config.AppSettings.Settings["LineFourPoint"].Value;//目的点位 + httpJobData.autoLoad = Convert.ToBoolean(config.AppSettings.Settings["autoLoad"].Value);//是否自动上料 true:自动上料 false:人工上料 + httpJobData.enableIOLoad = Convert.ToBoolean(config.AppSettings.Settings["enableIOLoad"].Value); //上料交互方式 false:接口交互 true:光电交互 + httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 + httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 + httpJobData.loadEquipmentId = 6; + httpJobData.unloadEquipmentId = 4; + httpModel.jobData = httpJobData; + string body ="["+ JsonConvert.SerializeObject(httpModel)+"]"; + //货位到货位 + //AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); + //httpSlotJobData.startSlotCode = "";//起点槽位编号 + //httpSlotJobData.endSlotCode = "";//目的槽位编号 + //httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //httpModel.jobData = httpSlotJobData; //string body = JsonConvert.SerializeObject(httpModel); - ////货位到货位 - ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); - ////httpSlotJobData.startSlotCode = "";//起点槽位编号 - ////httpSlotJobData.endSlotCode = "";//目的槽位编号 - ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - ////httpModel.jobData = httpSlotJobData; - ////string body = JsonConvert.SerializeObject(httpModel); - ////启用签名 - ////url = url + "?sign=" + MD5Deal(body); - //string data = HttpRequest(url, head, body); - //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseBodyModel response) - //{ - // return response.code; - //} + //启用签名 + //url = url + "?sign=" + MD5Deal(body); + string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); + object objData = JsonConvert.DeserializeObject(data); + if (objData != null && objData is HttpResponseBodyModel response) + { + return response.code; + } return "Analysis Error"; } /// @@ -403,51 +555,53 @@ namespace BPASmartClient.AGV /// public string AgvLeaveFryPotThree(string robotJobId) { - //string url = AGVRequestUrl.GetInstance.TaskSendUrl; - ////请求报文头 - //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); - //httpHeader.appKey = ""; - //httpHeader.appSecret = ""; - //httpHeader.requestId = ""; - //httpHeader.timestamp = ""; - //httpHeader.version = "2.8"; - //string head = JsonConvert.SerializeObject(httpHeader); - ////请求报文体 - //AGVModel httpModel = new AGVModel(); - //httpModel.robotJobId = robotJobId;//上游提供 - //httpModel.warehouseId = 123; //仓库编号 - //httpModel.jobPriority = 1;//任务执行的优先级 - //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - ////详细任务数据 - ////点到点 - //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); - //httpJobData.startPoint = "";//起点点位 - //httpJobData.endPoint = "";//目的点位 - //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - //httpModel.jobData = httpJobData; + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); + httpHeader.appKey = config.AppSettings.Settings["appKey"].Value; ; + httpHeader.appSecret = config.AppSettings.Settings["appSecret"].Value; + httpHeader.requestId = ResquestIdGenerate(); + httpHeader.timestamp = DateTime.Now.ToString(); + httpHeader.version = config.AppSettings.Settings["version"].Value; + string head = JsonConvert.SerializeObject(httpHeader); + //请求报文体 + AGVModel httpModel = new AGVModel(); + httpModel.robotJobId = robotJobId;//上游提供 + httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号 + httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级 + httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行 + httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); + httpJobData.startPoint = config.AppSettings.Settings["FryPotThreePoint"].Value;//起点点位 + httpJobData.endPoint = config.AppSettings.Settings["LineFourPoint"].Value;//目的点位 + httpJobData.autoLoad = Convert.ToBoolean(config.AppSettings.Settings["autoLoad"].Value);//是否自动上料 true:自动上料 false:人工上料 + httpJobData.enableIOLoad = Convert.ToBoolean(config.AppSettings.Settings["enableIOLoad"].Value); //上料交互方式 false:接口交互 true:光电交互 + httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 + httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 + httpJobData.loadEquipmentId = 7; + httpJobData.unloadEquipmentId = 4; + httpModel.jobData = httpJobData; + string body ="["+ JsonConvert.SerializeObject(httpModel)+"]"; + //货位到货位 + //AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); + //httpSlotJobData.startSlotCode = "";//起点槽位编号 + //httpSlotJobData.endSlotCode = "";//目的槽位编号 + //httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //httpModel.jobData = httpSlotJobData; //string body = JsonConvert.SerializeObject(httpModel); - ////货位到货位 - ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); - ////httpSlotJobData.startSlotCode = "";//起点槽位编号 - ////httpSlotJobData.endSlotCode = "";//目的槽位编号 - ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - ////httpModel.jobData = httpSlotJobData; - ////string body = JsonConvert.SerializeObject(httpModel); - ////启用签名 - ////url = url + "?sign=" + MD5Deal(body); - //string data = HttpRequest(url, head, body); - //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseBodyModel response) - //{ - // return response.code; - //} + //启用签名 + //url = url + "?sign=" + MD5Deal(body); + string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); + object objData = JsonConvert.DeserializeObject(data); + if (objData != null && objData is HttpResponseBodyModel response) + { + return response.code; + } return "Analysis Error"; } /// @@ -456,51 +610,53 @@ namespace BPASmartClient.AGV /// public string AgvLeaveFryPotFour(string robotJobId) { - //string url = AGVRequestUrl.GetInstance.TaskSendUrl; - ////请求报文头 - //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); - //httpHeader.appKey = ""; - //httpHeader.appSecret = ""; - //httpHeader.requestId = ""; - //httpHeader.timestamp = ""; - //httpHeader.version = "2.8"; - //string head = JsonConvert.SerializeObject(httpHeader); - ////请求报文体 - //AGVModel httpModel = new AGVModel(); - //httpModel.robotJobId = robotJobId;//上游提供 - //httpModel.warehouseId = 123; //仓库编号 - //httpModel.jobPriority = 1;//任务执行的优先级 - //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - ////详细任务数据 - ////点到点 - //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); - //httpJobData.startPoint = "";//起点点位 - //httpJobData.endPoint = "";//目的点位 - //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - //httpModel.jobData = httpJobData; + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); + httpHeader.appKey = config.AppSettings.Settings["appKey"].Value; ; + httpHeader.appSecret = config.AppSettings.Settings["appSecret"].Value; + httpHeader.requestId = ResquestIdGenerate(); + httpHeader.timestamp = DateTime.Now.ToString(); + httpHeader.version = config.AppSettings.Settings["version"].Value; + string head = JsonConvert.SerializeObject(httpHeader); + //请求报文体 + AGVModel httpModel = new AGVModel(); + httpModel.robotJobId = robotJobId;//上游提供 + httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号 + httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级 + httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行 + httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); + httpJobData.startPoint = config.AppSettings.Settings["FryPotFourPoint"].Value;//起点点位 + httpJobData.endPoint = config.AppSettings.Settings["LineFourPoint"].Value;//目的点位 + httpJobData.autoLoad = Convert.ToBoolean(config.AppSettings.Settings["autoLoad"].Value);//是否自动上料 true:自动上料 false:人工上料 + httpJobData.enableIOLoad = Convert.ToBoolean(config.AppSettings.Settings["enableIOLoad"].Value); //上料交互方式 false:接口交互 true:光电交互 + httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 + httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 + httpJobData.loadEquipmentId = 8; + httpJobData.unloadEquipmentId = 4; + httpModel.jobData = httpJobData; + string body = "["+JsonConvert.SerializeObject(httpModel)+"]"; + //货位到货位 + //AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); + //httpSlotJobData.startSlotCode = "";//起点槽位编号 + //httpSlotJobData.endSlotCode = "";//目的槽位编号 + //httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //httpModel.jobData = httpSlotJobData; //string body = JsonConvert.SerializeObject(httpModel); - ////货位到货位 - ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); - ////httpSlotJobData.startSlotCode = "";//起点槽位编号 - ////httpSlotJobData.endSlotCode = "";//目的槽位编号 - ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - ////httpModel.jobData = httpSlotJobData; - ////string body = JsonConvert.SerializeObject(httpModel); - ////启用签名 - ////url = url + "?sign=" + MD5Deal(body); - //string data = HttpRequest(url, head, body); - //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseBodyModel response) - //{ - // return response.code; - //} + //启用签名 + //url = url + "?sign=" + MD5Deal(body); + string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); + object objData = JsonConvert.DeserializeObject(data); + if (objData != null && objData is HttpResponseBodyModel response) + { + return response.code; + } return "Analysis Error"; } /// @@ -509,51 +665,53 @@ namespace BPASmartClient.AGV /// public string AgvLeaveFryPotFive(string robotJobId) { - //string url = AGVRequestUrl.GetInstance.TaskSendUrl; - ////请求报文头 - //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); - //httpHeader.appKey = ""; - //httpHeader.appSecret = ""; - //httpHeader.requestId = ""; - //httpHeader.timestamp = ""; - //httpHeader.version = "2.8"; - //string head = JsonConvert.SerializeObject(httpHeader); - ////请求报文体 - //AGVModel httpModel = new AGVModel(); - //httpModel.robotJobId = robotJobId;//上游提供 - //httpModel.warehouseId = 123; //仓库编号 - //httpModel.jobPriority = 1;//任务执行的优先级 - //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - ////详细任务数据 - ////点到点 - //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); - //httpJobData.startPoint = "";//起点点位 - //httpJobData.endPoint = "";//目的点位 - //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - //httpModel.jobData = httpJobData; + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); + httpHeader.appKey = config.AppSettings.Settings["appKey"].Value; ; + httpHeader.appSecret = config.AppSettings.Settings["appSecret"].Value; + httpHeader.requestId = ResquestIdGenerate(); + httpHeader.timestamp = DateTime.Now.ToString(); + httpHeader.version = config.AppSettings.Settings["version"].Value; + string head = JsonConvert.SerializeObject(httpHeader); + //请求报文体 + AGVModel httpModel = new AGVModel(); + httpModel.robotJobId = robotJobId;//上游提供 + httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号 + httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级 + httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行 + httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); + httpJobData.startPoint = config.AppSettings.Settings["FryPotFivePoint"].Value;//起点点位 + httpJobData.endPoint = config.AppSettings.Settings["LineFourPoint"].Value;//目的点位 + httpJobData.autoLoad = Convert.ToBoolean(config.AppSettings.Settings["autoLoad"].Value);//是否自动上料 true:自动上料 false:人工上料 + httpJobData.enableIOLoad = Convert.ToBoolean(config.AppSettings.Settings["enableIOLoad"].Value); //上料交互方式 false:接口交互 true:光电交互 + httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 + httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 + httpJobData.loadEquipmentId = 9; + httpJobData.unloadEquipmentId = 4; + httpModel.jobData = httpJobData; + string body = "["+JsonConvert.SerializeObject(httpModel)+"]"; + //货位到货位 + //AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); + //httpSlotJobData.startSlotCode = "";//起点槽位编号 + //httpSlotJobData.endSlotCode = "";//目的槽位编号 + //httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //httpModel.jobData = httpSlotJobData; //string body = JsonConvert.SerializeObject(httpModel); - ////货位到货位 - ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); - ////httpSlotJobData.startSlotCode = "";//起点槽位编号 - ////httpSlotJobData.endSlotCode = "";//目的槽位编号 - ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - ////httpModel.jobData = httpSlotJobData; - ////string body = JsonConvert.SerializeObject(httpModel); - ////启用签名 - ////url = url + "?sign=" + MD5Deal(body); - //string data = HttpRequest(url, head, body); - //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseBodyModel response) - //{ - // return response.code; - //} + //启用签名 + //url = url + "?sign=" + MD5Deal(body); + string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); + object objData = JsonConvert.DeserializeObject(data); + if (objData != null && objData is HttpResponseBodyModel response) + { + return response.code; + } return "Analysis Error"; } @@ -563,51 +721,53 @@ namespace BPASmartClient.AGV /// public string AgvLeaveLOneToClean(string robotJobId) { - //string url = AGVRequestUrl.GetInstance.TaskSendUrl; - ////请求报文头 - //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); - //httpHeader.appKey = ""; - //httpHeader.appSecret = ""; - //httpHeader.requestId = ""; - //httpHeader.timestamp = ""; - //httpHeader.version = "2.8"; - //string head = JsonConvert.SerializeObject(httpHeader); - ////请求报文体 - //AGVModel httpModel = new AGVModel(); - //httpModel.robotJobId = robotJobId;//上游提供 - //httpModel.warehouseId = 123; //仓库编号 - //httpModel.jobPriority = 1;//任务执行的优先级 - //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - ////详细任务数据 - ////点到点 - //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); - //httpJobData.startPoint = "";//起点点位 - //httpJobData.endPoint = "";//目的点位 - //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - //httpModel.jobData = httpJobData; + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); + httpHeader.appKey = config.AppSettings.Settings["appKey"].Value; ; + httpHeader.appSecret = config.AppSettings.Settings["appSecret"].Value; + httpHeader.requestId = ResquestIdGenerate(); + httpHeader.timestamp = DateTime.Now.ToString(); + httpHeader.version = config.AppSettings.Settings["version"].Value; + string head = JsonConvert.SerializeObject(httpHeader); + //请求报文体 + AGVModel httpModel = new AGVModel(); + httpModel.robotJobId = robotJobId;//上游提供 + httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号 + httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级 + httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行 + httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); + httpJobData.startPoint = config.AppSettings.Settings["LineOnePoint"].Value; //起点点位 + httpJobData.endPoint = config.AppSettings.Settings["CleanPoint"].Value; //目的点位 + httpJobData.autoLoad = Convert.ToBoolean(config.AppSettings.Settings["autoLoad"].Value);//是否自动上料 true:自动上料 false:人工上料 + httpJobData.enableIOLoad = Convert.ToBoolean(config.AppSettings.Settings["enableIOLoad"].Value); //上料交互方式 false:接口交互 true:光电交互 + httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 + httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 + httpJobData.loadEquipmentId = 11; + httpJobData.unloadEquipmentId = 10; + httpModel.jobData = httpJobData; + string body = "["+JsonConvert.SerializeObject(httpModel)+"]"; + //货位到货位 + //AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); + //httpSlotJobData.startSlotCode = "";//起点槽位编号 + //httpSlotJobData.endSlotCode = "";//目的槽位编号 + //httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //httpModel.jobData = httpSlotJobData; //string body = JsonConvert.SerializeObject(httpModel); - ////货位到货位 - ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); - ////httpSlotJobData.startSlotCode = "";//起点槽位编号 - ////httpSlotJobData.endSlotCode = "";//目的槽位编号 - ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - ////httpModel.jobData = httpSlotJobData; - ////string body = JsonConvert.SerializeObject(httpModel); - ////启用签名 - ////url = url + "?sign=" + MD5Deal(body); - //string data = HttpRequest(url, head, body); - //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseBodyModel response) - //{ - // return response.code; - //} + //启用签名 + //url = url + "?sign=" + MD5Deal(body); + string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); + object objData = JsonConvert.DeserializeObject(data); + if (objData != null && objData is HttpResponseBodyModel response) + { + return response.code; + } return "Analysis Error"; } /// @@ -616,51 +776,53 @@ namespace BPASmartClient.AGV /// public string AgvLeaveLTwoToClean(string robotJobId) { - //string url = AGVRequestUrl.GetInstance.TaskSendUrl; - ////请求报文头 - //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); - //httpHeader.appKey = ""; - //httpHeader.appSecret = ""; - //httpHeader.requestId = ""; - //httpHeader.timestamp = ""; - //httpHeader.version = "2.8"; - //string head = JsonConvert.SerializeObject(httpHeader); - ////请求报文体 - //AGVModel httpModel = new AGVModel(); - //httpModel.robotJobId = robotJobId;//上游提供 - //httpModel.warehouseId = 123; //仓库编号 - //httpModel.jobPriority = 1;//任务执行的优先级 - //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - ////详细任务数据 - ////点到点 - //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); - //httpJobData.startPoint = "";//起点点位 - //httpJobData.endPoint = "";//目的点位 - //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - //httpModel.jobData = httpJobData; + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); + httpHeader.appKey = config.AppSettings.Settings["appKey"].Value; ; + httpHeader.appSecret = config.AppSettings.Settings["appSecret"].Value; + httpHeader.requestId = ResquestIdGenerate(); + httpHeader.timestamp = DateTime.Now.ToString(); + httpHeader.version = config.AppSettings.Settings["version"].Value; + string head = JsonConvert.SerializeObject(httpHeader); + //请求报文体 + AGVModel httpModel = new AGVModel(); + httpModel.robotJobId = robotJobId;//上游提供 + httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号 + httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级 + httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行 + httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); + httpJobData.startPoint = config.AppSettings.Settings["LineTwoPoint"].Value; //起点点位 + httpJobData.endPoint = config.AppSettings.Settings["CleanPoint"].Value; //目的点位 + httpJobData.autoLoad = Convert.ToBoolean(config.AppSettings.Settings["autoLoad"].Value);//是否自动上料 true:自动上料 false:人工上料 + httpJobData.enableIOLoad = Convert.ToBoolean(config.AppSettings.Settings["enableIOLoad"].Value); //上料交互方式 false:接口交互 true:光电交互 + httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 + httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 + httpJobData.loadEquipmentId = 22; + httpJobData.unloadEquipmentId = 20; + httpModel.jobData = httpJobData; + string body ="["+ JsonConvert.SerializeObject(httpModel)+"]"; + //货位到货位 + //AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); + //httpSlotJobData.startSlotCode = "";//起点槽位编号 + //httpSlotJobData.endSlotCode = "";//目的槽位编号 + //httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //httpModel.jobData = httpSlotJobData; //string body = JsonConvert.SerializeObject(httpModel); - ////货位到货位 - ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); - ////httpSlotJobData.startSlotCode = "";//起点槽位编号 - ////httpSlotJobData.endSlotCode = "";//目的槽位编号 - ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - ////httpModel.jobData = httpSlotJobData; - ////string body = JsonConvert.SerializeObject(httpModel); - ////启用签名 - ////url = url + "?sign=" + MD5Deal(body); - //string data = HttpRequest(url, head, body); - //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseBodyModel response) - //{ - // return response.code; - //} + //启用签名 + //url = url + "?sign=" + MD5Deal(body); + string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); + object objData = JsonConvert.DeserializeObject(data); + if (objData != null && objData is HttpResponseBodyModel response) + { + return response.code; + } return "Analysis Error"; } /// @@ -669,51 +831,53 @@ namespace BPASmartClient.AGV /// public string AgvLeaveLThreeToClean(string robotJobId) { - //string url = AGVRequestUrl.GetInstance.TaskSendUrl; - ////请求报文头 - //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); - //httpHeader.appKey = ""; - //httpHeader.appSecret = ""; - //httpHeader.requestId = ""; - //httpHeader.timestamp = ""; - //httpHeader.version = "2.8"; - //string head = JsonConvert.SerializeObject(httpHeader); - ////请求报文体 - //AGVModel httpModel = new AGVModel(); - //httpModel.robotJobId = robotJobId;//上游提供 - //httpModel.warehouseId = 123; //仓库编号 - //httpModel.jobPriority = 1;//任务执行的优先级 - //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - ////详细任务数据 - ////点到点 - //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); - //httpJobData.startPoint = "";//起点点位 - //httpJobData.endPoint = "";//目的点位 - //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - //httpModel.jobData = httpJobData; + string url = AGVRequestUrl.GetInstance.TaskSendUrl; + //请求报文头 + HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); + httpHeader.appKey = config.AppSettings.Settings["appKey"].Value; ; + httpHeader.appSecret = config.AppSettings.Settings["appSecret"].Value; + httpHeader.requestId = ResquestIdGenerate(); + httpHeader.timestamp = DateTime.Now.ToString(); + httpHeader.version = config.AppSettings.Settings["version"].Value; + string head = JsonConvert.SerializeObject(httpHeader); + //请求报文体 + AGVModel httpModel = new AGVModel(); + httpModel.robotJobId = robotJobId;//上游提供 + httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号 + httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级 + httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行 + httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); + httpJobData.startPoint = config.AppSettings.Settings["LineThreePoint"].Value; //起点点位 + httpJobData.endPoint = config.AppSettings.Settings["CleanPoint"].Value; //目的点位 + httpJobData.autoLoad = Convert.ToBoolean(config.AppSettings.Settings["autoLoad"].Value);//是否自动上料 true:自动上料 false:人工上料 + httpJobData.enableIOLoad = Convert.ToBoolean(config.AppSettings.Settings["enableIOLoad"].Value); //上料交互方式 false:接口交互 true:光电交互 + httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 + httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 + httpJobData.loadEquipmentId = 33; + httpJobData.unloadEquipmentId = 30; + httpModel.jobData = httpJobData; + string body ="["+ JsonConvert.SerializeObject(httpModel)+"]"; + //货位到货位 + //AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); + //httpSlotJobData.startSlotCode = "";//起点槽位编号 + //httpSlotJobData.endSlotCode = "";//目的槽位编号 + //httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //httpModel.jobData = httpSlotJobData; //string body = JsonConvert.SerializeObject(httpModel); - ////货位到货位 - ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); - ////httpSlotJobData.startSlotCode = "";//起点槽位编号 - ////httpSlotJobData.endSlotCode = "";//目的槽位编号 - ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - ////httpModel.jobData = httpSlotJobData; - ////string body = JsonConvert.SerializeObject(httpModel); - ////启用签名 - ////url = url + "?sign=" + MD5Deal(body); - //string data = HttpRequest(url, head, body); - //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseBodyModel response) - //{ - // return response.code; - //} + //启用签名 + //url = url + "?sign=" + MD5Deal(body); + string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); + object objData = JsonConvert.DeserializeObject(data); + if (objData != null && objData is HttpResponseBodyModel response) + { + return response.code; + } return "Analysis Error"; } /// @@ -722,83 +886,85 @@ namespace BPASmartClient.AGV /// public string AgvLeaveCleanToLFour(string robotJobId) { - //string url = AGVRequestUrl.GetInstance.TaskSendUrl; - ////请求报文头 - //HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); - //httpHeader.appKey = ""; - //httpHeader.appSecret = ""; - //httpHeader.requestId = ""; - //httpHeader.timestamp = ""; - //httpHeader.version = "2.8"; - //string head = JsonConvert.SerializeObject(httpHeader); - ////请求报文体 - //AGVModel httpModel = new AGVModel(); - //httpModel.robotJobId = robotJobId;//上游提供 - //httpModel.warehouseId = 123; //仓库编号 - //httpModel.jobPriority = 1;//任务执行的优先级 - //httpModel.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - //httpModel.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - ////详细任务数据 - ////点到点 - //AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); - //httpJobData.startPoint = "";//起点点位 - //httpJobData.endPoint = "";//目的点位 - //httpJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //httpJobData.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - //httpJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //httpJobData.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - //httpModel.jobData = httpJobData; - //string body = JsonConvert.SerializeObject(httpModel); - ////货位到货位 - ////AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); - ////httpSlotJobData.startSlotCode = "";//起点槽位编号 - ////httpSlotJobData.endSlotCode = "";//目的槽位编号 - ////httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - ////httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - ////httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - ////httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - ////httpModel.jobData = httpSlotJobData; - ////string body = JsonConvert.SerializeObject(httpModel); - ////启用签名 - ////url = url + "?sign=" + MD5Deal(body); - //string data = HttpRequest(url, head, body); - //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseBodyModel response) - //{ - // return response.code; - //} - return "Analysis Error"; - } - /// - /// 任务取消 - /// - /// 上游系统任务号,全局唯一 - public string CancelJobTask(string robotJobId) - { - string url = AGVRequestUrl.GetInstance.TaskCancelUrl; + string url = AGVRequestUrl.GetInstance.TaskSendUrl; //请求报文头 HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); - httpHeader.appKey = ""; - httpHeader.appSecret = ""; - httpHeader.requestId = ""; - httpHeader.timestamp = ""; - httpHeader.version = "2.8"; + httpHeader.appKey = config.AppSettings.Settings["appKey"].Value; + httpHeader.appSecret = config.AppSettings.Settings["appSecret"].Value; + httpHeader.requestId = ResquestIdGenerate(); + httpHeader.timestamp = DateTime.Now.ToString(); + httpHeader.version = config.AppSettings.Settings["version"].Value; string head = JsonConvert.SerializeObject(httpHeader); //请求报文体 - AGVTaskCancelModel cancel = new AGVTaskCancelModel(); - cancel.robotJobId = robotJobId; - cancel.warehouseId = 123;//仓库编号 - string body = JsonConvert.SerializeObject(cancel); + AGVModel httpModel = new AGVModel(); + httpModel.robotJobId = robotJobId;//上游提供 + httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号 + httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级 + httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行 + httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + //详细任务数据 + //点到点 + AGV_PointRollerJobData httpJobData = new AGV_PointRollerJobData(); + httpJobData.startPoint = config.AppSettings.Settings["CleanPoint"].Value; //起点点位 + httpJobData.endPoint = config.AppSettings.Settings["LineFourPoint"].Value; //目的点位 + httpJobData.autoLoad = Convert.ToBoolean(config.AppSettings.Settings["autoLoad"].Value);//是否自动上料 true:自动上料 false:人工上料 + httpJobData.enableIOLoad = Convert.ToBoolean(config.AppSettings.Settings["enableIOLoad"].Value); //上料交互方式 false:接口交互 true:光电交互 + httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 + httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 + httpJobData.loadEquipmentId = 10; + httpJobData.unloadEquipmentId = 44; + httpModel.jobData = httpJobData; + string body = "["+JsonConvert.SerializeObject(httpModel)+"]"; + //货位到货位 + //AGV_SlotRollerJobData httpSlotJobData = new AGV_SlotRollerJobData(); + //httpSlotJobData.startSlotCode = "";//起点槽位编号 + //httpSlotJobData.endSlotCode = "";//目的槽位编号 + //httpSlotJobData.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //httpSlotJobData.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + //httpSlotJobData.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //httpSlotJobData.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + //httpModel.jobData = httpSlotJobData; + //string body = JsonConvert.SerializeObject(httpModel); //启用签名 //url = url + "?sign=" + MD5Deal(body); - string data = HttpRequest(url, head, body); - object objData = JsonConvert.DeserializeObject(data); + string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); + object objData = JsonConvert.DeserializeObject(data); if (objData != null && objData is HttpResponseBodyModel response) { return response.code; } return "Analysis Error"; } + ///// + ///// 任务取消 + ///// + ///// 上游系统任务号,全局唯一 + //public string CancelJobTask(string robotJobId) + //{ + // string url = AGVRequestUrl.GetInstance.TaskCancelUrl; + // //请求报文头 + // HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); + // httpHeader.appKey = config.AppSettings.Settings["appKey"].Value; + // httpHeader.appSecret = config.AppSettings.Settings["appSecret"].Value; + // httpHeader.requestId = ResquestIdGenerate(); + // httpHeader.timestamp = DateTime.Now.ToString(); + // httpHeader.version = config.AppSettings.Settings["version"].Value; + // string head = JsonConvert.SerializeObject(httpHeader); + // //请求报文体 + // AGVTaskCancelModel cancel = new AGVTaskCancelModel(); + // cancel.robotJobId = robotJobId; + // cancel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value);//仓库编号 + // string body = JsonConvert.SerializeObject(cancel); + // //启用签名 + // //url = url + "?sign=" + MD5Deal(body); + // string data = HttpRequest(url, head, body); + // object objData = JsonConvert.DeserializeObject(data); + // if (objData != null && objData is HttpResponseBodyModel response) + // { + // return response.code; + // } + // return "Analysis Error"; + //} /// /// 实操任务完成通知 /// @@ -808,21 +974,21 @@ namespace BPASmartClient.AGV string url = AGVRequestUrl.GetInstance.TaskCompleteUrl; //请求报文头 HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); - httpHeader.appKey = ""; - httpHeader.appSecret = ""; - httpHeader.requestId = ""; - httpHeader.timestamp = ""; - httpHeader.version = "2.8"; + httpHeader.appKey = config.AppSettings.Settings["appKey"].Value; + httpHeader.appSecret = config.AppSettings.Settings["appSecret"].Value; + httpHeader.requestId = ResquestIdGenerate(); + httpHeader.timestamp = DateTime.Now.ToString(); + httpHeader.version = config.AppSettings.Settings["version"].Value; string head = JsonConvert.SerializeObject(httpHeader); //请求报文体 AGVTaskCompleteNotifyModel notify = new AGVTaskCompleteNotifyModel(); notify.robotJobId = robotJobId; - notify.warehouseId = 123;//仓库编号 + notify.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value);//仓库编号 string body = JsonConvert.SerializeObject(notify); //启用签名 //url = url + "?sign=" + MD5Deal(body); - string data = HttpRequest(url, head, body); - object objData = JsonConvert.DeserializeObject(data); + string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); + object objData = JsonConvert.DeserializeObject(data); if (objData != null && objData is HttpResponseBodyModel response) { return response.code; @@ -836,27 +1002,28 @@ namespace BPASmartClient.AGV /// 任务编号 /// 消息编号 /// - public string UpDownFeedBack(string agvCode, string jobId, string msgId) + public string UpDownFeedBack(string agvCode, string jobId, string msgId,bool complete=true) { - string url = AGVRequestUrl.GetInstance.TaskCompleteUrl; + string url = AGVRequestUrl.GetInstance.AGVInteracteUrl; //请求报文头 HttpRequestHeaderModel httpHeader = new HttpRequestHeaderModel(); - httpHeader.appKey = ""; - httpHeader.appSecret = ""; - httpHeader.requestId = ""; - httpHeader.timestamp = ""; - httpHeader.version = "2.8"; + httpHeader.appKey = config.AppSettings.Settings["appKey"].Value; + httpHeader.appSecret = config.AppSettings.Settings["appSecret"].Value; + httpHeader.requestId = ResquestIdGenerate(); + httpHeader.timestamp = DateTime.Now.ToString(); + httpHeader.version = config.AppSettings.Settings["version"].Value; string head = JsonConvert.SerializeObject(httpHeader); //请求报文体 AGVLoadInteracteModel load = new AGVLoadInteracteModel(); load.agvCode = agvCode; load.jobId = jobId; load.msgId = msgId; + load.complete = true; string body = JsonConvert.SerializeObject(load); //启用签名 //url = url + "?sign=" + MD5Deal(body); string data = HttpRequest(url, head, body); - object objData = JsonConvert.DeserializeObject(data); + object objData = JsonConvert.DeserializeObject(data); if (objData != null && objData is HttpResponseBodyModel response) { return response.code; diff --git a/BPASmartClient.AGV/AGVModel.cs b/BPASmartClient.AGV/AGVModel.cs index 4853f227..72ea9753 100644 --- a/BPASmartClient.AGV/AGVModel.cs +++ b/BPASmartClient.AGV/AGVModel.cs @@ -22,8 +22,8 @@ namespace BPASmartClient.AGV /// 必填项 /// public long warehouseId { get; set; } - public string? robotJobGroupId { get; set; } - public int? sequence { get; set; } + //public string? robotJobGroupId { get; set; } + //public int? sequence { get; set; } /// /// 必填项 /// @@ -32,13 +32,13 @@ namespace BPASmartClient.AGV /// 必填项 /// 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? 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; } /// /// 必填项 /// diff --git a/BPASmartClient.AGV/AGVRequestUrl.cs b/BPASmartClient.AGV/AGVRequestUrl.cs index c1b758e2..208ba5be 100644 --- a/BPASmartClient.AGV/AGVRequestUrl.cs +++ b/BPASmartClient.AGV/AGVRequestUrl.cs @@ -6,7 +6,7 @@ public static AGVRequestUrl GetInstance => _instance ??= new AGVRequestUrl(); public AGVRequestUrl() { - string IpAddress = ""; + string IpAddress = "172.16.12.200"; 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"; diff --git a/BPASmartClient.AGV/AGV_PointRollerJobData.cs b/BPASmartClient.AGV/AGV_PointRollerJobData.cs index 4f765b7b..71f64506 100644 --- a/BPASmartClient.AGV/AGV_PointRollerJobData.cs +++ b/BPASmartClient.AGV/AGV_PointRollerJobData.cs @@ -13,7 +13,7 @@ namespace BPASmartClient.AGV { //private static AGV_PointRollerJobData _instance; //public static AGV_PointRollerJobData GetInstance => _instance ??= new AGV_PointRollerJobData(); - public string? containerCode { get; set; } + // public string? containerCode { get; set; } public string startPoint { get; set; } public string endPoint { get; set; } public bool autoLoad { get; set; } @@ -22,8 +22,8 @@ namespace BPASmartClient.AGV 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; } + //public bool? loadInteractive { get; set; } + //public int? loadHeight { get; set; } + //public int? unloadHeight { get; set; } } } diff --git a/BPASmartClient.AGV/Feedback/AGVToUpSystem.cs b/BPASmartClient.AGV/Feedback/AGVToUpSystem.cs index 41315450..180b1c39 100644 --- a/BPASmartClient.AGV/Feedback/AGVToUpSystem.cs +++ b/BPASmartClient.AGV/Feedback/AGVToUpSystem.cs @@ -8,34 +8,21 @@ 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(); + + public TaskEventData @event { get; set; } + + + + public string id { get; set;} + + public string type { get; set; } + + public string ts { get; set; } + + public long warehouseId { get; set; } + + public string zoneCode { get; set; } + + } } diff --git a/BPASmartClient.AGV/Feedback/EventData.cs b/BPASmartClient.AGV/Feedback/EventData.cs new file mode 100644 index 00000000..fd8a306a --- /dev/null +++ b/BPASmartClient.AGV/Feedback/EventData.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 EventData + { + /// + /// 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/Feedback/JobData.cs b/BPASmartClient.AGV/Feedback/JobData.cs index 1eddc7ff..6cb472db 100644 --- a/BPASmartClient.AGV/Feedback/JobData.cs +++ b/BPASmartClient.AGV/Feedback/JobData.cs @@ -18,29 +18,22 @@ namespace BPASmartClient.AGV.Feedback /// public string containerCode { get; set; } + + public string pointCode { 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/LoadRequest.cs b/BPASmartClient.AGV/Feedback/LoadRequest.cs new file mode 100644 index 00000000..b8a9db07 --- /dev/null +++ b/BPASmartClient.AGV/Feedback/LoadRequest.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.AGV.Feedback +{ + public class LoadRequest + { + public HttpResponseHeaderModel header { get; set; } + public Upstreamrequest body { get; set; } + } +} diff --git a/BPASmartClient.AGV/Feedback/TaskData.cs b/BPASmartClient.AGV/Feedback/TaskData.cs new file mode 100644 index 00000000..2d0eb524 --- /dev/null +++ b/BPASmartClient.AGV/Feedback/TaskData.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.AGV.Feedback +{ + public class TaskData + { + public HttpResponseHeaderModel header { get; set; } + public AGVToUpSystem body { get; set; } + } +} diff --git a/BPASmartClient.AGV/Feedback/TaskEventData.cs b/BPASmartClient.AGV/Feedback/TaskEventData.cs new file mode 100644 index 00000000..a924b4f1 --- /dev/null +++ b/BPASmartClient.AGV/Feedback/TaskEventData.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.AGV.Feedback +{ + public class TaskEventData + { + public JobData jobData { get; set; } + + public string jobId { get; set; } + + public string jobType { get; set; } + + public string robotJobId{get;set;} + + public string state { get; set;} + + public long warehouseId { get; set; } + + + } +} diff --git a/BPASmartClient.AGV/Feedback/Upstreamrequest.cs b/BPASmartClient.AGV/Feedback/Upstreamrequest.cs index 411189a1..d20b4482 100644 --- a/BPASmartClient.AGV/Feedback/Upstreamrequest.cs +++ b/BPASmartClient.AGV/Feedback/Upstreamrequest.cs @@ -8,46 +8,55 @@ 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; } + public EventData @event { get; set; } + + public string ts { get; set; } + + public string type { get; set; } + + public string zoneCode { get; set; } + + public long warehouseId { get; set; } + ///// + ///// 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/HttpResponseBodyModel.cs b/BPASmartClient.AGV/HttpResponseBodyModel.cs index c0cafc58..20e72ee5 100644 --- a/BPASmartClient.AGV/HttpResponseBodyModel.cs +++ b/BPASmartClient.AGV/HttpResponseBodyModel.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace BPASmartClient.AGV { - internal class HttpResponseBodyModel + public class HttpResponseBodyModel { public string code { get; set; } public string message { get; set; } diff --git a/BPASmartClient.AGV/HttpResponseData.cs b/BPASmartClient.AGV/HttpResponseData.cs index 9e843d58..a7b3b738 100644 --- a/BPASmartClient.AGV/HttpResponseData.cs +++ b/BPASmartClient.AGV/HttpResponseData.cs @@ -6,10 +6,10 @@ using System.Threading.Tasks; namespace BPASmartClient.AGV { - internal class HttpResponseData + public class HttpResponseData { public string code { get; set; } - public bool message { get; set; } + public string message { get; set; } public string robotJobId { get; set; } } } diff --git a/BPASmartClient.AGV/HttpResponseHeaderModel.cs b/BPASmartClient.AGV/HttpResponseHeaderModel.cs index 5ff914d8..f5ce06d7 100644 --- a/BPASmartClient.AGV/HttpResponseHeaderModel.cs +++ b/BPASmartClient.AGV/HttpResponseHeaderModel.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace BPASmartClient.AGV { - internal class HttpResponseHeaderModel + public class HttpResponseHeaderModel { public string? requestId { get; set; } public string? timestamp { get; set; } diff --git a/BPASmartClient.AGV/HttpResponseModel.cs b/BPASmartClient.AGV/HttpResponseModel.cs index 40ed05ed..11f31a3e 100644 --- a/BPASmartClient.AGV/HttpResponseModel.cs +++ b/BPASmartClient.AGV/HttpResponseModel.cs @@ -6,9 +6,9 @@ using System.Threading.Tasks; namespace BPASmartClient.AGV { - internal class HttpResponseModel + public class HttpResponseModel { - public HttpResponseHeaderModel? Header { get; set; } - public HttpResponseBodyModel? Body { get; set; } + public HttpResponseHeaderModel? header { get; set; } + public HttpResponseBodyModel? body { get; set; } } } diff --git a/BPASmartClient.AgvApi/Controllers/robotjobController.cs b/BPASmartClient.AgvApi/Controllers/robotjobController.cs index 3c485751..8c0a1195 100644 --- a/BPASmartClient.AgvApi/Controllers/robotjobController.cs +++ b/BPASmartClient.AgvApi/Controllers/robotjobController.cs @@ -1,4 +1,5 @@ -using BPASmartClient.AGV.Feedback; +using BPASmartClient.AGV; +using BPASmartClient.AGV.Feedback; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.SignalR; using Newtonsoft.Json; @@ -28,28 +29,32 @@ namespace BPASmartClient.AgvApi.Controllers { string body = await reader.ReadToEndAsync(); - AGVToUpSystem s = JsonConvert.DeserializeObject(body); - if (s != null) + var res = JsonConvert.DeserializeObject(body); + var r = res.body.@event; + if (r != null) { - await Factory.GetInstance.SendReport(s); - return "SUCCESS"; + await Factory.GetInstance.SendReport(r); + return "Report SUCCESS"; } } - //var res = JsonConvert.DeserializeObject(sign); - //if (res != null) - //{ - // Factory.GetInstance.SendReport(res); - // return "SUCCESS"; - //} } catch (Exception ex) { return ex.ToString(); } + //var res = JsonConvert.DeserializeObject(sign); + // if (res != null) + // { + // Factory.GetInstance.SendReport(res); + // return "SUCCESS"; + // } + //} + - // } + //} return "Error"; + } /// @@ -67,21 +72,32 @@ namespace BPASmartClient.AgvApi.Controllers using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8)) { string body = await reader.ReadToEndAsync(); - var res = JsonConvert.DeserializeObject(body); - if (res != null) + + var res = JsonConvert.DeserializeObject(body); + var r = res.body.@event; + if (r != null) { - await Factory.GetInstance.SendUpstreamrequest(res); - return "SUCCESS"; + await Factory.GetInstance.SendUpstreamrequest(r); + //return "UpStream SUCCESS"; + return JsonConvert.SerializeObject(new HttpResponseModel() { header = new HttpResponseHeaderModel { requestId = res.header.requestId,timestamp=DateTime.Now.ToString(),version="2.7" } ,body = new HttpResponseBodyModel() { success = true, code = "SUCCESS", message = "", data = null } }); + } } + //var res = JsonConvert.DeserializeObject(sign); + //if (res != null) + //{ + // Factory.GetInstance.SendUpstreamrequest(res); + // return "SUCCESS"; + //} } catch (Exception ex) { return ex.ToString(); } - // } + //} return "Error"; + } } diff --git a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj index 58565f9b..47c9fd6c 100644 --- a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj +++ b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj @@ -200,6 +200,8 @@ + + @@ -213,6 +215,14 @@ + + + + + + + + @@ -269,12 +279,6 @@ - - - PreserveNewest - - - @@ -358,10 +362,20 @@ + + + + + + + + + + @@ -538,4 +552,8 @@ + + + + diff --git a/BPASmartClient.CustomResource/Converters/BoolToFillColorConverter.cs b/BPASmartClient.CustomResource/Converters/BoolToFillColorConverter.cs new file mode 100644 index 00000000..d24de8d6 --- /dev/null +++ b/BPASmartClient.CustomResource/Converters/BoolToFillColorConverter.cs @@ -0,0 +1,28 @@ +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 BoolToFillColorConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null && value is bool tempBool) + { + return tempBool ? Brushes.Green : Brushes.Gray; + } + return Brushes.Gray; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/BPASmartClient.CustomResource/Converters/BoolToVisibilityConvert.cs b/BPASmartClient.CustomResource/Converters/BoolToVisibilityConvert.cs new file mode 100644 index 00000000..0bc2b122 --- /dev/null +++ b/BPASmartClient.CustomResource/Converters/BoolToVisibilityConvert.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; + +namespace BPASmartClient.CustomResource.Converters +{ + public class BoolToVisibilityConvert : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null && value is bool tempBool) + { + return tempBool ? Visibility.Visible : Visibility.Hidden; + } + return default; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/BPASmartClient.CustomResource/Converters/CountIsVisiableConvert.cs b/BPASmartClient.CustomResource/Converters/CountIsVisiableConvert.cs new file mode 100644 index 00000000..9d3ba102 --- /dev/null +++ b/BPASmartClient.CustomResource/Converters/CountIsVisiableConvert.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; + +namespace BPASmartClient.CustomResource.Converters +{ + public class CountIsVisiableConvert : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) + { + var count = value?.GetType()?.GetProperty("Count")?.GetValue(value); + if (count != null && count is int tempCount) + { + if (tempCount > 0) return Visibility.Visible; + } + } + return Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/BPASmartClient.CustomResource/Converters/DataTableRedundantConverter.cs b/BPASmartClient.CustomResource/Converters/DataTableRedundantConverter.cs new file mode 100644 index 00000000..20c2d244 --- /dev/null +++ b/BPASmartClient.CustomResource/Converters/DataTableRedundantConverter.cs @@ -0,0 +1,31 @@ +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 DataTableRedundantConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null && value is bool bit) + { + if (bit) + return new SolidColorBrush(Color.FromArgb(255, 245, 63, 98)); + else + return new SolidColorBrush(Color.FromArgb(255, 42, 178, 231)); + } + return default; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/BPASmartClient.CustomResource/Converters/ForegroundConverter.cs b/BPASmartClient.CustomResource/Converters/ForegroundConverter.cs new file mode 100644 index 00000000..0297db72 --- /dev/null +++ b/BPASmartClient.CustomResource/Converters/ForegroundConverter.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Data; +using System.Windows.Data; +using System.Globalization; +using System.Windows.Media; + +namespace BPASmartClient.CustomResource.Converters +{ + public class ForegroundConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + SolidColorBrush returnValue = new SolidColorBrush(Color.FromArgb(255, 0, 204, 255)); + if (value != null) + { + if (value.ToString() == "等待配料") + returnValue = new SolidColorBrush(Color.FromArgb(255, 236, 187, 17));//黄 FFECBB11 + else if (value.ToString() == "正在配料") + returnValue = new SolidColorBrush(Color.FromArgb(255, 22, 219, 234));//篮 FF16DBEA + else if (value.ToString() == "配料完成") + returnValue = new SolidColorBrush(Color.FromArgb(255, 43, 208, 111));//绿 FF2BD06F + } + return returnValue; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/BPASmartClient.CustomResource/Converters/StatusIconConverter.cs b/BPASmartClient.CustomResource/Converters/StatusIconConverter.cs new file mode 100644 index 00000000..9961f850 --- /dev/null +++ b/BPASmartClient.CustomResource/Converters/StatusIconConverter.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Data; +using System.Windows.Data; +using System.Globalization; +using System.Text.RegularExpressions; +using BPASmartClient.CustomResource.Pages.Enums; + +namespace BPASmartClient.CustomResource.Converters +{ + public class StatusIconConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) + { + if (value.ToString() == Status.等待配料.ToString()) + return Regex.Unescape(StringToUnicode("")); + else if (value.ToString() == Status.正在配料.ToString()) + return Regex.Unescape(StringToUnicode("")); + else if (value.ToString() == Status.配料完成.ToString()) + return Regex.Unescape(StringToUnicode("")); + } + return value; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + + /// + /// 字符串转为UniCode码字符串 + /// + public static string StringToUnicode(string s) + { + if (!string.IsNullOrEmpty(s)) + { + //这里把格式 转为 \ue625 + return s.Replace(@"&#x", @"\u").Replace(";", ""); + } + return s; + } + } +} diff --git a/BPASmartClient.CustomResource/Image/组合边框2.1.png b/BPASmartClient.CustomResource/Image/组合边框2.1.png new file mode 100644 index 00000000..fdf26d5a Binary files /dev/null and b/BPASmartClient.CustomResource/Image/组合边框2.1.png differ diff --git a/BPASmartClient.CustomResource/Image/组合边框2.png b/BPASmartClient.CustomResource/Image/组合边框2.png new file mode 100644 index 00000000..8ffa46c3 Binary files /dev/null and b/BPASmartClient.CustomResource/Image/组合边框2.png differ diff --git a/BPASmartClient.CustomResource/Image/荧光/29.png b/BPASmartClient.CustomResource/Image/荧光/29.png new file mode 100644 index 00000000..3f09aa23 Binary files /dev/null and b/BPASmartClient.CustomResource/Image/荧光/29.png differ diff --git a/BPASmartClient.CustomResource/Image/荧光/发光.png b/BPASmartClient.CustomResource/Image/荧光/发光.png new file mode 100644 index 00000000..e6042670 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..0023ce03 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..e9ea97a7 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..ed6aa401 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..17712bdd 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..a9fb49ed 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..47771c51 Binary files /dev/null and b/BPASmartClient.CustomResource/Image/荧光/返回.png differ diff --git a/BPASmartClient.CustomResource/Pages/Enums/Status.cs b/BPASmartClient.CustomResource/Pages/Enums/Status.cs new file mode 100644 index 00000000..c8b8b437 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Enums/Status.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.CustomResource.Pages.Enums +{ + public enum Status + { + 等待配料, + 正在配料, + 配料完成 + } +} diff --git a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs index 1bdbc5e4..785250d5 100644 --- a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs +++ b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs @@ -8,6 +8,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.Reflection; using System.Threading; +using System.Threading.Tasks; using System.Windows; namespace BPASmartClient.CustomResource.Pages.Model @@ -15,6 +16,21 @@ namespace BPASmartClient.CustomResource.Pages.Model public class AlarmHelper where AlarmT : class, new() { + private volatile static ConcurrentDictionary _Instance; + private static readonly object Obj_Lock = new object(); + public static AlarmT GetInstance(string name = "") + { + lock (Obj_Lock) + { + if (string.IsNullOrEmpty(name)) name = typeof(AlarmT).Name; + if (_Instance == null) _Instance = new ConcurrentDictionary(); + if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT()); + return _Instance[name]; + } + } + private AlarmHelper() { } + + public static ObservableCollection Alarms { get; set; } = new ObservableCollection(); public static List HistoryAlarms { get; set; } = new List(); static ConcurrentDictionary flagbit = new ConcurrentDictionary(); @@ -23,22 +39,29 @@ namespace BPASmartClient.CustomResource.Pages.Model public static Action RemoveAction { get; set; } public static Action ChangeAction { get; set; } - public static AlarmT Alarm { get; set; } = new AlarmT(); + //public static AlarmT Alarm { get; set; } = new AlarmT(); public static void Init() { AlarmViewModel.AlarmInfos = Alarms; ThreadManage.GetInstance().StartLong(new Action(() => { - foreach (var item in Alarm.GetType().GetProperties()) + if (_Instance != null) { - if (item.CustomAttributes.Count() > 0) + foreach (var temp in _Instance) { - var AlarmModel = item.GetCustomAttribute(); - if (AlarmModel != null) + foreach (var item in temp.Value.GetType().GetProperties()) { - bool value = Convert.ToBoolean(Alarm.GetType().GetProperty(item.Name)?.GetValue(Alarm)); - EdgeAlarm(value, AlarmModel.AlarmInfo, 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType); + if (item.CustomAttributes.Count() > 0) + { + var AlarmModel = item.GetCustomAttribute(); + if (AlarmModel != null) + { + bool value = Convert.ToBoolean(_Instance[temp.Key].GetType().GetProperty(item.Name)?.GetValue(_Instance[temp.Key])); + string text = typeof(AlarmT).Name == temp.Key ? AlarmModel.AlarmInfo : $"{temp.Key}:{AlarmModel.AlarmInfo}"; + EdgeAlarm(value, text, 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType); + } + } } } } @@ -47,15 +70,6 @@ namespace BPASmartClient.CustomResource.Pages.Model } - - //public static void AnalogAlarm(dynamic Trigger, string info, dynamic HH = null, dynamic H = 0, dynamic L = 0, dynamic LL = 0) - //{ - - //} - - - - /// /// 沿报警检测 /// @@ -131,4 +145,135 @@ namespace BPASmartClient.CustomResource.Pages.Model } } + + //public class AlarmHelper where AlarmT : class, new() + //{ + + + // //private volatile static ConcurrentDictionary _Instance; + // //public static AlarmT GetInstance(string name) + // //{ + // // if (_Instance == null) _Instance = new ConcurrentDictionary(); + // // if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT()); + // // return _Instance[name]; + // //} + // //private AlarmHelper() { } + + + // 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() + // { + // AlarmViewModel.AlarmInfos = Alarms; + // 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); + // }), $"{typeof(AlarmT).Name},报警通用模块监听"); + + // } + + + // //public static void AnalogAlarm(dynamic Trigger, string info, dynamic HH = null, dynamic H = 0, dynamic L = 0, dynamic LL = 0) + // //{ + + // //} + + + + + // /// + // /// 沿报警检测 + // /// + // /// 触发变量 + // /// 报警信息 + // /// 触发类型,上升沿 或 下降沿 + // 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/AlarmTest.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmTest.cs new file mode 100644 index 00000000..b7d1bce3 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Model/AlarmTest.cs @@ -0,0 +1,145 @@ +using BPASmartClient.CustomResource.Pages.ViewModel; +using BPASmartClient.Helper; +using BPASmartClient.Model; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; + +namespace BPASmartClient.CustomResource.Pages.Model +{ + public class AlarmTest where AlarmT : class, new() + { + + + private volatile static ConcurrentDictionary _Instance; + public static AlarmT GetInstance(string name = "") + { + if (string.IsNullOrEmpty(name)) name = typeof(AlarmT).Name; + if (_Instance == null) _Instance = new ConcurrentDictionary(); + if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT()); + return _Instance[name]; + } + private AlarmTest() { } + + + 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() + { + AlarmViewModel.AlarmInfos = Alarms; + ThreadManage.GetInstance().StartLong(new Action(() => + { + if (_Instance != null) + { + foreach (var temp in _Instance) + { + foreach (var item in temp.Value.GetType().GetProperties()) + { + if (item.CustomAttributes.Count() > 0) + { + var AlarmModel = item.GetCustomAttribute(); + if (AlarmModel != null) + { + bool value = Convert.ToBoolean(_Instance[temp.Key].GetType().GetProperty(item.Name)?.GetValue(_Instance[temp.Key])); + EdgeAlarm(value, $"{temp.Key}:{AlarmModel.AlarmInfo}", 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType); + } + } + } + } + } + Thread.Sleep(100); + }), $"{typeof(AlarmT).Name},报警通用模块监听"); + + } + + /// + /// 沿报警检测 + /// + /// 触发变量 + /// 报警信息 + /// 触发类型,上升沿 或 下降沿 + 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/MessageLog.cs b/BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs similarity index 87% rename from BPASmartClient.CustomResource/Pages/Model/MessageLog.cs rename to BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs index afc3925a..e1325b1a 100644 --- a/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs +++ b/BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs @@ -12,15 +12,15 @@ using BPASmartClient.CustomResource.Pages.View; namespace BPASmartClient.CustomResource.Pages.Model { - public class MessageLog + public class MessageNotify { - private volatile static MessageLog _Instance; - public static MessageLog GetInstance => _Instance ??= new MessageLog(); + private volatile static MessageNotify _Instance; + public static MessageNotify GetInstance => _Instance ??= new MessageNotify(); public static readonly object runLock = new object(); public static readonly object userlock = new object(); public static readonly object alarmlock = new object(); - private MessageLog() { } + private MessageNotify() { } public Action UserLog { get; set; } @@ -102,29 +102,31 @@ namespace BPASmartClient.CustomResource.Pages.Model public bool ShowDialog(string info, DialogType dialogType = DialogType.Information) { PromptView PV = new PromptView(); + PV.TextBlockInfo = info; switch (dialogType) { case DialogType.Warning: PV.TextBlockIcon = ""; PV.TextBlockForeground = Brushes.Yellow; - PV.TextBlockInfo = $"警告:{info}"; - PV.Cancel.Visibility = Visibility.Collapsed; + PV.infoType.Text = "警告:"; + //PV.Cancel.Visibility = Visibility.Collapsed; break; case DialogType.Error: PV.TextBlockIcon = ""; PV.TextBlockForeground = Brushes.Red; - PV.TextBlockInfo = $"错误:{info}"; - PV.Cancel.Visibility = Visibility.Collapsed; + PV.infoType.Text = "错误:"; + //PV.Cancel.Visibility = Visibility.Collapsed; break; case DialogType.Information: PV.TextBlockIcon = ""; PV.TextBlockForeground = Brushes.DeepSkyBlue; - PV.TextBlockInfo = $"提示:{info}"; - PV.Cancel.Visibility = Visibility.Visible; + PV.infoType.Text = "提示:"; + //PV.Cancel.Visibility = Visibility.Visible; break; default: break; } + PV.infoType.Foreground = PV.TextBlockForeground; var res = PV.ShowDialog(); return res == null ? false : (bool)res; } diff --git a/BPASmartClient.CustomResource/Pages/View/LoginView.xaml b/BPASmartClient.CustomResource/Pages/View/LoginView.xaml index 4b84c820..6d65f449 100644 --- a/BPASmartClient.CustomResource/Pages/View/LoginView.xaml +++ b/BPASmartClient.CustomResource/Pages/View/LoginView.xaml @@ -253,7 +253,7 @@ Grid.Row="1" Grid.Column="1"> - + @@ -315,7 +315,7 @@ Text="请输入账号密码" Visibility="Visible" /> - + diff --git a/BPASmartClient.CustomResource/Pages/View/PromptView.xaml b/BPASmartClient.CustomResource/Pages/View/PromptView.xaml index 1892c83b..f3e888b0 100644 --- a/BPASmartClient.CustomResource/Pages/View/PromptView.xaml +++ b/BPASmartClient.CustomResource/Pages/View/PromptView.xaml @@ -29,7 +29,7 @@ - + @@ -44,24 +44,31 @@ BorderThickness="0" Click="Button_Click" /> - + + - + @@ -77,7 +84,7 @@ Width="90" Height="30" Margin="5,0,5,0" - Click="Cancel_Click" + Click="Cancel_Click" Content="取消" FontSize="20" Style="{StaticResource ImageButtonStyle}" /> @@ -98,10 +105,5 @@ - - - - - diff --git a/BPASmartClient.CustomResource/Pages/View/PromptView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/PromptView.xaml.cs index e8d5fc3e..ffef6c16 100644 --- a/BPASmartClient.CustomResource/Pages/View/PromptView.xaml.cs +++ b/BPASmartClient.CustomResource/Pages/View/PromptView.xaml.cs @@ -23,6 +23,7 @@ namespace BPASmartClient.CustomResource.Pages.View public PromptView() { InitializeComponent(); + this.main.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; } public string TextBlockIcon diff --git a/BPASmartClient.CustomResource/Pages/View/UserManagerView.xaml b/BPASmartClient.CustomResource/Pages/View/UserManagerView.xaml index 5079533d..e0630ef5 100644 --- a/BPASmartClient.CustomResource/Pages/View/UserManagerView.xaml +++ b/BPASmartClient.CustomResource/Pages/View/UserManagerView.xaml @@ -1,54 +1,67 @@ - + - + - - - + + + + + --> + + + + + + + + + - - + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +