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(); } }
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(); } }