public static bool SentConfirmChangeMO(ZMO_MES_261_H header, ZMO_MES_261_I[] itemList,out List<string> errorMsg) { string methodName = MethodBase.GetCurrentMethod().Name; BaseLog.LoggingBegin(logger, methodName); errorMsg = new List<string>(); try { //request SAP web service //SAPMOConfirmChangeWS.ZMO_IME_261_H SAPClient =new ZMO_IME_261_H(); SAPMOConfirmChangeWS.Z_PRODORD261_IMES_BAPI_WSClient SAPClient = new SAPMOConfirmChangeWS.Z_PRODORD261_IMES_BAPI_WSClient("SAP_ConfirmChangeWS"); SAPClient.ClientCredentials.UserName.UserName = ConfigurationManager.AppSettings["SAPUserName"].ToString(); SAPClient.ClientCredentials.UserName.Password = ConfigurationManager.AppSettings["SAPUserPwd"].ToString(); ZMO_MES_261_R[] ItemResult = new ZMO_MES_261_R[0]; SAPClient.Z_PRODORD261_IMES_BAPI(header, ref itemList, ref ItemResult); //check SAP web service response result & return true/false foreach (ZMO_MES_261_R item in ItemResult) { if (item.RESULT261.Trim()== "F") { errorMsg.Add(item.ERRMSG); } } if (errorMsg.Count>0) { return false; } return true; } catch (Exception e) { BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e); // errorMsg = e.Message; return false; //throw e; } finally { BaseLog.LoggingEnd(logger, methodName); } }
private static ZMO_MES_261_H BuildSAPConfirmReworkMOHeader(string moId, string txnId, out int ConfirmReworkMoId) { ZMO_MES_261_H header = new ZMO_MES_261_H(); ConfirmReworkMoId = -1; DataTable dt = SQL.GetConfirmReworkMO(moId, txnId); ConfirmReworkMoId = (int)dt.Rows[0]["ID"]; //mapping DataTable to SAP MoConfirmReworkHeader Data structure header.MONUMBER = dt.Rows[0]["MO"].ToString().Trim();//MoNumber header.SERIALNUMBER = dt.Rows[0]["TxnId"].ToString().Trim();//SerialNumber header.PLANT = dt.Rows[0]["Plant"].ToString().Trim();//Plant header.PRDVER = dt.Rows[0]["ProductVer"].ToString().Trim();//ProductionVer return header; }