Exemple #1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            //DataTable paramTable = new DataTable(SPC_PARAM_DATA_FIELDS.DATABASE_TABLE_NAME);
            //paramTable.Columns.Add(SPC_PARAM_DATA_FIELDS.COL_KEY);

            if (meReason.Text.Trim().Length == 0)
            {
                MessageService.ShowError("请填写原因");
                return;
            }
            //剔除选择的原始数据
            DataSet dataSet = new DataSet();

            dataSet.ExtendedProperties.Add(SPC_PARAM_DATA_FIELDS.POINT_KEY, _pointkey);
            dataSet.ExtendedProperties.Add(SPC_PARAM_DATA_FIELDS.EDIT_REASON, meReason.Text);
            dataSet.ExtendedProperties.Add(SPC_PARAM_DATA_FIELDS.EDITOR, PropertyService.Get(PROPERTY_FIELDS.USER_NAME));
            dataSet.ExtendedProperties.Add("isMr", isMr);
            //dataSet.Tables.Add(paramTable);
            SpcEntity spcEntity = new SpcEntity();

            if (spcEntity.DeletePoints(dataSet))
            {
                MessageService.ShowMessage("剔除成功!");
                DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageService.ShowError("剔除异常点出错:" + spcEntity.ErrorMsg);
            }
        }
Exemple #2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (meReason.Text.Trim().Length == 0)
            {
                MessageService.ShowError("请填写原因");
                return;
            }
            if (MessageService.AskQuestion("确定要修正数据吗?"))
            {
                //剔除选择的原始数据
                DataSet dataSet = new DataSet();
                dataSet.ExtendedProperties.Add(SPC_PARAM_DATA_FIELDS.EDIT_REASON, meReason.Text);
                dataSet.ExtendedProperties.Add(SPC_PARAM_DATA_FIELDS.EDITOR, PropertyService.Get(PROPERTY_FIELDS.USER_NAME));
                //dataSet.ExtendedProperties.Add(SPC_PARAM_DATA_FIELDS.COL_KEY, colKey);
                dataSet.ExtendedProperties.Add(SPC_PARAM_DATA_FIELDS.EDIT_FLAG, _editFlag.ToString());
                dataSet.ExtendedProperties.Add(SPC_PARAM_DATA_FIELDS.POINT_KEY, _pointkey);

                SpcEntity spcEntity = new SpcEntity();
                //if (spcEntity.ModifyPoints(dataSet,isMr))
                if (spcEntity.ModifyPoints(dataSet))
                {
                    MessageService.ShowMessage("修正成功!");
                    DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    MessageService.ShowError("修正异常点出错:" + spcEntity.ErrorMsg);
                }
            }
        }
Exemple #3
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            SpcEntity spcEntity = new SpcEntity();

            spcEntity.ParamName = this.txtParamName.Text.Trim();
            DataSet dsParams = spcEntity.SearchParams();

            if (spcEntity.ErrorMsg.Length > 0)
            {
                MessageService.ShowError("查询参数出错!错误信息:" + spcEntity.ErrorMsg);
            }
            else
            {
                if (dsParams != null && dsParams.Tables.Count > 0 && dsParams.Tables.Contains(BASE_PARAMETER_FIELDS.DATABASE_TABLE_NAME))
                {
                    try
                    {
                        DataTable paramTable = dsParams.Tables[BASE_PARAMETER_FIELDS.DATABASE_TABLE_NAME];
                        //paramTable.Rows.Add("EFF","EFF","");
                        //paramTable.Rows.Add("UOC", "UOC","");
                        //paramTable.Rows.Add("ISC", "ISC","");
                        //paramTable.Rows.Add("FF", "FF","");
                        //paramTable.Rows.Add("IREV1", "IREV1","");
                        //paramTable.Rows.Add("IREV2", "IREV2","");
                        //paramTable.Rows.Add("RSH", "RSH","");
                        //paramTable.Rows.Add("RSER", "RSER","");
                        string[] columns = new string[] { "PARAMETER_NAME" };
                        KeyValuePair <string, string> category = new KeyValuePair <string, string>("CATEGORY_NAME", "SPC_PARAMETER");
                        DataTable baseParamTable = BaseData.Get(columns, category);
                        if (baseParamTable != null)
                        {
                            foreach (DataRow row in baseParamTable.Rows)
                            {
                                paramTable.Rows.Add(row["PARAMETER_NAME"].ToString(), row["PARAMETER_NAME"].ToString(), "");
                            }
                        }
                        grdCtrlParam.MainView   = gridViewParam;
                        grdCtrlParam.DataSource = paramTable;
                    }
                    catch (Exception ex)
                    {
                        MessageService.ShowError(ex.Message);
                    }
                }
            }
        }
