schangxiang@126.com
2025-09-01 b08bfd050511ed27e0bde0bd4095eed1fdb5ddeb
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
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using yunneiWCS.EnumDefine;
using yunneiWCS.SystemInteraction.mes2.dto;
 
namespace yunneiWCS.mes
{
    /// <summary>
    /// MES推送接口
    /// </summary>
    public class PushMesHandler
    {
        public static string mes_api_url = ConfigHelper.GetConfigString("MesUrl");//修改为配置文件 【EditBy shaocx,2022-01-27】
        static HTTPService mes_api = new HTTPService(mes_api_url);//mes基地址
 
        /// <summary>
        /// 给MES推送入库信息
        /// </summary>
        /// <param name="pushData"></param>
        /// <returns></returns>
        public static ApiResponse<object> Mes_InStockSend(List<InboundStockInfoToMes> pushData)
        {
            ApiResponse<object> res = null;
            try
            {
                MesRequest<List<InboundStockInfoToMes>> mesRequest = new MesRequest<List<InboundStockInfoToMes>>();
                mesRequest.data = pushData;
 
                string paprm = JsonConvert.SerializeObject(mesRequest);
                Guid guid = System.Guid.NewGuid();
                res = JsonConvert.DeserializeObject<ApiResponse<object>>(mes_api.postContentForString("T_WMS_Inbound_Record", paprm, guid));
                WZ.Useful.Commons.LogTextHelper.WriteLine("PushMesHandler", "Mes_InStockSend 返回状态码:", res.Code + " 返回信息:" + res.Message);
            }
            catch (Exception ex)
            {
                WZ.Useful.Commons.LogTextHelper.WriteLine("PushMesHandler", "Mes_InStockSend ", " 发送异常:" + JsonConvert.SerializeObject(ex));
                res.Message = "发送异常:" + ex.Message;
            }
            return res;
 
        }
    }
}