Esempio n. 1
0
        private void btnBandFix_Click(object sender, EventArgs e)
        {
            try
            {
                btnBandFix.Enabled = false;

                if (btnCon.Text == "连接")
                {
                    MessageBox.Show("请先连接Web服务器", "流程设置", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                string er = string.Empty;

                CGJWeb.CFIX_BAND fixture = new CGJWeb.CFIX_BAND();

                fixture.Base.IdCard    = txtIdCard.Text;
                fixture.Base.MaxSlot   = cmbSlotMax.SelectedIndex + 1;
                fixture.Base.LineNo    = System.Convert.ToInt16(txtLineNo.Text);
                fixture.Base.LineName  = txtLineName.Text;
                fixture.Base.Model     = txtModel.Text;
                fixture.Base.OrderName = txtOrder.Text;
                fixture.Base.MesFlag   = cmbMes.SelectedIndex;
                fixture.Base.UseStatus = (CGJWeb.EFIX_STATUS)(cmbUseStatus.SelectedIndex - 1);

                for (int i = 0; i < fixture.Base.MaxSlot; i++)
                {
                    CGJWeb.CSN_INFO sn = new CGJWeb.CSN_INFO();

                    sn.SerialNo = txtSn[i].Text;

                    fixture.Para.Add(sn);
                }

                watcher.Restart();

                if (!CGJWeb.BandSnToFixture(fixture, out er))
                {
                    labStatus.Text      = er;
                    labStatus.ForeColor = Color.Red;
                    return;
                }

                rtbRtn.Text         = er;
                labStatus.Text      = "绑定治具条码OK.";
                labStatus.ForeColor = Color.Blue;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                watcher.Stop();

                btnBandFix.Enabled = true;

                labTimes.Text = watcher.ElapsedMilliseconds.ToString();
            }
        }
Esempio n. 2
0
        private void btnCon_Click(object sender, EventArgs e)
        {
            try
            {
                btnCon.Enabled = false;

                if (btnCon.Text == "连接")
                {
                    string er = string.Empty;

                    string ulrWeb = txtUlrWeb.Text;

                    string version = string.Empty;

                    watcher.Restart();

                    if (!CGJWeb.CheckSystem(ulrWeb, out version, out er))
                    {
                        watcher.Stop();
                        labStatus.Text      = er;
                        labStatus.ForeColor = Color.Red;
                        return;
                    }
                    watcher.Stop();

                    rtbRtn.Text         = version;
                    labStatus.Text      = "连接Web服务端正常.";
                    labStatus.ForeColor = Color.Blue;
                    btnCon.ImageKey     = "Con";
                    btnCon.Text         = "断开";

                    CIniFile.WriteToIni("ToolDebug", "ulrWeb", ulrWeb, iniFile);
                }
                else
                {
                    labStatus.Text      = "断开Web服务端连接.";
                    labStatus.ForeColor = Color.Blue;
                    btnCon.ImageKey     = "Dis";
                    btnCon.Text         = "连接";
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                btnCon.Enabled = true;

                labTimes.Text = watcher.ElapsedMilliseconds.ToString();
            }
        }
Esempio n. 3
0
        private void btnRead_Click(object sender, EventArgs e)
        {
            try
            {
                btnRead.Enabled = false;

                if (btnCon.Text == "连接")
                {
                    MessageBox.Show("请先连接Web服务器", "流程设置", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                string er = string.Empty;

                List <CGJWeb.CSTAT_FLOW> StatFlow = null;

                watcher.Restart();

                if (!CGJWeb.GetStatFlowList(out StatFlow, out er))
                {
                    watcher.Stop();
                    labStatus.Text      = er;
                    labStatus.ForeColor = Color.Red;
                    return;
                }
                watcher.Stop();

                RefreshFlowPanel(StatFlow);

                rtbRtn.Text         = er;
                labStatus.Text      = "读取站别流程成功.";
                labStatus.ForeColor = Color.Blue;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                btnRead.Enabled = true;

                labTimes.Text = watcher.ElapsedMilliseconds.ToString();
            }
        }
Esempio n. 4
0
        private void btnResult_Click(object sender, EventArgs e)
        {
            try
            {
                btnResult.Enabled = false;

                if (btnCon.Text == "连接")
                {
                    MessageBox.Show("请先连接Web服务器", "流程设置", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                string er = string.Empty;

                watcher.Restart();

                List <CGJWeb.CSN_TESTDATA> rData = null;

                if (!CGJWeb.GetSnTestData(txtSn[0].Text, out rData, out er))
                {
                    labStatus.Text      = er;
                    labStatus.ForeColor = Color.Red;
                    return;
                }
                rtbRtn.Text         = er;
                labStatus.Text      = "读取条码[" + txtSn[0].Text + "]信息OK.";
                labStatus.ForeColor = Color.Blue;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                watcher.Stop();

                btnResult.Enabled = true;

                labTimes.Text = watcher.ElapsedMilliseconds.ToString();
            }
        }
Esempio n. 5
0
        private void btnFixYield_Click(object sender, EventArgs e)
        {
            try
            {
                btnFixYield.Enabled = false;

                if (btnCon.Text == "连接")
                {
                    MessageBox.Show("请先连接Web服务器", "流程设置", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                string er = string.Empty;

                watcher.Restart();

                CGJWeb.CFIX_YIELD yields = null;

                if (!CGJWeb.GetIdCardYield(txtIdCard.Text, txtStat.Text, out yields, out er))
                {
                    labStatus.Text      = er;
                    labStatus.ForeColor = Color.Red;
                    return;
                }
                rtbRtn.Text         = er;
                labStatus.Text      = "读取治具产能OK.";
                labStatus.ForeColor = Color.Blue;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                watcher.Stop();

                btnFixYield.Enabled = true;

                labTimes.Text = watcher.ElapsedMilliseconds.ToString();
            }
        }
Esempio n. 6
0
        private void btnUseStatus_Click(object sender, EventArgs e)
        {
            try
            {
                btnUseStatus.Enabled = false;

                if (btnCon.Text == "连接")
                {
                    MessageBox.Show("请先连接Web服务器", "流程设置", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                string er = string.Empty;

                watcher.Restart();

                CGJWeb.EFIX_STATUS useStatus = (CGJWeb.EFIX_STATUS)(cmbUseStatus.SelectedIndex - 1);

                if (!CGJWeb.SetFixtureUseStaus(txtIdCard.Text, useStatus, out er))
                {
                    labStatus.Text      = er;
                    labStatus.ForeColor = Color.Red;
                    return;
                }
                rtbRtn.Text         = er;
                labStatus.Text      = "设置治具状态OK.";
                labStatus.ForeColor = Color.Blue;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                watcher.Stop();

                btnUseStatus.Enabled = true;

                labTimes.Text = watcher.ElapsedMilliseconds.ToString();
            }
        }
Esempio n. 7
0
        private void btnChkSn_Click(object sender, EventArgs e)
        {
            try
            {
                btnChkSn.Enabled = false;

                if (btnCon.Text == "连接")
                {
                    MessageBox.Show("请先连接Web服务器", "流程设置", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                string er = string.Empty;

                watcher.Restart();

                if (!CGJWeb.CheckSn(txtSn[0].Text, txtFlow.Text, out er))
                {
                    labStatus.Text      = er;
                    labStatus.ForeColor = Color.Red;
                    return;
                }
                rtbRtn.Text         = er;
                labStatus.Text      = "检查条码[" + txtSn[0].Text + "]OK.";
                labStatus.ForeColor = Color.Blue;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                watcher.Stop();

                btnChkSn.Enabled = true;

                labTimes.Text = watcher.ElapsedMilliseconds.ToString();
            }
        }
Esempio n. 8
0
        private void btnFun_Click(object sender, EventArgs e)
        {
            try
            {
                btnFun.Enabled = false;

                watcher.Restart();

                string er = string.Empty;

                string reponseXml = string.Empty;

                if (!CGJWeb.PostFunction(txtFunName.Text, rtbSend.Text, out reponseXml, out er))
                {
                    labStatus.Text      = er;
                    labStatus.ForeColor = Color.Red;
                    return;
                }

                rtbRtn.Text         = reponseXml;
                labStatus.Text      = "调用[" + txtFunName.Text + "]成功.";
                labStatus.ForeColor = Color.Blue;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                btnFun.Enabled = true;

                watcher.Stop();

                labTimes.Text = watcher.ElapsedMilliseconds.ToString();
            }
        }
Esempio n. 9
0
        private void btnWriteResult_Click(object sender, EventArgs e)
        {
            try
            {
                btnWriteResult.Enabled = false;

                if (btnCon.Text == "连接")
                {
                    MessageBox.Show("请先连接Web服务器", "流程设置", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                string er = string.Empty;

                watcher.Restart();

                CGJWeb.CFIX_RESULT fixture = new CGJWeb.CFIX_RESULT();

                fixture.Base.IdCard = txtIdCard.Text;

                fixture.Base.CurFlowName = txtFlow.Text;

                fixture.Base.CurStatName = txtStat.Text;

                fixture.Base.StartTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");

                fixture.Base.EndTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");

                fixture.Base.LocalName = "L1-01";

                fixture.Base.CheckSn = cmbChkSn.SelectedIndex;

                for (int i = 0; i < cmbSlotMax.SelectedIndex + 1; i++)
                {
                    CGJWeb.CSN_RESULT Sn = new CGJWeb.CSN_RESULT();

                    Sn.SerialNo = txtSn[i].Text;

                    Sn.CurResult = cmbSnResult[i].SelectedIndex;

                    fixture.Para.Add(Sn);
                }

                if (!CGJWeb.UpdateFixtureResult(fixture, out er))
                {
                    labStatus.Text      = er;
                    labStatus.ForeColor = Color.Red;
                    return;
                }

                rtbRtn.Text         = er;
                labStatus.Text      = "上传治具测试结果OK.";
                labStatus.ForeColor = Color.Blue;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                watcher.Stop();

                btnWriteResult.Enabled = true;

                labTimes.Text = watcher.ElapsedMilliseconds.ToString();
            }
        }
Esempio n. 10
0
        private void btnGetFix_Click(object sender, EventArgs e)
        {
            try
            {
                btnGetFix.Enabled = false;

                if (btnCon.Text == "连接")
                {
                    MessageBox.Show("请先连接Web服务器", "流程设置", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                string er = string.Empty;

                watcher.Restart();

                CGJWeb.CFIX_BAND fixture = new CGJWeb.CFIX_BAND();

                if (!chkSnFlow.Checked)
                {
                    if (!CGJWeb.GetInfoFromFixture(txtIdCard.Text, out fixture, out er))
                    {
                        labStatus.Text      = er;
                        labStatus.ForeColor = Color.Red;
                        return;
                    }
                }
                else
                {
                    if (!CGJWeb.GetFlowSnFromFixture(txtIdCard.Text, txtFlow.Text, out fixture, out er))
                    {
                        labStatus.Text      = er;
                        labStatus.ForeColor = Color.Red;
                        return;
                    }
                }

                cmbSlotMax.SelectedIndex   = fixture.Base.MaxSlot - 1;
                cmbUseStatus.SelectedIndex = (int)fixture.Base.UseStatus + 1;
                txtLineNo.Text             = fixture.Base.LineNo.ToString();
                txtLineName.Text           = fixture.Base.LineName;
                txtModel.Text        = fixture.Base.Model;
                txtOrder.Text        = fixture.Base.OrderName;
                cmbMes.SelectedIndex = fixture.Base.MesFlag;

                for (int i = 0; i < fixture.Base.MaxSlot; i++)
                {
                    txtSn[i].Text                = fixture.Para[i].SerialNo;
                    txtSnFlow[i].Text            = fixture.Para[i].CurFlowName;
                    cmbSnResult[i].SelectedIndex = fixture.Para[i].CurResult;
                }

                rtbRtn.Text         = er;
                labStatus.Text      = "读取治具条码OK.";
                labStatus.ForeColor = Color.Blue;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                watcher.Stop();

                btnGetFix.Enabled = true;

                labTimes.Text = watcher.ElapsedMilliseconds.ToString();
            }
        }
Esempio n. 11
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                btnSave.Enabled = false;

                if (btnCon.Text == "连接")
                {
                    MessageBox.Show("请先连接Web服务器", "流程设置", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                if (MessageBox.Show("确定要保存站别与流程设置?", "流程设置", MessageBoxButtons.YesNo, MessageBoxIcon.Question) !=
                    DialogResult.Yes)
                {
                    return;
                }

                for (int i = 0; i < labStatId.Count; i++)
                {
                    if (txtStatName[i].Text == "")
                    {
                        MessageBox.Show("站别名称不能为空", "流程设置", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                    if (txtFlowName[i].Text == "")
                    {
                        MessageBox.Show("流程名称不能为空", "流程设置", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                }

                string er = string.Empty;

                watcher.Restart();

                List <int> flowIds = new List <int>();

                List <CGJWeb.CFLOW> flowList = new List <CGJWeb.CFLOW>();

                for (int i = 0; i < cmbFlowId.Count; i++)
                {
                    if (cmbDisable[i].SelectedIndex == 0 && !flowIds.Contains(cmbFlowId[i].SelectedIndex + 1))
                    {
                        flowIds.Add(cmbFlowId[i].SelectedIndex + 1);

                        CGJWeb.CFLOW flow = new CGJWeb.CFLOW();

                        flow.Id = cmbFlowId[i].SelectedIndex + 1;

                        flow.Name = txtFlowName[i].Text;

                        flow.Disable = 0;

                        flowList.Add(flow);
                    }
                }

                if (!CGJWeb.SetFlowList(flowList, out er))
                {
                    watcher.Stop();
                    labStatus.Text      = er;
                    labStatus.ForeColor = Color.Red;
                    return;
                }

                List <CGJWeb.CSTAT> statList = new List <CGJWeb.CSTAT>();

                for (int i = 0; i < labStatId.Count; i++)
                {
                    CGJWeb.CSTAT stat = new CGJWeb.CSTAT();

                    stat.Id = i + 1;

                    stat.Name = txtStatName[i].Text;

                    stat.Disable = cmbDisable[i].SelectedIndex;

                    statList.Add(stat);
                }
                if (!CGJWeb.SetStatList(statList, out er))
                {
                    watcher.Stop();
                    labStatus.Text      = er;
                    labStatus.ForeColor = Color.Red;
                    return;
                }

                List <CGJWeb.CSTAT_FLOW> statFlowList = new List <CGJWeb.CSTAT_FLOW>();

                for (int i = 0; i < labStatId.Count; i++)
                {
                    CGJWeb.CSTAT_FLOW statFlow = new CGJWeb.CSTAT_FLOW();

                    statFlow.StatId = i + 1;

                    statFlow.StatName = txtStatName[i].Text;

                    statFlow.FlowId = cmbFlowId[i].SelectedIndex + 1;

                    statFlow.FlowName = txtFlowName[i].Text;

                    statFlow.Disable = cmbDisable[i].SelectedIndex;

                    statFlowList.Add(statFlow);
                }

                if (!CGJWeb.SetStatToFlowList(statFlowList, out er))
                {
                    watcher.Stop();
                    labStatus.Text      = er;
                    labStatus.ForeColor = Color.Red;
                    return;
                }

                labStatus.Text      = "保存站别流程成功.";
                labStatus.ForeColor = Color.Blue;

                MessageBox.Show("保存站别流程成功", "流程设置", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                watcher.Stop();
                btnSave.Enabled = true;
                labTimes.Text   = watcher.ElapsedMilliseconds.ToString();
            }
        }
Esempio n. 12
0
        private void btnYieldQuery_Click(object sender, EventArgs e)
        {
            try
            {
                btnYieldQuery.Enabled = false;

                if (btnCon.Text == "连接")
                {
                    MessageBox.Show("请先连接Web服务器", "流程设置", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                string er = string.Empty;

                watcher.Restart();

                List <CGJWeb.CYieldRequest> request = new List <CGJWeb.CYieldRequest>();

                List <CGJWeb.CYieldReponse> reponse = null;

                request.Add(new CGJWeb.CYieldRequest()
                {
                    FlowName  = txtYieldFlow.Text,
                    StartTime = dtYieldStartTime.Value.ToString("yyyy/MM/dd HH:mm:ss"),
                    EndTime   = dtYieldEndTime.Value.ToString("yyyy/MM/dd HH:mm:ss")
                });

                if (!CGJWeb.GetYieldInStationAndTime(request, out reponse, out er))
                {
                    labStatus.Text      = er;
                    labStatus.ForeColor = Color.Red;
                    return;
                }

                if (reponse.Count > 0)
                {
                    labYieldTTNum.Text   = reponse[0].TTNum.ToString();
                    labYieldFailNum.Text = reponse[0].FailNum.ToString();
                }
                else
                {
                    labYieldTTNum.Text   = "0";
                    labYieldFailNum.Text = "0";
                }

                rtbRtn.Text         = er;
                labStatus.Text      = "读取工位时间段产能统计OK.";
                labStatus.ForeColor = Color.Blue;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                watcher.Stop();

                btnYieldQuery.Enabled = true;

                labTimes.Text = watcher.ElapsedMilliseconds.ToString();
            }
        }