Example #1
0
        //2.檢查資料內容
     

        //3.執行DB insert 
        public static void Process(MaterialInfoNoticeMsg martialNotice)
        {

            string methodName = MethodBase.GetCurrentMethod().Name;
            BaseLog.LoggingBegin(logger, methodName);
            string TxnId=martialNotice.SerialNumber.Trim();
            try

            {
               using (TransactionScope txn = UTL.CreateDbTxn())
                {

                    SQL.InsertSapMaterialData(TxnId);
                    SQL.InsertUpdateSapModelToIMES(TxnId);
                    SQL.InsertUpdateSapPartToIMES(TxnId);
                   // WS.Common.SQL.InsertTxnDataLog(EnumMsgCategory.Receive, "MaterialInfoNotice","","",TxnId,
                   //                                                             "", "", EnumMsgState.Success,"");
                   txn.Complete();
                }

            }

            catch (Exception e)
            {
                BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
              //  WS.Common.SQL.InsertTxnDataLog(EnumMsgCategory.Receive, "MaterialInfoNotice","","",TxnId,"",e.Message,
              //                                                                        EnumMsgState.Fail, "Error Occurred in function Excute.Process");
                throw e;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            } 
        }
 public void MaterialInfoNotice(MaterialInfoNoticeMsg materialNotice)
 {
         string methodName = MethodBase.GetCurrentMethod().Name;
         string msgName = "MaterialInfoNotice";
         BaseLog.LoggingBegin(logger, methodName);
         try
         {
             WS.Common.SQL.InsertTxnDataLog(EnumMsgCategory.Receive,
                                                                     msgName,
                                                                     string.IsNullOrEmpty(materialNotice.SerialNumber) ? "" : materialNotice.SerialNumber,
                                                                     "",
                                                                     "",
                                                                     "",
                                                                     "",
                                                                     EnumMsgState.Received,
                                                                     "");
             Execute.ValidateParameter(materialNotice);
             Execute.Process(materialNotice);
             WS.Common.SQL.InsertTxnDataLog(EnumMsgCategory.Receive,
                                                                     msgName,
                                                                     string.IsNullOrEmpty(materialNotice.SerialNumber) ? "" : materialNotice.SerialNumber,
                                                                     "",
                                                                     "",
                                                                     "",
                                                                     "",
                                                                     EnumMsgState.Success,
                                                                     "");
         }
         catch (Exception e)
         {
             BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
             WS.Common.SQL.InsertTxnDataLog(EnumMsgCategory.Receive,
                                                                   msgName,
                                                                   string.IsNullOrEmpty(materialNotice.SerialNumber) ? "" : materialNotice.SerialNumber,
                                                                   "",
                                                                   "",
                                                                   "",
                                                                   e.Message,
                                                                   EnumMsgState.Fail,
                                                                   "");
             
         }
         finally
         {
             BaseLog.LoggingEnd(logger, methodName);
         }
 }
Example #3
0
        //1.檢查必要的input parameter

        public static void ValidateParameter(MaterialInfoNoticeMsg martialNotice)
        {
            string methodName = MethodBase.GetCurrentMethod().Name;
            BaseLog.LoggingBegin(logger, methodName);
            try
            {
                if (string.IsNullOrEmpty(martialNotice.SerialNumber.Trim()))
                {
                    throw new Exception("The SerialNumber of MaterialInfoNoticeMsg is null or no data");
                }

            }
            catch
            {
                throw;
            }
            finally
            {
                BaseLog.LoggingEnd(logger, methodName);
            }

       
        }
Example #4
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);
            }
        }