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); } }
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); } }