刚接触c#,没看懂这段代码什么意思,invoke起到什么作用,这个foreach循环做了什么,有什么用处,求解
public ResultModule CreateStationOrderPicking(DataTable linedt,string iszlgpla, string itzlgpla, string creater, DateTime created)
{
ResultModule result = new ResultModule();
try
{
try
{
if(String.IsNullOrEmpty(iszlgpla)) iszlgpla = "TPD001";
if (String.IsNullOrEmpty(itzlgpla)) itzlgpla = "TPD002";
(new Mara()).SetMaraDT();
RfcDestination prd = RFCConn.Open();
IRfcFunction qafun = prd.Repository.CreateFunction("Z_PP_FUNC_CREATE_MVT_WS");
qafun.SetValue("CREATER", creater);
string strZGWBQ = "";
IRfcTable itemtable = qafun.GetTable("T_ZMMT006");//接参
foreach (DataRow dr in linedt.Rows)//datajson
{
strZGWBQ = dr["ZGWBQ"].ToString().ToUpper();
itemtable.Append();//将字符串连接到一起
itemtable.SetValue("ZLGPLA", iszlgpla);
itemtable.SetValue("ZTYPE", "PO");
itemtable.SetValue("MATNR", dr["MATNR"].ToString().ToUpper());
itemtable.SetValue("MAKTX", dr["MAKTX"]);
itemtable.SetValue("MENGE", dr["MENGE"].ToString());
itemtable.SetValue("TLGPLA", itzlgpla);
}
if (!String.IsNullOrEmpty(strZGWBQ))
{
qafun.SetValue("I_ZGWBQ", strZGWBQ);
}
qafun.Invoke(prd);
result.result = qafun.GetString("E_ZTRNO");//接参
result.message = qafun.GetString("E_MSG");//接参
}
catch (Exception exception)
{
WriteFileLog.WriteLine(exception.ToString());
}
}
finally
{
RFCConn.Close();
}
return result;
}