| | |
| | | /// </summary> |
| | | /// <param name="pushData"></param> |
| | | /// <returns></returns> |
| | | public static ApiResponse<object> Mes_InStockSend(List<InboundStockInfoToMes> pushData, string _identifier, LogType _logType) |
| | | public static mesMsg Mes_InStockSend(List<InboundStockInfoToMes> pushData, LogType _logType) |
| | | { |
| | | ApiResponse<object> res = null; |
| | | mesMsg res = null; |
| | | var funName = "Mes_InStockSend"; |
| | | try |
| | | { |
| | | MesRequest<List<InboundStockInfoToMes>> mesRequest = new MesRequest<List<InboundStockInfoToMes>>(); |
| | | mesRequest.data = pushData; |
| | | mesRequest.identifier = _identifier; |
| | | mesRequest.Datas = pushData; |
| | | mesRequest.TableName = "T_WMS_Inbound_Record"; |
| | | mesRequest.PrimaryKeys = "identifier"; |
| | | |
| | | string paprm = JsonConvert.SerializeObject(mesRequest); |
| | | Log4NetHelper.WriteInfoLog(_logType, $"{funName},准备参数:{paprm}"); |
| | |
| | | //模拟 |
| | | if (Form1.isvirtual) |
| | | {//模拟环境 |
| | | res = new ApiResponse<object>(); |
| | | res.Success = true; |
| | | res.Message = "系统模拟完成"; |
| | | res = new mesMsg(); |
| | | res.ErrorCode = 0; |
| | | res.ErrorMsg = "系统模拟完成"; |
| | | } |
| | | else |
| | | { |
| | | res = JsonConvert.DeserializeObject<ApiResponse<object>>(mes_api.postContentForString("T_WMS_Inbound_Record", paprm, guid)); |
| | | var resStr = mes_api.postContentForString("", paprm, guid); |
| | | Log4NetHelper.WriteInfoLog(_logType, $"{funName},结果返回:{resStr}"); |
| | | res = JsonConvert.DeserializeObject<mesMsg>(resStr); |
| | | } |
| | | |
| | | Log4NetHelper.WriteInfoLog(_logType, $"{funName},参数:{paprm},返回:{JsonConvert.SerializeObject(res)}"); |
| | |
| | | catch (Exception ex) |
| | | { |
| | | Log4NetHelper.WriteErrorLog(_logType, $"{funName},异常:" + ex.Message, ex); |
| | | res.Message = "发送异常:" + ex.Message; |
| | | res.ErrorCode = 4; |
| | | res.ErrorMsg = "wms发送异常:" + ex.Message; |
| | | } |
| | | return res; |
| | | |
| | |
| | | /// </summary> |
| | | /// <param name="pushData"></param> |
| | | /// <returns></returns> |
| | | public static ApiResponse<object> Mes_OutStockSend(List<InboundStockInfoToMes> pushData, string _identifier, LogType _logType) |
| | | public static mesMsg Mes_OutStockSend(List<InboundStockInfoToMes> pushData, LogType _logType) |
| | | { |
| | | ApiResponse<object> res = null; |
| | | mesMsg res = null; |
| | | var funName = "Mes_OutStockSend"; |
| | | try |
| | | { |
| | | MesRequest<List<InboundStockInfoToMes>> mesRequest = new MesRequest<List<InboundStockInfoToMes>>(); |
| | | mesRequest.data = pushData; |
| | | mesRequest.identifier = _identifier; |
| | | mesRequest.Datas = pushData; |
| | | mesRequest.TableName = "T_WMS_Outbound_Record"; |
| | | mesRequest.PrimaryKeys = "identifier"; |
| | | |
| | | string paprm = JsonConvert.SerializeObject(mesRequest); |
| | | Log4NetHelper.WriteInfoLog(_logType, $"{funName},准备参数:{paprm}"); |
| | |
| | | //模拟 |
| | | if (Form1.isvirtual) |
| | | {//模拟环境 |
| | | res = new ApiResponse<object>(); |
| | | res.Success = true; |
| | | res.Message = "系统模拟完成"; |
| | | res = new mesMsg(); |
| | | res.ErrorCode = 0; |
| | | res.ErrorMsg = "系统模拟完成"; |
| | | } |
| | | else |
| | | { |
| | | res = JsonConvert.DeserializeObject<ApiResponse<object>>(mes_api.postContentForString("T_WMS_Outbound_Record", paprm, guid)); |
| | | var resStr = mes_api.postContentForString("", paprm, guid); |
| | | Log4NetHelper.WriteInfoLog(_logType, $"{funName},结果返回:{resStr}"); |
| | | res = JsonConvert.DeserializeObject<mesMsg>(resStr); |
| | | } |
| | | |
| | | Log4NetHelper.WriteInfoLog(_logType, $"{funName},参数:{paprm},返回:{JsonConvert.SerializeObject(res)}"); |
| | |
| | | catch (Exception ex) |
| | | { |
| | | Log4NetHelper.WriteErrorLog(_logType, $"{funName},异常:" + ex.Message, ex); |
| | | res.Message = "发送异常:" + ex.Message; |
| | | res.ErrorCode = 4; |
| | | res.ErrorMsg = "wms发送异常:" + ex.Message; |
| | | } |
| | | return res; |
| | | |
| | |
| | | /// </summary> |
| | | /// <param name="pushData"></param> |
| | | /// <returns></returns> |
| | | public static ApiResponse<object> Mes_StockSend(List<InboundStockInfoToMes> pushData, LogType _logType) |
| | | public static mesMsg Mes_StockSend(List<InboundStockInfoToMes> pushData, LogType _logType) |
| | | { |
| | | ApiResponse<object> res = null; |
| | | mesMsg res = null; |
| | | var funName = "Mes_StockSend"; |
| | | try |
| | | { |
| | | MesRequest<List<InboundStockInfoToMes>> mesRequest = new MesRequest<List<InboundStockInfoToMes>>(); |
| | | mesRequest.data = pushData; |
| | | mesRequest.Datas = pushData; |
| | | mesRequest.TableName = "T_WMS_Realtime_Data"; |
| | | mesRequest.PrimaryKeys = "serialNumber,positionName"; |
| | | |
| | | 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 = "系统模拟完成"; |
| | | res = new mesMsg(); |
| | | res.ErrorCode = 0; |
| | | res.ErrorMsg = "系统模拟完成"; |
| | | } |
| | | else |
| | | { |
| | | res = JsonConvert.DeserializeObject<ApiResponse<object>>(mes_api.postContentForString("T_WMS_Realtime_Data", paprm, guid)); |
| | | var resStr = mes_api.postContentForString("", paprm, guid); |
| | | Log4NetHelper.WriteInfoLog(_logType, $"{funName},结果返回:{resStr}"); |
| | | res = JsonConvert.DeserializeObject<mesMsg>(resStr); |
| | | } |
| | | |
| | | |
| | |
| | | catch (Exception ex) |
| | | { |
| | | Log4NetHelper.WriteErrorLog(_logType, $"{funName},异常:" + ex.Message, ex); |
| | | res.Message = "发送异常:" + ex.Message; |
| | | res.ErrorCode = 4; |
| | | res.ErrorMsg = "wms发送异常:" + ex.Message; |
| | | } |
| | | return res; |
| | | |