添加项目文件。

This commit is contained in:
liming 蔡
2026-07-14 13:55:17 +08:00
parent 63759495f2
commit 8bbdf78731
335 changed files with 81415 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
using JY.MES.Entity;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Runtime.Serialization.Json;
using System.Text;
using System.Threading.Tasks;
using System.Web.Script.Serialization;
namespace JY.MES
{
/// <summary>
/// MES接口类
/// </summary>
public class MESApiHelper
{
public static string HttpPostJsonAPI(string url, string strJosnData, double MesRequestTime)
{
MesResponse mesResponse = new MesResponse();
try
{
StringContent stringContent = new StringContent(strJosnData, Encoding.UTF8, "application/json");
return new HttpClient()
{
Timeout = TimeSpan.FromSeconds(MesRequestTime)
}.PostAsync(url, (HttpContent)stringContent).Result.Content.ReadAsStringAsync().Result;
}
catch (Exception ex)
{
mesResponse.success = false;
mesResponse.message = $"massage:[{ex.InnerException}],mes: [MES反馈超时或无法访间MES服务器]";
mesResponse.error = 99;
return JsonConvert.SerializeObject(mesResponse);
}
}
}
}