private void BtnDel_MouseUp(object sender, MouseEventArgs e) { if (CheckDataAndSelect() == false) { return; } if (dgvMachine.CurrentRow.Selected == true) { DaoMachine Machine = (DaoMachine)dgvMachine.Rows[dgvMachine.CurrentCell.RowIndex].DataBoundItem; DialogResult Ret = MessageBoxEx.Show(this, string.Format("確定要刪除機台 {0} ?", Machine.機台代碼), "訊息", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (Ret == DialogResult.Yes) { DaoErrMsg Msg = DaoSQL.Instance.DeleteMachine(Machine); if (Msg.isError == false) { MessageBoxEx.Show(this, string.Format("機台 {0} 已刪除.", Machine.機台代碼), "訊息", MessageBoxButtons.OK, MessageBoxIcon.Information); Setup(); } else { MessageBoxEx.Show(this, string.Format("無法刪除機台 {0},{1}", Machine.機台代碼, Msg.ErrorMsg), "訊息", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
internal void Setup(eTestType Type, DaoMachine Machine, DaoUser User) { m_Machine = Machine; m_User = User; lblMachineNo.Text = Machine.機台代碼; lblUserID.Text = User.代碼; lblUserName.Text = User.作業員姓名; switch (Type) { case eTestType.eTT_MAIN: break; case eTestType.eTT_PRINT: tbSerial.Enabled = true; btnLU.Visible = true; btnRU.Visible = true; btnLD.Visible = true; break; default: break; } //先觸發一次時間;// TimerNow_Tick(new object(), new EventArgs()); }
public FormSettingMachine(DaoMachine Machine) { InitializeComponent(); int MachineIndex = 0; if (char.IsDigit(Machine.機台代碼, 0) == true) { MachineIndex = Machine.機台代碼.ToInt() + 26; } else { MachineIndex = Convert.ToChar(Machine.機台代碼.ToUpper()).ToInt() - 65; } Setup(MachineIndex, Machine.預設機台.Equals("Y") ? 1 : 0); cbMachine.Enabled = false; tbDescription.Text = Machine.描述; btnAdd.Text = "更 新"; m_isEditMode = true; }
private void CbMachineNo_BindingContextChanged(object sender, EventArgs e) { for (int i = 0; i < cbMachineNo.Items.Count; i++) { DaoMachine Machine = (DaoMachine)cbMachineNo.Items[i]; if (Machine.預設機台.Equals("Y")) { cbMachineNo.SelectedIndex = i; cbMachineNo.Enabled = false; break; } } }
public PageReport(DaoMachine Machine) { InitializeComponent(); m_Machine = Machine; m_dgvTestHistory = pdgvHistory.DataList; pdgvHistory.SetTotalPage(0); m_dgvTestHistory.RowHeadersVisible = false; m_dgvTestHistory.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; m_dgvTestHistory.AllowUserToAddRows = false; m_dgvTestHistory.AllowUserToDeleteRows = false; m_dgvTestHistory.MultiSelect = false; m_dgvTestHistory.ReadOnly = true; m_dgvTestHistory.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; m_dgvTestHistory.TabStop = false; }
public void PrintLabel(string Serial, DaoMachine Machine, DaoPartNumber PN, string Result, DateTime TestTime) { if (OpenPrinter() == 0) { return; } string ResultSerial = string.Format("{0}{1}{2}", Machine.機台代碼, PN.簡碼, Serial); TSCLIB_DLL.setup("18", "12", "2", "12", "1", "3", "0"); TSCLIB_DLL.clearbuffer(); TSCLIB_DLL.sendcommand(string.Format("QRCODE 12,8,L,2,A,0,M2,S7,\"UCC,{0},{1}\"", ResultSerial, TestTime.ToString("yyyy/MM/dd"))); TSCLIB_DLL.windowsfont(76, 11, 30, 0, 2, 0, "新細明體", Result); TSCLIB_DLL.windowsfont(66, 40, 20, 0, 0, 0, "新細明體", TestTime.ToString("yy/MM/dd")); TSCLIB_DLL.windowsfont(5, 62, 20, 0, 0, 0, "新細明體", PN.車型); TSCLIB_DLL.printlabel("1", "1"); TSCLIB_DLL.closeport(); }
public FormMain(DaoMachine Machine, DaoUser User) { InitializeComponent(); m_LastSelectIndex = tabMain.SelectedIndex; m_User = User; m_Machine = Machine; ptMain.Setup(Pages.PageTest.eTestType.eTT_MAIN, Machine, User); ptMain.LastTestResultEvent += this.LastTestResult; ptPrint.Setup(Pages.PageTest.eTestType.eTT_PRINT, Machine, User); DevCtrl.Instance.CH340ConnectChange += this.TestDeviceConnectState; DevCtrl.Instance.TestResult += this.TestResult; Uart.Instance.UartConnectChange += this.TestDeviceConnectState; Uart.Instance.TestResult += this.TestResult; DaoSnControl.Instance.UpdateSnEvent += this.SnUpdate; ptMain.CloseAppEvent += this.CloseApp; ptPrint.CloseAppEvent += this.CloseApp; rbtnMachine.Checked = true; }
private void BtnEdit_MouseUp(object sender, MouseEventArgs e) { if (CheckDataAndSelect() == false) { return; } if (dgvMachine.CurrentRow.Selected == true) { DaoMachine Machine = (DaoMachine)dgvMachine.Rows[dgvMachine.CurrentCell.RowIndex].DataBoundItem; FormSettingMachine fMachine = new FormSettingMachine(Machine); DialogResult Ret = fMachine.ShowDialog(); if (Ret == DialogResult.Yes) { Setup(); } fMachine.Close(); fMachine.Dispose(); } }
private bool Login() { //檢查有無輸入操作者代碼;// if (string.IsNullOrEmpty(cbUser.Text)) { MessageBoxEx.Show(this, "請輸入操作者代號!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); cbUser.Focus(); return(false); } //檢查有無輸入密碼;// if (string.IsNullOrEmpty(tbPW.Text)) { MessageBoxEx.Show(this, "請輸入密碼!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); tbPW.Focus(); return(false); } DaoUser User = (DaoUser)cbUser.SelectedItem; if (User.密碼.Equals(tbPW.Text) == false) { MessageBoxEx.Show(this, "密碼錯誤!", "訊息", MessageBoxButtons.OK, MessageBoxIcon.Warning); tbPW.Focus(); return(false); } MessageBoxEx.Show(this, "登入成功!", "訊息", MessageBoxButtons.OK, MessageBoxIcon.Information); //表示登入成功,要關閉視窗;// DialogResult = DialogResult.OK; DaoMachine Machine = (DaoMachine)cbMachineNo.SelectedItem; UserLogin?.Invoke(Machine, User); return(true); }
internal void Setup(DaoMachine Machine) { m_Machine = Machine; DataTable dt = DaoSQL.Instance.GetBackupInfo(); for (int i = 0; i < dt.Rows.Count; i++) { switch (dt.Rows[i]["Type"].ToString()) { case "Local": _PathLocalBackup = dt.Rows[i]["ADDR"].ToString(); break; case "Server": _PathServer = dt.Rows[i]["ADDR"].ToString(); break; case "ServerAccount": _Account = dt.Rows[i]["ADDR"].ToString(); break; case "ServerPW": _PW = dt.Rows[i]["ADDR"].ToString(); break; case "Report": _PathReport = dt.Rows[i]["ADDR"].ToString(); break; case "Database": _PathDb = dt.Rows[i]["ADDR"].ToString(); break; } } }
private static void UserLogin(DaoMachine Machine, DaoUser User) { m_Machine = Machine; m_LoginUser = User; }