Esempio n. 1
0
        private void tcMain_SelectedPageChanged(object sender, TabPageChangedEventArgs e)
        {
            if (e.Page != null && e.Page.Tag != null && e.Page.Tag is WIPStationProductionStatus)
            {
                string strProcedureName =
                    string.Format(
                        "{0}.{1}",
                        className,
                        MethodBase.GetCurrentMethod().Name);

                WIPStationProductionStatus workUnit = e.Page.Tag as WIPStationProductionStatus;
                int pageIndex = tcMain.TabPages.IndexOf(e.Page);

                int    errCode = 0;
                string errText = "";
                List <WIPStationSPCMonitor> datas = new List <WIPStationSPCMonitor>();

//#if DEBUG
//                datas.Add(
//                    new WIPStationSPCMonitor()
//                    {
//                        T47LeafID = 373564,
//                        PWONo_InExecution = "34PFF1CCQY60628003",
//                        T216LeafID = 5258697,
//                        T133LeafID = 2155684,
//                        T20LeafID = 352942,
//                    });
//#else

                WriteLog.Instance.WriteBeginSplitter(strProcedureName);
                try
                {
                    IRAPMDMClient.Instance.ufn_GetList_WIPStationSPCMonitor(
                        stationUser.CommunityID,
                        stationUser.SysLogID,
                        workUnit.T107Code,
                        ref datas,
                        out errCode,
                        out errText);
                    WriteLog.Instance.Write(
                        string.Format("({0}){1}", errCode, errText),
                        strProcedureName);
                    if (errCode != 0)
                    {
                        XtraMessageBox.Show(
                            errText,
                            "系统信息",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                        return;
                    }
                }
                finally
                {
                    WriteLog.Instance.WriteEndSplitter(strProcedureName);
                }
//#endif

                int t47LeafID = 0;
                if (datas.Count > 0)
                {
                    t47LeafID = datas[0].T47LeafID;
                }

                if (t47LeafID == 0)
                {
                    if (!(ucCharts[pageIndex] is ucUncontrolChart))
                    {
                        tcMain.TabPages[pageIndex].Controls.Remove(ucCharts[pageIndex]);
                        ucCharts[pageIndex] = null;

                        ucCharts[pageIndex] =
                            new ucUncontrolChart()
                        {
                            Dock   = DockStyle.Fill,
                            Parent = e.Page,
                        };
                    }
                }
                else
                {
                    switch (t47LeafID)
                    {
                    case 373564:
                        if (!(ucCharts[pageIndex] is ucRainBowChart))
                        {
                            tcMain.TabPages[pageIndex].Controls.Remove(ucCharts[pageIndex]);
                            ucCharts[pageIndex] = null;

                            ucRainBowChart chartRainBow =
                                new ucRainBowChart()
                            {
                                Dock   = DockStyle.Fill,
                                Parent = e.Page,
                            };
                            if (datas[0].TimeOutThreshold == 0)
                            {
                                chartRainBow.TimeOutThreshold = 60 * 1000;
                            }
                            else
                            {
                                chartRainBow.TimeOutThreshold = Convert.ToInt32(datas[0].TimeOutThreshold);
                            }

                            ucCharts[pageIndex] = chartRainBow;
                        }

                        (ucCharts[pageIndex] as ucRainBowChart).DrawChart(
                            stationUser,
                            workUnit,
                            datas[0].PWONo_InExecution,
                            t47LeafID,
                            datas[0].T216LeafID,
                            datas[0].T133LeafID,
                            datas[0].T20LeafID);

                        break;

                    case 373565:
                        if (!(ucCharts[pageIndex] is ucXBarRChart))
                        {
                            tcMain.TabPages[pageIndex].Controls.Remove(ucCharts[pageIndex]);
                            ucCharts[pageIndex] = null;

                            ucXBarRChart chartXbarR =
                                new ucXBarRChart()
                            {
                                Dock    = DockStyle.Fill,
                                Parent  = e.Page,
                                SPCRule = datas[0].SPCRule,
                            };

                            ucCharts[pageIndex] = chartXbarR;
                        }

                        (ucCharts[pageIndex] as ucXBarRChart).DrawChart(
                            stationUser,
                            workUnit,
                            datas[0],
                            datas[0].PWONo_InExecution,
                            datas[0].LCL,
                            datas[0].UCL,
                            datas[0].RLCL,
                            datas[0].RUCL,
                            datas[0].T20LeafID,
                            datas[0].PerQtyOfGroup);
                        break;
                    }
                }
            }
        }
Esempio n. 2
0
        //切换终端
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            frmUpdate update = new frmUpdate(stationUser);

            if (update.ShowDialog() == DialogResult.OK)
            {
                int    errCode = 0;
                string errText = "";
                List <WIPStationProductionStatus> tempunits = new List <WIPStationProductionStatus>();
                tempunits = GetWorkUnits(ref errCode, ref errText);
                if (errCode == 0)
                {
                    bool flag = false;
                    HideErrorMessage();
                    if (tempunits != null)
                    {
                        foreach (WIPStationProductionStatus u in tempunits)
                        {
                            foreach (WIPStationProductionStatus w in workUnits)
                            {
                                if (u.T107Code == w.T107Code && u.Ordinal == w.Ordinal)
                                {
                                    flag = true;
                                    break;
                                }
                            }
                            if (!flag)
                            {
                                workUnits.Add(u);
                                XtraTabPage page = tcMain.TabPages.Add();
                                page.Text = u.T107Name;
                                page.Tag  = u;

                                ucUncontrolChart chartNone = new ucUncontrolChart();
                                chartNone.Dock   = DockStyle.Fill;
                                chartNone.Parent = page;

                                InitConsumer(u.T107Code);

                                ucCharts.Add(chartNone);
                            }
                            flag = false;
                        }
                        if (tcMain.TabPages.Count > 0)
                        {
                            tcMain_SelectedPageChanged(
                                tcMain,
                                new TabPageChangedEventArgs(
                                    null,
                                    tcMain.TabPages[0]));
                        }
                    }
                }
                else
                {
                    ShowErrorMessage(errText);
                }
            }
        }
