public IRfcTable Rfc_Qdt_Dal(RFC_QDT_Model qdtModel, out RFC_IN_Message rfcMessage) { rfcMessage = new RFC_IN_Message(); try { _configurationId = new RFC_SetUp(); RfcDestinationManager.RegisterDestinationConfiguration(_configurationId); _dest = RfcDestinationManager.GetDestination("SAPMS"); _repository = _dest.Repository; IRfcFunction rfc = _repository.CreateFunction(qdtModel.FunctionModule); //调用函数名 IRfcTable table = rfc.GetTable(qdtModel.E_SAP_QDT); //RFC表数据 rfc.SetValue("I_MESKEY", qdtModel.I_MESKEY); //KEY随机号 不能重复 rfc.SetValue("I_USER", qdtModel.I_USER); //登录名 rfc.SetValue("I_MATNR", qdtModel.I_MATNR); rfc.SetValue("I_CHARG", qdtModel.I_CHARG); rfc.Invoke(_dest); rfcMessage.E_RETURN_CODE = rfc.GetString("E_RETURN_CODE").ToString(); rfcMessage.E_RETURN_MESSAGE = rfc.GetString("E_RETURN_MESSAGE").ToString(); rfcMessage.E_COUNT = rfc.GetInt("E_COUNT").ToString(); rfcMessage.E_SUM = rfc.GetInt("E_SUM").ToString(); return(table); } catch (Exception exception) { rfcMessage.E_RETURN_MESSAGE = "接口QDT 错误:" + exception.ToString(); return(null); } finally { RfcDestinationManager.UnregisterDestinationConfiguration(_configurationId); } }
public void InitSAP() { try { IDestinationConfiguration destinationConfig = null; destinationConfig = new SAPDestinationConfig(); destinationConfig.GetParameters(_destinationName); bool destinationFound = false; try { destinationFound = (RfcDestinationManager.GetDestination(_destinationName) != null); } catch { destinationFound = false; } if (!destinationFound) { RfcDestinationManager.RegisterDestinationConfiguration(destinationConfig); } } catch (Exception e) { throw new Exception("Errore di inizializzazione RfcDestination", e); } }
public IRfcTable Rfc_Del_Dal(RFC_DEL_Model delModel, out RFC_IN_Message rfcMessage) { rfcMessage = new RFC_IN_Message(); try { _configurationId = new RFC_SetUp(); RfcDestinationManager.RegisterDestinationConfiguration(_configurationId); _dest = RfcDestinationManager.GetDestination("SAPMS"); _repository = _dest.Repository; IRfcFunction rfc = _repository.CreateFunction(delModel.FunctionModule); //调用函数名 IRfcTable table = rfc.GetTable(delModel.E_SAP_DEL); //RFC表数据 rfc.SetValue("I_MESKEY", delModel.I_MESKEY); //KEY随机号 不能重复 rfc.SetValue("I_DATE", delModel.I_DATE); //日期 rfc.SetValue("I_TIME", delModel.I_TIME); //时间 rfc.SetValue("I_USER", delModel.I_USER); //登录名 rfc.SetValue("I_VBELN", delModel.I_VBELN); rfc.Invoke(_dest); rfcMessage.E_RETURN_CODE = rfc.GetString("E_RETURN_CODE").ToString(); //rfcMessage.E_RETURN_MESSAGE = rfc.GetString("E_RETURN_MESSAGE").ToString(); rfcMessage.E_COUNT = rfc.GetInt("E_COUNT").ToString(); rfcMessage.E_SUM = rfc.GetInt("E_SUM").ToString(); return(table); } catch (Exception exception) { rfcMessage.E_RETURN_MESSAGE = "接口DEL 错误:" + exception.ToString(); return(null); } finally { RfcDestinationManager.UnregisterDestinationConfiguration(_configurationId); } }
public IRfcTable Rfc_Stock_dal(RFC_STOCK_Model StockModel, out RFC_IN_Message rfcMessage) { rfcMessage = new RFC_IN_Message(); try { _configurationId = new RFC_SetUp(); RfcDestinationManager.RegisterDestinationConfiguration(_configurationId); _dest = RfcDestinationManager.GetDestination("SAPMS"); _repository = _dest.Repository; IRfcFunction rfc = _repository.CreateFunction(StockModel.FunctionModule); //调用函数名 IRfcTable table = rfc.GetTable(StockModel.L_MM_STOCK); //RFC表数据 rfc.SetValue("I_FLAG", "J"); rfc.Invoke(_dest); rfcMessage.E_RETURN_CODE = rfc.GetString("E_SUBRC").ToString(); rfcMessage.E_RETURN_MESSAGE = rfc.GetString("E_MESSAGE").ToString(); return(table); } catch (Exception exception) { rfcMessage.E_RETURN_MESSAGE = "接口STOCK错误:" + exception.ToString(); return(null); } finally { RfcDestinationManager.UnregisterDestinationConfiguration(_configurationId); } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //APERTURA CONECCION string destinationconfigname = "QA"; Application["destinationconfigname"] = destinationconfigname; IDestinationConfiguration destinationConfiguration = null; bool destinationisInialised = false; if (!destinationisInialised) { destinationConfiguration = new ECCDestinationConfig(); destinationConfiguration.GetParameters(destinationconfigname); if (RfcDestinationManager.TryGetDestination(destinationconfigname) == null) { RfcDestinationManager.RegisterDestinationConfiguration(destinationConfiguration); destinationisInialised = true; bool resultado = false; resultado = testconnection(destinationconfigname); Application["resultado"] = Convert.ToString(resultado); } } //FIN APERTURA CONECCION }
public RFC_OUT_Message Rfc_Rmu_Dal(List <RFC_RMU_Model.RFC_RMU_ITEM_Model> rmuItemModel, RFC_RMU_Model.RFC_RMU_HEADER_Model rmuHeaderModel) { RFC_OUT_Message rfcMessage = new RFC_OUT_Message(); try { _configurationId = new RFC_SetUp(); RfcDestinationManager.RegisterDestinationConfiguration(_configurationId); _dest = RfcDestinationManager.GetDestination("SAPMS"); _repository = _dest.Repository; IRfcFunction rfc = _repository.CreateFunction("Z_PP_MES_OUT_RMU"); //调用函数名 IRfcTable table = rfc.GetTable(rmuHeaderModel.E_SAP_RMU); //RFC表数据 IRfcStructure structure = rfc.GetStructure("I_HEADER"); //RFC表头数据 structure.SetValue("ZMESKEY", rmuHeaderModel.ZMESKEY); structure.SetValue("BLDAT", rmuHeaderModel.BLDAT); structure.SetValue("BUDAT", rmuHeaderModel.BUDAT); structure.SetValue("ZCOUNT", rmuHeaderModel.ZCOUNT); structure.SetValue("ZUSER", rmuHeaderModel.ZUSER); structure.SetValue("ZUNPLAN", rmuHeaderModel.ZUNPLAN); try { structure.SetValue("BKTXT", rmuHeaderModel.BKTXT); } catch {} foreach (var _rmuItemModel in rmuItemModel) { table.Insert(); table.CurrentRow.SetValue("ZMESITEM", _rmuItemModel.ZMESITEM); table.CurrentRow.SetValue("AUFNR", _rmuItemModel.AUFNR); table.CurrentRow.SetValue("POSNR", _rmuItemModel.POSNR); table.CurrentRow.SetValue("BWART", _rmuItemModel.BWART); table.CurrentRow.SetValue("MATNR", _rmuItemModel.MATNR); table.CurrentRow.SetValue("WERKS", _rmuItemModel.WERKS); table.CurrentRow.SetValue("LGORT", _rmuItemModel.LGORT); table.CurrentRow.SetValue("MENGE", _rmuItemModel.MENGE); table.CurrentRow.SetValue("MEINS", _rmuItemModel.MEINS); table.CurrentRow.SetValue("CHARG", _rmuItemModel.CHARG); table.CurrentRow.SetValue("ITEM_TEXT", _rmuItemModel.ITEM_TEXT); // rmuHeaderModel.ZSUM += _rmuItemModel.MENGE;//所有数据全部相加,取总数 } structure.SetValue("ZSUM", rmuHeaderModel.ZSUM); rfc.Invoke(_dest); rfcMessage.E_RETURN_CODE = rfc.GetString("E_RETURN_CODE").ToString(); rfcMessage.E_RETURN_MESSAGE = rfc.GetString("E_RETURN_MESSAGE").ToString(); rfcMessage.E_EXPROC = rfc.GetString("E_MAT_DOC").ToString(); return(rfcMessage); } catch (Exception exception) { rfcMessage.E_RETURN_MESSAGE = "接口RMU 错误:" + exception.ToString(); return(null); } finally { RfcDestinationManager.UnregisterDestinationConfiguration(_configurationId); } }
public RFC_OUT_Message Rfc_Fgo_Dal(List <RFC_FGO_Model.RFC_FGO_ITEM_Model> fgoItemModel, RFC_FGO_Model.RFC_FGO_HEADER_Model fgoHeaderModel) { RFC_OUT_Message rfcMessage = new RFC_OUT_Message(); try { _configurationId = new RFC_SetUp(); RfcDestinationManager.RegisterDestinationConfiguration(_configurationId); _dest = RfcDestinationManager.GetDestination("SAPMS"); _repository = _dest.Repository; IRfcFunction rfc = _repository.CreateFunction("Z_PP_MES_OUT_FGO"); //调用函数名 IRfcTable table = rfc.GetTable("T_DATA"); //RFC表数据 IRfcStructure structure = rfc.GetStructure("I_HEADER"); //RFC表头数据 structure.SetValue("ZMESKEY", fgoHeaderModel.ZMESKEY); structure.SetValue("AUFNR", fgoHeaderModel.AUFNR); structure.SetValue("BUDAT", fgoHeaderModel.BUDAT); structure.SetValue("ZCOUNT", fgoHeaderModel.ZCOUNT); //structure.SetValue("ZSUM", fgoHeaderModel.ZSUM); structure.SetValue("ZUSER", fgoHeaderModel.ZUSER); fgoHeaderModel.ZSUM = 0; foreach (var _fgoItemModel in fgoItemModel) { table.Insert(); table.CurrentRow.SetValue("ZMESITEM", _fgoItemModel.ZMESITEM); table.CurrentRow.SetValue("BWART", _fgoItemModel.BWART); table.CurrentRow.SetValue("WERKS", _fgoItemModel.WERKS); table.CurrentRow.SetValue("LGORT", _fgoItemModel.LGORT); table.CurrentRow.SetValue("MENGE", _fgoItemModel.MENGE); table.CurrentRow.SetValue("MEINS", _fgoItemModel.MEINS); table.CurrentRow.SetValue("ZINBOXNO_MIN", _fgoItemModel.ZINBOXNO_MIN); table.CurrentRow.SetValue("ZINBOXNO_MAX", _fgoItemModel.ZINBOXNO_MIN); table.CurrentRow.SetValue("ZLOTNO", _fgoItemModel.ZLOTNO); table.CurrentRow.SetValue("ZINBOXNO", _fgoItemModel.ZINBOXNO); fgoHeaderModel.ZSUM += _fgoItemModel.MENGE;//所有数据全部相加,取总数 } structure.SetValue("ZSUM", fgoHeaderModel.ZSUM); rfc.Invoke(_dest); rfcMessage.E_RETURN_CODE = rfc.GetString("E_RETURN_CODE").ToString(); rfcMessage.E_RETURN_MESSAGE = rfc.GetString("E_RETURN_MESSAGE").ToString(); //rfcMessage.E_PO_NUMBER = rfc.GetInt("E_COUNT").ToString(); //rfcMessage.E_EXPROC = rfc.GetInt("E_SUM").ToString(); rfcMessage.E_MAT_DOC = rfc.GetString("E_MAT_DOC").ToString(); rfcMessage.E_EXPROC = rfc.GetString("E_EXPROC").ToString(); return(rfcMessage); } catch (Exception exception) { rfcMessage.E_RETURN_MESSAGE = "接口FGO 错误:" + exception.ToString(); return(null); } finally { RfcDestinationManager.UnregisterDestinationConfiguration(_configurationId); } }
public RFC_OUT_Message Rfc_Gpr_Dal(List <RFC_GPR_Model.RFC_GPR_ITEM_Model> gprItemModel, RFC_GPR_Model.RFC_GPR_HEADER_Model gprHeaderModel) { RFC_OUT_Message rfcMessage = new RFC_OUT_Message(); try { _configurationId = new RFC_SetUp(); RfcDestinationManager.RegisterDestinationConfiguration(_configurationId); _dest = RfcDestinationManager.GetDestination("SAPMS"); _repository = _dest.Repository; IRfcFunction rfc = _repository.CreateFunction(gprHeaderModel.FunctionModule); //调用函数名 IRfcTable table = rfc.GetTable(gprHeaderModel.E_SAP_GRP); //RFC表数据 IRfcStructure structure = rfc.GetStructure("I_HEADER"); //RFC表头数据 structure.SetValue("ZMESKEY", gprHeaderModel.ZMESKEY); structure.SetValue("EBELN", gprHeaderModel.EBELN); structure.SetValue("BUKRS", gprHeaderModel.BUKRS); structure.SetValue("BSART", gprHeaderModel.BSART); structure.SetValue("EKORG", gprHeaderModel.EKORG); structure.SetValue("AEDAT", gprHeaderModel.AEDAT); structure.SetValue("LIFNR", gprHeaderModel.LIFNR); structure.SetValue("ZCOUNT", gprHeaderModel.ZCOUNT); structure.SetValue("ZUSER", gprHeaderModel.ZUSER); foreach (var _gprItemModel in gprItemModel) { table.Insert(); table.CurrentRow.SetValue("ZMESITEM", _gprItemModel.ZMESITEM); table.CurrentRow.SetValue("EBELP", _gprItemModel.EBELP); table.CurrentRow.SetValue("LOEKZ", _gprItemModel.LOEKZ); table.CurrentRow.SetValue("MATNR", _gprItemModel.MATNR); table.CurrentRow.SetValue("WERKS", _gprItemModel.WERKS); table.CurrentRow.SetValue("LGORT", _gprItemModel.LGORT); table.CurrentRow.SetValue("MENGE", _gprItemModel.MENGE); table.CurrentRow.SetValue("MEINS", _gprItemModel.MEINS); table.CurrentRow.SetValue("EINDT", _gprItemModel.EINDT); table.CurrentRow.SetValue("LICHA", _gprItemModel.LICHA); table.CurrentRow.SetValue("ZJPSONO", _gprItemModel.ZJPSONO); table.CurrentRow.SetValue("ZJPSOITEM", _gprItemModel.ZJPSOITEM); gprHeaderModel.ZSUM += _gprItemModel.MENGE;//所有数据全部相加,取总数 } structure.SetValue("ZSUM", gprHeaderModel.ZSUM); rfc.Invoke(_dest); rfcMessage.E_RETURN_CODE = rfc.GetString("E_RETURN_CODE").ToString(); //rfcMessage.E_RETURN_MESSAGE = rfc.GetString("E_RETURN_MESSAGE").ToString(); rfcMessage.E_PO_NUMBER = rfc.GetInt("E_COUNT").ToString(); rfcMessage.E_EXPROC = rfc.GetInt("E_SUM").ToString(); return(rfcMessage); } catch (Exception exception) { rfcMessage.E_RETURN_MESSAGE = "接口GPR 错误:" + exception.ToString(); return(null); } finally { RfcDestinationManager.UnregisterDestinationConfiguration(_configurationId); } }
public RFC_OUT_Message Rfc_Stu_Dal(List <RFC_STU_Model.RFC_STU_ITEM_Model> stuItemModel, RFC_STU_Model.RFC_STU_HEADER_Model stuHeaderModel) { RFC_OUT_Message rfcMessage = new RFC_OUT_Message(); try { _configurationId = new RFC_SetUp(); RfcDestinationManager.RegisterDestinationConfiguration(_configurationId); _dest = RfcDestinationManager.GetDestination("SAPMS"); _repository = _dest.Repository; IRfcFunction rfc = _repository.CreateFunction(stuHeaderModel.FunctionModule); //调用函数名 IRfcTable table = rfc.GetTable("T_DATA"); //RFC表数据 IRfcStructure structure = rfc.GetStructure("I_HEADER"); //RFC表头数据 structure.SetValue("ZMESKEY", stuHeaderModel.ZMESKEY); structure.SetValue("BUDAT", stuHeaderModel.BUDAT); structure.SetValue("ZCOUNT", stuHeaderModel.ZCOUNT); structure.SetValue("ZSUM", stuHeaderModel.ZSUM); structure.SetValue("ZUSER", stuHeaderModel.ZUSER); structure.SetValue("BKTXT", stuHeaderModel.BKTXT); table.Clear(); foreach (var _stuItemModel in stuItemModel) { table.Insert(); table.CurrentRow.SetValue("ZMESITEM", _stuItemModel.ZMESITEM); table.CurrentRow.SetValue("BWART", _stuItemModel.BWART); table.CurrentRow.SetValue("MATNR", _stuItemModel.MATNR); table.CurrentRow.SetValue("WERKS", _stuItemModel.WERKS); table.CurrentRow.SetValue("LGORT", _stuItemModel.LGORT); table.CurrentRow.SetValue("MENGE", _stuItemModel.MENGE); table.CurrentRow.SetValue("MEINS", _stuItemModel.MEINS); table.CurrentRow.SetValue("CHARG", _stuItemModel.CHARG); table.CurrentRow.SetValue("ZEILE", _stuItemModel.ZEILE); table.CurrentRow.SetValue("UMLGO", _stuItemModel.UMLGO); table.CurrentRow.SetValue("LIFNR", _stuItemModel.LIFNR); table.CurrentRow.SetValue("SOBKZ", _stuItemModel.SOBKZ); //stuHeaderModel.ZSUM += _stuItemModel.MENGE;//所有数据全部相加,取总数 } structure.SetValue("ZSUM", stuHeaderModel.ZSUM); rfc.Invoke(_dest); rfcMessage.E_RETURN_CODE = rfc.GetString("E_RETURN_CODE").ToString(); rfcMessage.E_RETURN_MESSAGE = rfc.GetString("E_RETURN_MESSAGE").ToString(); //rfcMessage.E_PO_NUMBER = rfc.GetInt("E_COUNT").ToString(); //rfcMessage.E_EXPROC = rfc.GetInt("E_SUM").ToString(); rfcMessage.E_MAT_DOC = rfc.GetString("E_MAT_DOC").ToString(); return(rfcMessage); } catch (Exception exception) { rfcMessage.E_RETURN_MESSAGE = "接口STU 错误:" + exception.ToString(); return(null); } finally { RfcDestinationManager.UnregisterDestinationConfiguration(_configurationId); } }
public RFC_OUT_Message Rfc_Fgu_Dal(List <RFC_FGU_Model.RFC_FGU_ITEM_Model> fguItemModel, RFC_FGU_Model.RFC_FGU_HEADER_Model fguHeaderModel) { RFC_OUT_Message rfcMessage = new RFC_OUT_Message(); try { _configurationId = new RFC_SetUp(); RfcDestinationManager.RegisterDestinationConfiguration(_configurationId); _dest = RfcDestinationManager.GetDestination("SAPMS"); _repository = _dest.Repository; IRfcFunction rfc = _repository.CreateFunction(fguHeaderModel.FunctionModule); //调用函数名 IRfcTable table = rfc.GetTable(fguHeaderModel.E_SAP_FGU); //RFC表数据 IRfcStructure structure = rfc.GetStructure("I_HEADER"); //RFC表头数据 structure.SetValue("ZMESKEY", fguHeaderModel.ZMESKEY); structure.SetValue("VBELN", fguHeaderModel.VBELN); structure.SetValue("WADAT_IST", fguHeaderModel.WADAT_IST); structure.SetValue("ZCOUNT", fguHeaderModel.ZCOUNT); structure.SetValue("ZSUM", fguHeaderModel.ZSUM); structure.SetValue("ZUSER", fguHeaderModel.ZUSER); structure.SetValue("ZSTEP", fguHeaderModel.ZSTEP); foreach (var _fguItemModel in fguItemModel) { table.Insert(); table.CurrentRow.SetValue("ZMESITEM", _fguItemModel.ZMESITEM); table.CurrentRow.SetValue("POSNR", _fguItemModel.POSNR); table.CurrentRow.SetValue("MATNR", _fguItemModel.MATNR); table.CurrentRow.SetValue("MENGE", _fguItemModel.MENGE); table.CurrentRow.SetValue("MEINS", _fguItemModel.MEINS); table.CurrentRow.SetValue("CHARG", _fguItemModel.CHARG); table.CurrentRow.SetValue("ZLOTNO", _fguItemModel.ZLOTNO); table.CurrentRow.SetValue("ZINBOXNO", _fguItemModel.ZINBOXNO); table.CurrentRow.SetValue("LOTQTY", _fguItemModel.LOTQTY); //fguHeaderModel.ZSUM += _fguItemModel.MENGE;//所有数据全部相加,取总数 } structure.SetValue("ZSUM", fguHeaderModel.ZSUM); rfc.Invoke(_dest); rfcMessage.E_RETURN_CODE = rfc.GetString("E_RETURN_CODE").ToString(); rfcMessage.E_RETURN_MESSAGE = rfc.GetString("E_RETURN_MESSAGE").ToString(); rfcMessage.E_MAT_DOC = rfc.GetString("E_MAT_DOC").ToString(); //rfcMessage.E_PO_NUMBER = rfc.GetInt("E_COUNT").ToString(); //rfcMessage.E_EXPROC = rfc.GetInt("E_SUM").ToString(); return(rfcMessage); } catch (Exception exception) { rfcMessage.E_RETURN_MESSAGE = "接口FGU 错误:" + exception.ToString(); return(null); } finally { RfcDestinationManager.UnregisterDestinationConfiguration(_configurationId); } }
/// <summary> /// Metoda rejestrujaca docelowa konfiguracje /// </summary> /// <param name="cfg">Interfejs konfiguracyjny</param> public void RegisterConfig(IDestinationConfiguration cfg) { // Register config try { RfcDestinationManager.RegisterDestinationConfiguration(cfg); } catch (Exception ex) { Messenger.Default.Send(new LogMessage(ex.Message, LogType.ERROR), "Log"); } }
public void InitializeConnection() { destinationConfig = new SAPDestinationConfig(this.saplogonlanguage); //destinationConfig.GetParameters(destinationConfigName); if (RfcDestinationManager.TryGetDestination(destinationConfigName) == null) { RfcDestinationManager.RegisterDestinationConfiguration(destinationConfig); destinationIsInialised = true; } }
//public void Connect() //{ // IDestinationConfiguration ID = new RFCConfigg(); // RfcDestinationManager.RegisterDestinationConfiguration(ID); // destination = RfcDestinationManager.GetDestination(ABAP_AS); // TestConnect(); // Console.Write(AttributesToString()); //} public void Connect() { ID = new RFCConfigg(); RfcDestinationManager.RegisterDestinationConfiguration(ID); destination = RfcDestinationManager.GetDestination(ABAP_AS); //TestConnect(); //Console.Write(AttributesToString()); }
/// <summary> /// /// </summary> /// <param name="sapConfigParameters">A dictionary with parameters (key = paramater name, value = parameter value)</param> public SapConnection(Dictionary<string, string> sapConfigParameters) { _destinationConfigName = sapConfigParameters.ContainsKey("NAME") ? sapConfigParameters["NAME"] : "DummyDestinationConfigName"; _destinationConfiguration = new DestinationConfiguration(sapConfigParameters); try { RfcDestinationManager.RegisterDestinationConfiguration(_destinationConfiguration); } catch (Exception ex) { throw new NSAPConnectorException("An exception occurred when trying to register configuration parameters. Check inner exception for details.", ex); } }
/// <summary> /// /// </summary> /// <param name="sapConfigParameters">A dictionary with parameters (key = paramater name, value = parameter value)</param> public SapConnection(Dictionary <string, string> sapConfigParameters) { _destinationConfigName = sapConfigParameters.ContainsKey("NAME") ? sapConfigParameters["NAME"] : "DummyDestinationConfigName"; _destinationConfiguration = new DestinationConfiguration(sapConfigParameters); try { RfcDestinationManager.RegisterDestinationConfiguration(_destinationConfiguration); } catch (Exception ex) { throw new NSAPConnectorException("An exception occurred when trying to register configuration parameters. Check inner exception for details.", ex); } }
public RFC_OUT_Message Rfc_Wtc_Dal(RFC_WTC_Model.RFC_WTC_HEADER_Model wtcHeaderModels) { RFC_OUT_Message rfcMessage = new RFC_OUT_Message(); try { _configurationId = new RFC_SetUp(); RfcDestinationManager.RegisterDestinationConfiguration(_configurationId); _dest = RfcDestinationManager.GetDestination("SAPMS"); _repository = _dest.Repository; IRfcFunction rfc = _repository.CreateFunction(wtcHeaderModels.FunctionModule); //调用函数名 //RFC表数据 IRfcStructure structure = rfc.GetStructure("I_HEADER"); //RFC表头数据 structure.SetValue("ZMESKEY", wtcHeaderModels.ZMESKEY); structure.SetValue("AUFNR", wtcHeaderModels.AUFNR); structure.SetValue("AUART", wtcHeaderModels.AUART); structure.SetValue("MATNR", wtcHeaderModels.MATNR); structure.SetValue("WERKS", wtcHeaderModels.WERKS); structure.SetValue("MENGE", wtcHeaderModels.MENGE); structure.SetValue("MEINS", wtcHeaderModels.MEINS); structure.SetValue("GLTRP", wtcHeaderModels.GLTRP); structure.SetValue("GSTRP", wtcHeaderModels.GSTRP); structure.SetValue("ZCOUNT", wtcHeaderModels.ZCOUNT); structure.SetValue("ZSUM", wtcHeaderModels.ZSUM); structure.SetValue("ZUSER", wtcHeaderModels.ZUSER); structure.SetValue("ZDELFLAG", wtcHeaderModels.ZDELFLAG); rfc.Invoke(_dest); rfcMessage.E_RETURN_CODE = rfc.GetString("E_RETURN_CODE").ToString(); rfcMessage.E_RETURN_MESSAGE = rfc.GetString("E_RETURN_MESSAGE").ToString(); rfcMessage.E_PRD_ORD_NO = rfc.GetString("E_PRD_ORD_NO").ToString(); rfcMessage.E_EXPROC = rfc.GetString("E_EXPROC").ToString(); rfcMessage.E_PRD_CHARG = rfc.GetString("E_PRD_CHARG").ToString(); return(rfcMessage); } catch (Exception exception) { rfcMessage.E_RETURN_MESSAGE = "接口WTC 错误:" + exception.ToString(); return(null); } finally { RfcDestinationManager.UnregisterDestinationConfiguration(_configurationId); } }
public RFC_OUT_Message Rfc_Fso_Dal(RFC_FSO_Model.RFC_FSO_HEADER_Model fsoHeaderModels) { RFC_OUT_Message rfcMessage = new RFC_OUT_Message(); try { _configurationId = new RFC_SetUp(); RfcDestinationManager.RegisterDestinationConfiguration(_configurationId); _dest = RfcDestinationManager.GetDestination("SAPMS"); _repository = _dest.Repository; IRfcFunction rfc = _repository.CreateFunction("Z_PP_MES_OUT_FSO"); //调用函数名 IRfcStructure structure = rfc.GetStructure("I_HEADER"); //RFC表头数据 structure.SetValue("ZMESKEY", fsoHeaderModels.ZMESKEY); structure.SetValue("PLNUM", fsoHeaderModels.PLNUM); structure.SetValue("MATNR", fsoHeaderModels.MATNR); structure.SetValue("PWWRK", fsoHeaderModels.PWWRK); structure.SetValue("PLWRK", fsoHeaderModels.PLWRK); structure.SetValue("PAART", fsoHeaderModels.PAART); structure.SetValue("MENGE", fsoHeaderModels.MENGE); structure.SetValue("MEINS", fsoHeaderModels.MEINS); structure.SetValue("PSTTR", fsoHeaderModels.PSTTR); structure.SetValue("PEDTR", fsoHeaderModels.PEDTR); structure.SetValue("VERID", fsoHeaderModels.VERID); structure.SetValue("ZCOUNT", fsoHeaderModels.ZCOUNT); structure.SetValue("ZSUM", fsoHeaderModels.ZSUM); structure.SetValue("ZUSER", fsoHeaderModels.ZUSER); structure.SetValue("ZCLEARFLAG", fsoHeaderModels.ZCLEARFLAG); rfc.Invoke(_dest); rfcMessage.E_RETURN_CODE = rfc.GetString("E_RETURN_CODE").ToString(); rfcMessage.E_RETURN_MESSAGE = rfc.GetString("E_RETURN_MESSAGE").ToString(); rfcMessage.E_PLAN_OR = rfc.GetString("E_PLAN_OR").ToString(); return(rfcMessage); } catch (Exception exception) { rfcMessage.E_RETURN_MESSAGE = "接口FSO 错误:" + exception.ToString(); return(null); } finally { RfcDestinationManager.UnregisterDestinationConfiguration(_configurationId); } }
void Application_Start(object sender, EventArgs e) { string destinationConfigurationName = "QA"; IDestinationConfiguration destinationConfig = null; bool IsDestinationInia = false; if (!IsDestinationInia) { destinationConfig = new SAPDestinationConfig(); destinationConfig.GetParameters(destinationConfigurationName); if (RfcDestinationManager.TryGetDestination(destinationConfigurationName) == null) { RfcDestinationManager.RegisterDestinationConfiguration(destinationConfig); IsDestinationInia = true; } } // Code that runs on application startup RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }
protected void Application_Start() { var _Ip = WebApi.Common.Function.GetIpAddresses(); //string destinationConfigName = "QAS"; if (_Ip.Count() > 0) { if (_Ip[_Ip.Count() - 1].ToString() == ConfigurationManager.AppSettings["ServerIp"]) { destinationConfigName = ConfigurationManager.AppSettings["SapMode"]; // destinationConfigName = "PRD"; } else { destinationConfigName = ConfigurationManager.AppSettings["SapModeTest"]; // destinationConfigName = "QAS"; } } IDestinationConfiguration destinationConfig = null; bool destinationIsInialised = false; if (!destinationIsInialised) { destinationConfig = new SapDestinationConfig(); destinationConfig.GetParameters(destinationConfigName); if (RfcDestinationManager.TryGetDestination(destinationConfigName) == null) { RfcDestinationManager.RegisterDestinationConfiguration(destinationConfig); destinationIsInialised = true; } } GlobalConfiguration.Configure(WebApiConfig.Register); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); //強迫只回傳json格式 GlobalConfiguration.Configuration.Formatters.XmlFormatter.SupportedMediaTypes.Clear(); }
public IRfcTable Rfc_Goods_Dal(string I_FLAG, string I_RSNUM, string TABLES, out RFC_IN_Message rfcMessage) { rfcMessage = new RFC_IN_Message(); try { _configurationId = new RFC_SetUp(); RfcDestinationManager.RegisterDestinationConfiguration(_configurationId); _dest = RfcDestinationManager.GetDestination("SAPMS"); _repository = _dest.Repository; IRfcFunction rfc = _repository.CreateFunction("Z_MM_OPC_FG"); //调用函数名 if (I_FLAG == "E") { IRfcTable table = rfc.GetTable(TABLES); rfc.SetValue("I_FLAG", "E"); rfc.Invoke(_dest); return(table); } else { IRfcTable table = rfc.GetTable(TABLES); rfc.SetValue("I_RSNUM", I_RSNUM); rfc.SetValue("I_FLAG", "B"); rfc.Invoke(_dest); return(table); } } catch (Exception exception) { rfcMessage.E_RETURN_MESSAGE = "接口库存 错误:" + exception.ToString(); return(null); } finally { RfcDestinationManager.UnregisterDestinationConfiguration(_configurationId); } }
void Application_Start(object sender, EventArgs e) { // Code that runs on application startup RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); Convertir convert = new Convertir(); string destinationConfigName = "SapQA"; //string destinationConfigName = "MAP"; IDestinationConfiguration destinationConfig = null; bool destinationIsInialised = false; if (!destinationIsInialised) { destinationConfig = new SAPDestinationConfig(); destinationConfig.GetParameters(destinationConfigName); if (RfcDestinationManager.TryGetDestination(destinationConfigName) == null) { RfcDestinationManager.RegisterDestinationConfiguration(destinationConfig); destinationIsInialised = true; } } }