79 lines
2.6 KiB
C#
79 lines
2.6 KiB
C#
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Net.Http;
|
|
using System.Text;
|
|
using System.Web;
|
|
using System.Web.Http;
|
|
using System.Collections.Concurrent;
|
|
using Newtonsoft.Json.Linq;
|
|
using System.Runtime.Remoting.Messaging;
|
|
|
|
|
|
namespace MesWork
|
|
{
|
|
|
|
public class IpcController : ApiController
|
|
{
|
|
readonly string headUrl = "Project/";
|
|
|
|
[HttpPost]
|
|
[Route("IPC/product")]
|
|
// IPC-接收装配信息
|
|
public HttpResponseMessage product([FromBody] JObject jobj)
|
|
{
|
|
return new HttpResponseMessage
|
|
{
|
|
Content = new StringContent(AnalysisMsg.product(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
|
|
};
|
|
}
|
|
|
|
[HttpPost]
|
|
[Route("IPC/RequestEnterOrLeave")]
|
|
// IPC-设备可进入或可离开状态
|
|
public HttpResponseMessage RequestEnterOrLeave([FromBody] JObject jobj)
|
|
{
|
|
return new HttpResponseMessage
|
|
{
|
|
Content = new StringContent(AnalysisMsg.RequestEnterOrLeave(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
|
|
};
|
|
}
|
|
[HttpPost]
|
|
[Route("IPC/WorkFinsih")]
|
|
// IPC-上下料完成AGV离开
|
|
public HttpResponseMessage WorkFinsih([FromBody] JObject jobj)
|
|
{
|
|
return new HttpResponseMessage
|
|
{
|
|
Content = new StringContent(AnalysisMsg.WorkFinsih(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
|
|
};
|
|
}
|
|
[HttpPost]
|
|
[Route("IPC/DeviceStatus")]
|
|
// IPC-设备状态
|
|
public HttpResponseMessage DeviceStatus([FromBody] JObject jobj)
|
|
{
|
|
return new HttpResponseMessage
|
|
{
|
|
Content = new StringContent(AnalysisMsg.IPCDeviceStatus(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
|
|
};
|
|
}
|
|
[HttpGet]
|
|
[Route("getInfo")]
|
|
public HttpResponseMessage getInfo()
|
|
{
|
|
string pp = @"{\""Result\"":\""OK\""}";
|
|
try
|
|
{
|
|
}
|
|
catch (Exception err)
|
|
{
|
|
// GlobalVar.log.Error(err.Message);
|
|
}
|
|
return new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") };
|
|
}
|
|
}
|
|
}
|