Browse Source

180项目更新

样式分支
taoye 2 years ago
parent
commit
01592cfaed
22 changed files with 2460 additions and 733 deletions
  1. +305
    -305
      BPASmartClient.AGV/AGVHelper.cs
  2. +12
    -0
      BPASmartClient.AgvApi/.config/dotnet-tools.json
  3. +3
    -5
      BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
  4. +56
    -0
      BPASmartClient.CustomResource/Pages/Model/AlarmInfo.cs
  5. +28
    -19
      BPASmartClient.CustomResource/Pages/Model/MessageLog.cs
  6. +5
    -6
      BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs
  7. +23
    -5
      BPASmartClient.Modbus/ModbusTcp.cs
  8. +31
    -11
      FryPot_DosingSystem/App.xaml.cs
  9. +7
    -4
      FryPot_DosingSystem/Control/DeviceOperate.cs
  10. +1419
    -305
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  11. +44
    -2
      FryPot_DosingSystem/Control/GlobalVariable.cs
  12. +17
    -0
      FryPot_DosingSystem/Model/MaterialNames.cs
  13. +96
    -0
      FryPot_DosingSystem/View/DebugView.xaml
  14. +62
    -0
      FryPot_DosingSystem/View/DebugView.xaml.cs
  15. +7
    -7
      FryPot_DosingSystem/View/DeviceListVIew.xaml
  16. +33
    -9
      FryPot_DosingSystem/View/NewRecipeView.xaml
  17. +53
    -0
      FryPot_DosingSystem/View/NewRecipeView.xaml.cs
  18. +35
    -21
      FryPot_DosingSystem/View/RecipeSetView.xaml
  19. +165
    -0
      FryPot_DosingSystem/ViewModel/DebugViewModel.cs
  20. +47
    -23
      FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs
  21. +10
    -9
      FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs
  22. +2
    -2
      TestDemo/Form1.cs

+ 305
- 305
BPASmartClient.AGV/AGVHelper.cs View File

@@ -76,46 +76,46 @@ namespace BPASmartClient.AGV
/// <returns></returns>
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";
}
/// <summary>
@@ -124,45 +124,45 @@ namespace BPASmartClient.AGV
/// <returns></returns>
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";
}
/// <summary>
@@ -171,45 +171,45 @@ namespace BPASmartClient.AGV
/// <returns></returns>
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";
}
/// <summary>
@@ -218,45 +218,45 @@ namespace BPASmartClient.AGV
/// <returns></returns>
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";
}
/// <summary>
@@ -265,45 +265,45 @@ namespace BPASmartClient.AGV
/// <returns></returns>
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";
}
/// <summary>
@@ -312,45 +312,45 @@ namespace BPASmartClient.AGV
/// <returns></returns>
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";
}
/// <summary>
@@ -359,45 +359,45 @@ namespace BPASmartClient.AGV
/// <returns></returns>
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";
}
/// <summary>
@@ -406,45 +406,45 @@ namespace BPASmartClient.AGV
/// <returns></returns>
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";
}
/// <summary>


+ 12
- 0
BPASmartClient.AgvApi/.config/dotnet-tools.json View File

@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "6.0.6",
"commands": [
"dotnet-ef"
]
}
}
}

+ 3
- 5
BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs View File

@@ -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;


+ 56
- 0
BPASmartClient.CustomResource/Pages/Model/AlarmInfo.cs View File