Exemple #4
0
        private void InitializeChart(DataSet valueDataSet, SpcEntity spcEntity)
        {
            if (txtPointsInterval.Text.Trim() != "" && Convert.ToInt32(txtPointsInterval.Text) > 0)
            {
                interval = Convert.ToInt32(txtPointsInterval.Text);
            }
            string c_title_01 = c_title;

            if (!equipmentNames.Trim().Equals(string.Empty))
            {
                c_title_01 = equipmentNames + "," + c_title;
            }
            #region
            switch (chartType.ToUpper())
            {
            case ChartType.XBAR_R:
                XbarRChart = new Xbar_RChart(valueDataSet, spcEntity, lst, c_title_01, interval, conCode);
                break;

            case ChartType.XBAR_S:
                XbarSChart = new Xbar_SChart(valueDataSet, spcEntity, lst, c_title_01, interval, conCode);
                break;

            case ChartType.XBAR_MR:
                X_mrChart = new X_MRChart(valueDataSet, spcEntity, lst, c_title_01, interval, conCode);
                break;

            case ChartType.XBAR:
                XbarChart = new XBARChart(valueDataSet, spcEntity, lst, c_title_01, interval, conCode);
                break;

            default:
                break;
            }
            #endregion
        }
Exemple #5
0
        private void btSave_Click(object sender, EventArgs e)
        {
            DataTable saveTable = new DataTable();

            saveTable.TableName = SPC_PARAMETER_FIELD.DATABASE_TABLE_NAME;
            saveTable.Columns.Add(SPC_PARAMETER_FIELD.PARAMETER_NAME);
            saveTable.Columns.Add(SPC_PARAMETER_FIELD.PARAMETER_KEY);
            saveTable.Columns.Add(COMMON_FIELDS.FIELD_COMMON_OPERATION_ACTION);
            DataTable paramTable = (DataTable)gcMainParam.DataSource;

            for (int i = 0; i < paramTable.Rows.Count; i++)
            {
                int    j;
                string paramKey = string.Empty;
                for (j = 0; j < mainParamTable.Rows.Count; j++)
                {
                    paramKey = paramTable.Rows[i][SPC_PARAMETER_FIELD.PARAMETER_KEY].ToString();
                    if (mainParamTable.Rows[j][SPC_PARAMETER_FIELD.PARAMETER_KEY].ToString() == paramKey)
                    {
                        break;
                    }
                }
                if (j == mainParamTable.Rows.Count)
                {
                    //add new
                    Dictionary <string, string> rowData = new Dictionary <string, string>()
                    {
                        { SPC_PARAMETER_FIELD.PARAMETER_KEY, paramTable.Rows[i][SPC_PARAMETER_FIELD.PARAMETER_KEY].ToString() },
                        { SPC_PARAMETER_FIELD.PARAMETER_NAME, paramTable.Rows[i][SPC_PARAMETER_FIELD.PARAMETER_NAME].ToString() },
                        { COMMON_FIELDS.FIELD_COMMON_OPERATION_ACTION, "New" }
                    };

                    SolarViewer.Hemera.Utils.Common.Utils.AddRowDataToDataTable(ref saveTable, rowData);
                }
            }

            for (int i = 0; i < mainParamTable.Rows.Count; i++)
            {
                int    j;
                string paramKey = string.Empty;
                for (j = 0; j < paramTable.Rows.Count; j++)
                {
                    paramKey = mainParamTable.Rows[i][SPC_PARAMETER_FIELD.PARAMETER_KEY].ToString();
                    if (paramTable.Rows[j][SPC_PARAMETER_FIELD.PARAMETER_KEY].ToString() == paramKey)
                    {
                        break;
                    }
                }
                if (j == paramTable.Rows.Count)
                {
                    //add delete
                    Dictionary <string, string> rowData = new Dictionary <string, string>()
                    {
                        { SPC_PARAMETER_FIELD.PARAMETER_KEY, mainParamTable.Rows[i][SPC_PARAMETER_FIELD.PARAMETER_KEY].ToString() },
                        { SPC_PARAMETER_FIELD.PARAMETER_NAME, mainParamTable.Rows[i][SPC_PARAMETER_FIELD.PARAMETER_NAME].ToString() },
                        { COMMON_FIELDS.FIELD_COMMON_OPERATION_ACTION, "Delete" }
                    };

                    SolarViewer.Hemera.Utils.Common.Utils.AddRowDataToDataTable(ref saveTable, rowData);
                }
            }

            if (saveTable.Rows.Count > 0)
            {
                DataSet dsSave = new DataSet();
                dsSave.Tables.Add(saveTable);
                spcEntity = new SpcEntity();
                if (spcEntity.SaveParams(dsSave))
                {
                    InitialData();
                }
            }
        }
