public static bool SentConfirmMO(ZMO_MES_CF_H header, ZMO_MES_CF_I[] itemList, out List<string> errorMsg) { string methodName = MethodBase.GetCurrentMethod().Name; BaseLog.LoggingBegin(logger, methodName); errorMsg = new List<string>(); try { //request SAP web service SAPMOConfirmWS.Z_PRODORDCONF_IMES_WSClient SAPClient = new SAPMOConfirmWS.Z_PRODORDCONF_IMES_WSClient("SAP_ConfirmWS"); SAPClient.ClientCredentials.UserName.UserName = ConfigurationManager.AppSettings["SAPUserName"].ToString(); SAPClient.ClientCredentials.UserName.Password = ConfigurationManager.AppSettings["SAPUserPwd"].ToString(); //SAPClient.Z_PRODORDCONF_IMES(header,itemList, ZMO_MES_CF_R[] ItemResult = new ZMO_MES_CF_R[0]; SAPClient.Z_PRODORDCONF_IMES(header,ref itemList,ref ItemResult); //IMES.Service.MO.SAPMOConfirmWS.ZMO_IME_CNF_R response = SAPClient.Z_PRODORDCONF_IMES((header, ref itemList); //check SAP web service response result & return true/false foreach (ZMO_MES_CF_R item in ItemResult) { if (item.RESULTCNF.Trim() == "F") { errorMsg.Add("MO:" + item.MONUMBER + " Confirm fail"); } } //if (response.RESULTCNF == "T") //{ // return true; // } //errorMsg = "ConfirmMO : SAP Response Fail...."; 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_CF_H BuildSAPConfirmMOHeader(string moId, string txnId, string isSync, out int confirmMoId) { ZMO_MES_CF_H header = new ZMO_MES_CF_H(); confirmMoId = -1; DataTable dt = SQL.GetConfirmMO(moId, txnId); confirmMoId = (int)dt.Rows[0]["ID"]; //mapping DataTable to SAP MoConfirmHeader Data structure header.MONUMBER = dt.Rows[0]["MO"].ToString().Trim();//MoNumber header.SERIALNUMBER = dt.Rows[0]["TxnId"].ToString().Trim();//SerialNumber header.MOTYPE=dt.Rows[0]["MOType"].ToString().Trim();//MoType header.BUILDOUTMTL = dt.Rows[0]["Model"].ToString().Trim();//BuildOutMtl header.DELIVEREDQTY=dt.Rows[0]["DeliveredQty"].ToString().Trim();//DeliveredQty header.UNIT=dt.Rows[0]["Unit"].ToString().Trim();//Unit header.CONFIRMDATE=string.Format("{0:yyyyMMdd}",(DateTime)dt.Rows[0]["ConfirmDate"]);//ConfirmDate header.CONFIRMTIME = string.Format("{0:HHmmss}", (DateTime)dt.Rows[0]["ConfirmDate"]);//ConfirmTime header.REMARK1 = "";//Remark1 header.REMARK2 = "";//Remark2 header.SYN = isSync; return header; }