@@ -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()
{
}
/// <summary>
/// 1 号滚筒线故障
/// </summary>
[Alarm("【1】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)]
public ushort LOneRollerTrouble { get; set; }
/// <summary>
/// 2 号滚筒线故障
/// </summary>
[Alarm("【2】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)]
public ushort LTwoRollerTrouble { get; set; }
/// <summary>
/// 3 号滚筒线故障
/// </summary>
[Alarm("【3】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)]
public ushort LThreeRollerTrouble { get; set; }
/// <summary>
/// 1 号炒锅滚筒运行故障
/// </summary>
[Alarm("【1】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)]
public ushort FryPotOneRollerTrouble { get; set; }
/// <summary>
/// 2 号炒锅滚筒运行故障
/// </summary>
[Alarm("【2】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)]
public ushort FryPotTwoRollerTrouble { get; set; }
/// <summary>
/// 3 号炒锅滚筒运行故障
/// </summary>
[Alarm("【3】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)]
public ushort FryPotThreeRollerTrouble { get; set; }
/// <summary>
/// 4 号炒锅滚筒运行故障
/// </summary>
[Alarm("【4】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)]
public ushort FryPotFourRollerTrouble { get; set; }
/// <summary>
/// 5 号炒锅滚筒运行故障
/// </summary>
[Alarm("【5】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)]
public ushort FryPotFiveRollerTrouble { get; set; }
}
}

+ 28
- 19
BPASmartClient.CustomResource/Pages/Model/MessageLog.cs View File

@@ -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<string> 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<UserLog>.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<UserLog>.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<RunLog>.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<RunLog>.GetInstance.Base.Add(runLog);
Application.Current.Dispatcher.Invoke(new Action(() => { runLogs.Insert(0, runLog); }));
RunLog?.Invoke(info);
}
}




+ 5
- 6
BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs View File

@@ -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<Alarm>.GetInstance.GetData();
var lists = Sqlite<BPASmartClient.Model.Alarm>.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<tt>.Alarms;
//AlarmHelper<tt>.Init();
AlarmInfos = AlarmHelper<AlarmInfo>.Alarms;
}

private void GetHistoryAlarm()
{
var data = Sqlite<Alarm>.GetInstance.GetData();
var data = Sqlite<BPASmartClient.Model.Alarm>.GetInstance.GetData();
if (data != null)
{
HistoryAlarm.Clear();
@@ -131,7 +131,6 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel


public ObservableCollection<Alarm> AlarmInfos { get; set; }

public ObservableCollection<Alarm> HistoryAlarm { get; set; } = new ObservableCollection<Alarm>();




+ 23
- 5
BPASmartClient.Modbus/ModbusTcp.cs View File

@@ -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)


+ 31
- 11
FryPot_DosingSystem/App.xaml.cs View File

@@ -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<AlarmInfo>.Init();
}
else
mv.Close();


HubHelper.GetInstance.Report = new Action<object>((o) =>
{
var res = JsonConvert.DeserializeObject<AGVToUpSystem>(o.ToString());
});
//HubHelper.GetInstance.Report = new Action<object>((o) =>
//{
// var res = JsonConvert.DeserializeObject<AGVToUpSystem>(o.ToString());
//});

HubHelper.GetInstance.Upstreamrequest = new Action<object>((o) =>
{
var res = JsonConvert.DeserializeObject<Upstreamrequest>(o.ToString());
});

HubHelper.GetInstance.Connect("192.168.1.99", 8089);
//HubHelper.GetInstance.Upstreamrequest = new Action<object>((o) =>
//{
// var res = JsonConvert.DeserializeObject<Upstreamrequest>(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<SubMenumodel> DebugManage = new ObservableCollection<SubMenumodel>();
DebugManage.Add(new SubMenumodel()
{
SubMenuName = "单一流程调试",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
AssemblyName = "FryPot_DosingSystem",
ToggleWindowPath = "View.DebugView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe683;",
MainMenuName = "调试界面",
Alias = "Debug Management",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
subMenumodels = DebugManage,
});

}
private void LoginDataInite()
{


+ 7
- 4
FryPot_DosingSystem/Control/DeviceOperate.cs View File

@@ -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<string, object> GetAllData()
{


+ 1419
- 305
FryPot_DosingSystem/Control/DosingLogicControl.cs
File diff suppressed because it is too large
View File


+ 44
- 2
FryPot_DosingSystem/Control/GlobalVariable.cs View File

@@ -11,6 +11,8 @@ namespace FryPot_DosingSystem.Control
/// </summary>
internal class GlobalVariable
{
/// <summary>
/// 滚筒线1
/// </summary>
@@ -61,17 +63,57 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public bool ExitMainTask { get; set; }
/// <summary>
/// 允许AGV去线体装桶条件
/// 允许AGV去线体1装桶条件
/// </summary>
public bool AllowAgvToLineLoadRoller { get; set; } = true;
/// <summary>
/// 允许AGV去线体2装桶条件
/// </summary>
public bool AllowAgvToLineTwoLoadRoller { get; set; } = true;
/// <summary>
/// 允许AGV去线体3装桶条件
/// </summary>
public bool AllowAgvToLineThreeLoadRoller { get; set; } = true;
/// <summary>
/// 配方唯一ID
/// </summary>
public string RecipeId { get; set; }
/// <summary>
/// 进桶出桶互锁
/// 线体1对应的进桶出桶互锁
/// </summary>
public bool InOrOutputLock { get; set; }
/// <summary>
/// 线体2对应的进桶出桶互锁
/// </summary>
public bool LTwoInOrOutputLock { get; set; }
/// <summary>
/// 线体3对应的进桶出桶互锁
/// </summary>
public bool LThreeInOrOutputLock { get; set; }
/// <summary>
/// 线体1任务执行锁
/// </summary>
public bool LOneTaskLock { get; set; }
/// <summary>
/// 线体2任务执行锁
/// </summary>
public bool LTwoTaskLock { get; set; }
/// <summary>
/// 线体3任务执行锁
/// </summary>
public bool LThreeTaskLock { get; set; }
/// <summary>
/// 线体1当前正在制作的配方名称
/// </summary>
public string LOneCurrentRecipeName { get; set; } = string.Empty;
/// <summary>
/// 线体2当前正在制作的配方名称
/// </summary>
public string LTwoCurrentRecipeName { get; set; } = string.Empty;
/// <summary>
/// 线体3当前正在制作的配方名称
/// </summary>
public string LThreeCurrentRecipeName { get; set; } = string.Empty;
#endregion

}


+ 17
- 0
FryPot_DosingSystem/Model/MaterialNames.cs View File

@@ -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<string> Names { get; set; }=new ObservableCollection<string>();
}
}

+ 96
- 0
FryPot_DosingSystem/View/DebugView.xaml View File

@@ -0,0 +1,96 @@
<UserControl x:Class="FryPot_DosingSystem.View.DebugView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FryPot_DosingSystem.View"
xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:DebugViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<Style x:Key="buttonStyle" TargetType="Button">
<Setter Property="Width" Value="100"></Setter>
<Setter Property="Height" Value="30"/>
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="Orange"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Margin" Value="3,3"/>
<Setter Property="Foreground" Value="SkyBlue"/>
<Setter Property="FontSize" Value="13"/>
</Style>
</UserControl.Resources>

<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<UniformGrid Columns="2">
<GroupBox Grid.Column="1" Header="PLC信号" Foreground="Aqua" BorderBrush="Pink">
<WrapPanel Orientation="Horizontal">
<Button Content="滚筒线运行信号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding RollerLineRunning}"></Button>
<!--<Button Content="工位号8桶号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding EightWorkLoc}"></Button>-->
<ComboBox SelectionChanged="ComboBox_SelectionChanged" ItemsSource="{Binding LineOneRollerCode}" Background="Transparent" Width="100" Height="34" Margin="3,3"/>
<Button Content="炒锅进料就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotInputArrive}"/>
<Button Content="炒锅空桶就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotEmptyRollerArrive}"/>
</WrapPanel>
</GroupBox>
<GroupBox Grid.Column="2" Header="AGV信号" Foreground="Aqua">
<WrapPanel Orientation="Horizontal">
<Button Content="AGV线体1上料就位" Style="{StaticResource buttonStyle}" Width="120" Command="{Binding AGVLOneArrive}"/>
<Button Content="AGV炒锅下料就位" Style="{StaticResource buttonStyle}" RenderTransformOrigin="0.5,0.5" Width="114" Command="{Binding AGVFryPotDownArrive}">
</Button>
<Button Content="AGV炒锅空桶上料就位" Style="{StaticResource buttonStyle}" Width="139" Command="{Binding AGVFryPotUpArrive}"/>
<Button Content="AGV拿到空桶信号" Style="{StaticResource buttonStyle}" Width="114" Command="{Binding AGVFryPotGetEmptyRoller}"/>
</WrapPanel>
</GroupBox>
</UniformGrid>
<UniformGrid Columns="2" Grid.Row="1">
<GroupBox Grid.Column="1" Header="PLC信号" Foreground="Aqua" BorderBrush="Pink">
<WrapPanel Orientation="Horizontal">
<Button Content="滚筒线运行信号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding RollerLineTwoRunning}"></Button>
<!--<Button Content="工位号8桶号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding EightWorkLoc}"></Button>-->
<ComboBox SelectionChanged="ComboBox_SelectionChanged_1" ItemsSource="{Binding LineTwoRollerCode}" Background="Transparent" Width="100" Height="34" Margin="3,3"/>
<Button Content="炒锅进料就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotTwoInputArrive}"/>
<Button Content="炒锅空桶就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotTwoEmptyRollerArrive}"/>
</WrapPanel>
</GroupBox>
<GroupBox Grid.Column="2" Header="AGV信号" Foreground="Aqua">
<WrapPanel Orientation="Horizontal">
<Button Content="AGV线体2上料就位" Style="{StaticResource buttonStyle}" Width="120" Command="{Binding AGVLTwoArrive}"/>
<Button Content="AGV炒锅下料就位" Style="{StaticResource buttonStyle}" RenderTransformOrigin="0.5,0.5" Width="114" Command="{Binding AGVFryPotTwoDownArrive}">
</Button>
<Button Content="AGV炒锅空桶上料就位" Style="{StaticResource buttonStyle}" Width="139" Command="{Binding AGVFryPotTwoUpArrive}"/>
<Button Content="AGV拿到空桶信号" Style="{StaticResource buttonStyle}" Width="114" Command="{Binding AGVFryPotTwoGetEmptyRoller}"/>
</WrapPanel>
</GroupBox>
</UniformGrid>
<UniformGrid Columns="2" Grid.Row="2">
<GroupBox Grid.Column="1" Header="PLC信号" Foreground="Aqua" BorderBrush="Pink">
<WrapPanel Orientation="Horizontal">
<Button Content="滚筒线运行信号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding RollerLineThreeRunning}"></Button>
<!--<Button Content="工位号8桶号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding EightWorkLoc}"></Button>-->
<ComboBox SelectionChanged="ComboBox_SelectionChanged_2" ItemsSource="{Binding LineThreeRollerCode}" Background="Transparent" Width="100" Height="34" Margin="3,3"/>
<Button Content="炒锅进料就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotThreeInputArrive}"/>
<Button Content="炒锅空桶就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotThreeEmptyRollerArrive}"/>
</WrapPanel>
</GroupBox>
<GroupBox Grid.Column="2" Header="AGV信号" Foreground="Aqua">
<WrapPanel Orientation="Horizontal">
<Button Content="AGV线体3上料就位" Style="{StaticResource buttonStyle}" Width="120" Command="{Binding AGVLThreeArrive}"/>
<Button Content="AGV炒锅下料就位" Style="{StaticResource buttonStyle}" RenderTransformOrigin="0.5,0.5" Width="114" Command="{Binding AGVFryPotThreeDownArrive}">
</Button>
<Button Content="AGV炒锅空桶上料就位" Style="{StaticResource buttonStyle}" Width="139" Command="{Binding AGVFryPotThreeUpArrive}"/>
<Button Content="AGV拿到空桶信号" Style="{StaticResource buttonStyle}" Width="114" Command="{Binding AGVFryPotThreeGetEmptyRoller}"/>
</WrapPanel>
</GroupBox>
</UniformGrid>
</Grid>

</UserControl>

+ 62
- 0
FryPot_DosingSystem/View/DebugView.xaml.cs View File

@@ -0,0 +1,62 @@
using BPASmartClient.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace FryPot_DosingSystem.View
{
/// <summary>
/// DebugView.xaml 的交互逻辑
/// </summary>
public partial class DebugView : UserControl
{
public DebugView()
{
InitializeComponent();
}

private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (sender is ComboBox cbo)
{
if (cbo.SelectedValue != null)
{
ActionManage.GetInstance.Send("EightWorkLoc",cbo.SelectedValue);
}
}
}

private void ComboBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
{
if (sender is ComboBox cbo)
{
if (cbo.SelectedValue != null)
{
ActionManage.GetInstance.Send("TwoEightWorkLoc", cbo.SelectedValue);
}
}
}

private void ComboBox_SelectionChanged_2(object sender, SelectionChangedEventArgs e)
{
if (sender is ComboBox cbo)
{
if (cbo.SelectedValue != null)
{
ActionManage.GetInstance.Send("ThreeEightWorkLoc", cbo.SelectedValue);
}
}
}
}
}

+ 7
- 7
FryPot_DosingSystem/View/DeviceListVIew.xaml View File

@@ -18,20 +18,20 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="20"/>
<RowDefinition Height="55"/>
<RowDefinition Height="10"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width="150" Height="35" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,20,0" Content="添加设备" Command="{Binding AddDeviceCommand}"></Button>
<Button Content="保存设置" Width="150" Height="35" Margin="0,0,20,0" Command="{Binding SaveDeviceConfig}"></Button>
<Button Width="150" Height="35" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,13,10,0" Content="添加设备" Command="{Binding AddDeviceCommand}"></Button>
<Button Content="保存设置" Width="150" Height="35" Margin="0,13,10,0" Command="{Binding SaveDeviceConfig}"></Button>
</StackPanel>
<Line Grid.Row="1" X1="0" Y1="10" X2="1300" Y2="10" Stroke="Aqua" StrokeThickness="1"></Line>
<Line Grid.Row="1" X1="0" Y1="10" X2="1920" Y2="10" Stroke="Aqua" StrokeThickness="1" VerticalAlignment="Center"></Line>
<Viewbox Grid.Row="2" VerticalAlignment="Top" >
<ItemsControl ItemsSource="{Binding devices}">
<ItemsControl ItemsSource="{Binding devices}" Padding="0,5,0,0">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel></StackPanel>


+ 33
- 9
FryPot_DosingSystem/View/NewRecipeView.xaml View File

@@ -190,17 +190,26 @@
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="80"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="配方信息" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" FontSize="25" Margin="0,10"></TextBlock>
<UniformGrid Grid.Row="1" Columns="2">
<StackPanel Orientation="Horizontal">
<TextBlock Text="请输入配方名称:" Foreground="Aqua" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBox Style="{DynamicResource TextBoxStyle}" Text="{Binding RecipeName}" Width="230" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange"
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal" Margin="0,8">
<TextBlock Text="请输入配方名称:" Foreground="Aqua" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBox Style="{DynamicResource TextBoxStyle}" Text="{Binding RecipeName}" Width="230" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange"
VerticalContentAlignment="Center"
BorderBrush="Aqua" VerticalAlignment="Center" FontSize="16" ></TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="请输入桶的数量:" Foreground="Aqua" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBox Style="{DynamicResource TextBoxStyle}" Text="{Binding RecipeRollerNum}" InputMethod.IsInputMethodEnabled="False" Width="230" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange"
VerticalContentAlignment="Center"
BorderBrush="Aqua" VerticalAlignment="Center" FontSize="16" TextChanged="TextBox_TextChanged"></TextBox>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Content="添加原料" Width="150" Margin="10" Height="30" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Cursor="Hand" Command="{Binding AddRecipe}" ></Button>
@@ -208,7 +217,22 @@
<Button Click="Button_Click" Content="取消" Height="30" FontSize="20" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Width="100" Margin="8,10" Cursor="Hand"></Button>
</StackPanel>
</UniformGrid>
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Hidden">
<Grid Grid.Row="2" Background="Cyan" Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="210"/>
<ColumnDefinition Width="225"/>
<ColumnDefinition Width="225"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="原料名称" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Tomato"/>
<GridSplitter></GridSplitter>
<TextBlock Grid.Column="1" Text="原料桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Tomato"/>
<GridSplitter Grid.Column="1"></GridSplitter>
<TextBlock Grid.Column="2" Text="原料重量" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Tomato"></TextBlock>
<GridSplitter Grid.Column="2"></GridSplitter>
<TextBlock Grid.Column="3" Text="操作" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Tomato"/>
</Grid>
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding materials}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
@@ -228,8 +252,8 @@
<ColumnDefinition Width="225"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<ComboBox ItemsSource="{Binding DataContext.materialNames,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding MaterialName}" Margin="10,0,0,10" Width="190" FontSize="14" Style="{StaticResource ComboBoxStyle1}">
<ComboBox.ItemContainerStyle>
<ComboBox ItemsSource="{Binding DataContext.materialNames,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding MaterialName}" Margin="10,0,0,10" Width="190" FontSize="14" KeyUp="ComboBox_KeyUp" LostFocus="ComboBox_LostFocus" Style="{StaticResource ComboBoxStyle1}">
<ComboBox.ItemContainerStyle>
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="#e69519"/>
@@ -252,7 +276,7 @@
Content="删除"
Width="94"
FontSize="14"
Margin="0,0,10,10"
Margin="0,0,20,10"
Background="Transparent"
BorderBrush="#e69519" Foreground="LightGray" HorizontalAlignment="Right"
Command="{Binding DataContext.RemoveRecipe,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"


+ 53
- 0
FryPot_DosingSystem/View/NewRecipeView.xaml.cs View File

@@ -1,8 +1,10 @@
using BPASmartClient.Helper;
using FryPot_DosingSystem.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
@@ -32,5 +34,56 @@ namespace FryPot_DosingSystem.View
{
this.Close();
}

private void ComboBox_KeyUp(object sender, KeyEventArgs e)
{
var res = sender as ComboBox;
Json<MaterialNames>.Read();
if (res.Text != null)
{
var datas = Json<MaterialNames>.Data.Names.Where(s => s.Contains(res.Text.Trim()));
// var datas = Json<MaterialNames>.Data.Names.ToList().FindAll(s => s.Contains(res.Text.Trim()));
if (datas.Count() > 0)
{
res.ItemsSource = datas;
res.IsDropDownOpen = true;
}
else
{
res.IsDropDownOpen = false;
}
}
}

private void ComboBox_LostFocus(object sender, RoutedEventArgs e)
{
var res = sender as ComboBox;
if (res.Text != null)
{
if (!MaterialNames.GetInstance.Names.Contains(res.Text.Trim()))//判断是否存在原料
{
MaterialNames.GetInstance.Names.Add(res.Text.Trim());
Json<MaterialNames>.Data = MaterialNames.GetInstance;
Json<MaterialNames>.Save();
}
}
}

private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
if (sender is TextBox txt)
{
if (new Regex("^[1-8]$").IsMatch(txt.Text))//全匹配
{

}
else
{
txt.Text=string.Empty;
}
}
}
}
}

+ 35
- 21
FryPot_DosingSystem/View/RecipeSetView.xaml View File

@@ -44,15 +44,15 @@
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition Height="55"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<UniformGrid Columns="2">
<Image Source="../hbl.ico" HorizontalAlignment="Left"></Image>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Column="2">
<pry:IcoButton Content="新建配方"
Margin="80,5,15,5"
Margin="80,15,10,0"
Width="150"
FontSize="16"
Foreground="Aqua"
@@ -62,7 +62,7 @@
Command="{Binding NewRecipe}">
</pry:IcoButton>
<pry:IcoButton
Content="保存配方" Margin="5,5"
Content="保存配方" Margin="5,15,10,0"
Width="150"
FontSize="16"
Foreground="Aqua"
@@ -75,8 +75,22 @@
</StackPanel>
</UniformGrid>
<!--<TextBlock Grid.Row="1" Text="配方信息" Foreground="Aquamarine" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18" Margin="0,5" ></TextBlock>-->
<Line Grid.Row="1" X1="0" Y1="10" X2="1000" Y2="10" Stroke="Aqua"></Line>
<ScrollViewer Grid.Row="2" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<!--<Line Grid.Row="1" X1="0" Y1="5" X2="1920" Y2="10" Stroke="Aqua" VerticalAlignment="Center"></Line>-->
<Grid Grid.Row="1" Background="Cyan" Margin="0,5,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
<!--<ColumnDefinition/>-->
</Grid.ColumnDefinitions>
<!--<TextBlock Text="编号" FontSize="16" Foreground="Tomato" HorizontalAlignment="Center" VerticalAlignment="Center"/>-->
<TextBlock Grid.Column="0" Text="配方名称" FontSize="16" Foreground="Tomato" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<GridSplitter BorderThickness="0.5" BorderBrush="CadetBlue"/>
<TextBlock Grid.Column="1" Text="编辑配方" FontSize="16" Foreground="Tomato" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<GridSplitter Grid.Column="1" BorderThickness="0.5" BorderBrush="CadetBlue"></GridSplitter>
<TextBlock Grid.Column="2" Text="删除配方" FontSize="16" Foreground="Tomato" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<ScrollViewer Grid.Row="2" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" Padding="0,5,0,0">
<ItemsControl ItemsSource="{Binding recipeModels}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
@@ -90,26 +104,26 @@
<ControlTemplate>
<Grid x:Name="gr">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="0.25*"></ColumnDefinition>
<ColumnDefinition Width="0.25*"></ColumnDefinition>
<ColumnDefinition Width="0.25*"></ColumnDefinition>
<!--<ColumnDefinition Width="0.25*"></ColumnDefinition>-->
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding RecipeId}" Grid.Column="0" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center"
<!--<TextBlock Text="{Binding RecipeId}" Grid.Column="0" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center"
Foreground="Aqua"
Margin="5,0,0,5"></TextBlock>
<TextBlock Text="{Binding RecipeName}" Grid.Column="1" Margin="5,0,0,5"
Margin="5,0,0,5"></TextBlock>-->
<TextBlock Text="{Binding RecipeName}" Grid.Column="0" Margin="5,0,0,5"
HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" FontSize="16"></TextBlock>
<Grid Grid.Column="3">
<Button FontSize="16"
Margin="5,0,0,5" Content="编辑配方" Style="{StaticResource buttonStyle}" Command="{Binding DataContext.EditRecipeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"
<Button FontSize="16" Grid.Column="1"
Margin="5,0,0,5" Content="编辑" Style="{StaticResource buttonStyle}" Command="{Binding DataContext.EditRecipeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"
CommandParameter="{Binding RecipeId}"></Button>
</Grid>
<Grid Grid.Column="4">
<Button Margin="5,0,0,5" FontSize="16" Content="删除配方" Style="{StaticResource buttonStyle}" Command="{Binding DataContext.DeleteRecipeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" CommandParameter="{Binding RecipeId}">
<Button Margin="5,0,0,5" FontSize="16" Grid.Column="2" Content="删除" Style="{StaticResource buttonStyle}" Command="{Binding DataContext.DeleteRecipeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" CommandParameter="{Binding RecipeId}">
</Button>
</Grid>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">


+ 165
- 0
FryPot_DosingSystem/ViewModel/DebugViewModel.cs View File

@@ -0,0 +1,165 @@
using BPASmartClient.Helper;
using FryPot_DosingSystem.Control;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FryPot_DosingSystem.ViewModel
{
internal class DebugViewModel : ObservableObject
{
public ObservableCollection<ushort> LineOneRollerCode { get; set; } = new ObservableCollection<ushort>() { 101,102,103,104,105,106,107,108,401,402,403,404,405,406,407,408};
public ObservableCollection<ushort> LineTwoRollerCode { get; set; } = new ObservableCollection<ushort>() {201,202,203,204,205,206,207,208,501,502,503,504,505,506,507,508 };
public ObservableCollection<ushort> LineThreeRollerCode { get; set; } = new ObservableCollection<ushort>() { 301,302,303,304,305,306,307,308};
//滚筒线1绑定命令
public RelayCommand RollerLineRunning { get; set; }
public RelayCommand EightWorkLoc { get; set; }
public RelayCommand FryPotInputArrive { get; set; }
public RelayCommand FryPotEmptyRollerArrive { get; set; }


public RelayCommand AGVLOneArrive { get; set; }
public RelayCommand AGVFryPotDownArrive { get; set; }
public RelayCommand AGVFryPotUpArrive { get; set; }
public RelayCommand AGVFryPotGetEmptyRoller { get; set; }

//滚筒线2绑定命令
public RelayCommand RollerLineTwoRunning { get; set; }
//public RelayCommand EightWorkLoc { get; set; }
public RelayCommand FryPotTwoInputArrive { get; set; }
public RelayCommand FryPotTwoEmptyRollerArrive { get; set; }


public RelayCommand AGVLTwoArrive { get; set; }
public RelayCommand AGVFryPotTwoDownArrive { get; set; }
public RelayCommand AGVFryPotTwoUpArrive { get; set; }
public RelayCommand AGVFryPotTwoGetEmptyRoller { get; set; }
//滚筒线3绑定命令
public RelayCommand RollerLineThreeRunning { get; set; }
//public RelayCommand EightWorkLoc { get; set; }
public RelayCommand FryPotThreeInputArrive { get; set; }
public RelayCommand FryPotThreeEmptyRollerArrive { get; set; }


public RelayCommand AGVLThreeArrive { get; set; }
public RelayCommand AGVFryPotThreeDownArrive { get; set; }
public RelayCommand AGVFryPotThreeUpArrive { get; set; }
public RelayCommand AGVFryPotThreeGetEmptyRoller { get; set; }

public DebugViewModel()
{
RollerLineRunning = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("RollerLineRunning");

}));
FryPotInputArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("FryPotInputArrive");

}));
FryPotEmptyRollerArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("FryPotEmptyRollerArrive");

}));
AGVLOneArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("AGVLOneArrive");

}));
AGVFryPotDownArrive = new RelayCommand(new Action(() =>
{

ActionManage.GetInstance.Send("AGVFryPotDownArrive");
}));
AGVFryPotUpArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("AGVFryPotUpArrive");

}));
AGVFryPotGetEmptyRoller = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("AGVFryPotGetEmptyRoller");
}));
//滚筒线2
RollerLineTwoRunning = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("RollerLineTwoRunning");

}));

FryPotTwoInputArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("FryPotTwoInputArrive");

}));
FryPotTwoEmptyRollerArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("FryPotTwoEmptyRollerArrive");

}));
AGVLTwoArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("AGVLTwoArrive");

}));
AGVFryPotTwoDownArrive = new RelayCommand(new Action(() =>
{

ActionManage.GetInstance.Send("AGVFryPotTwoDownArrive");
}));
AGVFryPotTwoUpArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("AGVFryPotTwoUpArrive");

}));
AGVFryPotTwoGetEmptyRoller = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("AGVFryPotTwoGetEmptyRoller");
}));
//滚筒线3
RollerLineThreeRunning = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("RollerLineThreeRunning");

}));

FryPotThreeInputArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("FryPotThreeInputArrive");

}));
FryPotThreeEmptyRollerArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("FryPotThreeEmptyRollerArrive");

}));
AGVLThreeArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("AGVLThreeArrive");

}));
AGVFryPotThreeDownArrive = new RelayCommand(new Action(() =>
{

ActionManage.GetInstance.Send("AGVFryPotThreeDownArrive");
}));
AGVFryPotThreeUpArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("AGVFryPotThreeUpArrive");

}));
AGVFryPotThreeGetEmptyRoller = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("AGVFryPotThreeGetEmptyRoller");
}));
}
}
}

