Browse Source

180更新

样式分支
taoye 2 years ago
parent
commit
3c675cba5f
22 changed files with 869 additions and 184 deletions
  1. +430
    -42
      BPASmartClient.AGV/AGVHelper.cs
  2. +2
    -0
      BPASmartClient.AGV/AGVLoadInteracteModel.cs
  3. +3
    -0
      BPASmartClient.AGV/AGVModel.cs
  4. +4
    -3
      BPASmartClient.AGV/AGVRequestUrl.cs
  5. +2
    -0
      BPASmartClient.AGV/AGVTaskCancelModel.cs
  6. +2
    -0
      BPASmartClient.AGV/AGVTaskCompleteNotifyModel.cs
  7. +2
    -0
      BPASmartClient.AGV/AGV_PointRollerJobData.cs
  8. +3
    -1
      BPASmartClient.AGV/AGV_SlotRollerJobData.cs
  9. +13
    -0
      BPASmartClient.AGV/App.config
  10. +1
    -0
      BPASmartClient.AGV/BPASmartClient.AGV.csproj
  11. +2
    -29
      BPASmartClient.AGV/Feedback/AGVToUpSystem.cs
  12. +41
    -0
      BPASmartClient.AGV/Feedback/AGVToUpSystemBody.cs
  13. +17
    -0
      BPASmartClient.AGV/Feedback/AGVUpReportHeader.cs
  14. +3
    -42
      BPASmartClient.AGV/Feedback/Upstreamrequest.cs
  15. +54
    -0
      BPASmartClient.AGV/Feedback/UpstreamrequestBody.cs
  16. +7
    -5
      BPASmartClient.AGV/HttpRequestHeaderModel.cs
  17. +16
    -0
      BPASmartClient.AGV/HttpResponseBodyModel.cs
  18. +15
    -0
      BPASmartClient.AGV/HttpResponseHeaderModel.cs
  19. +2
    -4
      BPASmartClient.AGV/HttpResponseModel.cs
  20. +2
    -2
      BPASmartClient.AgvApi/Controllers/robotjobController.cs
  21. +246
    -56
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  22. +2
    -0
      FryPot_DosingSystem/FryPot_DosingSystem.csproj

+ 430
- 42
BPASmartClient.AGV/AGVHelper.cs View File

@@ -7,7 +7,7 @@ using System.Net;
using System.Web;
using Newtonsoft.Json;
using System.Net.Http;
using System.Configuration;

