分支自 SuZhouGuanHong/TaiYuanTaiZhong

huanghongfeng
2024-07-19 bb929bd0809eefc1108dd779846ff07d997f7ef0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
{
    /// <summary>
    /// 向MES反馈出入库信息
    /// </summary>
    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<MES_Response>(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;
        }
    }
}