using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Comm;
using WIDESEA_Comm.Http;
using WIDESEA_Comm.LogInfo;
using WIDESEA_Comm.MES_Info;
using WIDESEA_Comm.MES_Info.Request;
using WIDESEA_Comm.TaskNo;
using WIDESEA_Core.Extensions;
using WIDESEA_Core.Utilities;
using WIDESEA_Entity.DomainModels;
using static System.Collections.Specialized.BitVector32;
using static WIDESEA_Comm.MES_Info.Request.MES_head;
namespace WIDESEA_WCS.Jobs.Task
{
///
/// 向MES反馈出入库信息
///
public class HandleTask_Mes
{
public static WebResponseContent UploadMESInfo(string jobID)
{
WebResponseContent content = new WebResponseContent();
string postJson = "";
string mesData = "";
try
{
MES_head mES_Head = new MES_head { status = "14", jobID = jobID };
postJson = JsonConvert.SerializeObject(mES_Head);
string url = "http://10.13.3.15:81/api/agv/agvNSHJobOrderStatus";
mesData = Request.RequestData(postJson, url);
if (mesData.Contains("连接尝试失败"))
throw new Exception(mesData);
var requestMes = JsonConvert.DeserializeObject(mesData);
if (requestMes.code == "200" && requestMes.Type == "success")
{
content.OK("工单完成信息成功!");
WritePCSLog.LogAdd("", "成功", "MES", "PCS", postJson, mesData, "工单信息反馈", "agvNSHJobOrderStatus", requestMes.message);
}
else
{
throw new Exception(requestMes.message);
}
}
catch (Exception ex)
{
content.Error(ex.Message);
WritePCSLog.LogAdd("", "失败", "MES", "WMS", postJson, mesData, "工单信息反馈", "agvNSHJobOrderStatus", ex.Message);
}
return content;
}
}
}