//using iWareCommon.Utils;
|
//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.ExtendFunction;
|
//using yunneiWCS.SystemInteraction.mes2.dto;
|
//using static WZ.Useful.Commons.NativeMethods;
|
|
//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, string _identifier, LogType _logType)
|
// {
|
// ApiResponse<object> res = null;
|
// var funName = "Mes_InStockSend";
|
// try
|
// {
|
// MesRequest<List<InboundStockInfoToMes>> mesRequest = new MesRequest<List<InboundStockInfoToMes>>();
|
// mesRequest.data = pushData;
|
// mesRequest.identifier = _identifier;
|
|
// string paprm = JsonConvert.SerializeObject(mesRequest);
|
// Log4NetHelper.WriteInfoLog(_logType, $"{funName},准备参数:{paprm}");
|
// Guid guid = System.Guid.NewGuid();
|
|
// //模拟
|
// if (Form1.isvirtual)
|
// {//模拟环境
|
// res = new ApiResponse<object>();
|
// res.Success = true;
|
// res.Message = "系统模拟完成";
|
// }
|
// else
|
// {
|
// var resStr = mes_api.postContentForString("T_WMS_Inbound_Record", paprm, guid);
|
// Log4NetHelper.WriteInfoLog(_logType, $"{funName},结果返回:{resStr}");
|
// res = JsonConvert.DeserializeObject<ApiResponse<object>>(resStr);
|
// }
|
|
// Log4NetHelper.WriteInfoLog(_logType, $"{funName},参数:{paprm},返回:{JsonConvert.SerializeObject(res)}");
|
// }
|
// catch (Exception ex)
|
// {
|
// Log4NetHelper.WriteErrorLog(_logType, $"{funName},异常:" + ex.Message, ex);
|
// res.Message = "发送异常:" + ex.Message;
|
// }
|
// return res;
|
|
// }
|
|
|
// /// <summary>
|
// /// 给MES推送出库信息
|
// /// </summary>
|
// /// <param name="pushData"></param>
|
// /// <returns></returns>
|
// public static ApiResponse<object> Mes_OutStockSend(List<InboundStockInfoToMes> pushData, string _identifier, LogType _logType)
|
// {
|
// ApiResponse<object> res = null;
|
// var funName = "Mes_OutStockSend";
|
// try
|
// {
|
// MesRequest<List<InboundStockInfoToMes>> mesRequest = new MesRequest<List<InboundStockInfoToMes>>();
|
// mesRequest.data = pushData;
|
// mesRequest.identifier = _identifier;
|
|
// string paprm = JsonConvert.SerializeObject(mesRequest);
|
// Log4NetHelper.WriteInfoLog(_logType, $"{funName},准备参数:{paprm}");
|
// Guid guid = System.Guid.NewGuid();
|
// //模拟
|
// if (Form1.isvirtual)
|
// {//模拟环境
|
// res = new ApiResponse<object>();
|
// res.Success = true;
|
// res.Message = "系统模拟完成";
|
// }
|
// else
|
// {
|
// var resStr = mes_api.postContentForString("T_WMS_Outbound_Record", paprm, guid);
|
// Log4NetHelper.WriteInfoLog(_logType, $"{funName},结果返回:{resStr}");
|
// res = JsonConvert.DeserializeObject<ApiResponse<object>>(resStr);
|
// }
|
|
// Log4NetHelper.WriteInfoLog(_logType, $"{funName},参数:{paprm},返回:{JsonConvert.SerializeObject(res)}");
|
// }
|
// catch (Exception ex)
|
// {
|
// Log4NetHelper.WriteErrorLog(_logType, $"{funName},异常:" + ex.Message, ex);
|
// res.Message = "发送异常:" + ex.Message;
|
// }
|
// return res;
|
|
// }
|
|
|
// /// <summary>
|
// /// 给MES推送库存信息
|
// /// </summary>
|
// /// <param name="pushData"></param>
|
// /// <returns></returns>
|
// public static ApiResponse<object> Mes_StockSend(List<InboundStockInfoToMes> pushData, LogType _logType)
|
// {
|
// ApiResponse<object> res = null;
|
// var funName = "Mes_StockSend";
|
// try
|
// {
|
// MesRequest<List<InboundStockInfoToMes>> mesRequest = new MesRequest<List<InboundStockInfoToMes>>();
|
// mesRequest.data = pushData;
|
|
// string paprm = JsonConvert.SerializeObject(mesRequest);
|
// Guid guid = System.Guid.NewGuid();
|
// Log4NetHelper.WriteInfoLog(_logType, $"{funName},准备参数:{paprm}");
|
// //模拟
|
// if (Form1.isvirtual)
|
// {//模拟环境
|
// res = new ApiResponse<object>();
|
// res.Success = true;
|
// res.Message = "系统模拟完成";
|
// }
|
// else
|
// {
|
// var resStr = mes_api.postContentForString("T_WMS_Realtime_Data", paprm, guid);
|
// Log4NetHelper.WriteInfoLog(_logType, $"{funName},结果返回:{resStr}");
|
// res = JsonConvert.DeserializeObject<ApiResponse<object>>(resStr);
|
// }
|
|
|
// Log4NetHelper.WriteInfoLog(_logType, $"{funName},参数:{paprm},返回:{JsonConvert.SerializeObject(res)}");
|
// }
|
// catch (Exception ex)
|
// {
|
// Log4NetHelper.WriteErrorLog(_logType, $"{funName},异常:" + ex.Message, ex);
|
// res.Message = "发送异常:" + ex.Message;
|
// }
|
// return res;
|
|
// }
|
// }
|
//}
|