diff --git a/BPASmartClient.AGV/AGVHelper.cs b/BPASmartClient.AGV/AGVHelper.cs index cf6204c5..acb342e1 100644 --- a/BPASmartClient.AGV/AGVHelper.cs +++ b/BPASmartClient.AGV/AGVHelper.cs @@ -76,46 +76,46 @@ namespace BPASmartClient.AGV /// public string AgvToLineOneLoadRoller(string robotJobId) { - string url = AGVRequestUrl.GetInstance.TaskSendUrl; - //请求报文头 - HttpRequestHeaderModel.GetInstance.appKey = ""; - HttpRequestHeaderModel.GetInstance.appSecret = ""; - HttpRequestHeaderModel.GetInstance.requestId = ""; - HttpRequestHeaderModel.GetInstance.timestamp = ""; - HttpRequestHeaderModel.GetInstance.version = "2.8"; - string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); - //请求报文体 - AGVModel.GetInstance.robotJobId =robotJobId ;//上游提供 - AGVModel.GetInstance.warehouseId = 123; //仓库编号 - AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 - AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - //详细任务数据 - //点到点 - AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 - AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 - AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; - string body = JsonConvert.SerializeObject(AGVModel.GetInstance); - // string newBody = String.Join(",\r\n", bodyData.Split(','));//格式处理,看需求 - //货位到货位 - //AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 - //AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 - //AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //AGV_SlotRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - //AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //AGV_SlotRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - //AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + //string url = AGVRequestUrl.GetInstance.TaskSendUrl; + ////请求报文头 + //HttpRequestHeaderModel.GetInstance.appKey = ""; + //HttpRequestHeaderModel.GetInstance.appSecret = ""; + //HttpRequestHeaderModel.GetInstance.requestId = ""; + //HttpRequestHeaderModel.GetInstance.timestamp = ""; + //HttpRequestHeaderModel.GetInstance.version = "2.8"; + //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); + ////请求报文体 + //AGVModel.GetInstance.robotJobId =robotJobId ;//上游提供 + //AGVModel.GetInstance.warehouseId = 123; //仓库编号 + //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 + //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 + //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + ////详细任务数据 + ////点到点 + //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 + //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 + //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 + //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); - string data = HttpRequest(url, head, body); - object objData = JsonConvert.DeserializeObject(data); - if (objData != null && objData is HttpResponseModel response) - { - return response.Body?.code; - } + //// string newBody = String.Join(",\r\n", bodyData.Split(','));//格式处理,看需求 + ////货位到货位 + ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 + ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 + ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + ////AGV_SlotRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 + ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + ////AGV_SlotRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + //string data = HttpRequest(url, head, body); + //object objData = JsonConvert.DeserializeObject(data); + //if (objData != null && objData is HttpResponseModel response) + //{ + // return response.Body?.code; + //} return "Analysis Error"; } /// @@ -124,45 +124,45 @@ namespace BPASmartClient.AGV /// public string AgvToLineTwoLoadRoller(string robotJobId) { - string url = AGVRequestUrl.GetInstance.TaskSendUrl; - //请求报文头 - HttpRequestHeaderModel.GetInstance.appKey = ""; - HttpRequestHeaderModel.GetInstance.appSecret = ""; - HttpRequestHeaderModel.GetInstance.requestId = ""; - HttpRequestHeaderModel.GetInstance.timestamp = ""; - HttpRequestHeaderModel.GetInstance.version = "2.8"; - string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); - //请求报文体 - AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 - AGVModel.GetInstance.warehouseId = 123; //仓库编号 - AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 - AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - //详细任务数据 - //点到点 - AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 - AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 - AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; - string body = JsonConvert.SerializeObject(AGVModel.GetInstance); - //货位到货位 - //AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 - //AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 - //AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - //AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - //AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + //string url = AGVRequestUrl.GetInstance.TaskSendUrl; + ////请求报文头 + //HttpRequestHeaderModel.GetInstance.appKey = ""; + //HttpRequestHeaderModel.GetInstance.appSecret = ""; + //HttpRequestHeaderModel.GetInstance.requestId = ""; + //HttpRequestHeaderModel.GetInstance.timestamp = ""; + //HttpRequestHeaderModel.GetInstance.version = "2.8"; + //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); + ////请求报文体 + //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 + //AGVModel.GetInstance.warehouseId = 123; //仓库编号 + //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 + //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 + //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + ////详细任务数据 + ////点到点 + //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 + //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 + //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 + //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); - string data= HttpRequest(url, head, body); - object objData= JsonConvert.DeserializeObject(data); - if (objData != null && objData is HttpResponseModel response) - { - return response.Body?.code; - } + ////货位到货位 + ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 + ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 + ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + //string data= HttpRequest(url, head, body); + //object objData= JsonConvert.DeserializeObject(data); + //if (objData != null && objData is HttpResponseModel response) + //{ + // return response.Body?.code; + //} return "Analysis Error"; } /// @@ -171,45 +171,45 @@ namespace BPASmartClient.AGV /// public string AgvToLineThreeLoadRoller(string robotJobId) { - string url = AGVRequestUrl.GetInstance.TaskSendUrl; - //请求报文头 - HttpRequestHeaderModel.GetInstance.appKey = ""; - HttpRequestHeaderModel.GetInstance.appSecret = ""; - HttpRequestHeaderModel.GetInstance.requestId = ""; - HttpRequestHeaderModel.GetInstance.timestamp = ""; - HttpRequestHeaderModel.GetInstance.version = "2.8"; - string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); - //请求报文体 - AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 - AGVModel.GetInstance.warehouseId = 123; //仓库编号 - AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 - AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - //详细任务数据 - //点到点 - AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 - AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 - AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; - string body = JsonConvert.SerializeObject(AGVModel.GetInstance); - //货位到货位 - //AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 - //AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 - //AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - //AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - //AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + //string url = AGVRequestUrl.GetInstance.TaskSendUrl; + ////请求报文头 + //HttpRequestHeaderModel.GetInstance.appKey = ""; + //HttpRequestHeaderModel.GetInstance.appSecret = ""; + //HttpRequestHeaderModel.GetInstance.requestId = ""; + //HttpRequestHeaderModel.GetInstance.timestamp = ""; + //HttpRequestHeaderModel.GetInstance.version = "2.8"; + //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); + ////请求报文体 + //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 + //AGVModel.GetInstance.warehouseId = 123; //仓库编号 + //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 + //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 + //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + ////详细任务数据 + ////点到点 + //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 + //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 + //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 + //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); - string data = HttpRequest(url, head, body); - object objData = JsonConvert.DeserializeObject(data); - if (objData != null && objData is HttpResponseModel response) - { - return response.Body?.code; - } + ////货位到货位 + ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 + ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 + ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + //string data = HttpRequest(url, head, body); + //object objData = JsonConvert.DeserializeObject(data); + //if (objData != null && objData is HttpResponseModel response) + //{ + // return response.Body?.code; + //} return "Analysis Error"; } /// @@ -218,45 +218,45 @@ namespace BPASmartClient.AGV /// public string AgvLeaveFryPotOne(string robotJobId) { - string url = AGVRequestUrl.GetInstance.TaskSendUrl; - //请求报文头 - HttpRequestHeaderModel.GetInstance.appKey = ""; - HttpRequestHeaderModel.GetInstance.appSecret = ""; - HttpRequestHeaderModel.GetInstance.requestId = ""; - HttpRequestHeaderModel.GetInstance.timestamp = ""; - HttpRequestHeaderModel.GetInstance.version = "2.8"; - string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); - //请求报文体 - AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 - AGVModel.GetInstance.warehouseId = 123; //仓库编号 - AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 - AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - //详细任务数据 - //点到点 - AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 - AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 - AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; - string body = JsonConvert.SerializeObject(AGVModel.GetInstance); - //货位到货位 - //AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 - //AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 - //AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - //AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - //AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + //string url = AGVRequestUrl.GetInstance.TaskSendUrl; + ////请求报文头 + //HttpRequestHeaderModel.GetInstance.appKey = ""; + //HttpRequestHeaderModel.GetInstance.appSecret = ""; + //HttpRequestHeaderModel.GetInstance.requestId = ""; + //HttpRequestHeaderModel.GetInstance.timestamp = ""; + //HttpRequestHeaderModel.GetInstance.version = "2.8"; + //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); + ////请求报文体 + //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 + //AGVModel.GetInstance.warehouseId = 123; //仓库编号 + //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 + //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 + //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + ////详细任务数据 + ////点到点 + //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 + //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 + //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 + //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); - string data = HttpRequest(url, head, body); - object objData = JsonConvert.DeserializeObject(data); - if (objData != null && objData is HttpResponseModel response) - { - return response.Body?.code; - } + ////货位到货位 + ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 + ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 + ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + //string data = HttpRequest(url, head, body); + //object objData = JsonConvert.DeserializeObject(data); + //if (objData != null && objData is HttpResponseModel response) + //{ + // return response.Body?.code; + //} return "Analysis Error"; } /// @@ -265,45 +265,45 @@ namespace BPASmartClient.AGV /// public string AgvLeaveFryPotTwo(string robotJobId) { - string url = AGVRequestUrl.GetInstance.TaskSendUrl; - //请求报文头 - HttpRequestHeaderModel.GetInstance.appKey = ""; - HttpRequestHeaderModel.GetInstance.appSecret = ""; - HttpRequestHeaderModel.GetInstance.requestId = ""; - HttpRequestHeaderModel.GetInstance.timestamp = ""; - HttpRequestHeaderModel.GetInstance.version = "2.8"; - string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); - //请求报文体 - AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 - AGVModel.GetInstance.warehouseId = 123; //仓库编号 - AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 - AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - //详细任务数据 - //点到点 - AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 - AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 - AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; - string body = JsonConvert.SerializeObject(AGVModel.GetInstance); - //货位到货位 - //AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 - //AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 - //AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - //AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - //AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + //string url = AGVRequestUrl.GetInstance.TaskSendUrl; + ////请求报文头 + //HttpRequestHeaderModel.GetInstance.appKey = ""; + //HttpRequestHeaderModel.GetInstance.appSecret = ""; + //HttpRequestHeaderModel.GetInstance.requestId = ""; + //HttpRequestHeaderModel.GetInstance.timestamp = ""; + //HttpRequestHeaderModel.GetInstance.version = "2.8"; + //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); + ////请求报文体 + //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 + //AGVModel.GetInstance.warehouseId = 123; //仓库编号 + //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 + //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 + //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + ////详细任务数据 + ////点到点 + //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 + //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 + //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 + //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); - string data = HttpRequest(url, head, body); - object objData = JsonConvert.DeserializeObject(data); - if (objData != null && objData is HttpResponseModel response) - { - return response.Body?.code; - } + ////货位到货位 + ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 + ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 + ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + //string data = HttpRequest(url, head, body); + //object objData = JsonConvert.DeserializeObject(data); + //if (objData != null && objData is HttpResponseModel response) + //{ + // return response.Body?.code; + //} return "Analysis Error"; } /// @@ -312,45 +312,45 @@ namespace BPASmartClient.AGV /// public string AgvLeaveFryPotThree(string robotJobId) { - string url = AGVRequestUrl.GetInstance.TaskSendUrl; - //请求报文头 - HttpRequestHeaderModel.GetInstance.appKey = ""; - HttpRequestHeaderModel.GetInstance.appSecret = ""; - HttpRequestHeaderModel.GetInstance.requestId = ""; - HttpRequestHeaderModel.GetInstance.timestamp = ""; - HttpRequestHeaderModel.GetInstance.version = "2.8"; - string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); - //请求报文体 - AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 - AGVModel.GetInstance.warehouseId = 123; //仓库编号 - AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 - AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - //详细任务数据 - //点到点 - AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 - AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 - AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; - string body = JsonConvert.SerializeObject(AGVModel.GetInstance); - //货位到货位 - //AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 - //AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 - //AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - //AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - //AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + //string url = AGVRequestUrl.GetInstance.TaskSendUrl; + ////请求报文头 + //HttpRequestHeaderModel.GetInstance.appKey = ""; + //HttpRequestHeaderModel.GetInstance.appSecret = ""; + //HttpRequestHeaderModel.GetInstance.requestId = ""; + //HttpRequestHeaderModel.GetInstance.timestamp = ""; + //HttpRequestHeaderModel.GetInstance.version = "2.8"; + //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); + ////请求报文体 + //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 + //AGVModel.GetInstance.warehouseId = 123; //仓库编号 + //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 + //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 + //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + ////详细任务数据 + ////点到点 + //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 + //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 + //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 + //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); - string data = HttpRequest(url, head, body); - object objData = JsonConvert.DeserializeObject(data); - if (objData != null && objData is HttpResponseModel response) - { - return response.Body?.code; - } + ////货位到货位 + ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 + ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 + ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + //string data = HttpRequest(url, head, body); + //object objData = JsonConvert.DeserializeObject(data); + //if (objData != null && objData is HttpResponseModel response) + //{ + // return response.Body?.code; + //} return "Analysis Error"; } /// @@ -359,45 +359,45 @@ namespace BPASmartClient.AGV /// public string AgvLeaveFryPotFour(string robotJobId) { - string url = AGVRequestUrl.GetInstance.TaskSendUrl; - //请求报文头 - HttpRequestHeaderModel.GetInstance.appKey = ""; - HttpRequestHeaderModel.GetInstance.appSecret = ""; - HttpRequestHeaderModel.GetInstance.requestId = ""; - HttpRequestHeaderModel.GetInstance.timestamp = ""; - HttpRequestHeaderModel.GetInstance.version = "2.8"; - string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); - //请求报文体 - AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 - AGVModel.GetInstance.warehouseId = 123; //仓库编号 - AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 - AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - //详细任务数据 - //点到点 - AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 - AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 - AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; - string body = JsonConvert.SerializeObject(AGVModel.GetInstance); - //货位到货位 - //AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 - //AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 - //AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - //AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - //AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + //string url = AGVRequestUrl.GetInstance.TaskSendUrl; + ////请求报文头 + //HttpRequestHeaderModel.GetInstance.appKey = ""; + //HttpRequestHeaderModel.GetInstance.appSecret = ""; + //HttpRequestHeaderModel.GetInstance.requestId = ""; + //HttpRequestHeaderModel.GetInstance.timestamp = ""; + //HttpRequestHeaderModel.GetInstance.version = "2.8"; + //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); + ////请求报文体 + //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 + //AGVModel.GetInstance.warehouseId = 123; //仓库编号 + //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 + //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 + //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + ////详细任务数据 + ////点到点 + //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 + //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 + //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 + //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); - string data = HttpRequest(url, head, body); - object objData = JsonConvert.DeserializeObject(data); - if (objData != null && objData is HttpResponseModel response) - { - return response.Body?.code; - } + ////货位到货位 + ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 + ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 + ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + //string data = HttpRequest(url, head, body); + //object objData = JsonConvert.DeserializeObject(data); + //if (objData != null && objData is HttpResponseModel response) + //{ + // return response.Body?.code; + //} return "Analysis Error"; } /// @@ -406,45 +406,45 @@ namespace BPASmartClient.AGV /// public string AgvLeaveFryPotFive(string robotJobId) { - string url = AGVRequestUrl.GetInstance.TaskSendUrl; - //请求报文头 - HttpRequestHeaderModel.GetInstance.appKey = ""; - HttpRequestHeaderModel.GetInstance.appSecret = ""; - HttpRequestHeaderModel.GetInstance.requestId = ""; - HttpRequestHeaderModel.GetInstance.timestamp = ""; - HttpRequestHeaderModel.GetInstance.version = "2.8"; - string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); - //请求报文体 - AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 - AGVModel.GetInstance.warehouseId = 123; //仓库编号 - AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 - AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 - AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE - //详细任务数据 - //点到点 - AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 - AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 - AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 - AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 - AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; - string body = JsonConvert.SerializeObject(AGVModel.GetInstance); - //货位到货位 - //AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 - //AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 - //AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 - //AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 - //AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 - //AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 - //AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + //string url = AGVRequestUrl.GetInstance.TaskSendUrl; + ////请求报文头 + //HttpRequestHeaderModel.GetInstance.appKey = ""; + //HttpRequestHeaderModel.GetInstance.appSecret = ""; + //HttpRequestHeaderModel.GetInstance.requestId = ""; + //HttpRequestHeaderModel.GetInstance.timestamp = ""; + //HttpRequestHeaderModel.GetInstance.version = "2.8"; + //string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance); + ////请求报文体 + //AGVModel.GetInstance.robotJobId = robotJobId;//上游提供 + //AGVModel.GetInstance.warehouseId = 123; //仓库编号 + //AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级 + //AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行 + //AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE + ////详细任务数据 + ////点到点 + //AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位 + //AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位 + //AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + //AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互 + //AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + //AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互 + //AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance; //string body = JsonConvert.SerializeObject(AGVModel.GetInstance); - string data = HttpRequest(url, head, body); - object objData = JsonConvert.DeserializeObject(data); - if (objData != null && objData is HttpResponseModel response) - { - return response.Body?.code; - } + ////货位到货位 + ////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号 + ////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号 + ////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料 + ////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互 + ////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料 + ////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互 + ////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance; + ////string body = JsonConvert.SerializeObject(AGVModel.GetInstance); + //string data = HttpRequest(url, head, body); + //object objData = JsonConvert.DeserializeObject(data); + //if (objData != null && objData is HttpResponseModel response) + //{ + // return response.Body?.code; + //} return "Analysis Error"; } /// diff --git a/BPASmartClient.AgvApi/.config/dotnet-tools.json b/BPASmartClient.AgvApi/.config/dotnet-tools.json new file mode 100644 index 00000000..c9b7f4ff --- /dev/null +++ b/BPASmartClient.AgvApi/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-ef": { + "version": "6.0.6", + "commands": [ + "dotnet-ef" + ] + } + } +} \ No newline at end of file diff --git a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs index f24df307..c7080c4c 100644 --- a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs +++ b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs @@ -4,12 +4,10 @@ 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.Text; using System.Threading; -using System.Threading.Tasks; -using System.Collections.ObjectModel; using System.Windows; namespace BPASmartClient.CustomResource.Pages.Model @@ -39,7 +37,7 @@ namespace BPASmartClient.CustomResource.Pages.Model { bool value = Convert.ToBoolean(Alarm.GetType().GetProperty(item.Name)?.GetValue(Alarm)); EdgeAlarm(value, AlarmModel.AlarmInfo, 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType); - } + } } } Thread.Sleep(100); @@ -59,7 +57,7 @@ namespace BPASmartClient.CustomResource.Pages.Model 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]) + if (edgeType == AlarmTriggerType.Rising ? !flagbit[text] :flagbit[text]) { AddAlarm(Trigger, text, alarmLevel); flagbit[text] = edgeType == AlarmTriggerType.Rising ? true : false; diff --git a/BPASmartClient.CustomResource/Pages/Model/AlarmInfo.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmInfo.cs new file mode 100644 index 00000000..253b09dd --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Model/AlarmInfo.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.CustomResource.Pages.Model +{ + public class AlarmInfo + { + public AlarmInfo() + { + + } + /// + /// 1 号滚筒线故障 + /// + [Alarm("【1】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] + public ushort LOneRollerTrouble { get; set; } + /// + /// 2 号滚筒线故障 + /// + [Alarm("【2】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] + public ushort LTwoRollerTrouble { get; set; } + /// + /// 3 号滚筒线故障 + /// + [Alarm("【3】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] + public ushort LThreeRollerTrouble { get; set; } + /// + /// 1 号炒锅滚筒运行故障 + /// + [Alarm("【1】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] + public ushort FryPotOneRollerTrouble { get; set; } + /// + /// 2 号炒锅滚筒运行故障 + /// + [Alarm("【2】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] + public ushort FryPotTwoRollerTrouble { get; set; } + /// + /// 3 号炒锅滚筒运行故障 + /// + [Alarm("【3】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] + public ushort FryPotThreeRollerTrouble { get; set; } + /// + /// 4 号炒锅滚筒运行故障 + /// + [Alarm("【4】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] + public ushort FryPotFourRollerTrouble { get; set; } + /// + /// 5 号炒锅滚筒运行故障 + /// + [Alarm("【5】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)] + public ushort FryPotFiveRollerTrouble { get; set; } + } +} diff --git a/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs b/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs index db603c1c..da1d1e0e 100644 --- a/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs +++ b/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs @@ -12,7 +12,10 @@ namespace BPASmartClient.CustomResource.Pages.Model public class MessageLog { private volatile static MessageLog _Instance; - public static MessageLog GetInstance => _Instance ?? (_Instance = new MessageLog()); + public static MessageLog GetInstance => _Instance ??= new MessageLog(); + + public static readonly object runLock = new object(); + public static readonly object userlock = new object(); private MessageLog() { } public Action UserLog { get; set; } @@ -37,30 +40,36 @@ namespace BPASmartClient.CustomResource.Pages.Model public void ShowUserLog(string info) { - UserLog userLog = new UserLog() + lock (userlock) { - Date = DateTime.Now.ToString("yyyy-MM-dd"), - Time = DateTime.Now.ToString("HH:mm:ss"), - Permission = Global.userInfo.permission.ToString(), - UserName = Global.userInfo.UserName, - LogInfo = info - }; - Sqlite.GetInstance.Base.Add(userLog); - Application.Current.Dispatcher.Invoke(new Action(() => { userLogs.Insert(0, userLog); })); - UserLog?.Invoke(info); + UserLog userLog = new UserLog() + { + Date = DateTime.Now.ToString("yyyy-MM-dd"), + Time = DateTime.Now.ToString("HH:mm:ss"), + Permission = Global.userInfo.permission.ToString(), + UserName = Global.userInfo.UserName, + LogInfo = info + }; + Sqlite.GetInstance.Base.Add(userLog); + Application.Current.Dispatcher.Invoke(new Action(() => { userLogs.Insert(0, userLog); })); + UserLog?.Invoke(info); + } } public void ShowRunLog(string info) { - RunLog runLog = new RunLog() + lock (runLock) { - Date = DateTime.Now.ToString("yyyy-MM-dd"), - Time = DateTime.Now.ToString("HH:mm:ss"), - RunLogInfo = info - }; - Sqlite.GetInstance.Base.Add(runLog); - Application.Current.Dispatcher.Invoke(new Action(() => { runLogs.Insert(0, runLog); })); - RunLog?.Invoke(info); + RunLog runLog = new RunLog() + { + Date = DateTime.Now.ToString("yyyy-MM-dd"), + Time = DateTime.Now.ToString("HH:mm:ss"), + RunLogInfo = info + }; + Sqlite.GetInstance.Base.Add(runLog); + Application.Current.Dispatcher.Invoke(new Action(() => { runLogs.Insert(0, runLog); })); + RunLog?.Invoke(info); + } } diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs index 1238f0c0..3213c65a 100644 --- a/BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs +++ b/BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs @@ -9,8 +9,8 @@ using System.Collections.ObjectModel; using System.Windows; using BPASmartClient.Helper; using Microsoft.Toolkit.Mvvm.Input; -using BPASmartClient.Model; using BPASmartClient.CustomResource.Pages.Model; +using BPASmartClient.Model; namespace BPASmartClient.CustomResource.Pages.ViewModel { @@ -26,7 +26,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel } if (ControlButText == "开始查询") { - var lists = Sqlite.GetInstance.GetData(); + var lists = Sqlite.GetInstance.GetData(); var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList(); if (res != null) { @@ -64,13 +64,13 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel } }); - //AlarmInfos = AlarmHelper.Alarms; - //AlarmHelper.Init(); + AlarmInfos = AlarmHelper.Alarms; + } private void GetHistoryAlarm() { - var data = Sqlite.GetInstance.GetData(); + var data = Sqlite.GetInstance.GetData(); if (data != null) { HistoryAlarm.Clear(); @@ -131,7 +131,6 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel public ObservableCollection AlarmInfos { get; set; } - public ObservableCollection HistoryAlarm { get; set; } = new ObservableCollection(); diff --git a/BPASmartClient.Modbus/ModbusTcp.cs b/BPASmartClient.Modbus/ModbusTcp.cs index 9ead03b5..05663d0e 100644 --- a/BPASmartClient.Modbus/ModbusTcp.cs +++ b/BPASmartClient.Modbus/ModbusTcp.cs @@ -142,6 +142,22 @@ namespace BPASmartClient.Modbus return LwAddress; } } + else if (address.ToUpper().Contains("D") && address.Length == 5) + { + try + { + string head = "4"+(Convert.ToInt32(address.Substring(1, 1)) - 1).ToString(); + string tail = address.Substring(2, 3); + address = head + tail; + return Convert.ToInt32(address); + } + catch (Exception) + { + //打印日志 + + } + + } } return -1; } @@ -171,7 +187,7 @@ namespace BPASmartClient.Modbus commandType = CommandType.Coils; return master.ReadCoils(slaveAddress, startAddress, len); } - else if (address.ToUpper().Contains("VW") || address.ToUpper().Contains("LW")) + else if (address.ToUpper().Contains("VW") || address.ToUpper().Contains("LW")|| address.ToUpper().Contains("D")) { commandType = CommandType.HoldingRegisters; return master.ReadHoldingRegisters(slaveAddress, startAddress, len); @@ -181,6 +197,7 @@ namespace BPASmartClient.Modbus commandType = CommandType.Inputs; return master.ReadInputs(slaveAddress, startAddress, len); } + } catch (Exception ex) { @@ -199,14 +216,15 @@ namespace BPASmartClient.Modbus { try { - string head = (Convert.ToInt32(address.Substring(1, 1)) - 1).ToString(); + string head = "4"+(Convert.ToInt32(address.Substring(1, 1)) - 1).ToString(); string tail = address.Substring(2, 3); - address = head + tail; + address = head + tail; + return Convert.ToInt32(address); } catch (Exception) { //打印日志 - return -1; + } } @@ -276,7 +294,7 @@ namespace BPASmartClient.Modbus else if (value is bool[] boolsValue) master.WriteMultipleCoils(slaveAddress, startAddress, boolsValue); } - else if (address.ToUpper().Contains("VW") || address.ToUpper().Contains("LW")) + else if (address.ToUpper().Contains("VW") || address.ToUpper().Contains("LW")|| address.ToUpper().Contains("D")) { commandType = CommandType.HoldingRegisters; if (value is ushort ushortValue) diff --git a/FryPot_DosingSystem/App.xaml.cs b/FryPot_DosingSystem/App.xaml.cs index f28d2fb4..9b03056c 100644 --- a/FryPot_DosingSystem/App.xaml.cs +++ b/FryPot_DosingSystem/App.xaml.cs @@ -15,6 +15,7 @@ using System.Data; using System.Linq; using System.Threading.Tasks; using System.Windows; +using AlarmInfo = BPASmartClient.CustomResource.Pages.Model.AlarmInfo; namespace FryPot_DosingSystem { @@ -37,23 +38,25 @@ namespace FryPot_DosingSystem mv.Show(); DeviceOperate deviceOperate = DeviceOperate.GetInstance;//开启实时PLC数据读取 DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序 + HubHelper.GetInstance.Connect("192.168.1.130", 8089); + AlarmHelper.Init(); } else mv.Close(); - HubHelper.GetInstance.Report = new Action((o) => - { - var res = JsonConvert.DeserializeObject(o.ToString()); - }); + //HubHelper.GetInstance.Report = new Action((o) => + //{ + // var res = JsonConvert.DeserializeObject(o.ToString()); + //}); - HubHelper.GetInstance.Upstreamrequest = new Action((o) => - { - var res = JsonConvert.DeserializeObject(o.ToString()); - }); - - HubHelper.GetInstance.Connect("192.168.1.99", 8089); + //HubHelper.GetInstance.Upstreamrequest = new Action((o) => + //{ + // var res = JsonConvert.DeserializeObject(o.ToString()); + //}); + //本地服务连接 + } protected override void OnExit(ExitEventArgs e) { @@ -164,7 +167,7 @@ namespace FryPot_DosingSystem SubMenuName = "用户登录", SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, AssemblyName = "BPASmartClient.CustomResource", - ToggleWindowPath = "Pages.View.LoginView" + ToggleWindowPath = "Pages.View.SubPagLoginView" }); UserManager.Add(new SubMenumodel() @@ -185,6 +188,23 @@ namespace FryPot_DosingSystem subMenumodels = UserManager, }); #endregion + ObservableCollection DebugManage = new ObservableCollection(); + DebugManage.Add(new SubMenumodel() + { + SubMenuName = "单一流程调试", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 }, + AssemblyName = "FryPot_DosingSystem", + ToggleWindowPath = "View.DebugView" + }); + MenuManage.GetInstance.menuModels.Add(new MenuModel() + { + MainMenuIcon = "", + MainMenuName = "调试界面", + Alias = "Debug Management", + MainMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 }, + subMenumodels = DebugManage, + }); + } private void LoginDataInite() { diff --git a/FryPot_DosingSystem/Control/DeviceOperate.cs b/FryPot_DosingSystem/Control/DeviceOperate.cs index 821a9793..5f9fe3be 100644 --- a/FryPot_DosingSystem/Control/DeviceOperate.cs +++ b/FryPot_DosingSystem/Control/DeviceOperate.cs @@ -20,7 +20,7 @@ namespace FryPot_DosingSystem.Control ModbusTcp modbus = new ModbusTcp(); private string Ip { get; set; } private string Port { get; set; } - private bool Connected { get; set; } + public bool Connected { get; set; } private string DeviceName { get; set; } @@ -78,7 +78,7 @@ namespace FryPot_DosingSystem.Control { foreach (var item in Variables) { - var res = modbus.Read(item.Address, item.Length, "180项目"); + var res = modbus.Read(item.Address, item.Length); if (Data.ContainsKey(item.Address)) { Data[item.Address] = res; @@ -95,8 +95,11 @@ namespace FryPot_DosingSystem.Control }),$"设备【{DeviceName}】PLC实时数据读取线程"); } public void WritePlcData(string address,ushort value) - { - modbus.Write(address, value,"180项目"); + { + lock (this) + { + modbus.Write(address, value); + } } public ConcurrentDictionary GetAllData() { diff --git a/FryPot_DosingSystem/Control/DosingLogicControl.cs b/FryPot_DosingSystem/Control/DosingLogicControl.cs index d3296f70..c4c3a4af 100644 --- a/FryPot_DosingSystem/Control/DosingLogicControl.cs +++ b/FryPot_DosingSystem/Control/DosingLogicControl.cs @@ -26,18 +26,42 @@ namespace FryPot_DosingSystem.Control public static DosingLogicControl GetInstance => _instance ??= new DosingLogicControl(); public ConcurrentDictionary PlcReadData = new ConcurrentDictionary(); /// - /// 配方队列 + /// 线体1配方队列 /// public ConcurrentQueue RecipeQuene = new ConcurrentQueue(); /// - /// 进料原料队列 + /// 线体2配方队列 + /// + public ConcurrentQueue LTwoRecipeQuene = new ConcurrentQueue(); + /// + /// 线体3配方队列 + /// + public ConcurrentQueue LThreeRecipeQuene = new ConcurrentQueue(); + /// + /// 线体1进料原料队列 /// public ConcurrentQueue InputMaterialQuene = new ConcurrentQueue(); /// - /// 出料原料队列 + /// 线体2进料原料队列 + /// + public ConcurrentQueue LTwoInputMaterialQuene = new ConcurrentQueue(); + /// + /// 线体3进料原料队列 + /// + public ConcurrentQueue LThreeInputMaterialQuene = new ConcurrentQueue(); + /// + /// 线体1出料原料队列 /// public ConcurrentQueue OutputMaterialQuene = new ConcurrentQueue(); /// + /// 线体2出料原料队列 + /// + public ConcurrentQueue LTwoOutputMaterialQuene = new ConcurrentQueue(); + /// + /// 线体3出料原料队列 + /// + public ConcurrentQueue LThreeOutputMaterialQuene = new ConcurrentQueue(); + /// /// 全局变量对象声明 /// GlobalVariable globalVar; @@ -45,25 +69,155 @@ namespace FryPot_DosingSystem.Control /// 线体状态对象声明 /// HardWareStatusViewModel hardWareStatusModel; - + /// + /// 报警信息对象声明 + /// #region 上位机内部变量 - //int lineAlarm = 0;//线体故障信号 1:无故障 -1:故障 - int FryPotAlarm = 0;//炒锅滚筒故障信号 1:无故障 -1:故障 + int FryPotAlarm = 0;//炒锅1滚筒故障信号 1:无故障 -1:故障 + int FryPotTwoAlarm = 0;//炒锅2滚筒故障信号 1:无故障 -1:故障 + int FryPotThreeAlarm = 0;//炒锅3滚筒故障信号 1:无故障 -1:故障 + int FryPotFourAlarm = 0;//炒锅4滚筒故障信号 1:无故障 -1:故障 + int FryPotFiveAlarm = 0;//炒锅5滚筒故障信号 1:无故障 -1:故障 int ReicpeNum = 0;//记录接收到的配方数 + bool ErrorRecipe;//线体1错误配方标识 + bool LTwoErrorRecipe;//线体2错误配方标识 + bool LThreeErrorRecipe;//线体3错误配方标识 #endregion #region agv临时变量 - bool agvArriveUpLoad = false;//agv是否到达线体装料位置 - bool agvArriveUnLoad = false;//agv是否到达炒锅送料位置 - bool agvFryPotEmptyRollerArrive = false;//agv是否拿到炒锅空桶 - string robotJobId = String.Empty;//当前上游系统任务号,全局唯一 - //List robotJobIds = new List();//存储当前上游系统任务号,全局唯一 - bool loadInteractive = false;// fasle:不需要上料交互 true:需要上料交互 + bool agvArriveUpLoad = false;//agv是否到达线体1装料位置 + bool agvArriveLTwoUpLoad = false;//agv是否到达线体2装料位置 + bool agvArriveLThreeUpLoad = false;//agv是否到达线体3装料位置 + + bool agvArriveUnLoad = false;//线体1 agv是否到达炒锅送料位置 + bool LTwoagvArriveUnLoad = false;//线体2 agv是否到达炒锅送料位置 + bool LThreeagvArriveUnLoad = false;//线体3 agv是否到达炒锅送料位置 + + bool agvFryPotEmptyRollerArrive = false;// 线体1的agv是否拿到炒锅空桶 + bool LTwoagvFryPotEmptyRollerArrive = false; //线体2的agv是否拿到炒锅空桶 + bool LThreeagvFryPotEmptyRollerArrive = false;//线体3的agv是否拿到炒锅空桶 + + string LOnerobotJobId = String.Empty;//线体1当前上游系统任务号,全局唯一 + string LTworobotJobId = String.Empty;//线体2当前上游系统任务号,全局唯一 + string LThreerobotJobId = String.Empty;//线体3当前上游系统任务号,全局唯一 + + //bool loadInteractive = false;// fasle:不需要上料交互 true:需要上料交互 #endregion + /// + /// 调试命令注册 + /// + public void CommandRegist() + { + ActionManage.GetInstance.Register(new Action(() => + { + globalVar.rollerLineOne.OutMaterialingSingle = 1; + }), "RollerLineRunning"); + ActionManage.GetInstance.Register(new Action((obj) => + { + globalVar.rollerLineOne.StationEight = (ushort)obj; + }), "EightWorkLoc"); + ActionManage.GetInstance.Register(new Action(() => + { + globalVar.fryPotOne.InputMaterialArrivedSingle = 1; + globalVar.fryPotFour.InputMaterialArrivedSingle = 1; + }), "FryPotInputArrive"); + ActionManage.GetInstance.Register(new Action(() => + { + globalVar.fryPotOne.EmptyBarrelArrivedSingle = 1; + globalVar.fryPotFour.EmptyBarrelArrivedSingle = 1; + }), "FryPotEmptyRollerArrive"); + ActionManage.GetInstance.Register(new Action(() => + { + agvArriveUpLoad = true; + }), "AGVLOneArrive"); + ActionManage.GetInstance.Register(new Action(() => + { + agvArriveUnLoad = true; + }), "AGVFryPotDownArrive"); + ActionManage.GetInstance.Register(new Action(() => + { + agvArriveUpLoad = true; + }), "AGVFryPotUpArrive"); + ActionManage.GetInstance.Register(new Action(() => + { + agvFryPotEmptyRollerArrive = true; + + }), "AGVFryPotGetEmptyRoller"); + //滚筒线2 + ActionManage.GetInstance.Register(new Action(() => + { + globalVar.rollerLineTwo.OutMaterialingSingle = 1; + }), "RollerLineTwoRunning"); + ActionManage.GetInstance.Register(new Action((obj) => + { + globalVar.rollerLineTwo.StationEight = (ushort)obj; + }), "TwoEightWorkLoc"); + ActionManage.GetInstance.Register(new Action(() => + { + globalVar.fryPotTwo.InputMaterialArrivedSingle = 1; + globalVar.fryPotFive.InputMaterialArrivedSingle = 1; + }), "FryPotTwoInputArrive"); + ActionManage.GetInstance.Register(new Action(() => + { + globalVar.fryPotTwo.EmptyBarrelArrivedSingle = 1; + globalVar.fryPotFive.EmptyBarrelArrivedSingle = 1; + }), "FryPotTwoEmptyRollerArrive"); + ActionManage.GetInstance.Register(new Action(() => + { + agvArriveLTwoUpLoad = true; + }), "AGVLTwoArrive"); + ActionManage.GetInstance.Register(new Action(() => + { + LTwoagvArriveUnLoad = true; + }), "AGVFryPotTwoDownArrive"); + ActionManage.GetInstance.Register(new Action(() => + { + agvArriveLTwoUpLoad = true; + }), "AGVFryPotTwoUpArrive"); + ActionManage.GetInstance.Register(new Action(() => + { + LTwoagvFryPotEmptyRollerArrive = true; + + }), "AGVFryPotTwoGetEmptyRoller"); + //滚筒线3 + ActionManage.GetInstance.Register(new Action(() => + { + globalVar.rollerLineThree.OutMaterialingSingle = 1; + }), "RollerLineThreeRunning"); + ActionManage.GetInstance.Register(new Action((obj) => + { + globalVar.rollerLineThree.StationEight = (ushort)obj; + }), "ThreeEightWorkLoc"); + ActionManage.GetInstance.Register(new Action(() => + { + globalVar.fryPotThree.InputMaterialArrivedSingle = 1; + }), "FryPotThreeInputArrive"); + ActionManage.GetInstance.Register(new Action(() => + { + globalVar.fryPotThree.EmptyBarrelArrivedSingle = 1; + }), "FryPotThreeEmptyRollerArrive"); + ActionManage.GetInstance.Register(new Action(() => + { + agvArriveLThreeUpLoad = true; + }), "AGVLThreeArrive"); + ActionManage.GetInstance.Register(new Action(() => + { + LThreeagvArriveUnLoad = true; + }), "AGVFryPotThreeDownArrive"); + ActionManage.GetInstance.Register(new Action(() => + { + agvArriveLThreeUpLoad = true; + }), "AGVFryPotThreeUpArrive"); + ActionManage.GetInstance.Register(new Action(() => + { + LThreeagvFryPotEmptyRollerArrive = true; + + }), "AGVFryPotThreeGetEmptyRoller"); + } public DosingLogicControl() { globalVar = new GlobalVariable(); hardWareStatusModel = HardWareStatusViewModel.GetInstance; - ActionManage.GetInstance.Register(new Action(RecipeDataParse), "RecipeSetDown"); + ActionManage.GetInstance.Register(new Action(RecipeDataParse), "RecipeSetDown"); ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); }), "ClearRecipes"); ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 1; }), "StartPlcInite"); ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 0; }), "EndPlcInite"); @@ -73,6 +227,7 @@ namespace FryPot_DosingSystem.Control ResetProgram(); ReadPlcData(); IniteTask(); + CommandRegist(); } /// @@ -81,26 +236,48 @@ namespace FryPot_DosingSystem.Control /// private void AgvFeedBackUpReportDataAnalysis(object obj) { - if (obj != null && obj is byte[] datas) + //if (obj != null && obj is byte[] datas) + //{ + //string strData = Encoding.UTF8.GetString(datas); + Upstreamrequest objData = JsonConvert.DeserializeObject(obj.ToString()); + if (objData != null) { - string strData = Encoding.UTF8.GetString(datas); - object objData = JsonConvert.DeserializeObject(strData); - if (objData != null && objData is Upstreamrequest upDownReportData) + + //线体1请求上下料 + if (objData.robotJobId == LOnerobotJobId && objData.command == "LOAD")//同一任务号且处于上料阶段,AGV请求上料 { - //if (upDownReportData.body != null && upDownReportData.body is UpstreamrequestBody body) - //{ - // if (body.robotJobId == robotJobId && body.command == "LOAD")//同一任务号且处于上料阶段 - // { - // agvArriveUpLoad = true;//AGV到达上料位置 - // } - // if (body.robotJobId == robotJobId && body.command == "UNLOAD")//同一任务号且处于下料阶段 - // { - // agvArriveUnLoad = true;//AGV到达下料位置 - // } + agvArriveUpLoad = true;//AGV到达上料位置 + + } + if (objData.robotJobId == LOnerobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段 + { + agvArriveUnLoad = true;//AGV到达下料位置 + + } + //线体2请求上下料 + if (objData.robotJobId == LTworobotJobId && objData.command == "LOAD") + { + agvArriveLTwoUpLoad = true;//AGV到达上料位置 + + } + if (objData.robotJobId == LTworobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段 + { + LTwoagvArriveUnLoad = true;//AGV到达下料位置 + + } + //线体3请求上下料 + if (objData.robotJobId == LThreerobotJobId && objData.command == "LOAD") + { + agvArriveLThreeUpLoad = true;//AGV到达上料位置 + + } + if (objData.robotJobId == LThreerobotJobId && objData.command == "UNLOAD")//同一任务号且处于下料阶段 + { + LThreeagvArriveUnLoad = true;//AGV到达下料位置 - //} } } + } /// @@ -109,21 +286,141 @@ namespace FryPot_DosingSystem.Control /// private void AgvTaskUpReportDataAnalysis(object obj) { - if (obj != null && obj is byte[] datas) + //if (obj != null && obj is byte[] datas) + //{ + // string strData = Encoding.UTF8.GetString(datas); + AGVToUpSystem objData = JsonConvert.DeserializeObject(obj.ToString()); + if (objData != null) { - string strData = Encoding.UTF8.GetString(datas); - object objData = JsonConvert.DeserializeObject(strData); - if (objData != null && objData is AGVToUpSystem agvUpReportData) + #region 线体上下料任务信息回报 + //线体1任务上报 + if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指线体上料 { - //if (agvUpReportData.body != null && agvUpReportData.body is AGVToUpSystemBody body) - //{ - // if (body.state == "ROLLER_LOAD_FINISH" && body.jobData.startPointCode == "")//上料完成以及到达指定上料点位 - // { - // agvFryPotEmptyRollerArrive = true; - // } - //} + //日志 + } + //线体2任务上报 + if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指线体上料 + { + //日志 + } + //线体3任务上报 + if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指线体上料 + { + //日志 + } + + //线体1任务上报 + if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指线体上料 + { + + } + //线体2任务上报 + if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指线体上料 + { + + } + //线体3任务上报 + if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指线体上料 + { + + } + //线体1任务上报 + if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体下料 + { + } + //线体2任务上报 + if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体下料 + { + + } + //线体3任务上报 + if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体下料 + { + + } + //线体1任务上报 + if (objData.state == "DONE" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指线体下料 + { + + } + //线体2任务上报 + if (objData.state == "DONE" && objData.robotJobId == LTworobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指线体下料 + { + + } + //线体3任务上报 + if (objData.state == "DONE" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指线体下料 + { + + } + #endregion + + #region 空桶上下料任务信息回报 + //线体1任务上报 + if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指空桶上料 + { + //日志 + } + //线体2任务上报 + if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指空桶上料 + { + //日志 + } + //线体3任务上报 + if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指空桶上料 + { + //日志 + } + + //线体1任务上报 + if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指空桶上料 + { + agvFryPotEmptyRollerArrive = true; + } + //线体2任务上报 + if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指空桶上料 + { + LTwoagvFryPotEmptyRollerArrive = true; + } + //线体3任务上报 + if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指空桶上料 + { + LThreeagvFryPotEmptyRollerArrive = true; + } + //线体1任务上报 + if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指空桶下料 + { + + } + //线体2任务上报 + if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指空桶下料 + { + + } + //线体3任务上报 + if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指空桶下料 + { + + } + //线体1任务上报 + if (objData.state == "DONE" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指空桶下料 + { + + } + //线体2任务上报 + if (objData.state == "DONE" && objData.robotJobId == LTworobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指空桶下料 + { + + } + //线体3任务上报 + if (objData.state == "DONE" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指空桶下料 + { + + } + #endregion } + } /// @@ -135,7 +432,7 @@ namespace FryPot_DosingSystem.Control { if (RTrig.GetInstance("ResetProgram").Start(globalVar.PlcInite == 1))//判断是否初始化 一初始化就重启主任务 { - MessageLog.GetInstance.ShowRunLog("主任务正在重启"); + MessageLog.GetInstance.ShowUserLog("主任务正在重启"); ThreadManage.GetInstance().StopTask("MainTask", new Action(() => { ThreadManage.GetInstance().StopTask("MainViewReadPlcData", new Action(() => @@ -148,7 +445,7 @@ namespace FryPot_DosingSystem.Control ActionManage.GetInstance.Send("ClearRecipes"); ReadPlcData(); IniteTask(); - MessageLog.GetInstance.ShowRunLog("主任务重启完成"); + MessageLog.GetInstance.ShowUserLog("主任务重启完成"); })); })); } @@ -161,113 +458,123 @@ namespace FryPot_DosingSystem.Control /// public void ReadPlcData() { - ThreadManage.GetInstance().StartLong(new Action(() => - { - GetAddressData("D2001", new Action((data) => - { - globalVar.rollerLineOne.StationOne = data[0]; - globalVar.rollerLineOne.StationTwo = data[1]; - globalVar.rollerLineOne.StationThree = data[2]; - globalVar.rollerLineOne.StationFour = data[3]; - globalVar.rollerLineOne.StationFive = data[4]; - globalVar.rollerLineOne.StationSix = data[5]; - globalVar.rollerLineOne.StationSeven = data[6]; - globalVar.rollerLineOne.StationEight = data[7]; - })); - GetAddressData("D2011", new Action((data) => - { - globalVar.rollerLineTwo.StationOne = data[0]; - globalVar.rollerLineTwo.StationTwo = data[1]; - globalVar.rollerLineTwo.StationThree = data[2]; - globalVar.rollerLineTwo.StationFour = data[3]; - globalVar.rollerLineTwo.StationFive = data[4]; - globalVar.rollerLineTwo.StationSix = data[5]; - globalVar.rollerLineTwo.StationSeven = data[6]; - globalVar.rollerLineTwo.StationEight = data[7]; - })); - GetAddressData("D2021", new Action((data) => - { - globalVar.rollerLineThree.StationOne = data[0]; - globalVar.rollerLineThree.StationTwo = data[1]; - globalVar.rollerLineThree.StationThree = data[2]; - globalVar.rollerLineThree.StationFour = data[3]; - globalVar.rollerLineThree.StationFive = data[4]; - globalVar.rollerLineThree.StationSix = data[5]; - globalVar.rollerLineThree.StationSeven = data[6]; - globalVar.rollerLineThree.StationEight = data[7]; - })); - GetAddressData("D2031", new Action((data) => - { - globalVar.rollerLineOne.OutMaterialingSingle = data[3]; - globalVar.rollerLineTwo.OutMaterialingSingle = data[4]; - globalVar.rollerLineThree.OutMaterialingSingle = data[5]; - globalVar.rollerLineOne.OutMaterialingTroubleSingle = data[6]; - globalVar.rollerLineTwo.OutMaterialingTroubleSingle = data[7]; - globalVar.rollerLineThree.OutMaterialingTroubleSingle = data[8]; - })); - GetAddressData("D2040", new Action((data) => - { - globalVar.fryPotOne.InputMaterialRollerRunningSingle = data[0]; - globalVar.fryPotTwo.InputMaterialRollerRunningSingle = data[1]; - globalVar.fryPotThree.InputMaterialRollerRunningSingle = data[2]; - globalVar.fryPotFour.InputMaterialRollerRunningSingle = data[3]; - globalVar.fryPotFive.InputMaterialRollerRunningSingle = data[4]; - })); - GetAddressData("D2045", new Action((data) => - { - globalVar.fryPotOne.InputMaterialArrivedSingle = data[0]; - globalVar.fryPotTwo.InputMaterialArrivedSingle = data[1]; - globalVar.fryPotThree.InputMaterialArrivedSingle = data[2]; - globalVar.fryPotFour.InputMaterialArrivedSingle = data[3]; - globalVar.fryPotFive.InputMaterialArrivedSingle = data[4]; - })); - GetAddressData("D2050", new Action((data) => - { - globalVar.fryPotOne.EmptyBarrelArrivedSingle = data[0]; - globalVar.fryPotTwo.EmptyBarrelArrivedSingle = data[1]; - globalVar.fryPotThree.EmptyBarrelArrivedSingle = data[2]; - globalVar.fryPotFour.EmptyBarrelArrivedSingle = data[3]; - globalVar.fryPotFive.EmptyBarrelArrivedSingle = data[4]; - })); - GetAddressData("D2065", new Action((data) => - { - globalVar.fryPotOne.EmptyBarrelRollerRunningSingle = data[0]; - globalVar.fryPotTwo.EmptyBarrelRollerRunningSingle = data[1]; - globalVar.fryPotThree.EmptyBarrelRollerRunningSingle = data[2]; - globalVar.fryPotFour.EmptyBarrelRollerRunningSingle = data[3]; - globalVar.fryPotFive.EmptyBarrelRollerRunningSingle = data[4]; - })); - GetAddressData("D2070", new Action((data) => - { - globalVar.fryPotOne.RollerTroubleSingle = data[0]; - globalVar.fryPotTwo.RollerTroubleSingle = data[1]; - globalVar.fryPotThree.RollerTroubleSingle = data[2]; - globalVar.fryPotFour.RollerTroubleSingle = data[3]; - globalVar.fryPotFive.RollerTroubleSingle = data[4]; - })); - GetAddressData("D2078", new Action(data => - { - globalVar.rollerLineOne.RecipeCompleteSingle = data[0]; - globalVar.rollerLineTwo.RecipeCompleteSingle = data[1]; - globalVar.rollerLineThree.RecipeCompleteSingle = data[2]; - })); - GetAddressData("D2075", new Action(data => - { + //ThreadManage.GetInstance().StartLong(new Action(() => + //{ + // GetAddressData("D2001", new Action((data) => + // { + // globalVar.rollerLineOne.StationOne = data[0]; + // globalVar.rollerLineOne.StationTwo = data[1]; + // globalVar.rollerLineOne.StationThree = data[2]; + // globalVar.rollerLineOne.StationFour = data[3]; + // globalVar.rollerLineOne.StationFive = data[4]; + // globalVar.rollerLineOne.StationSix = data[5]; + // globalVar.rollerLineOne.StationSeven = data[6]; + // globalVar.rollerLineOne.StationEight = data[7]; + // })); + // GetAddressData("D2011", new Action((data) => + // { + // globalVar.rollerLineTwo.StationOne = data[0]; + // globalVar.rollerLineTwo.StationTwo = data[1]; + // globalVar.rollerLineTwo.StationThree = data[2]; + // globalVar.rollerLineTwo.StationFour = data[3]; + // globalVar.rollerLineTwo.StationFive = data[4]; + // globalVar.rollerLineTwo.StationSix = data[5]; + // globalVar.rollerLineTwo.StationSeven = data[6]; + // globalVar.rollerLineTwo.StationEight = data[7]; + // })); + // GetAddressData("D2021", new Action((data) => + // { + // globalVar.rollerLineThree.StationOne = data[0]; + // globalVar.rollerLineThree.StationTwo = data[1]; + // globalVar.rollerLineThree.StationThree = data[2]; + // globalVar.rollerLineThree.StationFour = data[3]; + // globalVar.rollerLineThree.StationFive = data[4]; + // globalVar.rollerLineThree.StationSix = data[5]; + // globalVar.rollerLineThree.StationSeven = data[6]; + // globalVar.rollerLineThree.StationEight = data[7]; + // })); + // GetAddressData("D2031", new Action((data) => + // { + // globalVar.rollerLineOne.OutMaterialingSingle = data[3]; + // globalVar.rollerLineTwo.OutMaterialingSingle = data[4]; + // globalVar.rollerLineThree.OutMaterialingSingle = data[5]; + // //globalVar.rollerLineOne.OutMaterialingTroubleSingle = data[6]; + // //globalVar.rollerLineTwo.OutMaterialingTroubleSingle = data[7]; + // //globalVar.rollerLineThree.OutMaterialingTroubleSingle = data[8]; + // AlarmHelper.Alarm.LOneRollerTrouble = data[6]; + // AlarmHelper.Alarm.LTwoRollerTrouble = data[7]; + // AlarmHelper.Alarm.LThreeRollerTrouble = data[8]; - globalVar.CleadBarrelEnterSingle = data[0]; - })); - GetAddressData("D2077", new Action(data => - { + // })); + // GetAddressData("D2040", new Action((data) => + // { + // globalVar.fryPotOne.InputMaterialRollerRunningSingle = data[0]; + // globalVar.fryPotTwo.InputMaterialRollerRunningSingle = data[1]; + // globalVar.fryPotThree.InputMaterialRollerRunningSingle = data[2]; + // globalVar.fryPotFour.InputMaterialRollerRunningSingle = data[3]; + // globalVar.fryPotFive.InputMaterialRollerRunningSingle = data[4]; + // })); + // GetAddressData("D2045", new Action((data) => + // { + // globalVar.fryPotOne.InputMaterialArrivedSingle = data[0]; + // globalVar.fryPotTwo.InputMaterialArrivedSingle = data[1]; + // globalVar.fryPotThree.InputMaterialArrivedSingle = data[2]; + // globalVar.fryPotFour.InputMaterialArrivedSingle = data[3]; + // globalVar.fryPotFive.InputMaterialArrivedSingle = data[4]; + // })); + // GetAddressData("D2050", new Action((data) => + // { + // globalVar.fryPotOne.EmptyBarrelArrivedSingle = data[0]; + // globalVar.fryPotTwo.EmptyBarrelArrivedSingle = data[1]; + // globalVar.fryPotThree.EmptyBarrelArrivedSingle = data[2]; + // globalVar.fryPotFour.EmptyBarrelArrivedSingle = data[3]; + // globalVar.fryPotFive.EmptyBarrelArrivedSingle = data[4]; + // })); + // GetAddressData("D2065", new Action((data) => + // { + // globalVar.fryPotOne.EmptyBarrelRollerRunningSingle = data[0]; + // globalVar.fryPotTwo.EmptyBarrelRollerRunningSingle = data[1]; + // globalVar.fryPotThree.EmptyBarrelRollerRunningSingle = data[2]; + // globalVar.fryPotFour.EmptyBarrelRollerRunningSingle = data[3]; + // globalVar.fryPotFive.EmptyBarrelRollerRunningSingle = data[4]; + // })); + // GetAddressData("D2070", new Action((data) => + // { + // //globalVar.fryPotOne.RollerTroubleSingle = data[0]; + // //globalVar.fryPotTwo.RollerTroubleSingle = data[1]; + // //globalVar.fryPotThree.RollerTroubleSingle = data[2]; + // //globalVar.fryPotFour.RollerTroubleSingle = data[3]; + // //globalVar.fryPotFive.RollerTroubleSingle = data[4]; + // AlarmHelper.Alarm.FryPotOneRollerTrouble = data[0]; + // AlarmHelper.Alarm.FryPotTwoRollerTrouble = data[1]; + // AlarmHelper.Alarm.FryPotThreeRollerTrouble = data[2]; + // AlarmHelper.Alarm.FryPotFourRollerTrouble = data[3]; + // AlarmHelper.Alarm.FryPotFiveRollerTrouble = data[4]; + // })); + // GetAddressData("D2078", new Action(data => + // { + // globalVar.rollerLineOne.RecipeCompleteSingle = data[0]; + // globalVar.rollerLineTwo.RecipeCompleteSingle = data[1]; + // globalVar.rollerLineThree.RecipeCompleteSingle = data[2]; + // })); + // GetAddressData("D2075", new Action(data => + // { - globalVar.CleadBarrelExitSingle = data[0]; - })); - //globalVar.rollerLineOne.OutMaterialingSingle = 0; - //globalVar.rollerLineOne.StationOne = 401; - //globalVar.rollerLineOne.StationTwo = 402; - //globalVar.rollerLineOne.OutMaterialingTroubleSingle = 1; - RollerLineStatusDisplay(); - Thread.Sleep(10); - }), "MainViewReadPlcData"); + // globalVar.CleadBarrelEnterSingle = data[0]; + // })); + // GetAddressData("D2077", new Action(data => + // { + + // globalVar.CleadBarrelExitSingle = data[0]; + // })); + // //globalVar.rollerLineOne.OutMaterialingSingle = 0; + // //globalVar.rollerLineOne.StationOne = 401; + // //globalVar.rollerLineOne.StationTwo = 402; + // //globalVar.rollerLineOne.OutMaterialingTroubleSingle = 1; + // // AlarmHelper.Alarm.LOneRollerTrouble =1; + // RollerLineStatusDisplay(); + // Thread.Sleep(10); + //}), "MainViewReadPlcData"); } /// @@ -283,7 +590,7 @@ namespace FryPot_DosingSystem.Control hardWareStatusModel.RollerOneModel.LocSixRollerSerial = globalVar.rollerLineOne.StationSix; hardWareStatusModel.RollerOneModel.LocSevenRollerSerial = globalVar.rollerLineOne.StationSeven; hardWareStatusModel.RollerOneModel.LocEightRollerSerial = globalVar.rollerLineOne.StationEight; - if (globalVar.rollerLineOne.OutMaterialingTroubleSingle == 0) + if (AlarmHelper.Alarm.LOneRollerTrouble == 0) { hardWareStatusModel.RollerOneModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障 @@ -311,7 +618,7 @@ namespace FryPot_DosingSystem.Control hardWareStatusModel.RollerTwoModel.LocSixRollerSerial = globalVar.rollerLineTwo.StationSix; hardWareStatusModel.RollerTwoModel.LocSevenRollerSerial = globalVar.rollerLineTwo.StationSeven; hardWareStatusModel.RollerTwoModel.LocEightRollerSerial = globalVar.rollerLineTwo.StationEight; - if (globalVar.rollerLineTwo.OutMaterialingTroubleSingle == 0) + if (AlarmHelper.Alarm.LTwoRollerTrouble == 0) { hardWareStatusModel.RollerTwoModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障 } @@ -338,7 +645,7 @@ namespace FryPot_DosingSystem.Control hardWareStatusModel.RollerThreeModel.LocSixRollerSerial = globalVar.rollerLineThree.StationSix; hardWareStatusModel.RollerThreeModel.LocSevenRollerSerial = globalVar.rollerLineThree.StationSeven; hardWareStatusModel.RollerThreeModel.LocEightRollerSerial = globalVar.rollerLineThree.StationEight; - if (globalVar.rollerLineThree.OutMaterialingTroubleSingle == 0) + if (AlarmHelper.Alarm.LThreeRollerTrouble == 0) { hardWareStatusModel.RollerThreeModel.RollerAlarmState = Color.FromRgb(130, 232, 139);//无故障 } @@ -396,159 +703,647 @@ namespace FryPot_DosingSystem.Control { Task.Run(new Action(() => { - if (obj != null && obj is NewRecipeModel recipe) + if (obj != null && obj is NewRecipeModel[] recipes) { - RecipeQuene.Enqueue(recipe); - ReicpeNum++; - MessageLog.GetInstance.ShowRunLog($"接收到第{ReicpeNum}个配方"); + //int? res = (recipe.materialCollection.ElementAt(0).MaterialLoc) / 100; + //if (res != null) + //{ + // switch (res) + // { + // case 1: + // case 4: RecipeQuene.Enqueue(recipe); break; + // case 3: LThreeRecipeQuene.Enqueue(recipe); break; + // case 2: + // case 5: LTwoRecipeQuene.Enqueue(recipe); break; + // } + // ReicpeNum++; + // MessageLog.GetInstance.ShowUserLog($"接收到第{ReicpeNum}个配方"); + //} + ReicpeNum = ReicpeNum + recipes.Length; + MessageLog.GetInstance.ShowUserLog($"新接收到{recipes.Length}个配方,总共{ReicpeNum}个配方"); + for (int i = 0; i < recipes.Length; i++) + { + int? res = recipes[i].materialCollection.ElementAt(0).MaterialLoc / 100; + if (res != null) + { + switch (res) + { + case 1: + case 4: RecipeQuene.Enqueue(recipes[i]); break; + case 3: LThreeRecipeQuene.Enqueue(recipes[i]); break; + case 2: + case 5: LTwoRecipeQuene.Enqueue(recipes[i]); break; + } + } + } } })); - - } /// /// 开启主任务 /// public void MainTask() { - RecipeDataToPlc(); - AgvLoadRoller(); - FryPotInputMaterial(); - FryPotOutputMaterial(); + ////RecipeDataToPlc(); + //LOneRecipeDataToPlc(); + //LTwoRecipeDataToPlc(); + //LThreeRecipeDataToPlc(); + ////AgvLoadRoller(); + //LOneLoadRoller(); + //LTwoAgvLoadRoller(); + //LThreeAgvLoadRoller(); + //// FryPotInputMaterial(); + //LOneFryPotInputMaterial(); + //LTwoFryPotInputMaterial(); + //LThreeFryPotInputMaterial(); + ////FryPotOutputMaterial(); + //LOneFryPotOutputMaterial(); + //LTwoFryPotOutputMaterial(); + //LThreeFryPotOutputMaterial(); + LineOneProcessExecute(); + LineTwoProcessExecute(); + LineThreeProcessExecute(); } /// - /// 数据下发PLC + /// 线体1的执行流程 /// - public void RecipeDataToPlc() + public void LineOneProcessExecute() { - if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0)//后续添加其它限制条件 + if (!globalVar.LOneTaskLock) { - //NewRecipeModel newRecipe = new NewRecipeModel(); - MaterialType material = new MaterialType(); - if (RecipeQuene.TryDequeue(out NewRecipeModel result)) + globalVar.LOneTaskLock = true; + Task.Run(new Action(() => { - MessageLog.GetInstance.ShowRunLog($"开始制作【{result.RecipeName}】 配方"); - //for (int k = 0; k < result.materialCollection.Count-1; k++) - //{ - // for (int j = 0; j < result.materialCollection.Count-1-k; j++) - // { - // if (result.materialCollection[j].MaterialLoc > result.materialCollection[j + 1].MaterialLoc) - // { - // material = result.materialCollection[j]; - // result.materialCollection[j] = result.materialCollection[j + 1]; - // result.materialCollection[j + 1] = material; - // } - // } - //} + LOneRecipeDataToPlc(); + LOneLoadRoller(); + LOneFryPotInputMaterial(); + LOneFryPotOutputMaterial(); + globalVar.LOneTaskLock = false; + })); + + } + + } + /// + /// 线体2的执行流程 + /// + public void LineTwoProcessExecute() + { + if (!globalVar.LTwoTaskLock) + { + globalVar.LTwoTaskLock = true; + Task.Run(new Action(() => + { + LTwoRecipeDataToPlc(); + LTwoAgvLoadRoller(); + LTwoFryPotInputMaterial(); + LTwoFryPotOutputMaterial(); + globalVar.LTwoTaskLock = false; + })); + } + } + /// + /// 线体3的执行流程 + /// + public void LineThreeProcessExecute() + { + if (!globalVar.LThreeTaskLock) + { + globalVar.LThreeTaskLock = true; + Task.Run(new Action(() => + { + LThreeRecipeDataToPlc(); + LThreeAgvLoadRoller(); + LThreeFryPotInputMaterial(); + LThreeFryPotOutputMaterial(); + globalVar.LThreeTaskLock = false; + })); + } + } + + /// + /// 3号滚筒线数据下发 2022/7/4 新增 + /// + /// + private void LThreeRecipeDataToPlc() + { + if (LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0 && !LThreeErrorRecipe) + { + if (globalVar.LThreeCurrentRecipeName != string.Empty) + { + MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成"); + globalVar.LThreeCurrentRecipeName = string.Empty; + } + } + if (LThreeRecipeQuene.Count > 0 && LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0)//后续添加其它限制条件 + { + if (globalVar.LThreeCurrentRecipeName != string.Empty) + MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成"); + if (LThreeRecipeQuene.TryDequeue(out NewRecipeModel result)) + { + LThreeErrorRecipe = false; + int headNum = result.materialCollection[0].MaterialLoc / 100; + globalVar.LThreeCurrentRecipeName = result.RecipeName; + MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线开始制作【{result.RecipeName}】 配方"); for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料 { - //将配方中原料加入新的队列 - InputMaterialQuene.Enqueue(new MaterialInfo() + if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && headNum == 3) { - materialType = result.materialCollection[i], - materialId = result.RecipeId - }); - ushort n = result.materialCollection[i].MaterialLoc; - switch (n / 100) + //将配方中原料加入新的队列 + LThreeInputMaterialQuene.Enqueue(new MaterialInfo() + { + materialType = result.materialCollection[i], + materialId = result.RecipeId + }); + RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight);//3号滚筒线桶号以及重量数据下发 + } + else { - case 1: - case 4: RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//1号滚筒线桶号以及重量数据下发 - case 2: - case 5: RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//2号滚筒线桶号以及重量数据下发 - case 3: RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//3号滚筒线桶号以及重量数据下发 + MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); + LThreeInputMaterialQuene.Clear(); + LThreeErrorRecipe = true; + return; } } - switch (result.materialCollection[0].MaterialLoc / 100) + DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count);//发送3号滚筒线工序数据 + } + } + + + + } + /// + /// 2号滚筒线数据下发 2022/7/4 新增 + /// + /// + private void LTwoRecipeDataToPlc() + { + if (LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0 && !LTwoErrorRecipe) + { + if (globalVar.LTwoCurrentRecipeName != string.Empty) + { + MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成"); + globalVar.LTwoCurrentRecipeName = string.Empty; + } + } + + if (LTwoRecipeQuene.Count > 0 && LTwoOutputMaterialQuene.Count == 0 && LTwoInputMaterialQuene.Count == 0)//后续添加其它限制条件 + { + if (globalVar.LTwoCurrentRecipeName != string.Empty) + MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成"); + if (LTwoRecipeQuene.TryDequeue(out NewRecipeModel result)) + { + LTwoErrorRecipe = false; + int headNum = result.materialCollection[0].MaterialLoc / 100; + globalVar.LTwoCurrentRecipeName = result.RecipeName; + MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线开始制作【{result.RecipeName}】 配方"); + for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料 { - case 1: - DeviceOperate.GetInstance.WritePlcData("D1009", (ushort)result.materialCollection.Count); break;//发送1号滚筒线工序数据 - case 2: - DeviceOperate.GetInstance.WritePlcData("D1026", (ushort)result.materialCollection.Count); break;//发送2号滚筒线工序数据 - case 3: - DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count); break;//发送3号滚筒线工序数据 + if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 2 || headNum == 5)) + { + //将配方中原料加入新的队列 + LTwoInputMaterialQuene.Enqueue(new MaterialInfo() + { + materialType = result.materialCollection[i], + materialId = result.RecipeId + }); + RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight);//2号滚筒线桶号以及重量数据下发 + } + else + { + MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); + LTwoInputMaterialQuene.Clear(); + LTwoErrorRecipe = true; + return; + } } + DeviceOperate.GetInstance.WritePlcData("D1026", (ushort)result.materialCollection.Count);//发送2号滚筒线工序数据 } } + + } + /// - /// AGV到配方对应线体装桶以及出料到炒锅 + /// 1号滚筒线数据下发 2022/7/4 新增 /// - public void AgvLoadRoller() + private void LOneRecipeDataToPlc() { - //lineAlarm = 0; - if (InputMaterialQuene.Count > 0) + if (OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0 && !ErrorRecipe) + { + if (globalVar.LOneCurrentRecipeName != string.Empty) + { + MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线【{globalVar.LOneCurrentRecipeName}】 配方制作完成"); + globalVar.LOneCurrentRecipeName = string.Empty; + } + } + if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0)//后续添加其它限制条件 { - switch (InputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) + if (RecipeQuene.TryDequeue(out NewRecipeModel result)) { - case 1: - case 4: AgvToLineOneLoadRoller(); AgvFromLineOneToFryPot(); break;//AGV到1号线体装桶 - case 2: - case 5: AgvToLineTwoLoadRoller(); AgvFromLineTwoToFryPot(); break;//AGV到2号线体装桶 - case 3: AgvToLineThreeLoadRoller(); AgvFromLineThreeToFryPot(); break;//AGV到3号线体装桶 + ErrorRecipe = false; + int headNum = result.materialCollection[0].MaterialLoc / 100; ; + globalVar.LOneCurrentRecipeName = result.RecipeName; + MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线开始制作【{result.RecipeName}】 配方"); + for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料 + { + if (result.materialCollection.Count<=8&&result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && (headNum == 1 || headNum == 4)) + { + //将配方中原料加入新的队列 + InputMaterialQuene.Enqueue(new MaterialInfo() + { + materialType = result.materialCollection[i], + materialId = result.RecipeId + }); + RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight);//1号滚筒线桶号以及重量数据下发 + } + else + { + MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); + InputMaterialQuene.Clear(); + ErrorRecipe = true; + return; + } + } + DeviceOperate.GetInstance.WritePlcData("D1009", (ushort)result.materialCollection.Count);//发送1号滚筒线工序数据 + } } + + + } + + /// + /// 数据下发PLC + /// + //public void RecipeDataToPlc() + //{ + // if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0)//后续添加其它限制条件 + // { + // //NewRecipeModel newRecipe = new NewRecipeModel(); + // //MaterialType material = new MaterialType(); + // if (RecipeQuene.TryDequeue(out NewRecipeModel result)) + // { + // //newRecipe = result; + // MessageLog.GetInstance.ShowRunLog($"开始制作【{result.RecipeName}】 配方"); + // //for (int k = 0; k < newRecipe.materialCollection.Count - 1; k++) + // //{ + // // for (int j = 0; j < newRecipe.materialCollection.Count - 1 - k; j++) + // // { + // // if (newRecipe.materialCollection[j].MaterialLoc > newRecipe.materialCollection[j + 1].MaterialLoc) + // // { + // // material = newRecipe.materialCollection[j]; + // // // newRecipe.materialCollection[j] = null; + // // newRecipe.materialCollection[j] = newRecipe.materialCollection[j + 1]; + // // // newRecipe.materialCollection[j + 1] = null; + // // newRecipe.materialCollection[j + 1] = material; + // // } + // // } + // //} + // for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料 + // { + // //将配方中原料加入新的队列 + // InputMaterialQuene.Enqueue(new MaterialInfo() + // { + // materialType = result.materialCollection[i], + // materialId = result.RecipeId + // }); + // ushort n = result.materialCollection[i].MaterialLoc; + // switch (n / 100) + // { + // case 1: + // case 4: RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//1号滚筒线桶号以及重量数据下发 + // case 2: + // case 5: RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//2号滚筒线桶号以及重量数据下发 + // case 3: RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, result.materialCollection[i].MaterialWeight); break;//3号滚筒线桶号以及重量数据下发 + // } + // } + // switch (result.materialCollection[0].MaterialLoc / 100) + // { + // case 1: + // DeviceOperate.GetInstance.WritePlcData("D1009", (ushort)result.materialCollection.Count); break;//发送1号滚筒线工序数据 + // case 2: + // DeviceOperate.GetInstance.WritePlcData("D1026", (ushort)result.materialCollection.Count); break;//发送2号滚筒线工序数据 + // case 3: + // DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count); break;//发送3号滚筒线工序数据 + // } + // } + // } + + //} + /// + /// AGV到配方线体1装桶以及出料到炒锅 + /// + //public void AgvLoadRoller() + //{ + // //lineAlarm = 0; + // if (InputMaterialQuene.Count > 0) + // { + // switch (InputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) + // { + // case 1: + // case 4: AgvToLineOneLoadRoller(); AgvFromLineOneToFryPot(); break;//AGV到1号线体装桶 + // case 2: + // case 5: AgvToLineTwoLoadRoller(); AgvFromLineTwoToFryPot(); break;//AGV到2号线体装桶 + // case 3: AgvToLineThreeLoadRoller(); AgvFromLineThreeToFryPot(); break;//AGV到3号线体装桶 + // } + // } + + //} + /// + /// AGV到配方线体1装桶以及出料到炒锅 + /// + public void LOneLoadRoller() + { + if (InputMaterialQuene.Count > 0) + { + AgvToLineOneLoadRoller(); + AgvFromLineOneToFryPot();//AGV到1号线体装桶 + } + } + /// + /// AGV到配方线体2装桶以及出料到炒锅 + /// + public void LTwoAgvLoadRoller() + { + if (LTwoInputMaterialQuene.Count > 0) + { + + AgvToLineTwoLoadRoller(); + AgvFromLineTwoToFryPot();//AGV到2号线体装桶 + + + } + } + /// + /// AGV到配方线体3装桶以及出料到炒锅 + /// + public void LThreeAgvLoadRoller() + { + if (LThreeInputMaterialQuene.Count > 0) + { + + AgvToLineThreeLoadRoller(); + AgvFromLineThreeToFryPot();//AGV到2号线体装桶 + + + } } /// /// AGV从炒锅送料位置到倒料过程处理 /// - public void FryPotInputMaterial() + //public void FryPotInputMaterial() + //{ + // if (OutputMaterialQuene.Count > 0 && !globalVar.InOrOutputLock) + // { + // while (!agvArriveUnLoad)//等待agv到达炒锅位置 + // { + // Thread.Sleep(5); + // if (globalVar.ExitMainTask) + // return; + // } + // AgvArriveFryPotSingleSetDown(); + // FryPotRollerTroubleCheck(); + // if (FryPotAlarm == 1)//炒锅滚筒无故障 + // { + // //炒锅滚筒进料运行到位处理 + // FryPotInputMaterialRollerOperate(); + // globalVar.InOrOutputLock = true; + // } + + // } + + //} + /// + /// 线体1的AGV从炒锅送料位置到倒料过程处理 + /// + public void LOneFryPotInputMaterial() { if (OutputMaterialQuene.Count > 0 && !globalVar.InOrOutputLock) { - while (!agvArriveUnLoad)//等待agv到达炒锅位置 { Thread.Sleep(5); if (globalVar.ExitMainTask) return; } - AgvArriveFryPotSingleSetDown(); - FryPotRollerTroubleCheck(); - if (FryPotAlarm == 1)//炒锅滚筒无故障 + agvArriveUnLoad = false; + MessageLog.GetInstance.ShowRunLog("AGV到达【1】号线体指定炒锅下料位置"); + AgvArriveFryPotOneOrFourSingleSetDown(); + FryPotOneRollerTroubleCheck(); + if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//炒锅滚筒无故障 { //炒锅滚筒进料运行到位处理 - FryPotInputMaterialRollerOperate(); + FryPotOneOrFourInputMaterialRollerOperate(); globalVar.InOrOutputLock = true; } } - } /// - /// 炒锅出桶 + /// 线体2的AGV从炒锅送料位置到倒料过程处理 + /// + public void LTwoFryPotInputMaterial() + { + if (LTwoOutputMaterialQuene.Count > 0 && !globalVar.LTwoInOrOutputLock) + { + while (!LTwoagvArriveUnLoad)//等待agv到达炒锅位置 + { + Thread.Sleep(5); + if (globalVar.ExitMainTask) + return; + } + LTwoagvArriveUnLoad = false; + MessageLog.GetInstance.ShowRunLog("AGV到达【2】号线体指定炒锅下料位置"); + AgvArriveFryPotTwoOrFiveSingleSetDown(); + FryPotTwoRollerTroubleCheck(); + if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//炒锅滚筒无故障 + { + //炒锅滚筒进料运行到位处理 + FryPotTwoOrFiveInputMaterialRollerOperate(); + globalVar.LTwoInOrOutputLock = true; + } + + } + } + /// + /// 线体3的AGV从炒锅送料位置到倒料过程处理 + /// + public void LThreeFryPotInputMaterial() + { + if (LThreeOutputMaterialQuene.Count > 0 && !globalVar.LThreeInOrOutputLock) + { + while (!LThreeagvArriveUnLoad)//等待agv到达炒锅位置 + { + Thread.Sleep(5); + if (globalVar.ExitMainTask) + return; + } + LThreeagvArriveUnLoad = false; + MessageLog.GetInstance.ShowRunLog("AGV到达【3】号线体指定炒锅下料位置"); + AgvArriveFryPotThreeSingleSetDown(); + FryPotThreeRollerTroubleCheck(); + if (FryPotThreeAlarm == 1)//炒锅滚筒无故障 + { + //炒锅滚筒进料运行到位处理 + FryPotThreeInputMaterialRollerOperate(); + globalVar.LThreeInOrOutputLock = true; + } + + } + } + /// + /// 炒锅出桶 + /// + //public void FryPotOutputMaterial() + //{ + // if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock) + // { + // AgvFromFryPotToClean();//上游下发搬运任务给AGV + // while (!agvArriveUpLoad)//等待agv到达炒锅位置 + // { + // Thread.Sleep(5); + // if (globalVar.ExitMainTask) + // return; + // } + // agvArriveUpLoad = false; + // AgvArriveFryPotOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号 + // FryPotRollerTroubleCheck(); + // if (FryPotAlarm == 1)//无故障 + // { + // FryPotOutEmpetyRollerOperate(); + // if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料 + // { + // while (!agvFryPotEmptyRollerArrive)//等待AGV拿到出桶空桶 + // { + // Thread.Sleep(5); + // if (globalVar.ExitMainTask) + // return; + // } + // //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅 + // globalVar.AllowAgvToLineLoadRoller = true; + // globalVar.InOrOutputLock = false; + // } + // } + + // } + //} + /// + /// 线体1对应炒锅出桶 + /// + public void LOneFryPotOutputMaterial() + { + if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock) + { + AgvFromFryPotOneOrFourToClean();//上游下发搬运任务给AGV + while (!agvArriveUpLoad)//等待agv到达炒锅位置 + { + Thread.Sleep(5); + if (globalVar.ExitMainTask) + return; + } + agvArriveUpLoad = false; + MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线对应炒锅空桶上料位置"); + AgvArriveFryPotOneOrFourOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号 + FryPotOneRollerTroubleCheck(); + if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//无故障 + { + FryPotOneOrFourOutEmpetyRollerOperate(); + if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料 + { + while (!agvFryPotEmptyRollerArrive)//等待AGV拿到出桶空桶 + { + Thread.Sleep(5); + if (globalVar.ExitMainTask) + return; + } + agvFryPotEmptyRollerArrive = false; + MessageLog.GetInstance.ShowRunLog("AGV在【1】号滚筒线对应炒锅空桶上料完成,将进行空桶回收"); + //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅 + globalVar.AllowAgvToLineLoadRoller = true; + globalVar.InOrOutputLock = false; + } + } + + } + } + /// + /// 线体2对应炒锅出桶 + /// + public void LTwoFryPotOutputMaterial() + { + if (LTwoOutputMaterialQuene.Count > 0 && globalVar.LTwoInOrOutputLock) + { + AgvFromFryPotTwoOrFiveToClean();//上游下发搬运任务给AGV + while (!agvArriveLTwoUpLoad)//等待agv到达炒锅上料位置 + { + Thread.Sleep(5); + if (globalVar.ExitMainTask) + return; + } + agvArriveLTwoUpLoad = false; + MessageLog.GetInstance.ShowRunLog("AGV到达【2】号滚筒线对应炒锅空桶上料位置"); + AgvArriveFryPotTwoOrFiveOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号 + FryPotTwoRollerTroubleCheck(); + if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//无故障 + { + FryPotTwoOrFiveOutEmpetyRollerOperate(); + if (LTwoOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料 + { + while (!LTwoagvFryPotEmptyRollerArrive)//等待AGV拿到出桶空桶 + { + Thread.Sleep(5); + if (globalVar.ExitMainTask) + return; + } + LTwoagvFryPotEmptyRollerArrive = false; + MessageLog.GetInstance.ShowRunLog("AGV在【2】号滚筒线对应炒锅空桶上料完成,将进行空桶回收"); + //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅 + globalVar.AllowAgvToLineTwoLoadRoller = true; + globalVar.LTwoInOrOutputLock = false; + } + } + + } + } + /// + /// 线体3对应炒锅出桶 /// - public void FryPotOutputMaterial() + public void LThreeFryPotOutputMaterial() { - if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock) + if (LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeInOrOutputLock) { - AgvFromFryPotToClean();//上游下发搬运任务给AGV - while (!agvArriveUpLoad)//等待agv到达炒锅位置 + AgvFromFryPotThreeToClean();//上游下发搬运任务给AGV + while (!agvArriveLThreeUpLoad)//等待agv到达炒锅位置 { Thread.Sleep(5); if (globalVar.ExitMainTask) return; } - agvArriveUpLoad = false; - AgvArriveFryPotOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号 - FryPotRollerTroubleCheck(); - if (FryPotAlarm == 1)//无故障 + agvArriveLThreeUpLoad = false; + MessageLog.GetInstance.ShowRunLog("AGV到达【3】号滚筒线对应炒锅空桶上料位置"); + AgvArriveFryPotThreeOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号 + FryPotThreeRollerTroubleCheck(); + if (FryPotThreeAlarm == 1)//无故障 { - FryPotOutEmpetyRollerOperate(); - if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料 + FryPotThreeOutEmpetyRollerOperate(); + if (LThreeOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料 { - while (!agvFryPotEmptyRollerArrive)//等待AGV拿到出桶空桶 + while (!LThreeagvFryPotEmptyRollerArrive)//等待AGV拿到出桶空桶 { Thread.Sleep(5); if (globalVar.ExitMainTask) return; } + LThreeagvFryPotEmptyRollerArrive = false; + MessageLog.GetInstance.ShowRunLog("AGV在【3】号滚筒线对应炒锅空桶上料完成,将进行空桶回收"); //AGV拿到空桶,让AGV运桶到指定位置,同时可以让下一个AGV从线体装料运到炒锅 - globalVar.AllowAgvToLineLoadRoller = true; - globalVar.InOrOutputLock = false; + globalVar.AllowAgvToLineThreeLoadRoller = true; + globalVar.LThreeInOrOutputLock = false; } } @@ -557,9 +1352,9 @@ namespace FryPot_DosingSystem.Control /// /// 炒锅滚筒进料运行到位处理 /// - public void FryPotInputMaterialRollerOperate() + public void FryPotInputMaterialRollerOperate(ConcurrentQueue queue) { - switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) + switch (queue.ElementAt(0).materialType.MaterialLoc / 100) { case 1: while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0) @@ -600,11 +1395,66 @@ namespace FryPot_DosingSystem.Control } /// - /// 炒锅滚筒空桶出桶处理 + /// 炒锅1,4滚筒进料运行到位处理 /// - public void FryPotOutEmpetyRollerOperate() + public void FryPotOneOrFourInputMaterialRollerOperate() { switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) + { + case 1: + while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0) + { + Thread.Sleep(5); if (globalVar.ExitMainTask) + return; + } + MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; + case 4: + while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0) + { + Thread.Sleep(5); if (globalVar.ExitMainTask) + return; + } + MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; + } + } + /// + /// 炒锅2,5滚筒进料运行到位处理 + /// + public void FryPotTwoOrFiveInputMaterialRollerOperate() + { + switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) + { + case 2: + while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0) + { + Thread.Sleep(5); if (globalVar.ExitMainTask) + return; + } + MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; + case 5: + while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0) + { + Thread.Sleep(5); if (globalVar.ExitMainTask) + return; + } + MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; + } + } + public void FryPotThreeInputMaterialRollerOperate() + { + while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0) + { + Thread.Sleep(5); if (globalVar.ExitMainTask) + return; + } + MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); + } + /// + /// 炒锅滚筒空桶出桶处理 + /// + public void FryPotOutEmpetyRollerOperate(ConcurrentQueue queue) + { + switch (queue.ElementAt(0).materialType.MaterialLoc / 100) { case 1: while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0) @@ -612,44 +1462,102 @@ namespace FryPot_DosingSystem.Control Thread.Sleep(5); if (globalVar.ExitMainTask) return; } - MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break; + MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; case 2: while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0) { Thread.Sleep(5); if (globalVar.ExitMainTask) return; } - MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break; + MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; case 3: while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0) { Thread.Sleep(5); if (globalVar.ExitMainTask) return; } - MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break; + MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; case 4: while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0) { Thread.Sleep(5); if (globalVar.ExitMainTask) return; } - MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break; + MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; case 5: while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0) { Thread.Sleep(5); if (globalVar.ExitMainTask) return; } - MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break; + MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; } } /// - /// 发送agv送料就位信号至PLC(线体到炒锅) + /// 炒锅1,4滚筒空桶出桶处理 /// - public void AgvArriveFryPotSingleSetDown() + public void FryPotOneOrFourOutEmpetyRollerOperate() { switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) + { + case 1: + while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0) + { + Thread.Sleep(5); if (globalVar.ExitMainTask) + return; + } + MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; + case 4: + while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0) + { + Thread.Sleep(5); if (globalVar.ExitMainTask) + return; + } + MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:【{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; + } + } + /// + /// 炒锅2,5滚筒空桶出桶处理 + /// + public void FryPotTwoOrFiveOutEmpetyRollerOperate() + { + switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) + { + case 2: + while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0) + { + Thread.Sleep(5); if (globalVar.ExitMainTask) + return; + } + MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; + case 5: + while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0) + { + Thread.Sleep(5); if (globalVar.ExitMainTask) + return; + } + MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; + } + } + /// + /// 炒锅3滚筒空桶出桶处理 + /// + public void FryPotThreeOutEmpetyRollerOperate() + { + while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0) + { + Thread.Sleep(5); if (globalVar.ExitMainTask) + return; + } + MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); + } + /// + /// 发送agv送料就位信号至PLC(线体到炒锅) + /// + public void AgvArriveFryPotSingleSetDown(ConcurrentQueue queue) + { + switch (queue.ElementAt(0).materialType.MaterialLoc / 100) { case 1: DeviceOperate.GetInstance.WritePlcData("D1055", 1); break;//agv到炒锅1送料就位信号 case 2: DeviceOperate.GetInstance.WritePlcData("D1056", 1); break;//agv到炒锅2送料就位信号 @@ -659,11 +1567,40 @@ namespace FryPot_DosingSystem.Control } } /// - /// 发送agv回桶就位信号至PLC + /// 发送agv送料就位信号至PLC(线体1到炒锅) /// - public void AgvArriveFryPotOutEmptyRollerSingleSetDown() + public void AgvArriveFryPotOneOrFourSingleSetDown() { switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) + { + case 1: DeviceOperate.GetInstance.WritePlcData("D1055", 1); break;//agv到炒锅1送料就位信号 + case 4: DeviceOperate.GetInstance.WritePlcData("D1058", 1); break;//agv到炒锅4送料就位信号 + } + } + /// + /// 发送agv送料就位信号至PLC(线体2到炒锅) + /// + public void AgvArriveFryPotTwoOrFiveSingleSetDown() + { + switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) + { + case 2: DeviceOperate.GetInstance.WritePlcData("D1056", 1); break;//agv到炒锅2送料就位信号 + case 5: DeviceOperate.GetInstance.WritePlcData("D1059", 1); break;//agv到炒锅5送料就位信号 + } + } + /// + /// 发送agv送料就位信号至PLC(线体3到炒锅) + /// + public void AgvArriveFryPotThreeSingleSetDown() + { + DeviceOperate.GetInstance.WritePlcData("D1057", 1); //agv到炒锅3送料就位信号 + } + /// + /// 发送agv回桶就位信号至PLC + /// + public void AgvArriveFryPotOutEmptyRollerSingleSetDown(ConcurrentQueue queue) + { + switch (queue.ElementAt(0).materialType.MaterialLoc / 100) { case 1: DeviceOperate.GetInstance.WritePlcData("D1060", 1); break;//agv到炒锅1送料就位信号 case 2: DeviceOperate.GetInstance.WritePlcData("D1061", 1); break;//agv到炒锅2送料就位信号 @@ -672,67 +1609,161 @@ namespace FryPot_DosingSystem.Control case 5: DeviceOperate.GetInstance.WritePlcData("D1064", 1); break;//agv到炒锅5送料就位信号 } } + + public void AgvArriveFryPotOneOrFourOutEmptyRollerSingleSetDown() + { + switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) + { + case 1: DeviceOperate.GetInstance.WritePlcData("D1060", 1); break;//agv到炒锅1送料就位信号 + case 4: DeviceOperate.GetInstance.WritePlcData("D1063", 1); break;//agv到炒锅4送料就位信号 + } + } + public void AgvArriveFryPotTwoOrFiveOutEmptyRollerSingleSetDown() + { + switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) + { + case 2: DeviceOperate.GetInstance.WritePlcData("D1061", 1); break;//agv到炒锅2送料就位信号 + case 5: DeviceOperate.GetInstance.WritePlcData("D1064", 1); break;//agv到炒锅5送料就位信号 + } + } + public void AgvArriveFryPotThreeOutEmptyRollerSingleSetDown() + { + DeviceOperate.GetInstance.WritePlcData("D1062", 1);//agv到炒锅3送料就位信号 + } /// /// AGV离开炒锅运送空桶任务 /// - public void AgvFromFryPotToClean() + public void AgvFromFryPotToClean(ConcurrentQueue queue) { - switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) + switch (queue.ElementAt(0).materialType.MaterialLoc / 100) { case 1: erp: string id = Guid.NewGuid().ToString("N");//上游唯一ID - if (id == robotJobId) + if (id == LOnerobotJobId) { goto erp; } string info = AGVHelper.GetInstance.AgvLeaveFryPotOne(id); - robotJobId = id; + LOnerobotJobId = id; FryCarryTaskErrorCodeAnalysis(info, 1); break; case 2: erp1: string id1 = Guid.NewGuid().ToString("N");//上游唯一ID - if (id1 == robotJobId) + if (id1 == LTworobotJobId) { goto erp1; } string info1 = AGVHelper.GetInstance.AgvLeaveFryPotTwo(id1); - robotJobId = id1; + LTworobotJobId = id1; FryCarryTaskErrorCodeAnalysis(info1, 2); break; case 3: erp2: string id2 = Guid.NewGuid().ToString("N");//上游唯一ID - if (id2 == robotJobId) + if (id2 == LThreerobotJobId) { goto erp2; } string info2 = AGVHelper.GetInstance.AgvLeaveFryPotThree(id2); - robotJobId = id2; + LThreerobotJobId = id2; FryCarryTaskErrorCodeAnalysis(info2, 3); break; case 4: erp3: string id3 = Guid.NewGuid().ToString("N");//上游唯一ID - if (id3 == robotJobId) + if (id3 == LOnerobotJobId) + { + goto erp3; + } + string info3 = AGVHelper.GetInstance.AgvLeaveFryPotFour(id3); + LOnerobotJobId = id3; + FryCarryTaskErrorCodeAnalysis(info3, 4); break; + case 5: + erp4: string id4 = Guid.NewGuid().ToString("N");//上游唯一ID + if (id4 == LTworobotJobId) + { + goto erp4; + } + string info4 = AGVHelper.GetInstance.AgvLeaveFryPotFive(id4); + LTworobotJobId = id4; + FryCarryTaskErrorCodeAnalysis(info4, 5); break; + } + } + /// + /// AGV离开炒锅1,4运送空桶任务 + /// + public void AgvFromFryPotOneOrFourToClean() + { + switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) + { + case 1: + erp: string id = Guid.NewGuid().ToString("N");//上游唯一ID + if (id == LOnerobotJobId) + { + goto erp; + } + MessageLog.GetInstance.ShowRunLog("AGV执行【1】号炒锅空桶回收任务"); + string info = AGVHelper.GetInstance.AgvLeaveFryPotOne(id); + LOnerobotJobId = id; + FryCarryTaskErrorCodeAnalysis(info, 1); break; + case 4: + erp3: string id3 = Guid.NewGuid().ToString("N");//上游唯一ID + if (id3 == LOnerobotJobId) { goto erp3; } + MessageLog.GetInstance.ShowRunLog("AGV执行【4】号炒锅空桶回收任务"); string info3 = AGVHelper.GetInstance.AgvLeaveFryPotFour(id3); - robotJobId = id3; + LOnerobotJobId = id3; FryCarryTaskErrorCodeAnalysis(info3, 4); break; + } + } + /// + /// AGV离开炒锅2,5运送空桶任务 + /// + public void AgvFromFryPotTwoOrFiveToClean() + { + switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) + { + case 2: + erp1: string id1 = Guid.NewGuid().ToString("N");//上游唯一ID + if (id1 == LTworobotJobId) + { + goto erp1; + } + MessageLog.GetInstance.ShowRunLog("AGV执行【2】号炒锅空桶回收任务"); + string info1 = AGVHelper.GetInstance.AgvLeaveFryPotTwo(id1); + LTworobotJobId = id1; + FryCarryTaskErrorCodeAnalysis(info1, 2); break; case 5: erp4: string id4 = Guid.NewGuid().ToString("N");//上游唯一ID - if (id4 == robotJobId) + if (id4 == LTworobotJobId) { goto erp4; } + MessageLog.GetInstance.ShowRunLog("AGV执行【5】号炒锅空桶回收任务"); string info4 = AGVHelper.GetInstance.AgvLeaveFryPotFive(id4); - robotJobId = id4; + LTworobotJobId = id4; FryCarryTaskErrorCodeAnalysis(info4, 5); break; } } /// + /// AGV离开炒锅3运送空桶任务 + /// + public void AgvFromFryPotThreeToClean() + { + erp2: string id2 = Guid.NewGuid().ToString("N");//上游唯一ID + if (id2 == LThreerobotJobId) + { + goto erp2; + } + MessageLog.GetInstance.ShowRunLog("AGV执行【3】号炒锅空桶回收任务"); + string info2 = AGVHelper.GetInstance.AgvLeaveFryPotThree(id2); + LThreerobotJobId = id2; + FryCarryTaskErrorCodeAnalysis(info2, 3); + } + /// /// 处理agv从线体1到送料到炒锅的条件 /// /// public void AgvFromLineOneToFryPot() { - erp: if (globalVar.rollerLineOne.OutMaterialingTroubleSingle == 0)//无故障 + erp: if (AlarmHelper.Alarm.LOneRollerTrouble == 0)//无故障 { while (!agvArriveUpLoad)//等待AGV到线体装料位置 { @@ -741,7 +1772,8 @@ namespace FryPot_DosingSystem.Control return; } agvArriveUpLoad = false; - AgvArriveLineSingelSetDown(); + MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置"); + AgvArriveLineSingelSetDown(InputMaterialQuene); if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo)) { while (!(globalVar.rollerLineOne.StationEight == materialInfo.materialType.MaterialLoc))//等待线体工号位8存放对应原料桶号 @@ -750,6 +1782,7 @@ namespace FryPot_DosingSystem.Control if (globalVar.ExitMainTask) return; } + MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶"); OutputMaterialQuene.Enqueue(materialInfo); //原料到位,agv到位,agv自行运料到炒锅 } @@ -757,9 +1790,9 @@ namespace FryPot_DosingSystem.Control } else//有故障 { - while (globalVar.rollerLineOne.OutMaterialingTroubleSingle == 1) + while (AlarmHelper.Alarm.LOneRollerTrouble == 1) { - Thread.Sleep(50); + Thread.Sleep(5); if (globalVar.ExitMainTask) return; } @@ -774,17 +1807,18 @@ namespace FryPot_DosingSystem.Control /// public void AgvFromLineTwoToFryPot() { - erp: if (globalVar.rollerLineTwo.OutMaterialingTroubleSingle == 0)//无故障 + erp: if (AlarmHelper.Alarm.LTwoRollerTrouble == 0)//无故障 { - while (!agvArriveUpLoad)//等待AGV到线体装料位置 + while (!agvArriveLTwoUpLoad)//等待AGV到线体装料位置 { Thread.Sleep(5); if (globalVar.ExitMainTask) return; } - agvArriveUpLoad = false; - AgvArriveLineSingelSetDown(); - if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo)) + agvArriveLTwoUpLoad = false; + MessageLog.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置"); + AgvArriveLineSingelSetDown(LTwoInputMaterialQuene); + if (LTwoInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo)) { while (!(globalVar.rollerLineTwo.StationEight == materialInfo.materialType.MaterialLoc))//等待线体工号位8存放对应原料桶号 { @@ -792,16 +1826,17 @@ namespace FryPot_DosingSystem.Control if (globalVar.ExitMainTask) return; } - OutputMaterialQuene.Enqueue(materialInfo); + MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶"); + LTwoOutputMaterialQuene.Enqueue(materialInfo); //原料到位,agv到位,agv运料到炒锅 } } else//有故障 { - while (globalVar.rollerLineTwo.OutMaterialingTroubleSingle == 1) + while (AlarmHelper.Alarm.LTwoRollerTrouble == 1) { - Thread.Sleep(50); + Thread.Sleep(5); if (globalVar.ExitMainTask) return; } @@ -816,17 +1851,18 @@ namespace FryPot_DosingSystem.Control /// public void AgvFromLineThreeToFryPot() { - erp: if (globalVar.rollerLineThree.OutMaterialingTroubleSingle == 0)//无故障 + erp: if (AlarmHelper.Alarm.LThreeRollerTrouble == 0)//无故障 { - while (!agvArriveUpLoad)//等待AGV到线体装料位置 + while (!agvArriveLThreeUpLoad)//等待AGV到线体装料位置 { Thread.Sleep(5); if (globalVar.ExitMainTask) return; } - agvArriveUpLoad = false; - AgvArriveLineSingelSetDown(); - if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo)) + agvArriveLThreeUpLoad = false; + MessageLog.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置"); + AgvArriveLineSingelSetDown(LThreeInputMaterialQuene); + if (LThreeInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo)) { while (!(globalVar.rollerLineThree.StationEight == materialInfo.materialType.MaterialLoc))//等待线体工号位8存放对应原料桶号 { @@ -834,16 +1870,17 @@ namespace FryPot_DosingSystem.Control if (globalVar.ExitMainTask) return; } - OutputMaterialQuene.Enqueue(materialInfo); + MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶"); + LThreeOutputMaterialQuene.Enqueue(materialInfo); //原料到位,agv到位,agv运料到炒锅 } } else //有故障 { - while (globalVar.rollerLineThree.OutMaterialingTroubleSingle == 1) + while (AlarmHelper.Alarm.LThreeRollerTrouble == 1) { - Thread.Sleep(50); + Thread.Sleep(5); if (globalVar.ExitMainTask) return; } @@ -861,16 +1898,16 @@ namespace FryPot_DosingSystem.Control { if (errorCode == "SUCCESS") { - MessageLog.GetInstance.ShowRunLog($"AGV去{num}号线体"); + MessageLog.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装桶"); globalVar.AllowAgvToLineLoadRoller = false; } else if (errorCode == "Analysis Error") { - MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号线体接口调用失败,请检查"); + MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查"); } else { - MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号线体失败,错误码:{errorCode}"); + MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线失败,错误码:{errorCode}"); } } /// @@ -896,7 +1933,7 @@ namespace FryPot_DosingSystem.Control public void AgvToLineOneLoadRoller() { - if (globalVar.rollerLineOne.OutMaterialingTroubleSingle == 0)//输送线无故障 + if (AlarmHelper.Alarm.LOneRollerTrouble == 0)//输送线无故障 { if (InputMaterialQuene.Count > 0) { @@ -907,10 +1944,11 @@ namespace FryPot_DosingSystem.Control return; } e: string id = Guid.NewGuid().ToString("N"); - if (id == robotJobId) + if (id == LOnerobotJobId) goto e; + string info = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id); - robotJobId = id; + LOnerobotJobId = id; Thread.Sleep(500); LineCarryTaskErrorCodeAnalysis(info, 1); } @@ -924,21 +1962,22 @@ namespace FryPot_DosingSystem.Control } public void AgvToLineTwoLoadRoller() { - if (globalVar.rollerLineTwo.OutMaterialingTroubleSingle == 0)//输送线无故障 + if (AlarmHelper.Alarm.LTwoRollerTrouble == 0)//输送线无故障 { - if (InputMaterialQuene.Count > 0) + if (LTwoInputMaterialQuene.Count > 0) { - while (!globalVar.AllowAgvToLineLoadRoller || globalVar.rollerLineOne.OutMaterialingSingle == 0) //后续考虑是否用while + while (!globalVar.AllowAgvToLineTwoLoadRoller || globalVar.rollerLineTwo.OutMaterialingSingle == 0) //后续考虑是否用while { Thread.Sleep(5); if (globalVar.ExitMainTask) return; } p: string id = Guid.NewGuid().ToString(); - if (id == robotJobId) + if (id == LTworobotJobId) goto p; string info = AGVHelper.GetInstance.AgvToLineTwoLoadRoller(id); - robotJobId = id; + // MessageLog.GetInstance.ShowRunLog("AGV去【2】号滚筒线装桶"); + LTworobotJobId = id; Thread.Sleep(500); LineCarryTaskErrorCodeAnalysis(info, 2); } @@ -953,21 +1992,22 @@ namespace FryPot_DosingSystem.Control } public void AgvToLineThreeLoadRoller() { - if (globalVar.rollerLineThree.OutMaterialingTroubleSingle == 0)//输送线无故障 + if (AlarmHelper.Alarm.LThreeRollerTrouble == 0)//输送线无故障 { - if (InputMaterialQuene.Count > 0) + if (LThreeInputMaterialQuene.Count > 0) { - while (!globalVar.AllowAgvToLineLoadRoller || globalVar.rollerLineOne.OutMaterialingSingle == 0) //后续考虑是否用while + while (!globalVar.AllowAgvToLineThreeLoadRoller || globalVar.rollerLineThree.OutMaterialingSingle == 0) //后续考虑是否用while { Thread.Sleep(5); if (globalVar.ExitMainTask) return; } g: string id = Guid.NewGuid().ToString(); - if (id == robotJobId) + if (id == LThreerobotJobId) goto g; string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id); - robotJobId = id; + // MessageLog.GetInstance.ShowRunLog("AGV去【3】号滚筒线装桶"); + LThreerobotJobId = id; Thread.Sleep(500); LineCarryTaskErrorCodeAnalysis(info, 3); } @@ -1117,11 +2157,11 @@ namespace FryPot_DosingSystem.Control } /// - /// AGV进料就位信号下发至PLC + /// AGV线体进料就位信号下发至PLC /// - public void AgvArriveLineSingelSetDown() + public void AgvArriveLineSingelSetDown(ConcurrentQueue queue) { - switch (InputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) + switch (queue.ElementAt(0).materialType.MaterialLoc / 100) { case 1: case 4: DeviceOperate.GetInstance.WritePlcData("D1052", 1); break;//AGV进料就位信号1 @@ -1131,56 +2171,130 @@ namespace FryPot_DosingSystem.Control } } + /// /// 炒锅滚筒信号检测 /// public void FryPotRollerTroubleCheck() { FryPotAlarm = 0; + FryPotTwoAlarm = 0; + FryPotThreeAlarm = 0; + FryPotFourAlarm = 0; + FryPotFiveAlarm = 0; switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) { case 1: - if (globalVar.fryPotOne.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotOne.RollerTroubleSingle == 1) + if (AlarmHelper.Alarm.FryPotOneRollerTrouble == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (AlarmHelper.Alarm.FryPotOneRollerTrouble == 1) { - Thread.Sleep(50); if (globalVar.ExitMainTask) + Thread.Sleep(5); if (globalVar.ExitMainTask) return; } MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行"); FryPotAlarm = 1; break; case 2: - if (globalVar.fryPotTwo.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【2】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotTwo.RollerTroubleSingle == 1) + if (AlarmHelper.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【2】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; } while (AlarmHelper.Alarm.FryPotTwoRollerTrouble == 1) { - Thread.Sleep(50); if (globalVar.ExitMainTask) + Thread.Sleep(5); if (globalVar.ExitMainTask) return; } MessageLog.GetInstance.ShowRunLog("炒锅【2】输送滚筒故障解除,继续运行"); - FryPotAlarm = 1; break; + FryPotTwoAlarm = 1; break; case 3: - if (globalVar.fryPotThree.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotThree.RollerTroubleSingle == 1) + if (AlarmHelper.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; } while (AlarmHelper.Alarm.FryPotThreeRollerTrouble == 1) { - Thread.Sleep(50); if (globalVar.ExitMainTask) + Thread.Sleep(5); if (globalVar.ExitMainTask) return; } MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行"); - FryPotAlarm = 1; break; + FryPotThreeAlarm = 1; break; case 4: - if (globalVar.fryPotFour.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotFour.RollerTroubleSingle == 1) + if (AlarmHelper.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; } while (AlarmHelper.Alarm.FryPotFourRollerTrouble == 1) { - Thread.Sleep(50); if (globalVar.ExitMainTask) + Thread.Sleep(5); if (globalVar.ExitMainTask) return; } MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行"); - FryPotAlarm = 1; break; + FryPotFourAlarm = 1; break; case 5: - if (globalVar.fryPotFive.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【5】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotFive.RollerTroubleSingle == 1) + if (AlarmHelper.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【5】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; } while (AlarmHelper.Alarm.FryPotFiveRollerTrouble == 1) { - Thread.Sleep(50); if (globalVar.ExitMainTask) + Thread.Sleep(5); if (globalVar.ExitMainTask) return; } MessageLog.GetInstance.ShowRunLog("炒锅【5】输送滚筒故障解除,继续运行"); + FryPotFiveAlarm = 1; break; + + } + } + /// + /// 炒锅1,4滚筒信号检测 + /// + public void FryPotOneRollerTroubleCheck() + { + FryPotAlarm = 0; + FryPotFourAlarm = 0; + switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) + { + case 1: + if (AlarmHelper.Alarm.FryPotOneRollerTrouble == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotOneRollerTrouble == 1) + { + Thread.Sleep(5); if (globalVar.ExitMainTask) + return; + } + MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行"); FryPotAlarm = 1; break; + case 4: + if (AlarmHelper.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotFourRollerTrouble == 1) + { + Thread.Sleep(5); if (globalVar.ExitMainTask) + return; + } + MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行"); + FryPotFourAlarm = 1; break; + } + } + /// + /// 炒锅2,5滚筒信号检测 + /// + public void FryPotTwoRollerTroubleCheck() + { + FryPotTwoAlarm = 0; + FryPotFiveAlarm = 0; + switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) + { + case 2: + if (AlarmHelper.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotTwoRollerTrouble == 1) + { + Thread.Sleep(5); if (globalVar.ExitMainTask) + return; + } + MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行"); + FryPotTwoAlarm = 1; break; + case 5: + if (AlarmHelper.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotFiveRollerTrouble == 1) + { + Thread.Sleep(5); if (globalVar.ExitMainTask) + return; + } + MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行"); + FryPotFiveAlarm = 1; break; + } + } + /// + /// 炒锅3滚筒信号检测 + /// + public void FryPotThreeRollerTroubleCheck() + { + FryPotThreeAlarm = 0; + if (AlarmHelper.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotThreeRollerTrouble == 1) + { + Thread.Sleep(5); if (globalVar.ExitMainTask) + return; } + MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行"); + FryPotThreeAlarm = 1; } } diff --git a/FryPot_DosingSystem/Control/GlobalVariable.cs b/FryPot_DosingSystem/Control/GlobalVariable.cs index 90119a8e..c2afb2e6 100644 --- a/FryPot_DosingSystem/Control/GlobalVariable.cs +++ b/FryPot_DosingSystem/Control/GlobalVariable.cs @@ -11,6 +11,8 @@ namespace FryPot_DosingSystem.Control /// internal class GlobalVariable { + + /// /// 滚筒线1 /// @@ -61,17 +63,57 @@ namespace FryPot_DosingSystem.Control /// public bool ExitMainTask { get; set; } /// - /// 允许AGV去线体装桶条件 + /// 允许AGV去线体1装桶条件 /// public bool AllowAgvToLineLoadRoller { get; set; } = true; /// + /// 允许AGV去线体2装桶条件 + /// + public bool AllowAgvToLineTwoLoadRoller { get; set; } = true; + /// + /// 允许AGV去线体3装桶条件 + /// + public bool AllowAgvToLineThreeLoadRoller { get; set; } = true; + /// /// 配方唯一ID /// public string RecipeId { get; set; } /// - /// 进桶出桶互锁 + /// 线体1对应的进桶出桶互锁 /// public bool InOrOutputLock { get; set; } + /// + /// 线体2对应的进桶出桶互锁 + /// + public bool LTwoInOrOutputLock { get; set; } + /// + /// 线体3对应的进桶出桶互锁 + /// + public bool LThreeInOrOutputLock { get; set; } + /// + /// 线体1任务执行锁 + /// + public bool LOneTaskLock { get; set; } + /// + /// 线体2任务执行锁 + /// + public bool LTwoTaskLock { get; set; } + /// + /// 线体3任务执行锁 + /// + public bool LThreeTaskLock { get; set; } + /// + /// 线体1当前正在制作的配方名称 + /// + public string LOneCurrentRecipeName { get; set; } = string.Empty; + /// + /// 线体2当前正在制作的配方名称 + /// + public string LTwoCurrentRecipeName { get; set; } = string.Empty; + /// + /// 线体3当前正在制作的配方名称 + /// + public string LThreeCurrentRecipeName { get; set; } = string.Empty; #endregion } diff --git a/FryPot_DosingSystem/Model/MaterialNames.cs b/FryPot_DosingSystem/Model/MaterialNames.cs new file mode 100644 index 00000000..56dbd017 --- /dev/null +++ b/FryPot_DosingSystem/Model/MaterialNames.cs @@ -0,0 +1,17 @@ +using Microsoft.Toolkit.Mvvm.ComponentModel; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FryPot_DosingSystem.Model +{ + public class MaterialNames:ObservableObject + { + private static MaterialNames _instance; + public static MaterialNames GetInstance=>_instance ?? (_instance = new MaterialNames()); + public ObservableCollection Names { get; set; }=new ObservableCollection(); + } +} diff --git a/FryPot_DosingSystem/View/DebugView.xaml b/FryPot_DosingSystem/View/DebugView.xaml new file mode 100644 index 00000000..24afcb6c --- /dev/null +++ b/FryPot_DosingSystem/View/DebugView.xaml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + - + - + diff --git a/FryPot_DosingSystem/View/NewRecipeView.xaml b/FryPot_DosingSystem/View/NewRecipeView.xaml index 155b8795..891894a2 100644 --- a/FryPot_DosingSystem/View/NewRecipeView.xaml +++ b/FryPot_DosingSystem/View/NewRecipeView.xaml @@ -190,17 +190,26 @@ - + + - + - - - + + + + + + + + @@ -208,7 +217,22 @@ - + + + + + + + + + + + + + + + + @@ -228,8 +252,8 @@ - - + +