namespace BPASmartClient.AGV
{
@@ -20,7 +20,24 @@ namespace BPASmartClient.AGV
{
}

/// <summary>
/// 获取配置文件信息
/// </summary>
/// <param name="strKey"></param>
/// <returns></returns>
public string GetAppSettingValue(string strKey)
{
string file = System.Environment.CurrentDirectory;
Configuration config = ConfigurationManager.OpenExeConfiguration(file);
foreach (string key in config.AppSettings.Settings.AllKeys)
{
if (key == strKey)
{
return config.AppSettings.Settings[strKey].Value.ToString();
}
}
return null;
}
public string HttpRequest(string url, string head, string body)
{
return PostData(url, head, body);
@@ -57,89 +74,460 @@ namespace BPASmartClient.AGV
/// AGV去1号线体装桶
/// </summary>
/// <returns></returns>
public string AgvToLineOneLoadRoller()
public string AgvToLineOneLoadRoller(string robotJobId)
{
string url = "";
string head = "";
string body = "";
return HttpRequest(url,head,body);
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId =robotJobId ;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
// string newBody = String.Join(",\r\n", bodyData.Split(','));//格式处理,看需求
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// AGV去2号线体装桶
/// </summary>
/// <returns></returns>
public string AgvToLineTwoLoadRoller()
public string AgvToLineTwoLoadRoller(string robotJobId)
{
string url = "";
string head = "";
string body = "";
return HttpRequest(url, head, body);
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data= HttpRequest(url, head, body);
object objData= JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// AGV去3号线体装桶
/// </summary>
/// <returns></returns>
public string AgvToLineThreeLoadRoller()
public string AgvToLineThreeLoadRoller(string robotJobId)
{
string url = "";
string head = "";
string body = "";
return HttpRequest(url, head, body);
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// AGV离开炒锅1
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotOne()
public string AgvLeaveFryPotOne(string robotJobId)
{
string url = "";
string head = "";
string body = "";
return HttpRequest(url, head, body);
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// AGV离开炒锅2
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotTwo()
public string AgvLeaveFryPotTwo(string robotJobId)
{
string url = "";
string head = "";
string body = "";
return HttpRequest(url, head, body);
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// AGV离开炒锅3
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotThree()
public string AgvLeaveFryPotThree(string robotJobId)
{
string url = "";
string head = "";
string body = "";
return HttpRequest(url, head, body);
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// AGV离开炒锅4
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotFour()
public string AgvLeaveFryPotFour(string robotJobId)
{
string url = "";
string head = "";
string body = "";
return HttpRequest(url, head, body);
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// AGV离开炒锅5
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotFive()
public string AgvLeaveFryPotFive(string robotJobId)
{
string url = "";
string head = "";
string body = "";
return HttpRequest(url, head, body);
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// 任务取消
/// </summary>
/// <param name="robotJobId">上游系统任务号,全局唯一</param>
public string CancelJobTask(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskCancelUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVTaskCancelModel.GetInstance.robotJobId = robotJobId;
AGVTaskCancelModel.GetInstance.warehouseId = 123;//仓库编号
string body = JsonConvert.SerializeObject(AGVTaskCancelModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// 实操任务完成通知
/// </summary>
/// <returns></returns>
public string TaskCompleteNotify(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskCompleteUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVTaskCompleteNotifyModel.GetInstance.robotJobId = robotJobId;
AGVTaskCompleteNotifyModel.GetInstance.warehouseId = 123;//仓库编号
string body=JsonConvert.SerializeObject(AGVTaskCompleteNotifyModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
/// <summary>
/// AGV上下料交互反馈
/// </summary>
/// <param name="agvCode">AGV编号</param>
/// <param name="jobId">任务编号</param>
/// <param name="msgId">消息编号</param>
/// <returns></returns>
public string UpDownFeedBack(string agvCode,string jobId,string msgId)
{
string url = AGVRequestUrl.GetInstance.TaskCompleteUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVLoadInteracteModel.GetInstance.agvCode = agvCode;
AGVLoadInteracteModel.GetInstance.jobId = jobId;
AGVLoadInteracteModel.GetInstance.msgId= msgId;
string body=JsonConvert.SerializeObject(AGVLoadInteracteModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
return "Analysis Error";
}
}
}

+ 2
- 0
BPASmartClient.AGV/AGVLoadInteracteModel.cs View File

@@ -11,6 +11,8 @@ namespace BPASmartClient.AGV
/// </summary>
internal class AGVLoadInteracteModel
{
private static AGVLoadInteracteModel _instance;
public static AGVLoadInteracteModel GetInstance=>_instance ??= new AGVLoadInteracteModel();
public string agvCode { get; set;}
public string jobId { get; set; }
public string msgId { get; set; }


+ 3
- 0
BPASmartClient.AGV/AGVModel.cs View File

@@ -11,6 +11,9 @@ namespace BPASmartClient.AGV
/// </summary>
internal class AGVModel
{
private static AGVModel _instance;
public static AGVModel GetInstance => _instance ??= new AGVModel();
/// <summary>
/// 必填项
/// </summary>


+ 4
- 3
BPASmartClient.AGV/AGVRequestUrl.cs View File

@@ -2,10 +2,11 @@
{
public class AGVRequestUrl
{
//public string HttpHeader { get; set; }
//public string TaskSendBody { get; set; }
public AGVRequestUrl(string IpAddress)
private static AGVRequestUrl _instance;
public static AGVRequestUrl GetInstance => _instance ??= new AGVRequestUrl();
public AGVRequestUrl()
{
string IpAddress = "";
TaskSendUrl= $"http://{IpAddress}/api/quicktron/wcs/standardized.robot.job.submit";
TaskCancelUrl= $"http://{IpAddress}/api/quicktron/wcs/standardized.robot.job.cancel";
TaskCompleteUrl= $"http://{IpAddress}/api/quicktron/wcs/standardized.operation.notice";


+ 2
- 0
BPASmartClient.AGV/AGVTaskCancelModel.cs View File

@@ -11,6 +11,8 @@ namespace BPASmartClient.AGV
/// </summary>
internal class AGVTaskCancelModel
{
private static AGVTaskCancelModel _instance;
public static AGVTaskCancelModel GetInstance => _instance ??= new AGVTaskCancelModel();
public string robotJobId { get; set; }
public long warehouseId { get; set; }
public string? executeMode { get; set; }


+ 2
- 0
BPASmartClient.AGV/AGVTaskCompleteNotifyModel.cs View File

@@ -11,6 +11,8 @@ namespace BPASmartClient.AGV
/// </summary>
internal class AGVTaskCompleteNotifyModel
{
private static AGVTaskCompleteNotifyModel _instance;
public static AGVTaskCompleteNotifyModel GetInstance=>_instance ??= new AGVTaskCompleteNotifyModel();
public string? robotJobId { get; set; }
public string? bucketCode { get; set; }
public string? bucketslotCode { get; set; }


+ 2
- 0
BPASmartClient.AGV/AGV_PointRollerJobData.cs View File

@@ -11,6 +11,8 @@ namespace BPASmartClient.AGV
/// </summary>
internal class AGV_PointRollerJobData:IJobData
{
private static AGV_PointRollerJobData _instance;
public static AGV_PointRollerJobData GetInstance => _instance ??= new AGV_PointRollerJobData();
public string? containerCode { get; set; }
public string startPoint { get; set; }
public string endPoint { get; set; }


+ 3
- 1
BPASmartClient.AGV/AGV_SlotRollerJobData.cs View File

@@ -11,8 +11,10 @@ namespace BPASmartClient.AGV
/// </summary>
internal class AGV_SlotRollerJobData:IJobData
{
private static AGV_SlotRollerJobData _instance;
public static AGV_SlotRollerJobData GetInstance => _instance ??= new AGV_SlotRollerJobData();
public string? containerCode { get; set; }
public string startIotCode { get; set; }
public string startSlotCode { get; set; }
public string endSlotCode { get; set; }
public bool autoLoad { get; set; }
public bool enableIOLoad { get; set; }


+ 13
- 0
BPASmartClient.AGV/App.config View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!--请求报文头-->
<add key="appKey" value="132"/>
<add key="appSecret" value="123"/>
<add key="requestId" value="123"/>
<add key="timestamp" value="123"/>
<add key ="version" value="2.8"/>
<!--请求报文体-->
</appSettings>
</configuration>

+ 1
- 0
BPASmartClient.AGV/BPASmartClient.AGV.csproj View File

@@ -8,6 +8,7 @@

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
</ItemGroup>

</Project>

+ 2
- 29
BPASmartClient.AGV/Feedback/AGVToUpSystem.cs View File

@@ -8,34 +8,7 @@ namespace BPASmartClient.AGV.Feedback
{
public class AGVToUpSystem
{
/// <summary>
/// 上游系统任务号,全局唯一
/// </summary>
public string robotJobId { get; set; }

/// <summary>
/// 仓库编号
/// </summary>
public int warehouseId { get; set; }

/// <summary>
/// 任务快仓系统编号
/// </summary>
public string jobId { get; set; }

/// <summary>
/// 任务状态
/// </summary>
public string state { get; set; }

/// <summary>
/// 内部任务类型
/// </summary>
public string jobType { get; set; }

/// <summary>
/// 数据字段
/// </summary>
public JobData jobData { get; set; } = new JobData();
public AGVUpReportHeader? head { get; set; }
public AGVToUpSystemBody? body { get; set; }
}
}

+ 41
- 0
BPASmartClient.AGV/Feedback/AGVToUpSystemBody.cs View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV.Feedback
{
public class AGVToUpSystemBody
{
/// <summary>
/// 上游系统任务号,全局唯一
/// </summary>
public string robotJobId { get; set; }

/// <summary>
/// 仓库编号
/// </summary>
public int warehouseId { get; set; }

/// <summary>
/// 任务快仓系统编号
/// </summary>
public string jobId { get; set; }

/// <summary>
/// 任务状态
/// </summary>
public string state { get; set; }

/// <summary>
/// 内部任务类型
/// </summary>
public string jobType { get; set; }

/// <summary>
/// 数据字段
/// </summary>
public JobData jobData { get; set; } = new JobData();
}
}

+ 17
- 0
BPASmartClient.AGV/Feedback/AGVUpReportHeader.cs View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV.Feedback
{
public class AGVUpReportHeader
{
public string? appKey { get; set; }
public string? appSecret { get; set; }
public string? requestId { get; set; }
public string? timestamp { get; set; }
public string? version { get; set; }
}
}

+ 3
- 42
BPASmartClient.AGV/Feedback/Upstreamrequest.cs View File

@@ -6,49 +6,10 @@ using System.Threading.Tasks;

namespace BPASmartClient.AGV.Feedback
{
public class Upstreamrequest
public class UpStreamrequest
{
/// <summary>
/// AGV编号
/// </summary>
public string agvCode { get; set; }

/// <summary>
/// 容器编号,如果一次上/下多个容器,则多个容器用英文逗号分隔
/// </summary>
public string containerCode { get; set; }

/// <summary>
/// 上游设备ID 本字段适用于只有一个辊筒设备的时候使用
/// </summary>
public long equipmentId { get; set; }

/// <summary>
/// 上游设备ID,多个用英文逗号分隔 本字段适用于多辊筒同时上下料的时候使用
/// </summary>
public string equipmentIds { get; set; }

/// <summary>
/// 快仓任务编号
/// </summary>
public string jobId { get; set; }

/// <summary>
/// 消息ID
/// </summary>
public string msgId { get; set; }

/// <summary>
/// 交互阶段
/// LOAD:上料阶段
/// UNLOAD:下料阶段
/// </summary>
public string command { get; set; }

/// <summary>
/// 上游任务号
/// </summary>
public string robotJobId { get; set; }
public AGVUpReportHeader? head { get; set; }

public UpstreamrequestBody? body { get; set; }
}
}

+ 54
- 0
BPASmartClient.AGV/Feedback/UpstreamrequestBody.cs View File

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV.Feedback
{
public class UpstreamrequestBody
{
/// <summary>
/// AGV编号
/// </summary>
public string agvCode { get; set; }

/// <summary>
/// 容器编号,如果一次上/下多个容器,则多个容器用英文逗号分隔
/// </summary>
public string containerCode { get; set; }

/// <summary>
/// 上游设备ID 本字段适用于只有一个辊筒设备的时候使用
/// </summary>
public long equipmentId { get; set; }

/// <summary>
/// 上游设备ID,多个用英文逗号分隔 本字段适用于多辊筒同时上下料的时候使用
/// </summary>
public string equipmentIds { get; set; }

/// <summary>
/// 快仓任务编号
/// </summary>
public string jobId { get; set; }

/// <summary>
/// 消息ID
/// </summary>
public string msgId { get; set; }

/// <summary>
/// 交互阶段
/// LOAD:上料阶段
/// UNLOAD:下料阶段
/// </summary>
public string command { get; set; }

/// <summary>
/// 上游任务号
/// </summary>
public string robotJobId { get; set; }

}
}

+ 7
- 5
BPASmartClient.AGV/HttpRequestHeaderModel.cs View File

@@ -8,10 +8,12 @@ namespace BPASmartClient.AGV
{
internal class HttpRequestHeaderModel
{
public string appKey { get; set; }
public string appSecret { get; set; }
public string requestId { get; set; }
public string timestamp { get; set; }
public string version { get; set; }
private static HttpRequestHeaderModel _instance;
public static HttpRequestHeaderModel GetInstance => _instance ??= new HttpRequestHeaderModel();
public string? appKey { get; set; }
public string? appSecret { get; set; }
public string? requestId { get; set; }
public string? timestamp { get; set; }
public string? version { get; set; }
}
}

+ 16
- 0
BPASmartClient.AGV/HttpResponseBodyModel.cs View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV
{
internal class HttpResponseBodyModel
{
public string code { get; set; }
public string message { get; set; }
public bool success { get; set; }
public HttpResponseData data { get; set; }
}
}

+ 15
- 0
BPASmartClient.AGV/HttpResponseHeaderModel.cs View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV
{
internal class HttpResponseHeaderModel
{
public string? requestId { get; set; }
public string? timestamp { get; set; }
public string? version { get; set; }
}
}

+ 2
- 4
BPASmartClient.AGV/HttpResponseModel.cs View File

@@ -8,9 +8,7 @@ namespace BPASmartClient.AGV
{
internal class HttpResponseModel
{
public string code { get; set; }
public string message { get; set; }
public bool success { get; set; }
public HttpResponseData data { get; set; }
public HttpResponseHeaderModel? Header { get; set; }
public HttpResponseBodyModel? Body { get; set; }
}
}

+ 2
- 2
BPASmartClient.AgvApi/Controllers/robotjobController.cs View File

@@ -15,7 +15,7 @@ namespace BPASmartClient.AgvApi.Controllers
/// <param name="sign"></param>
/// <returns></returns>
[HttpPost("report")]
public string report(AGVToUpSystem ent)
public string report(AGVToUpSystemBody ent)
{
if (ent != null)
{
@@ -30,7 +30,7 @@ namespace BPASmartClient.AgvApi.Controllers
/// <param name="upstreamrequest"></param>
/// <returns></returns>
[HttpPost("upstreamrequest")]
public string upstreamrequest(Upstreamrequest upstreamrequest)
public string upstreamrequest(UpstreamrequestBody upstreamrequest)
{
if (upstreamrequest != null)
{


+ 246
- 56
FryPot_DosingSystem/Control/DosingLogicControl.cs View File

@@ -1,7 +1,11 @@
using BPASmartClient.AGV;
using BPASmartClient.AGV.Enums;
using BPASmartClient.AGV.Feedback;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using BPASmartClient.HubHelper;
using FryPot_DosingSystem.Model;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -41,9 +45,12 @@ namespace FryPot_DosingSystem.Control
int ReicpeNum = 0;//记录接收到的配方数
#endregion
#region agv临时变量
bool agvArriveLine = false;//agv是否到达线体装料位置
bool agvArriveFryPot = false;//agv是否到达炒锅送料位置
bool agvArriveUpLoad = false;//agv是否到达线体装料位置
bool agvArriveUnLoad = false;//agv是否到达炒锅送料位置
bool agvFryPotEmptyRollerArrive = false;//agv是否拿到炒锅空桶
string robotJobId = String.Empty;//当前上游系统任务号,全局唯一
//List<string> robotJobIds = new List<string>();//存储当前上游系统任务号,全局唯一
bool loadInteractive = false;// fasle:不需要上料交互 true:需要上料交互
#endregion
public DosingLogicControl()
{
@@ -53,10 +60,63 @@ namespace FryPot_DosingSystem.Control
ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 1; }), "StartPlcInite");
ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 0; }), "EndPlcInite");
ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitMainTask = true; }), "FryPotDosingMainTaskExit");
HubHelper.GetInstance.Report = new Action<object>(AgvTaskUpReportDataAnalysis);
HubHelper.GetInstance.Upstreamrequest = new Action<object>(AgvFeedBackUpReportDataAnalysis);
ResetProgram();
ReadPlcData();
IniteTask();
}
/// <summary>
/// AGV上下料上报数据解析
/// </summary>
/// <param name="obj"></param>
private void AgvFeedBackUpReportDataAnalysis(object obj)
{
if (obj != null && obj is byte[] datas)
{
string strData = Encoding.UTF8.GetString(datas);
object objData = JsonConvert.DeserializeObject(strData);
if (objData != null && objData is UpStreamrequest upDownReportData)
{
if (upDownReportData.body != null && upDownReportData.body is UpstreamrequestBody body)
{
if (body.robotJobId== robotJobId && body.command == "LOAD")//同一任务号且处于上料阶段
{
agvArriveUpLoad = true;//AGV到达上料位置
}
if ( body.robotJobId== robotJobId && body.command == "UNLOAD")//同一任务号且处于下料阶段
{
agvArriveUnLoad = true;//AGV到达下料位置
}
}
}
}
}

/// <summary>
/// AGV搬运任务上报数据解析
/// </summary>
/// <param name="obj"></param>
private void AgvTaskUpReportDataAnalysis(object obj)
{
if (obj != null && obj is byte[] datas)
{
string strData = Encoding.UTF8.GetString(datas);
object objData = JsonConvert.DeserializeObject(strData);
if (objData != null && objData is AGVToUpSystem agvUpReportData)
{
if (agvUpReportData.body != null && agvUpReportData.body is AGVToUpSystemBody body)
{
if (body.state == "ROLLER_LOAD_FINISH"&&body.jobData.startPointCode=="")//上料完成以及到达指定上料点位
{
agvFryPotEmptyRollerArrive = true;
}
}
}
}
}

/// <summary>
/// 主任务重启
/// </summary>
@@ -132,7 +192,7 @@ namespace FryPot_DosingSystem.Control
globalVar.rollerLineOne.OutMaterialingSingle = data[3];
globalVar.rollerLineTwo.OutMaterialingSingle = data[4];
globalVar.rollerLineThree.OutMaterialingSingle = data[5];
globalVar.rollerLineOne.OutMaterialingTroubleSingle=data[6];
globalVar.rollerLineOne.OutMaterialingTroubleSingle = data[6];
globalVar.rollerLineTwo.OutMaterialingTroubleSingle = data[7];
globalVar.rollerLineThree.OutMaterialingTroubleSingle = data[8];
}));
@@ -320,7 +380,8 @@ namespace FryPot_DosingSystem.Control
{
if (OutputMaterialQuene.Count > 0 && !globalVar.InOrOutputLock)
{
while (!agvArriveFryPot)//等待agv到达炒锅位置

while (!agvArriveUnLoad)//等待agv到达炒锅位置
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
@@ -334,10 +395,7 @@ namespace FryPot_DosingSystem.Control
FryPotInputMaterialRollerOperate();
globalVar.InOrOutputLock = true;
}
else
{
//MessageLog.GetInstance.ShowEx($"警告:炒锅{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100}滚筒故障!!!");
}

}

}
@@ -348,12 +406,14 @@ namespace FryPot_DosingSystem.Control
{
if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock)
{
while (!agvArriveFryPot)//等待agv到达炒锅位置
AgvFromFryPotToClean();//上游下发搬运任务给AGV
while (!agvArriveUpLoad)//等待agv到达炒锅位置
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
agvArriveUpLoad = false;
AgvArriveFryPotOutEmptyRollerSingleSetDown();//暂时考虑agv送完料后原地等待,不加条件,直接发送到位信号
FryPotRollerTroubleCheck();
if (FryPotAlarm == 1)//无故障
@@ -372,10 +432,7 @@ namespace FryPot_DosingSystem.Control
globalVar.InOrOutputLock = false;
}
}
else//有故障
{

}
}
}
/// <summary>
@@ -386,35 +443,35 @@ namespace FryPot_DosingSystem.Control
switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
{
case 1:
while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0 || globalVar.fryPotOne.InputMaterialRollerRunningSingle == 0)
while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
case 2:
while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0 || globalVar.fryPotTwo.InputMaterialRollerRunningSingle == 0)
while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
case 3:
while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0 || globalVar.fryPotThree.InputMaterialRollerRunningSingle == 0)
while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
case 4:
while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0 || globalVar.fryPotFour.InputMaterialRollerRunningSingle == 0)
while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
case 5:
while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0 || globalVar.fryPotFive.InputMaterialRollerRunningSingle == 0)
while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
@@ -430,21 +487,41 @@ namespace FryPot_DosingSystem.Control
{
switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
{
case 1: while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0 || globalVar.fryPotOne.EmptyBarrelRollerRunningSingle == 0) { Thread.Sleep(5); if (globalVar.ExitMainTask)
case 1:
while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
} MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
case 2: while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0 || globalVar.fryPotTwo.EmptyBarrelRollerRunningSingle == 0) { Thread.Sleep(5); if (globalVar.ExitMainTask)
}
MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
case 2:
while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
} MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
case 3: while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0 || globalVar.fryPotThree.EmptyBarrelRollerRunningSingle == 0) { Thread.Sleep(5); if (globalVar.ExitMainTask)
}
MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
case 3:
while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
} MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
case 4: while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0 || globalVar.fryPotFour.EmptyBarrelRollerRunningSingle == 0) { Thread.Sleep(5); if (globalVar.ExitMainTask)
}
MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
case 4:
while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
} MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
case 5: while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0 || globalVar.fryPotFive.EmptyBarrelRollerRunningSingle == 0) { Thread.Sleep(5); if (globalVar.ExitMainTask)
}
MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
case 5:
while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
} MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;
}
MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}空桶到达出桶位置,正在出桶"); break;

}
}
@@ -477,20 +554,74 @@ namespace FryPot_DosingSystem.Control
}
}
/// <summary>
/// AGV离开炒锅运送空桶任务
/// </summary>
public void AgvFromFryPotToClean()
{
switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
{
case 1:
erp: string id = Guid.NewGuid().ToString();//上游唯一ID
if (id == robotJobId)
{
goto erp;
}
string info = AGVHelper.GetInstance.AgvLeaveFryPotOne(id);
robotJobId = id;
FryCarryTaskErrorCodeAnalysis(info, 1); break;
case 2:
erp1: string id1 = Guid.NewGuid().ToString();//上游唯一ID
if (id1 == robotJobId)
{
goto erp1;
}
string info1 = AGVHelper.GetInstance.AgvLeaveFryPotTwo(id1);
robotJobId = id1;
FryCarryTaskErrorCodeAnalysis(info1, 2); break;
case 3:
erp2: string id2 = Guid.NewGuid().ToString();//上游唯一ID
if (id2 == robotJobId)
{
goto erp2;
}
string info2 = AGVHelper.GetInstance.AgvLeaveFryPotThree(id2);
robotJobId = id2;
FryCarryTaskErrorCodeAnalysis(info2, 3); break;
case 4:
erp3: string id3 = Guid.NewGuid().ToString();//上游唯一ID
if (id3 == robotJobId)
{
goto erp3;
}
string info3 = AGVHelper.GetInstance.AgvLeaveFryPotFour(id3);
robotJobId = id3;
FryCarryTaskErrorCodeAnalysis(info3, 4); break;
case 5:
erp4: string id4 = Guid.NewGuid().ToString();//上游唯一ID
if (id4 == robotJobId)
{
goto erp4;
}
string info4 = AGVHelper.GetInstance.AgvLeaveFryPotFive(id4);
robotJobId = id4;
FryCarryTaskErrorCodeAnalysis(info4, 5); break;
}
}
/// <summary>
/// 处理agv从线体1到送料到炒锅的条件
/// </summary>
/// <param name="lineAlarm"></param>
public void AgvFromLineOneToFryPot()
{
erp: if (globalVar.rollerLineOne.OutMaterialingTroubleSingle==0)//无故障
erp: if (globalVar.rollerLineOne.OutMaterialingTroubleSingle == 0)//无故障
{
while (!agvArriveLine)//等待AGV到线体装料位置
while (!agvArriveUpLoad)//等待AGV到线体装料位置
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
agvArriveLine = false;
agvArriveUpLoad = false;
AgvArriveLineSingelSetDown();
if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
{
@@ -501,7 +632,7 @@ namespace FryPot_DosingSystem.Control
return;
}
OutputMaterialQuene.Enqueue(materialInfo);
//原料到位,agv到位,agv运料到炒锅
//原料到位,agv到位,agv自行运料到炒锅
}

}
@@ -514,7 +645,7 @@ namespace FryPot_DosingSystem.Control
return;
}
MessageLog.GetInstance.ShowRunLog("线体【1】滚筒故障解除,继续运行");
//lineAlarm = 1;
//lineAlarm = 1;
goto erp;
}
}
@@ -526,13 +657,13 @@ namespace FryPot_DosingSystem.Control
{
erp: if (globalVar.rollerLineTwo.OutMaterialingTroubleSingle == 0)//无故障
{
while (!agvArriveLine)//等待AGV到线体装料位置
while (!agvArriveUpLoad)//等待AGV到线体装料位置
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
agvArriveLine = false;
agvArriveUpLoad = false;
AgvArriveLineSingelSetDown();
if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
{
@@ -556,7 +687,7 @@ namespace FryPot_DosingSystem.Control
return;
}
MessageLog.GetInstance.ShowRunLog("线体【2】滚筒故障解除,继续运行");
// lineAlarm = 1;
// lineAlarm = 1;
goto erp;
}
}
@@ -568,13 +699,13 @@ namespace FryPot_DosingSystem.Control
{
erp: if (globalVar.rollerLineThree.OutMaterialingTroubleSingle == 0)//无故障
{
while (!agvArriveLine)//等待AGV到线体装料位置
while (!agvArriveUpLoad)//等待AGV到线体装料位置
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
return;
}
agvArriveLine = false;
agvArriveUpLoad = false;
AgvArriveLineSingelSetDown();
if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
{
@@ -598,10 +729,52 @@ namespace FryPot_DosingSystem.Control
return;
}
MessageLog.GetInstance.ShowRunLog("线体【3】滚筒故障解除,继续运行");
// lineAlarm = 1;
// lineAlarm = 1;
goto erp;
}
}
/// <summary>
/// 线体搬运任务错误码分析
/// </summary>
/// <param name="errorCode"></param>
/// <param name="num"></param>
public void LineCarryTaskErrorCodeAnalysis(string errorCode, int num)
{
if (errorCode == "SUCCESS")
{
MessageLog.GetInstance.ShowRunLog($"AGV去{num}号线体");
globalVar.AllowAgvToLineLoadRoller = false;
}
else if (errorCode == "Analysis Error")
{
MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号线体接口调用失败,请检查");
}
else
{
MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号线体失败,错误码:{errorCode}");
}
}
/// <summary>
/// 炒锅搬运任务错误码分析
/// </summary>
/// <param name="errorCode"></param>
/// <param name="num"></param>
public void FryCarryTaskErrorCodeAnalysis(string errorCode, int num)
{
if (errorCode == "SUCCESS")
{
MessageLog.GetInstance.ShowRunLog($"AGV离开{num}号炒锅");
}
else if (errorCode == "Analysis Error")
{
MessageLog.GetInstance.ShowRunLog($"提示:AGV离开{num}号炒锅接口调用失败,请检查");
}
else
{
MessageLog.GetInstance.ShowRunLog($"提示:AGV离开{num}号炒锅失败,错误码:{errorCode}");
}
}