+ 47
- 23
FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs View File

@@ -1,4 +1,5 @@
using BPASmartClient.Helper;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using FryPot_DosingSystem.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
@@ -18,27 +19,38 @@ namespace FryPot_DosingSystem.ViewModel
/// </summary>
public string recipeId { get; set; }
/// <summary>
/// 配名称
/// 配名称
/// </summary>
private string _recipeName;
public string RecipeName { get { return _recipeName; } set { _recipeName = value; OnPropertyChanged(); } }

private int _recipeRollerNum;
/// <summary>
/// 配方中桶数
/// </summary>
public int RecipeRollerNum { get { return _recipeRollerNum; } set { _recipeRollerNum = value; OnPropertyChanged(); } }

public ObservableCollection<MaterialType> materials { get; set; } = new ObservableCollection<MaterialType>();

public ObservableCollection<string> materialNames { get; set; } = new ObservableCollection<string>() { "肉","葱","蒜"};
public ObservableCollection<string> materialNames { get; set; } = new ObservableCollection<string>();

public RelayCommand AddRecipe { get; set; }
public RelayCommand<string> RemoveRecipe { get; set; }
public RelayCommand Comfirm { get; set; }
public NewRecipeViewModel()
{
ActionManage.GetInstance.Register(new Action<object>(Id => {
Json<MaterialNames>.Read();
MaterialNames.GetInstance.Names = Json<MaterialNames>.Data.Names;
materialNames = Json<MaterialNames>.Data.Names;
ActionManage.GetInstance.Register(new Action<object>(Id =>
{
if (Id != null && Id is string strId)
{
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == strId);
if (res != null && res is NewRecipeModel rom)
{
RecipeName = rom.RecipeName;
RecipeRollerNum = rom.materialCollection.Count;
foreach (var item in rom.materialCollection)
{
materials.Add(item);
@@ -46,20 +58,24 @@ namespace FryPot_DosingSystem.ViewModel
recipeId = strId;
}
}
}),"EditRecipe");
}), "EditRecipe");
AddRecipe = new RelayCommand(() =>
{
pr:
string materialCode = Guid.NewGuid().ToString();//原料唯一ID ,后期需要根据实际要求更改
var res = materials.FirstOrDefault(p => p.MaterialCode == materialCode);
if (res == null)
{
materials.Add(new MaterialType() { MaterialCode = materialCode });
}
else
{
goto pr;
}
for (int i = 0; i < RecipeRollerNum; i++)
{
pr1:
string materialCode = Guid.NewGuid().ToString();//原料唯一ID ,后期需要根据实际要求更改
var res = materials.FirstOrDefault(p => p.MaterialCode == materialCode);
if (res == null)
{
materials.Add(new MaterialType() { MaterialCode = materialCode });
}
else
{
goto pr1;
}
}
});
RemoveRecipe = new RelayCommand<string>(code =>
{
@@ -72,27 +88,35 @@ namespace FryPot_DosingSystem.ViewModel
var bom = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeId);
if (bom == null)//新配方
{
prop: string recipeID = Guid.NewGuid().ToString();//配方唯一ID,后期根据实际要求更改
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID);
if (res == null)
if (RecipeRollerNum != 0)
{
Json<RecipeManage>.Data.Recipes.Add(new NewRecipeModel { RecipeId = recipeID, RecipeName = RecipeName, materialCollection = materials });//配方添加
prop: string recipeID = Guid.NewGuid().ToString();//配方唯一ID,后期根据实际要求更改
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID);
if (res == null)
{
Json<RecipeManage>.Data.Recipes.Add(new NewRecipeModel { RecipeId = recipeID, RecipeName = RecipeName, materialCollection = materials });//配方添加

}
else
{
goto prop;
}
MessageLog.GetInstance.ShowUserLog("新建配方成功");
}
else
{
goto prop;
MessageLog.GetInstance.ShowUserLog("新建配方无效【配方中没有添加原料】");
}
ActionManage.GetInstance.Send("CloseNewRecipeView");
}
else //已有配方,用于编辑
{
bom.materialCollection= materials;
bom.materialCollection = materials;
bom.RecipeName = RecipeName;
ActionManage.GetInstance.Send("CloseNewRecipeView");
}
});
}
}
}

