private List <OutStockDetails_Model> CreateMaterialRequestByProductDetails(ref OutStock_Model OutStockModel, IRfcTable rtb) { List <OutStockDetails_Model> lstPrdReturnDetails = null; if (rtb != null) { if (rtb.RowCount > 0) { lstPrdReturnDetails = new List <OutStockDetails_Model>(); } foreach (var itemRtb in rtb) { OutStockModel.Plant = itemRtb.GetString("WERKS"); OutStockModel.PlantName = itemRtb.GetString("WNAME"); OutStockModel.MoveType = string.Empty; OutStockDetails_Model item = new OutStockDetails_Model(); item.VoucherNo = itemRtb.GetString("EBELN"); item.RowNo = itemRtb.GetString("EBELP"); item.MaterialNo = itemRtb.GetString("MATNR"); item.MaterialDesc = itemRtb.GetString("MAKTX"); item.Unit = itemRtb.GetString("MEINS"); item.Plant = itemRtb.GetString("WERKS"); item.PlantName = itemRtb.GetString("WNAME"); item.StorageLoc = itemRtb.GetString("LGORT"); item.OutStockQty = itemRtb.GetInt("BDMNG"); item.OldOutStockQtySAP = itemRtb.GetInt("YFSL"); item.WaitOutStockQty = itemRtb.GetInt("KFSL"); item.RemainStockQtySAP = itemRtb.GetInt("YLKC"); lstPrdReturnDetails.Add(item); } } return(null); }
private OutStock_Model CreateMaterialRequestOutSideHead(IRfcTable rtb) { OutStock_Model OSM = new OutStock_Model(); if (rtb != null && rtb.Count > 0) { OSM.VoucherNo = rtb[0].GetString("EBELN"); OSM.SupCode = rtb[0].GetString("LIFNR"); OSM.SupName = rtb[0].GetString("NAME1"); } return(OSM); }
public bool GetMaterialRequestOutSideForSAP(ref OutStock_Model OutStockModel, ref string strErrMsg) { try { var sap_comm = SAP_Common.SAP_Common.CreateInstance(); IRfcTable rtbInput = null; string tableindex = null; string functionName = "ZLS_WX_DETAIL_READ"; Dictionary <string, string> lstParameters = new Dictionary <string, string>(); lstParameters.Add("EBELN", OutStockModel.VoucherNo); Dictionary <string, Dictionary <string, object> > lstStructures = null; List <string> ParameterNamesForOut = null; Dictionary <string, string> ParametersOutput = null; List <string> StructureNamesForOut = null; Dictionary <string, IRfcStructure> StructureOutputs = null; List <string> tableNamesForOut = new List <string>() { "WX_HEADER", " WX_ITEM", "RETURN" }; Dictionary <string, IRfcTable> rtbsOutput = null; bool bSucc = sap_comm.getSapFunctionToTable(functionName, lstParameters, lstStructures, rtbInput, tableindex, ParameterNamesForOut, out ParametersOutput, StructureNamesForOut, out StructureOutputs, tableNamesForOut, out rtbsOutput, ref strErrMsg); if (bSucc == false) { return(bSucc); } //创建表头信息 OutStockModel = CreateMaterialRequestOutSideHead(rtbsOutput["WX_HEADER"]); if (OutStockModel == null || string.IsNullOrEmpty(OutStockModel.VoucherNo)) { strErrMsg = "获取SAP外协领料单表头信息失败!"; return(false); } OutStockModel.IsOutStockPost = 1; OutStockModel.IsUnderShelvePost = 2; OutStockModel.VoucherType = 130; OutStockModel.lstOutStockDetails = CreateMaterialRequestByProductDetails(ref OutStockModel, rtbsOutput["WX_ITEM"]); return(true); } catch (Exception ex) { throw ex; } }
/// <summary> /// 生产作业单领料 /// </summary> /// <param name="OutStockModel"></param> /// <param name="strErrMsg"></param> /// <returns></returns> public bool GetMaterialRequestByProductInfoForSAP(ref OutStock_Model OutStockModel, ref string strErrMsg) { try { var sap_comm = SAP_Common.SAP_Common.CreateInstance(); IRfcTable rtbInput = null; string tableindex = null; string functionName = "ZLS_AUFNR_READ"; Dictionary <string, string> lstParameters = new Dictionary <string, string>(); lstParameters.Add("I_AUFNR", OutStockModel.VoucherNo.PadLeft(12, '0'));//作业领料单(生产订单) Dictionary <string, Dictionary <string, object> > lstStructures = null; List <string> ParameterNamesForOut = null; Dictionary <string, string> ParametersOutput = null; List <string> StructureNamesForOut = null; Dictionary <string, IRfcStructure> StructureOutputs = null; List <string> tableNamesForOut = new List <string>() { "I_RESB", "RETURN" }; Dictionary <string, IRfcTable> rtbsOutput = null; bool bSucc = sap_comm.getSapFunctionToTable(functionName, lstParameters, lstStructures, rtbInput, tableindex, ParameterNamesForOut, out ParametersOutput, StructureNamesForOut, out StructureOutputs, tableNamesForOut, out rtbsOutput, ref strErrMsg); if (bSucc == false) { return(bSucc); } OutStockModel.IsOutStockPost = 1; OutStockModel.IsUnderShelvePost = 2; OutStockModel.VoucherType = 120; OutStockModel.lstOutStockDetails = CreateMaterialRequestByProductDetails(ref OutStockModel, rtbsOutput["I_RESB"]); return(true); } catch (Exception ex) { throw ex; } }
public bool GetMaterialRequestInfoForSAP(ref OutStock_Model OutStockModel, ref string strErrMsg) { try { var sap_comm = SAP_Common.SAP_Common.CreateInstance(); string tableindex = "I_BEDNR"; string functionName = "ZLS_BEDNR_READ"; Dictionary <string, string> lstParameters = new Dictionary <string, string>(); lstParameters.Add("I_BWART", SelectVoucherType(OutStockModel.VoucherType));//261-生产补料 311-库位转储 221-研发领料 201 成本中心领料 Dictionary <string, Dictionary <string, object> > lstStructures = null; List <string> ParameterNamesForOut = null; Dictionary <string, string> ParametersOutput = null; List <string> StructureNamesForOut = null; Dictionary <string, IRfcStructure> StructureOutputs = null; List <string> tableNamesForOut = new List <string>() { "I_REQ", "RETURN" }; Dictionary <string, IRfcTable> rtbsOutput = null; IRfcTable rtbInput = CreateIrfcTableForMaterialInfo(sap_comm, OutStockModel, functionName, tableindex); bool bSucc = sap_comm.getSapFunctionToTable(functionName, lstParameters, lstStructures, rtbInput, tableindex, ParameterNamesForOut, out ParametersOutput, StructureNamesForOut, out StructureOutputs, tableNamesForOut, out rtbsOutput, ref strErrMsg); if (bSucc == false) { return(bSucc); } OutStockModel.IsOutStockPost = 1; OutStockModel.IsUnderShelvePost = 2; OutStockModel.lstOutStockDetails = CreateMaterialRequestDetails(ref OutStockModel, rtbsOutput["I_REQ"]); return(true); } catch (Exception ex) { throw ex; } }
public bool GetMaterialKeeperForSAP(OutStock_Model OutStockModel, ref List <Material_Model> lstMaterial, ref string strErrMsg) { try { var sap_comm = SAP_Common.SAP_Common.CreateInstance(); string functionName = "ZLS_WLBG_DETAIL_READ"; Dictionary <string, string> lstParameters = null; Dictionary <string, Dictionary <string, object> > lstStructures = null; string tableindex = "T_MATNR"; List <string> ParameterNamesForOut = null; Dictionary <string, string> ParametersOutput = null; List <string> StructureNamesForOut = null; Dictionary <string, IRfcStructure> StructureOutputs = null; List <string> tableNamesForOut = new List <string>() { "T_WLBG", "RETURN" }; Dictionary <string, IRfcTable> rtbsOutput = null; IRfcTable rtbInput = CreateIrfcTableForMaterialInfo(sap_comm, OutStockModel.lstOutStockDetails, functionName, tableindex); bool bSucc = sap_comm.getSapFunctionToTable(functionName, lstParameters, lstStructures, rtbInput, tableindex, ParameterNamesForOut, out ParametersOutput, StructureNamesForOut, out StructureOutputs, tableNamesForOut, out rtbsOutput, ref strErrMsg); if (bSucc == false) { return(bSucc); } lstMaterial = CreateMaterialKeeper(rtbsOutput["T_WLBG"]); return(bSucc); } catch (Exception ex) { throw ex; } }
private List <OutStockDetails_Model> CreateMaterialRequestDetails(ref OutStock_Model OutStockModel, IRfcTable rtb) { List <OutStockDetails_Model> lstPrdReturnDetails = null; if (rtb != null) { if (rtb.RowCount > 0) { lstPrdReturnDetails = new List <OutStockDetails_Model>(); } foreach (var itemRtb in rtb) { OutStockModel.VoucherNo = itemRtb.GetString("BEDNR"); OutStockModel.Plant = itemRtb.GetString("WERKS"); OutStockModel.PlantName = itemRtb.GetString("NAME1"); OutStockModel.MoveType = itemRtb.GetString("BWART"); OutStockDetails_Model item = new OutStockDetails_Model(); item.VoucherNo = itemRtb.GetString("BEDNR"); item.RowNo = itemRtb.GetString("BSPOS"); item.MaterialNo = itemRtb.GetString("MATNR"); item.MaterialDesc = itemRtb.GetString("MAKTX"); item.Unit = itemRtb.GetString("MEINS"); item.Plant = itemRtb.GetString("WERKS"); item.PlantName = itemRtb.GetString("NAME1"); item.StorageLoc = itemRtb.GetString("LGORT"); item.OutStockQty = itemRtb.GetInt("BDMNG"); item.ProDel = itemRtb.GetString("XLOEK"); item.ReserveNumber = itemRtb.GetString("RSNUM"); //item.ReserveRowNo = itemRtb.GetString("RSPOS"); item.RequstReason = itemRtb.GetString("CR_TXT"); lstPrdReturnDetails.Add(item); } } return(lstPrdReturnDetails); }
private List <OutStockDetails_Model> CreateMaterialRequestByProductDetails(ref OutStock_Model OutStockModel, IRfcTable rtb) { List <OutStockDetails_Model> lstPrdReturnDetails = null; if (rtb != null) { if (rtb.RowCount > 0) { lstPrdReturnDetails = new List <OutStockDetails_Model>(); } foreach (var itemRtb in rtb) { OutStockModel.VoucherNo = itemRtb.GetString("AUFNR").TrimStart('0'); OutStockModel.Plant = itemRtb.GetString("WERKS"); OutStockModel.PlantName = itemRtb.GetString("NAME1"); OutStockModel.MoveType = itemRtb.GetString("BWART"); OutStockDetails_Model item = new OutStockDetails_Model(); item.VoucherNo = itemRtb.GetString("AUFNR").TrimStart('0'); item.RowNo = string.Empty; item.MaterialNo = itemRtb.GetString("MATNR"); item.MaterialDesc = itemRtb.GetString("MAKTX"); item.Unit = itemRtb.GetString("MEINS"); item.Plant = itemRtb.GetString("WERKS"); item.PlantName = itemRtb.GetString("NAME1"); item.StorageLoc = itemRtb.GetString("LGORT"); item.OutStockQty = itemRtb.GetInt("ZBDMNG"); item.ProRecoil = itemRtb.GetString("RGEKZ"); item.ProDel = itemRtb.GetString("XLOEK"); item.ProVirtual = itemRtb.GetString("DUMPS"); item.ReserveNumber = itemRtb.GetString("RSNUM"); item.ReserveRowNo = itemRtb.GetString("RSPOS"); lstPrdReturnDetails.Add(item); } } return(null); }
private IRfcTable CreateIrfcTableForMaterialInfo(SAP_Common.SAP_Common sap_comm, OutStock_Model outStockModel, string functionName, string strRfcTableName) { IRfcTable rfcTable = sap_comm.CreateIrfcTable(functionName, strRfcTableName); string[] ArrayVoucherNo = outStockModel.VoucherNo.Split(','); if (rfcTable != null) { for (int i = 0; i < ArrayVoucherNo.Count(); i++) { rfcTable.Insert(); rfcTable.CurrentRow.SetValue("BEDNR", ArrayVoucherNo[i]); } } return(rfcTable); }