private IRfcTable CreateIrfcTableForTaskInfo(SAP_Common.SAP_Common sap_comm, Task.Task_Model taskInfo, UserInfo userModel, string functionName, string strRfcTableName) { IRfcTable rfcTable = sap_comm.CreateIrfcTable(functionName, strRfcTableName); //过账前,过滤掉下架数量为零的数据 var lstTaskInfo = taskInfo.lstTaskDetails.Where(t => t.CurrentPostQty > 0).ToList(); foreach (var item in lstTaskInfo) { rfcTable.Insert(); rfcTable.CurrentRow.SetValue("ORDERID", item.VoucherNo); rfcTable.CurrentRow.SetValue("MATERIAL", item.MaterialNo); rfcTable.CurrentRow.SetValue("PLANT", item.Plant); rfcTable.CurrentRow.SetValue("STGE_LOC", item.StorageLoc); rfcTable.CurrentRow.SetValue("PO_NUMBER", item.VoucherNo); rfcTable.CurrentRow.SetValue("PO_ITEM", item.RowNo); rfcTable.CurrentRow.SetValue("MOVE_TYPE", "261"); rfcTable.CurrentRow.SetValue("ENTRY_QNT", item.CurrentPostQty); rfcTable.CurrentRow.SetValue("BASE_UOM", item.Unit); rfcTable.CurrentRow.SetValue("MVT_IND", "F"); rfcTable.CurrentRow.SetValue("GR_RCPT", string.Empty); } return(rfcTable); }
private IRfcTable CreateIrfcTableForTaskInfo(SAP_Common.SAP_Common sap_comm, Task.Task_Model taskInfo, UserInfo userModel, string functionName, string strRfcTableName) { IRfcTable rfcTable = sap_comm.CreateIrfcTable(functionName, strRfcTableName); //过账前,过滤掉下架数量为零的数据 var lstTaskInfo = taskInfo.lstTaskDetails.Where(t => t.CurrentPostQty > 0).ToList(); foreach (var item in lstTaskInfo) { rfcTable.Insert(); //rfcTable.CurrentRow.SetValue("ORDERID", item.VoucherNo); rfcTable.CurrentRow.SetValue("MATNR", item.MaterialNo); //rfcTable.CurrentRow.SetValue("PLANT", item.Plant); //rfcTable.CurrentRow.SetValue("STGE_LOC", item.StorageLoc); //rfcTable.CurrentRow.SetValue("PO_NUMBER", item.VoucherNo); //rfcTable.CurrentRow.SetValue("PO_ITEM", item.RowNo); //rfcTable.CurrentRow.SetValue("MOVE_TYPE", taskInfo.MoveType); rfcTable.CurrentRow.SetValue("SFSL", item.CurrentPostQty); rfcTable.CurrentRow.SetValue("YLFH", item.RemainStockQty); rfcTable.CurrentRow.SetValue("ZYLFLAG", "X"); } return(rfcTable); }
public bool PostMaterialRequestToSAPByProduct(ref Task.Task_Model taskInfo, UserInfo userModel, ref string strErrMsg) { try { var sap_comm = SAP_Common.SAP_Common.CreateInstance(); string strMaterialDoc = string.Empty; string functionName = "ZBAPI_GOODSMVT_CREATE_03"; Dictionary <string, string> lstParameters = new Dictionary <string, string>(); Dictionary <string, Dictionary <string, object> > lstStructures = new Dictionary <string, Dictionary <string, object> >(); Dictionary <string, object> header = new Dictionary <string, object>(); header.Add("PSTNG_DATE", DateTime.Now.ToString("yyyy-MM-dd"));//.ToString("yyyy-MM-dd HH:mm:ss") header.Add("DOC_DATE", DateTime.Now.ToString("yyyy-MM-dd")); header.Add("REF_DOC_NO", string.Empty); header.Add("BILL_OF_LADING", string.Empty); header.Add("GR_GI_SLIP_NO", userModel.UserName); header.Add("PR_UNAME", string.Empty); header.Add("HEADER_TXT", string.Empty); header.Add("BAR_CODE", string.Empty); lstStructures.Add("GOODSMVT_HEADER", header); Dictionary <string, string> ParametersOutput = null; Dictionary <string, IRfcStructure> StructureOutputs = new Dictionary <string, IRfcStructure>(); StructureOutputs.Add("GOODSMVT_HEADRET", null); Dictionary <string, IRfcTable> rtbsOutput = new Dictionary <string, IRfcTable>(); rtbsOutput.Add("RETURN", null); string strRfcTableName = "GOODSMVT_ITEM"; IRfcTable rfcTable = CreateIrfcTableForTaskInfo(sap_comm, taskInfo, userModel, functionName, strRfcTableName); string strMaterialNo = string.Empty; bool bSucc = sap_comm.PostSapFunctionFromTable(functionName, lstParameters, lstStructures, ref ParametersOutput, ref StructureOutputs, ref rtbsOutput , "GOODSMVT_ITEM", rfcTable, ref strErrMsg); if (bSucc == true) { //DeliveryInfo.materialDocModel = new MaterialDoc_Model(); taskInfo.materialDocModel = sap_comm.GetMaterialDoc(taskInfo.VoucherType, StructureOutputs["GOODSMVT_HEADRET"]); } return(bSucc); } catch (RfcAbapRuntimeException ex) { throw ex; } }
public bool PostMaterialRequestToSAPByOutSide(ref Task.Task_Model taskInfo, string strStorageLoc, UserInfo userModel, ref string strErrMsg) { try { var sap_comm = SAP_Common.SAP_Common.CreateInstance(); string strMaterialDoc = string.Empty; string functionName = "ZLS_WX_MBLNR_CREATE"; Dictionary <string, string> lstParameters = new Dictionary <string, string>(); lstParameters.Add("EBELN", taskInfo.VoucherNo); lstParameters.Add("EBELP", string.Empty); lstParameters.Add("WERKS", taskInfo.Plant); lstParameters.Add("LGORT", strStorageLoc); Dictionary <string, Dictionary <string, object> > lstStructures = new Dictionary <string, Dictionary <string, object> >(); Dictionary <string, string> ParametersOutput = null; Dictionary <string, IRfcStructure> StructureOutputs = new Dictionary <string, IRfcStructure>(); StructureOutputs.Add("T_MATDOC", null); Dictionary <string, IRfcTable> rtbsOutput = new Dictionary <string, IRfcTable>(); rtbsOutput.Add("RETURN", null); string strRfcTableName = "T_WXGZ"; IRfcTable rfcTable = CreateIrfcTableForTaskInfo(sap_comm, taskInfo, userModel, functionName, strRfcTableName); string strMaterialNo = string.Empty; bool bSucc = sap_comm.PostSapFunctionFromTable(functionName, lstParameters, lstStructures, ref ParametersOutput, ref StructureOutputs, ref rtbsOutput , "T_WXGZ", rfcTable, ref strErrMsg); if (bSucc == true) { //DeliveryInfo.materialDocModel = new MaterialDoc_Model(); taskInfo.materialDocModel = sap_comm.GetMaterialDoc(taskInfo.VoucherType, StructureOutputs["T_WXGZ"]); } return(bSucc); } catch (RfcAbapRuntimeException ex) { throw ex; } }