| | |
| | | using Newtonsoft.Json; |
| | | using iWareCommon.Utils; |
| | | using iWareLog.Report.Helper; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | /// </summary> |
| | | public class PushMesHandler |
| | | { |
| | | public static string mes_api_url = "";// ConfigHelper.GetConfigString("MesUrl");//修改为配置文件 【EditBy shaocx,2022-01-27】 |
| | | 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> |
| | |
| | | /// </summary> |
| | | /// <param name="pushData"></param> |
| | | /// <returns></returns> |
| | | public static ApiResponse<string> Mes_InStockSend(List<InboundStockInfoToMes> pushData) |
| | | public static ApiResponse<string> Mes_InStockSend(InOutStorageDetailResultForMes pushData) |
| | | { |
| | | ApiResponse<string> res = null; |
| | | var funName = "Mes_InStockSend"; |
| | | try |
| | | { |
| | | MesRequest<List<InboundStockInfoToMes>> mesRequest = new MesRequest<List<InboundStockInfoToMes>>(); |
| | | mesRequest.Datas = pushData; |
| | | mesRequest.TableName = "T_WMS_Inbound_Record"; |
| | | mesRequest.PrimaryKeys = "identifier"; |
| | | |
| | | string paprm = JsonConvert.SerializeObject(mesRequest); |
| | | string paprm = JsonConvert.SerializeObject(pushData); |
| | | //Log4NetHelper.WriteInfoLog(_logType, $"{funName},准备参数:{paprm}"); |
| | | Guid guid = System.Guid.NewGuid(); |
| | | |
| | | //模拟 |
| | | if (1 == 2) |
| | | {//模拟环境 |
| | | res = new ApiResponse<string>(); |
| | | res.Code = 500; |
| | | res.Success = false; |
| | | res.Message = "系统模拟完成"; |
| | | } |
| | | else |
| | | { |
| | | var resStr = mes_api.postContentForString("", paprm, guid); |
| | | //Log4NetHelper.WriteInfoLog(_logType, $"{funName},结果返回:{resStr}"); |
| | | res = JsonConvert.DeserializeObject<ApiResponse<string>>(resStr); |
| | | } |
| | | var resStr = mes_api.postContentForString("materialBack", paprm, guid); |
| | | //Log4NetHelper.WriteInfoLog(_logType, $"{funName},结果返回:{resStr}"); |
| | | res = JsonConvert.DeserializeObject<ApiResponse<string>>(resStr); |
| | | |
| | | |
| | | //Log4NetHelper.WriteInfoLog(_logType, $"{funName},参数:{paprm},返回:{JsonConvert.SerializeObject(res)}"); |
| | | } |