chore: initial commit

This commit is contained in:
XingCheng3
2026-05-29 09:34:04 +08:00
commit 78ae9dcd2e
683 changed files with 68110 additions and 0 deletions

View File

@@ -0,0 +1,134 @@
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.Threading;
using System.Net;
using System.Net.Http.Headers;
using System.IO;
using MisDataSaveDate;
using WebApi;
namespace MisDataSaveDate
{
/// <summary>
/// AGV接口控制器
/// </summary>
public class WebController : ApiController
{
readonly string headUrl = "/";
/// <summary>
/// AGV请求进入接口接收方
/// 接收AGV的进入请求并存储到数据库
/// </summary>
/// <param name="jobj">AGV请求数据</param>
/// <returns>处理结果</returns>
[HttpPost]
[Route("web/WEB_Request")]
public HttpResponseMessage WEB_Request([FromBody] JObject jobj)
{
return new HttpResponseMessage
{
Content = new StringContent(WEB_BusinessLogic.WEB_Request(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
};
}
/// <summary>
/// AGV请求进入接口接收方
/// 接收AGV的进入请求并存储到数据库
/// </summary>
/// <param name="jobj">AGV请求数据</param>
/// <returns>处理结果</returns>
[HttpPost]
[Route("web/WEB_SpotCheckResultUpload")]
public HttpResponseMessage WEB_SpotCheckResultUpload([FromBody] SpotCheckResult request)
{
var result = new MsgResHeader<object>
{
code = 200,
message = "",
Data = null
};
try
{
if (request == null)
{
throw new Exception("请求体不能为空");
}
var response = CALL_Inerface_DataHandle.CALL_Inerface_SpotCheckResultUpload(request);
int.TryParse(response["code"]?.ToString() ?? "500", out int remoteCode);
result.code = remoteCode;
result.message = response["message"]?.ToString() ?? "";
result.Data = response["data"];
}
catch (Exception ex)
{
result.code = 500;
result.message = ex.Message;
}
return new HttpResponseMessage
{
Content = new StringContent(JsonConvert.SerializeObject(result), Encoding.GetEncoding("UTF-8"), "application/json")
};
}
/// <summary>
/// 磨合转序接口
/// 调用AGV转序接口成功后执行转序存储过程
/// </summary>
/// <param name="jobj">转序请求数据</param>
/// <returns>处理结果</returns>
[HttpPost]
[Route("web/WEB_RunningInTransfer")]
public HttpResponseMessage WEB_RunningInTransfer([FromBody] JObject jobj)
{
return new HttpResponseMessage
{
Content = new StringContent(WEB_BusinessLogic.WEB_RunningInTransfer(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
};
}
/// <summary>
/// 批量读取PLC点位值接口
/// 前端传递TagTypeCodeID数组和工位号返回对应点位的值
/// </summary>
/// <param name="jobj">请求数据包含OpName和TagTypeCodeIDs数组</param>
/// <returns>返回对应TagTypeCodeID的值列表</returns>
[HttpPost]
[Route("web/WEB_ReadPLCValues")]
public HttpResponseMessage WEB_ReadPLCValues([FromBody] JObject jobj)
{
return new HttpResponseMessage
{
Content = new StringContent(WEB_BusinessLogic.WEB_ReadPLCValues(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
};
}
/// <summary>
/// 写入PLC接口
/// 前端传递TagTypeCodeID、工位号和值写入到PLC
/// </summary>
/// <param name="jobj">请求数据包含TagTypeCodeID、OpName和TagValue</param>
/// <returns>写入结果</returns>
[HttpPost]
[Route("web/WEB_WritePLC")]
public HttpResponseMessage WEB_WritePLC([FromBody] JObject jobj)
{
return new HttpResponseMessage
{
Content = new StringContent(WEB_BusinessLogic.WEB_WritePLC(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json")
};
}
}
}