Esempio n. 3
0
        private void frmSPCOMain_Shown(object sender, EventArgs e)
        {
            WindowState = FormWindowState.Maximized;
            Application.DoEvents();

            int    errCode = 0;
            string errText = "";

            #region 获取服务器的当前时间,并设置当前的系统时间
            IRAPSystemClient.Instance.sfn_GetServerDateTime(
                ref serverTime,
                out errCode,
                out errText);
            if (errCode == 0)
            {
                SetSystemDateTime.SetSystemTime(serverTime);
            }
            #endregion

            if (stationUser == null || stationUser.SysLogID <= 0)
            {
                #region 获取当前站点的登录信息
                stationUser = PadLogin(ref errCode, ref errText);
                if (errCode != 0)
                {
                    ShowErrorMessage(errText);
                    return;
                }
                else
                {
                    HideErrorMessage();
                }
                #endregion
            }

            if (stationUser != null)
            {
                lblStationID.Text = stationUser.HostName;

                #region 获取当前站点监管的工位列表,并根据工位列表生成控制图
                if (stationUser.SysLogID > 0)
                {
                    if (!xtraScrollableControl.Visible)
                    {
                        xtraScrollableControl.Visible = true;
                    }

                    if (workUnits.Count == 0)
                    {
                        btnClose.Visible = false;
                        try
                        {
                            tcMain.TabPages.Clear();
                            workUnits = GetWorkUnits(ref errCode, ref errText);

                            if (errCode == 0)
                            {
                                HideErrorMessage();
                                List <string> filters = new List <string>();
                                foreach (WIPStationProductionStatus workUnit in workUnits)
                                {
#if DEBUG
                                    //workUnit.T47LeafID = 373564;
#endif

                                    XtraTabPage page = tcMain.TabPages.Add();
                                    page.Text = workUnit.T107Name;
                                    page.Tag  = workUnit;

                                    ucUncontrolChart chartNone = new ucUncontrolChart();
                                    chartNone.Dock   = DockStyle.Fill;
                                    chartNone.Parent = page;
                                    filters.Add(workUnit.T107Code);

                                    ucCharts.Add(chartNone);
                                }

                                if (tcMain.TabPages.Count > 0)
                                {
                                    tcMain_SelectedPageChanged(
                                        tcMain,
                                        new TabPageChangedEventArgs(
                                            null,
                                            tcMain.TabPages[0]));
                                }
                                foreach (string filter in filters)
                                {
                                    InitConsumer(filter);
                                }
                                InitConsumer(stationUser.SysLogID.ToString());
                            }
                            else
                            {
                                ShowErrorMessage(errText);
                            }
                        }
                        finally
                        {
                            btnClose.Visible = true;
                        }
                    }
                }
                #endregion
            }
        }