Exemple #6
0
 public SpcParameterCtrl()
 {
     InitializeComponent();
     spcEntity = new SpcEntity();
 }
Exemple #7
0
 public AbnormalRules()
 {
     InitializeComponent();
     spcEntity = new SpcEntity();
 }
Exemple #8
0
        private void LoadChart()
        {
            spcEntity = new SpcEntity();

            picPanel.Controls.Clear();
            try
            {
                if (paramValueDs_temp != null && paramValueDs_temp.Tables.Count > 0 && paramValueDs_temp.Tables[SPC_PARAM_DATA_FIELDS.DB_FOR_POINTS].Rows.Count > 0)
                {
                    dtSpec = paramValueDs_New.Tables[EDC_POINT_PARAMS_FIELDS.DATABASE_TABLE_NAME];
                    DataRow dr = null;
                    //设备
                    if (!string.IsNullOrEmpty(betEquipment.EditValue.ToString()))
                    {
                        string[] s_array = betEquipment.EditValue.ToString().Split(',');

                        string    s   = string.Format("EQUIPMENT_KEY='{0}'", s_array[0]);
                        DataRow[] drs = dtSpec.Select(s);
                        if (drs.Length > 0)
                        {
                            dr = drs[0];
                        }
                        else
                        {
                            dr = dtSpec.Rows[0];
                        }
                    }
                    else
                    {
                        DataRow[] drs = dtSpec.Select(@"EQUIPMENT_KEY=''");
                        if (drs.Length > 0)
                        {
                            dr = drs[0];
                        }
                        else
                        {
                            dr = dtSpec.Rows[0];
                        }
                    }

                    spcEntity.USL = dr[EDC_POINT_PARAMS_FIELDS.FIELD_UPPER_BOUNDARY].ToString();
                    spcEntity.SL  = dr[EDC_POINT_PARAMS_FIELDS.FIELD_TARGET].ToString();
                    spcEntity.LSL = dr[EDC_POINT_PARAMS_FIELDS.FIELD_LOWER_BOUNDARY].ToString();
                    spcEntity.UCL = dr[EDC_POINT_PARAMS_FIELDS.FIELD_UPPER_SPEC].ToString();
                    spcEntity.LCL = dr[EDC_POINT_PARAMS_FIELDS.FIELD_LOWER_SPEC].ToString();

                    if (paramValueDs_New.ExtendedProperties.ContainsKey("C_TITLE"))
                    {
                        c_title = paramValueDs_New.ExtendedProperties["C_TITLE"].ToString() + dtSpec.Rows[0][EDC_POINT_PARAMS_FIELDS.FIELD_PARAM_NAME].ToString();
                    }

                    this.layoutControlGroupCondition.Expanded = false;
                    picLoad.Visible = true;
                    picPanel.Controls.Add(picLoad);

                    Control.CheckForIllegalCrossThreadCalls = false;
                    BackgroundWorker backWorker = new BackgroundWorker();
                    backWorker.DoWork += new DoWorkEventHandler((r, d) =>
                    {
                        InitializeChart(paramValueDs_temp, spcEntity);
                    });
                    backWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler((r, c) =>
                    {
                        picLoad.Visible = false;
                        #region
                        switch (chartType.ToUpper())
                        {
                        case ChartType.XBAR_R:
                            picPanel.Controls.Add(XbarRChart);
                            XbarRChart.Dock = DockStyle.Fill;
                            break;

                        case ChartType.XBAR_S:
                            picPanel.Controls.Add(XbarSChart);
                            XbarSChart.Dock = DockStyle.Fill;
                            break;

                        case ChartType.XBAR_MR:
                            picPanel.Controls.Add(X_mrChart);
                            X_mrChart.Dock = DockStyle.Fill;
                            break;

                        case ChartType.XBAR:
                            picPanel.Controls.Add(XbarChart);
                            XbarChart.Dock = DockStyle.Fill;
                            break;

                        default:
                            break;
                        }
                        #endregion
                    });
                    backWorker.RunWorkerAsync();
                }
                else
                {
                    MessageService.ShowMessage("没有查询到结果");
                }
            }
            catch (Exception ex)
            {
                conid = string.Empty;
                MessageService.ShowError(ex.Message);
            }
        }