public void AgvToLineOneLoadRoller()
{
if (globalVar.rollerLineOne.OutMaterialingTroubleSingle == 0)//输送线无故障
@@ -614,17 +787,21 @@ namespace FryPot_DosingSystem.Control
if (globalVar.ExitMainTask)
return;
}
AGVHelper.GetInstance.AgvToLineOneLoadRoller();
MessageLog.GetInstance.ShowRunLog("AGV去1号线体");
globalVar.AllowAgvToLineLoadRoller = false;
e: string id = Guid.NewGuid().ToString();
if (id == robotJobId)
goto e;
string info = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id);
robotJobId = id;
Thread.Sleep(500);
LineCarryTaskErrorCodeAnalysis(info, 1);
}
}
else
{
MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【1】故障!!!");
// lineAlarm = -1;
// lineAlarm = -1;
}
// lineAlarm = 1;
// lineAlarm = 1;
}
public void AgvToLineTwoLoadRoller()
{
@@ -638,9 +815,13 @@ namespace FryPot_DosingSystem.Control
if (globalVar.ExitMainTask)
return;
}
AGVHelper.GetInstance.AgvToLineTwoLoadRoller();
MessageLog.GetInstance.ShowRunLog("AGV去2号线体");
globalVar.AllowAgvToLineLoadRoller = false;
p: string id = Guid.NewGuid().ToString();
if (id == robotJobId)
goto p;
string info = AGVHelper.GetInstance.AgvToLineTwoLoadRoller(id);
robotJobId= id;
Thread.Sleep(500);
LineCarryTaskErrorCodeAnalysis(info, 2);
}

}
@@ -649,7 +830,7 @@ namespace FryPot_DosingSystem.Control
MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【2】故障!!!");
//lineAlarm = -1;
}
// lineAlarm = 1;
// lineAlarm = 1;
}
public void AgvToLineThreeLoadRoller()
{
@@ -663,18 +844,22 @@ namespace FryPot_DosingSystem.Control
if (globalVar.ExitMainTask)
return;
}
AGVHelper.GetInstance.AgvToLineThreeLoadRoller();
MessageLog.GetInstance.ShowRunLog("AGV去3号线体");
globalVar.AllowAgvToLineLoadRoller = false;
g: string id = Guid.NewGuid().ToString();
if(id==robotJobId)
goto g;
string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id);
robotJobId = id;
Thread.Sleep(500);
LineCarryTaskErrorCodeAnalysis(info, 3);
}

}
else
{
MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【3】故障!!!");
// lineAlarm = -1;
// lineAlarm = -1;
}
// lineAlarm = 1;
// lineAlarm = 1;
}
/// <summary>
/// 1号线体数据下发
@@ -841,34 +1026,39 @@ namespace FryPot_DosingSystem.Control
Thread.Sleep(50); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
FryPotAlarm = 1; break;
case 2:
if (globalVar.fryPotTwo.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotTwo.RollerTroubleSingle == 1)
if (globalVar.fryPotTwo.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【2】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotTwo.RollerTroubleSingle == 1)
{
Thread.Sleep(50); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog("炒锅【2】输送滚筒故障解除,继续运行");
FryPotAlarm = 1; break;
case 3:
if (globalVar.fryPotThree.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotThree.RollerTroubleSingle == 1)
if (globalVar.fryPotThree.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotThree.RollerTroubleSingle == 1)
{
Thread.Sleep(50); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行");
FryPotAlarm = 1; break;
case 4:
if (globalVar.fryPotFour.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotFour.RollerTroubleSingle == 1)
if (globalVar.fryPotFour.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotFour.RollerTroubleSingle == 1)
{
Thread.Sleep(50); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
FryPotAlarm = 1; break;
case 5:
if (globalVar.fryPotFive.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotFive.RollerTroubleSingle == 1)
if (globalVar.fryPotFive.RollerTroubleSingle == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【5】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (globalVar.fryPotFive.RollerTroubleSingle == 1)
{
Thread.Sleep(50); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog("炒锅【5】输送滚筒故障解除,继续运行");
FryPotAlarm = 1; break;

}


+ 2
- 0
FryPot_DosingSystem/FryPot_DosingSystem.csproj View File

@@ -18,6 +18,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="6.0.6" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NModbus" Version="3.0.72" />
</ItemGroup>

@@ -25,6 +26,7 @@
<ProjectReference Include="..\BPASmartClient.AGV\BPASmartClient.AGV.csproj" />
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Helper\BPASmartClient.Helper.csproj" />
<ProjectReference Include="..\BPASmartClient.HubHelper\BPASmartClient.HubHelper.csproj" />
<ProjectReference Include="..\BPASmartClient.Modbus\BPASmartClient.Modbus.csproj" />
</ItemGroup>



Loading…
Cancel
Save