Esempio n. 1
0
        public static void getSPCValues(int curveIndex, float UCL, float LCL)
        {
            SPCFunctions SPCClass = new SPCFunctions();

            SPCClass.CalculateSPC(UCL, LCL, curveIndex, gVariable.dataInPoint, gVariable.CHART_TYPE_NO_SPC);

            cp[curveIndex]  = SPCClass.getSPCCp();
            cpk[curveIndex] = SPCClass.getSPCCpk();
            ppk[curveIndex] = SPCClass.getSPCPpk();
        }
Esempio n. 2
0
        //this function is not used in one curve function, because one curve may include a larger number of points, CPK is only a result of limited number of points
        private void getSPCValues(int index, float usl, float lsl)
        {
            float cp, pp, cpk, ppk;

            SPCFunctions SPCClass = new SPCFunctions();

            SPCClass.CalculateSPC(usl, lsl, index, gVariable.dataInPoint, gVariable.CHART_TYPE_NO_SPC);

            cp  = SPCClass.getSPCCp();
            pp  = SPCClass.getSPCPp();
            cpk = SPCClass.getSPCCpk();
            ppk = SPCClass.getSPCPpk();

            chart1.ChartAreas[0].AxisX.Title = "Cp: " + cp.ToString("f4") + " Cpk: " + cpk.ToString("f4") + "Pp: " + pp.ToString("f4") + "     Ppk: " + ppk.ToString("f4");
        }
