using DefaultEdit.Model; using NextTreatMesDemo.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NextTreatMesDemo.Utils { public class MesServer : IServer { /// /// MES地址(最好写在配置文件内方便维护) /// public static string MesHead = "https://mes2-web.sw.eainc.com/mes2/rest/"; #region 生产相关 public XnRestfulResult GetModels(string modelid, string deviceId) { var http = new ApiHelper(); var response = http.ApiGet(MesHead + $"models/{modelid}?deviceCode={deviceId}"); string responseValue = response.RawText; return response; } public XnRestfulResult GetProductionRecord(string modelId) { var http = new ApiHelper(); var response = http.ApiGet(MesHead + $"productionRecords?modelId={modelId}&productionType=UVcuring"); string responseValue = response.RawText; return response; } public XnRestfulResult GetPrintTask(string taskId) { var http = new ApiHelper(); var response = http.ApiGet(MesHead + $"printTasks/{taskId}/info"); string responseValue = response.RawText; return response; } public XnRestfulResult GetUserInfo(string cardId) { var http = new ApiHelper(); var response = http.ApiGet(MesHead + $"users?cardId={cardId}"); string responseValue = response.RawText; return response; } public XnRestfulResult PostRecord(Rt_ProductionRecordDto rt_ProductionRecord) { var http = new ApiHelper(); var response = http.ApiPost(MesHead + "productionRecords", rt_ProductionRecord, EasyHttp.Http.HttpContentTypes.ApplicationJson); string responseValue = response.RawText; return response; } public XnRestfulResult GetUserInfoByAccount(string userId, string userPassword) { var http = new ApiHelper(); var response = http.ApiGet(MesHead + $"users/{userId}?password={userPassword}"); string responseValue = response.RawText; return response; } public XnRestfulResult> GetGroupItems(string groupName, string DeviceId) { var http = new ApiHelper(); var response = http.ApiGet>(MesHead + $"items?containerId={groupName}&deviceCode={DeviceId}"); string responseValue = response.RawText; return response; } #endregion } }