/// <summary> /// 发送 /// </summary> /// <param name="logFid"></param> /// <param name="interfaceConfigInfo"></param> /// <param name="errorCode"></param> /// <param name="errorMsg"></param> /// <param name="msgContent"></param> /// <returns></returns> public static ExecuteResultConstants Send(Guid logFid, InterfaceConfigInfo interfaceConfigInfo, ref string errorCode, ref string errorMsg, out string msgContent) { /// msgContent = string.Empty; /// List <SrmVmiSupplierPartInfo> vmiSupplierParts = new SrmVmiSupplierPartBLL().GetList("" + "[LOG_FID] = N'" + logFid + "' and " + "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Untreated + "", string.Empty); if (vmiSupplierParts.Count == 0) { errorCode = "MC:0x00000212";///经检测,传递数据为空,请确认 return(ExecuteResultConstants.Exception); } ///转换发送内容 List <BFDAVmiSupplierPartInfo> list = new List <BFDAVmiSupplierPartInfo>(); foreach (var vmiSupplierPartInfo in vmiSupplierParts) { list.Add(GetSrmVmiSupplierPartInfo(vmiSupplierPartInfo)); } ///准备把集合转成一个对象 BFDASRMSendDataInfo <BFDAVmiSupplierPartInfo> sendDataInfo = new BFDASRMSendDataInfo <BFDAVmiSupplierPartInfo>(); sendDataInfo.List = list; /// SupplierMaterialService_pttClient client = new SupplierMaterialService_pttClient(); client.Endpoint.Address = new EndpointAddress(interfaceConfigInfo.CallUrl); ///数据发送 msgContent = new XmlWrapper().ObjectToXmlByEncoding(sendDataInfo, Encoding.UTF8, false); msgContent = msgContent.Replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>", ""); /// string result = client.SupplierMaterialService(msgContent, out errorCode, out errorMsg); Log.WriteLogToFile(logFlag, interfaceCode + "--Return:dataCnt:" + result + "Content:" + msgContent + "\r", AppDomain.CurrentDomain.BaseDirectory + @"\log\", DateTime.Now.ToString("yyyyMMddHH")); if (result == Convert.ToString((int)OutboundReturnStateConstants.FAILURE)) { return(ExecuteResultConstants.Error); } return(ExecuteResultConstants.Success); }
/// <summary> /// 发送 /// </summary> /// <param name="logFid"></param> /// <param name="interfaceConfigInfo"></param> /// <param name="errorCode"></param> /// <param name="errorMsg"></param> /// <param name="msgContent"></param> /// <returns></returns> public static ExecuteResultConstants Send(Guid logFid, InterfaceConfigInfo interfaceConfigInfo, ref string errorCode, ref string errorMsg, out string msgContent) { /// msgContent = string.Empty; /// List <SrmJisPullOrderInfo> srmJisPullOrderInfos = new SrmJisPullOrderBLL().GetList("[LOG_FID] = N'" + logFid + "' and [PROCESS_FLAG] = " + (int)ProcessFlagConstants.Untreated + "", string.Empty); if (srmJisPullOrderInfos.Count == 0) { errorCode = "MC:0x00000212";///经检测,传递数据为空,请确认 return(ExecuteResultConstants.Exception); } ///转换成BFDA集合 List <BFDAJisPullOrderInfo> list = new List <BFDAJisPullOrderInfo>(); foreach (var srmJisPullOrderInfo in srmJisPullOrderInfos) { list.Add(GetSrmJisPullOrderInfo(srmJisPullOrderInfo)); } ///准备把集合转成一个对象 BFDASRMSendDataInfo <BFDAJisPullOrderInfo> sendDataInfo = new BFDASRMSendDataInfo <BFDAJisPullOrderInfo> { List = list }; /// msgContent = new XmlWrapper().ObjectToXmlByEncoding(sendDataInfo, Encoding.UTF8, false); msgContent = msgContent.Replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>", ""); /// JISPullService_pttClient client = new JISPullService_pttClient(); client.Endpoint.Address = new EndpointAddress(interfaceConfigInfo.CallUrl); ///数据发送 string result = client.JISPullService(msgContent, out errorCode, out errorMsg); if (result == Convert.ToString((int)OutboundReturnStateConstants.FAILURE)) { return(ExecuteResultConstants.Error); } return(ExecuteResultConstants.Success); }