Esempio n. 1
0
        /// <summary>
        /// 判断异常规则代码是否存在
        /// </summary>
        /// <param name="strCode"></param>
        /// <returns></returns>
        public bool IsExistAbnormalCode(string[] strCode)
        {
            bool    blResult = true;
            DataSet dsReturn = new DataSet();

            try
            {
                IServerObjFactory serverObj = CallRemotingService.GetRemoteObject();
                dsReturn  = serverObj.CreateISampEngine().IsExistAbnormalCode(strCode);
                _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
                if (_errorMsg.Length > 0)
                {
                    blResult = false;
                    MessageService.ShowError(_errorMsg);
                }
                else if (Convert.ToInt32(dsReturn.ExtendedProperties["Code_Counts"].ToString()) > 0)
                {
                    blResult = false;
                }
            }
            catch (Exception ex)
            {
                blResult = false;
                MessageService.ShowError(ex.Message);
            }
            return(blResult);
        }
Esempio n. 2
0
        public override bool Delete()
        {
            try
            {
                string            msg      = string.Empty;
                DataSet           dsReturn = null;
                IServerObjFactory factor   = CallRemotingService.GetRemoteObject();
                if (null != factor)
                {
                    dsReturn = factor.CreateISampEngine().DeleteSamp(_spKey);
                    msg      = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
                    if (msg != string.Empty)
                    {
                        MessageService.ShowError(msg);
                        return(false);
                    }
                    else
                    {
                        MessageService.ShowMessage("${res:Global.SuccessMessage}", "${res:Global.SystemInfo}");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError(ex);
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }

            return(true);
        }
Esempio n. 3
0
 public void GetSampByKey(string spKey)
 {
     try
     {
         string            msg      = string.Empty;
         DataSet           dsReturn = null;
         IServerObjFactory factor   = CallRemotingService.GetRemoteObject();
         if (null != factor)
         {
             dsReturn = factor.CreateISampEngine().GetSampByKey(spKey);
             msg      = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
             if (msg != string.Empty)
             {
                 MessageService.ShowError(msg);
             }
             else
             {
                 SetSampProperties(dsReturn.Tables[EDC_SP_FIELDS.DATABASE_TABLE_NAME]);
             }
         }
     }
     catch (Exception)
     {
     }
     finally
     {
         CallRemotingService.UnregisterChannel();
     }
 }
Esempio n. 4
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            try
            {
                Hashtable spHashTable = new Hashtable();
                DataSet   dataSet     = new DataSet();

                string spName = this.txtSpName.Text.Trim();

                if (spName.Length > 0)
                {
                    spHashTable.Add(EDC_SP_FIELDS.FIELD_SP_NAME, spName);
                }

                DataTable spDataTable = FanHai.Hemera.Share.Common.CommonUtils.ParseToDataTable(spHashTable);
                spDataTable.TableName = EDC_SP_FIELDS.DATABASE_TABLE_NAME;
                dataSet.Tables.Add(spDataTable);

                string            msg           = string.Empty;
                DataSet           dsReturn      = new DataSet();
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();

                if (serverFactory != null)
                {
                    dsReturn = serverFactory.CreateISampEngine().SearchSamp(dataSet);
                    msg      = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
                    if (msg != string.Empty)
                    {
                        MessageService.ShowError(msg);
                    }
                    else
                    {
                        grdCtrlSamp.MainView   = gridViewSamp;
                        grdCtrlSamp.DataSource = dsReturn.Tables[EDC_SP_FIELDS.DATABASE_TABLE_NAME];
                    }
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError(ex);
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }
        }
Esempio n. 5
0
        public override bool UpdateStatus()
        {
            //get status of samp and put them into hashtable
            Hashtable spHashTable = new Hashtable();
            DataSet   dataSet     = new DataSet();

            // Add "Edc Data"
            spHashTable.Add(EDC_SP_FIELDS.FIELD_SP_KEY, _spKey);
            spHashTable.Add(EDC_SP_FIELDS.FIELD_STATUS, Convert.ToInt32(_spStatus).ToString());

            DataTable spDataTable = FanHai.Hemera.Share.Common.CommonUtils.ParseToDataTable(spHashTable);

            spDataTable.TableName = EDC_SP_FIELDS.DATABASE_TABLE_NAME;
            dataSet.Tables.Add(spDataTable);

            try
            {
                string            msg      = string.Empty;
                DataSet           dsReturn = null;
                IServerObjFactory factor   = CallRemotingService.GetRemoteObject();
                if (null != factor)
                {
                    dsReturn = factor.CreateISampEngine().UpdateSamp(dataSet);
                    msg      = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
                    if (msg != string.Empty)
                    {
                        MessageService.ShowError(msg);
                        return(false);
                    }
                    else
                    {
                        MessageService.ShowMessage("${res:Global.UpdateStatusMessage}", "${res:Global.SystemInfo}");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError(ex);
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }

            return(true);
        }
Esempio n. 6
0
        /// <summary>
        /// 获得异常规则
        /// </summary>
        /// <returns></returns>
        /// Owner by genchille.yang 2012-03-12 17:10:22
        public DataSet GetAbnormalRule()
        {
            DataSet dsReturn = new DataSet();

            try
            {
                IServerObjFactory serverObj = CallRemotingService.GetRemoteObject();
                dsReturn  = serverObj.CreateISampEngine().GetAbnormalRule();
                _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
                if (_errorMsg.Length > 0)
                {
                    MessageService.ShowError(_errorMsg);
                }
                else
                {
                    DataTable dtMain = null, dtDtl = null;
                    if (dsReturn.Tables.Contains(EDC_ABNORMAL_FIELDS.DATABASE_TABLE_NAME))
                    {
                        dtMain = dsReturn.Tables[EDC_ABNORMAL_FIELDS.DATABASE_TABLE_NAME];
                    }
                    if (dsReturn.Tables.Contains(EDC_ABNORMAL_DTL_FIELDS.DATABASE_TABLE_NAME))
                    {
                        dtDtl = dsReturn.Tables[EDC_ABNORMAL_DTL_FIELDS.DATABASE_TABLE_NAME];
                    }
                    if (null == dtMain || null == dtDtl)
                    {
                        MessageService.ShowError("异常规则表信息出错,请与管理员联系");
                    }
                    else
                    {
                        dsReturn.Tables.Clear();
                        dsReturn.Tables.Add(dtMain);
                        dsReturn.Tables.Add(dtDtl);

                        dsReturn.Relations.Add("子规则明细", dtMain.Columns[EDC_ABNORMAL_FIELDS.FIELD_ABNORMALID], dtDtl.Columns[EDC_ABNORMAL_DTL_FIELDS.FIELD_ABNORMALID]);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError(ex.Message);
            }
            return(dsReturn);
        }
Esempio n. 7
0
        public bool SampNameValidate()
        {
            try
            {
                string            msg      = string.Empty;
                DataSet           dsReturn = null;
                IServerObjFactory factor   = CallRemotingService.GetRemoteObject();
                if (null != factor)
                {
                    dsReturn = factor.CreateISampEngine().GetDistinctSampName();
                    msg      = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
                    if (msg != string.Empty)
                    {
                        MessageService.ShowError(msg);
                    }
                    else
                    {
                        foreach (DataRow dataRow in dsReturn.Tables[EDC_SP_FIELDS.DATABASE_TABLE_NAME].Rows)
                        {
                            if (_spName == dataRow[0].ToString())
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError(ex);
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }

            return(true);
        }
Esempio n. 8
0
        ///// <summary>
        ///// 新增异常点规则
        ///// </summary>
        ///// <param name="dsAbnormalRule"></param>
        ///// <returns></returns>
        //public bool InsertAbnormalRule(DataSet dsAbnormalRule)
        //{
        //    bool blResult = true;
        //    DataSet dsReturn = new DataSet();
        //    try
        //    {
        //        IServerObjFactory serverObj = CallRemotingService.GetRemoteObject();
        //        dsReturn = serverObj.CreateISampEngine().InsertAbnormalRule(dsAbnormalRule);
        //        _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
        //        if (_errorMsg.Length > 0)
        //        {
        //            blResult = false;
        //            MessageService.ShowError(_errorMsg);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        blResult = false;
        //        MessageService.ShowError(ex.Message);
        //    }
        //    return blResult;
        //}

        ///// <summary>
        ///// 更新/删除 异常点规则
        ///// </summary>
        ///// <param name="dsAbnormalRule"></param>
        ///// <returns></returns>
        //public bool UpdateAbnormalRule(DataSet dsAbnormalRule)
        //{
        //    bool blResult = true;
        //    DataSet dsReturn = new DataSet();
        //    try
        //    {
        //        IServerObjFactory serverObj = CallRemotingService.GetRemoteObject();
        //        dsReturn = serverObj.CreateISampEngine().UpdateAbnormalRule(dsAbnormalRule);
        //        _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
        //        if (_errorMsg.Length > 0)
        //        {
        //            blResult = false;
        //            MessageService.ShowError(_errorMsg);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        blResult = false;
        //        MessageService.ShowError(ex.Message);
        //    }
        //    return blResult;
        //}
        /// <summary>
        /// 保存异常规则---包括新增和更新
        /// </summary>
        /// <param name="dsAbnormalRule"></param>
        /// <returns></returns>
        public bool SaveAbnormalRule(DataSet dsAbnormalRule)
        {
            bool    blResult = true;
            DataSet dsReturn = new DataSet();

            try
            {
                IServerObjFactory serverObj = CallRemotingService.GetRemoteObject();
                dsReturn  = serverObj.CreateISampEngine().SaveAbnormalRule(dsAbnormalRule);
                _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
                if (_errorMsg.Length > 0)
                {
                    blResult = false;
                    MessageService.ShowError(_errorMsg);
                }
            }
            catch (Exception ex)
            {
                blResult = false;
                MessageService.ShowError(ex.Message);
            }
            return(blResult);
        }
Esempio n. 9
0
        /// <summary>
        /// 获得SPC选择的异常规则
        /// </summary>
        /// <param name="abnormalIds"></param>
        /// <returns></returns>
        /// Owner by genchille.yang 2012-03-26 16:12:39
        public DataSet GetAbnormalDetailRule(string abnormalIds)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                IServerObjFactory serverObj = CallRemotingService.GetRemoteObject();
                dsReturn  = serverObj.CreateISampEngine().GetAbnormalDetailRule(abnormalIds);
                _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
                if (_errorMsg.Length > 0)
                {
                    MessageService.ShowError(_errorMsg);
                }
                else if (!dsReturn.Tables.Contains(EDC_ABNORMAL_DTL_FIELDS.DATABASE_TABLE_NAME))
                {
                    MessageService.ShowError("异常规则表信息出错,请与管理员联系");
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError(ex.Message);
            }
            return(dsReturn);
        }
Esempio n. 10
0
        public bool Save(bool bNew)
        {
            //get all informations of samp and put them into hashtable
            Hashtable spHashTable = new Hashtable();
            DataSet   dataSet     = new DataSet();

            // Add "Edc Data"
            spHashTable.Add(EDC_SP_FIELDS.FIELD_SP_KEY, _spKey);
            spHashTable.Add(EDC_SP_FIELDS.FIELD_SP_NAME, _spName);
            spHashTable.Add(EDC_SP_FIELDS.FIELD_STATUS, Convert.ToInt32(_spStatus).ToString());
            spHashTable.Add(EDC_SP_FIELDS.FIELD_DESCRIPTIONS, _spDescription);

            spHashTable.Add(EDC_SP_FIELDS.FIELD_SAMPLING_MODE, _spMode);
            spHashTable.Add(EDC_SP_FIELDS.FIELD_SAMPLING_SIZE, _spSize);
            spHashTable.Add(EDC_SP_FIELDS.FIELD_PERCENT_FLAG, _spPercentFlag);

            spHashTable.Add(EDC_SP_FIELDS.FIELD_MAX_SAMPLING_SIZE, _spMaxSize);
            spHashTable.Add(EDC_SP_FIELDS.FIELD_UNIT_SAMPLING_MODE, _spUnitMode);
            spHashTable.Add(EDC_SP_FIELDS.FIELD_UNIT_SAMPLING_SIZE, _spUnitSize);
            spHashTable.Add(EDC_SP_FIELDS.FIELD_STRATEGY_SIZE, _spStrategySize);

            DataTable spDataTable = FanHai.Hemera.Share.Common.CommonUtils.ParseToDataTable(spHashTable);

            spDataTable.TableName = EDC_SP_FIELDS.DATABASE_TABLE_NAME;
            dataSet.Tables.Add(spDataTable);

            //Call Remoting Service
            try
            {
                string            msg      = string.Empty;
                DataSet           dsReturn = null;
                IServerObjFactory factor   = CallRemotingService.GetRemoteObject();
                if (null != factor)
                {
                    if (bNew)
                    {
                        dsReturn = factor.CreateISampEngine().AddSamp(dataSet);
                    }
                    else
                    {
                        dsReturn = factor.CreateISampEngine().UpdateSamp(dataSet);
                    }
                    msg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
                    if (msg != string.Empty)
                    {
                        MessageService.ShowError(msg);
                        return(false);
                    }
                    else
                    {
                        MessageService.ShowMessage("${res:Global.SuccessMessage}", "${res:Global.SystemInfo}");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError(ex);
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }

            return(true);
        }