Esempio n. 3
0
        private void Form3_Load(object sender, EventArgs e)
        {
            int i;

            Chart[] chartArray = { chart1,  chart2,  chart3,  chart4,  chart5,  chart6,  chart7,  chart8,  chart9,  chart10,
                                   chart11, chart12, chart13, chart14, chart15, chart16, chart17, chart18, chart19, chart20,
                                   chart21, chart22, chart23, chart24, chart25, chart26, chart27, chart28, chart29, chart30,
                                   chart31, chart32, chart33, chart34, chart35, chart36 };

            TextBox[] textBoxArray = { textBox1,  textBox2,  textBox3,  textBox4,  textBox5,  textBox6,  textBox7,  textBox8,  textBox9,  textBox10,
                                       textBox11, textBox12, textBox13, textBox14, textBox15, textBox16, textBox17, textBox18, textBox19, textBox20,
                                       textBox21, textBox22, textBox23, textBox24, textBox25, textBox26, textBox27, textBox28, textBox29, textBox30,
                                       textBox31, textBox32, textBox33, textBox34, textBox35, textBox36 };

            Label[] labelArray = { label1,  label2,  label3,  label4,  label5,  label6,  label7,  label8,  label9,  label10,
                                   label11, label12, label13, label14, label15, label16, label17, label18, label19, label20,
                                   label21, label22, label23, label24, label25, label26, label27, label28, label29, label30,
                                   label31, label32, label33, label34, label35, label36 };

            try
            {
                //we need to first call this to get SPCClass
                SPCClass = new SPCFunctions();

                aTimer = new System.Windows.Forms.Timer();

                //refresh screen every 100 ms
                aTimer.Interval = 1000;
                aTimer.Enabled  = true;

                aTimer.Tick += new EventHandler(timer_listview);

                drawCurveFunc();

                //display chart, textbox and label if this port is enabled
                for (i = 0; i < gVariable.totalCurveNum[gVariable.boardIndexSelected]; i++)
                {
                    labelArray[i].Text = gVariable.curveTitle[i]; //.Remove(gVariable.curveTitle[i].IndexOf('('));
                    labelArray[i].Show();

                    textBoxArray[i].Text = gVariable.curveTextArray[i];
                    textBoxArray[i].Show();
                    textBoxArray[i].Enabled = true;

                    initEveryChart(i, chartArray[i], gVariable.curveTitle[i] + "  ——  " + SPCChartNameArray[gVariable.SPCChartIndex]);
                    chartArray[i].Show();
                }

                //we have altogether 36 charts, index equal or larger than gVariable.totalCurveNum does not used so will be disabled
                for (; i < gVariable.maxCurveNum; i++)
                {
                    labelArray[i].Hide();
                    textBoxArray[i].Hide();
                    chartArray[i].Hide();
                }
                this.Text = gVariable.programTitle + "SPC状况监测";

                closeReason = 0;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Form3_Load() in SPCCurve function !" + ex);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 插入某工艺点质量统计报告
        /// </summary>
        /// <param name="seg">开始、结束时间、数据点code、计划号</param>
        protected static void InsertRecord(MSYS.IHAction.TimeSeg seg)
        {
            MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator();
            int recordnum           = Convert.ToInt16(opt.GetSegValue("select count(rowid) as count  from ht_qlt_data_record  where plan_id = '" + seg.planno + "' and para_code = '" + seg.nodecode + "'  and b_time = '" + seg.starttime + "' and e_time = '" + seg.endtime + "'", "count"));
            //if (recordnum > 0)
            //    return;

            string teamcode = opt.GetSegValue("select team_code  from ht_prod_schedule where date_begin <='" + seg.starttime + "' and date_end >='" + seg.endtime + "' and work_staus = '1'", "team_code");

            IHAction ihopt = new IHAction();
            //根据开始、结束时间、数据点code、计划号获取原始数据,返回的数据为三列:时间、值、状态;状态为料头、料尾、过程值、断流
            List <IHAction.ParaRes> dt = ihopt.GetIHOrgDataSet(seg);

            if (dt == null)
            {
                return;
            }
            string gaptime = "";
            string is_gap  = "0";
            List <IHAction.Gaptime> gaplist = ihopt.gaptimes();

            if (gaplist == null)
            {
                gaptime = "0";
            }
            else
            {
                int timecount = 0;
                foreach (IHAction.Gaptime time in gaplist)
                {
                    timecount += time.gaptime;
                }
                gaptime = timecount.ToString();
            }
            if (gaptime != "0")
            {
                is_gap = "1";
            }
            //////////////////////////////////////////////////////////////////////////////////////////
            double[] samples = null;
            if (dt != null && dt.Count > 0)
            {
                List <IHAction.ParaRes> Rows = dt.FindAll(s => s.status == "过程值");

                samples = Rows.Select(s => s.value).ToArray();
            }
            ///////////////根据原始数据计算算统计数据///////////////////////////////////////////////////////

            if (samples != null && samples.GetLength(0) > 0)
            {
                DataSet set = opt.CreateDataSetOra("select s.para_code,s.value,s.upper_limit,s.lower_limit from ht_pub_prod_design r left join ht_tech_stdd_code_detail s on r.tech_stdd_code = s.tech_code  where r.prod_code = '" + seg.planno.Substring(8, 7) + "' and s.para_code = '" + seg.nodecode + "'");
                if (set != null && set.Tables[0].Select().GetLength(0) > 0 && set.Tables[0].Select()[0]["value"].ToString() != "" && set.Tables[0].Select()[0]["upper_limit"].ToString() != "" && set.Tables[0].Select()[0]["lower_limit"].ToString() != "")
                {
                    string CL       = set.Tables[0].Select()[0]["value"].ToString();
                    string upvalue  = set.Tables[0].Select()[0]["upper_limit"].ToString();
                    string lowvalue = set.Tables[0].Select()[0]["lower_limit"].ToString();

                    SPCFunctions spc        = new SPCFunctions(samples, Convert.ToDouble(upvalue), Convert.ToDouble(lowvalue));
                    string[]     tableseg   = { "PLAN_ID", "PROD_CODE", "PARA_CODE", "TEAM", "B_TIME", "E_TIME", "AVG", "COUNT", "MIN", "MAX", "QUANUM", "QUARATE", "UPCOUNT", "UPRATE", "DOWNCOUNT", "DOWNRATE", "STDDEV", "ABSDEV", "IS_GAP", "CPK", "VAR", "RANGE", "GAP_TIME" };
                    string[]     tablevalue = { seg.planno, seg.planno.Substring(8, 7), seg.nodecode, teamcode, seg.starttime, seg.endtime, spc.avg.ToString(), spc.count.ToString(), spc.min.ToString(), spc.max.ToString(), spc.passcount.ToString(), spc.passrate.ToString("f4"), spc.upcount.ToString(), spc.uprate.ToString("f4"), spc.downcount.ToString(), spc.downrate.ToString("f4"), spc.stddev.ToString("f4"), spc.absdev.ToString("f4"), is_gap, spc.Cpk.ToString("f4"), spc.var.ToString("f4"), spc.Range.ToString("f4"), gaptime };
                    opt.MergeInto(tableseg, tablevalue, 6, "HT_QLT_DATA_RECORD");
                }
            }
        }