+ 10
- 9
FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs View File

@@ -14,7 +14,7 @@ namespace FryPot_DosingSystem.ViewModel
{
internal class RecipeSetDownViewModel : ObservableObject
{

/// <summary>
/// 配方下发
@@ -36,18 +36,19 @@ namespace FryPot_DosingSystem.ViewModel
var res = Recipes.FirstOrDefault(p => p.RecipeId == strId);
if (res != null)
{
RecipeSetDown(res);
RecipeSetDown(new NewRecipeModel[] { res });
}
}
});
AllRecipeSetDownCommand = new RelayCommand(() =>
{
if (Recipes!=null)
if (Recipes != null)
{
foreach (var recipeModel in Recipes)
{
RecipeSetDown(recipeModel);
}
//foreach (var recipeModel in Recipes)
//{
// RecipeSetDown(recipeModel);
//}
RecipeSetDown(Recipes.ToArray());
}

});
@@ -55,9 +56,9 @@ namespace FryPot_DosingSystem.ViewModel
/// <summary>
/// 数据下发方法
/// </summary>
public void RecipeSetDown(NewRecipeModel recipeModel)
public void RecipeSetDown(NewRecipeModel[] recipes)
{
ActionManage.GetInstance.Send("RecipeSetDown",recipeModel);
ActionManage.GetInstance.Send("RecipeSetDown", recipes);
}
}
}

+ 2
- 2
TestDemo/Form1.cs View File

@@ -16,7 +16,7 @@ namespace TestDemo
{
AGVToUpSystem aGVToUpSystem = new AGVToUpSystem();
string value = JsonConvert.SerializeObject(aGVToUpSystem);
string url = $"http://192.168.1.99:8089/apicallback/quicktron/robotjob/report?sign={value}";
string url = $"http://192.168.1.130:8089/apicallback/quicktron/robotjob/report?sign={value}";
var res = APIHelper.GetInstance.HttpRequest(url, "", aGVToUpSystem, RequestType.POST);
}

@@ -25,7 +25,7 @@ namespace TestDemo

Upstreamrequest aGVToUpSystem = new Upstreamrequest();
string value = JsonConvert.SerializeObject(aGVToUpSystem);
string url = $"http://192.168.1.99:8089/apicallback/quicktron/robotjob/upstreamrequest?sign={value}";
string url = $"http://192.168.1.130:8089/apicallback/quicktron/robotjob/upstreamrequest?sign={value}";
var res = APIHelper.GetInstance.HttpRequest(url, "", aGVToUpSystem, RequestType.POST);
}
}

Loading…
Cancel
Save