Ejemplo n.º 1
0
        public MaterialInfo QueryMaterialInfo(string component, out string errorText)
        {
            errorText = "";
            string methodName = MethodBase.GetCurrentMethod().Name;

            BaseLog.LoggingBegin(logger, methodName);
            try
            {
                SAPWSQueryMaterial.Z_RFC_GET_MATMASClient sapQueryMaterialClient = new SAPWSQueryMaterial.Z_RFC_GET_MATMASClient("SAPQueryMaterial");

                sapQueryMaterialClient.ClientCredentials.UserName.UserName = ConfigurationManager.AppSettings["SAPUserName"].ToString();
                sapQueryMaterialClient.ClientCredentials.UserName.Password = ConfigurationManager.AppSettings["SAPUserPwd"].ToString();
                SAPWSQueryMaterial.ZmatInfo materialInfo = sapQueryMaterialClient.ZRfcGetMatmas(component, ConfigurationManager.AppSettings["SAPPlant"].ToString());
                MaterialInfo info = new MaterialInfo();


                info.Material=  materialInfo.Material;
                info.Serilnumber= materialInfo.Serilnumber;
                info.Plant=materialInfo.Plant;
                info.Materialgroup = materialInfo.Materialgroup;
                info.Materialtype = materialInfo.Materialtype;
                info.Materialstatus = materialInfo.Materialstatus;
                info.CustomerMaterial =materialInfo.Oldmaterialnumber;
                info.Cutsomer =     materialInfo.Externalmaterialgroup;
                info.Materialdescription = materialInfo.Materialdescription;
                
                return info;
            }
            catch (Exception e)
            {
                BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
                errorText = e.Message;
                return null;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            }
        }
Ejemplo n.º 2
0
        public bool UpdateMaterial(string component, out string errorText)
        {
            errorText = "";
            string methodName = MethodBase.GetCurrentMethod().Name;

            BaseLog.LoggingBegin(logger, methodName);
            try
            {
                SAPWSQueryMaterial.Z_RFC_GET_MATMASClient sapQueryMaterialClient = new SAPWSQueryMaterial.Z_RFC_GET_MATMASClient("SAPQueryMaterial");

                sapQueryMaterialClient.ClientCredentials.UserName.UserName = ConfigurationManager.AppSettings["SAPUserName"].ToString();
                sapQueryMaterialClient.ClientCredentials.UserName.Password = ConfigurationManager.AppSettings["SAPUserPwd"].ToString();
                SAPWSQueryMaterial.ZmatInfo materialInfo = sapQueryMaterialClient.ZRfcGetMatmas(component, ConfigurationManager.AppSettings["SAPPlant"].ToString());

                IMES.WS.MaterialInfoNotice.SQL.InsertSAPMaterialInfo(materialInfo.Material,
                                                                                                           materialInfo.Serilnumber,
                                                                                                           materialInfo.Plant,
                                                                                                           materialInfo.Materialgroup,
                                                                                                           materialInfo.Materialtype,
                                                                                                           materialInfo.Materialstatus,
                                                                                                           materialInfo.Oldmaterialnumber,
                                                                                                           materialInfo.Externalmaterialgroup,
                                                                                                           materialInfo.Materialdescription);
                WSMaterialInfoNotice wsMaterialInfo = new WSMaterialInfoNotice();
                MaterialInfoNoticeMsg materialMsg = new MaterialInfoNoticeMsg();
                materialMsg.SerialNumber =  materialInfo.Serilnumber;
                wsMaterialInfo.MaterialInfoNotice(materialMsg);               
                return true;
            }
            catch (Exception e)
            {
                BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
                errorText = e.Message;
                return false;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            }
        }