示例#1
0
 public void MI_MES_DN_REQ([System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:sap2mes:deliverynote_ii")] DT_MES_DN_REQ MT_MES_DN_REQ)
 {
     this.Invoke("MI_MES_DN_REQ", new object[] {
         MT_MES_DN_REQ
     });
 }
示例#2
0
 /// <remarks/>
 public System.IAsyncResult BeginMI_MES_DN_REQ(DT_MES_DN_REQ MT_MES_DN_REQ, System.AsyncCallback callback, object asyncState)
 {
     return(this.BeginInvoke("MI_MES_DN_REQ", new object[] {
         MT_MES_DN_REQ
     }, callback, asyncState));
 }
示例#3
0
        public ServiceResult Run(RunMethod runMethod)
        {
            /*====Get WebService URL and UserName and Password====*/
            SAPWebServiceEntity webServiceEntity = System.Configuration.ConfigurationManager.GetSection("DNTransferConfig") as SAPWebServiceEntity;

            if (webServiceEntity == null)
            {
                return(new ServiceResult(false, "没有维护DNTransfer对应的Service地址", this.m_Argument.TransactionCode));
            }

            #region Begin for Prepare input Paremente
            // Prepare input parameter
            DT_MES_DN_REQ dnParameter = new DT_MES_DN_REQ();
            dnParameter.TRANS = this.m_Argument.TransactionCode;

            if (this.m_Argument.DNCode.Trim().Length == 0)
            {
                dnParameter.DATE_B = this.m_Argument.MaintainDate_B.Date.ToString("yyyyMMdd", new System.Globalization.CultureInfo("en-US"));
                dnParameter.DATE_E = this.m_Argument.MaintainDate_E.Date.ToString("yyyyMMdd", new System.Globalization.CultureInfo("en-US"));
                dnParameter.WERKS  = this.m_Argument.OrgList;
                dnParameter.VBELN  = "";
            }
            else
            {
                dnParameter.DATE_B = "";
                dnParameter.DATE_E = "";
                dnParameter.WERKS  = null;
                dnParameter.VBELN  = this.m_Argument.DNCode.Trim().ToUpper();
            }
            #endregion

            // Serialize the Input Parameter
            string xmlFilePath = SerializeUtil.SerializeFile(this.m_Argument.TransactionCode + "_Request.xml",
                                                             typeof(DT_MES_DN_REQ), dnParameter);

            #region For Request Log
            DBDateTime         requestDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
            SAPDataTransferLog log             = new SAPDataTransferLog();
            TransferFacade     transferFacade  = new TransferFacade(this.DataProvider);
            log.JobID               = TransferFacade.DNTransferJobID;
            log.TransactionCode     = this.m_Argument.TransactionCode;
            log.TransactionSequence = 1;
            log.RequestDate         = requestDateTime.DBDate;
            log.RequestTime         = requestDateTime.DBTime;
            log.RequestContent      = xmlFilePath;
            log.OrganizationID      = 2000;
            log.SendRecordCount     = 1;
            transferFacade.AddSAPDataTransferLog(log);
            #endregion

            #region Begin for Calling WebService
            // Call Web Service through DNServiceClientProxy
            try
            {
                DNServiceClientProxy clientProxy = new DNServiceClientProxy();
                clientProxy.RequestEncoding = Encoding.UTF8;
                clientProxy.Timeout         = InternalVariables.MS_TimeOut * 1000;
                clientProxy.Url             = webServiceEntity.Url;
                clientProxy.PreAuthenticate = true;
                System.Uri uri = new Uri(clientProxy.Url);
                clientProxy.Credentials = new NetworkCredential(webServiceEntity.UserName, webServiceEntity.Password).GetCredential(uri, "");
                clientProxy.MI_MES_DN_REQ(dnParameter);
                clientProxy.Dispose();
                clientProxy = null;
            }
            catch (Exception e)
            {
                log.Result       = "Fail";
                log.ErrorMessage = e.Message;
                transferFacade.UpdateSAPDataTransferLog(log);
                return(new ServiceResult(false, e.Message, log.TransactionCode));
            }
            #endregion

            return(new ServiceResult(true, "", this.m_Argument.TransactionCode));
        }