Esempio n. 1
0
        internal void SetTestResult(DaoLastTestResult Ret)
        {
            if (m_LastTest == null)
            {
                m_LastTest = new DaoLastTestResult();
            }
            m_LastTest = Ret;

            Invoke((MethodInvoker) delegate
            {
                tbPN.Text     = m_LastTest.PN.件號;
                tbSerial.Text = m_LastTest.Serial;
            });
        }
Esempio n. 2
0
 private void LastTestResult(DaoLastTestResult Ret)
 {
     ptPrint.SetTestResult(Ret);
 }
Esempio n. 3
0
        /// <summary>
        /// 測試結果設定
        /// </summary>
        /// <param name="isSuccess"></param>
        /// <param name="ByOp"></param>
        internal void TestResult(bool isSuccess, bool ByOp = false)
        {
            if (m_isUsbDeviceConnect == false)
            {
                Invoke((MethodInvoker) delegate
                {
                    MessageBoxEx.Show(this, "請先連接測試設備!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                });
                return;
            }

            if (m_isInputPn == false)
            {
                //Invoke((MethodInvoker)delegate
                //{
                //    MessageBoxEx.Show(this, "請輸入有效友永件號!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //});
                return;
            }

            Invoke((MethodInvoker) delegate
            {
                SetTestIcon(isSuccess == true ? eTestIconState.eTEST_OK : eTestIconState.eTEST_NG);

                //填上流水編號;//
                DateTime LastTestTime = Properties.Settings.Default.LastTestTime;
                TimeSpan ts           = DateTime.Now - LastTestTime;
                if (ts.Days > 0)
                {
                    Properties.Settings.Default.TestSerial = 1;
                }
                else
                {
                    Properties.Settings.Default.TestSerial++;
                }

                if (ByOp == false)
                {
                    tbSerial.Text = String.Format("{0:0000000}", Properties.Settings.Default.TestSerial.ToInt());
                }
                else
                {
                    tbSerial.Text = String.Format("H{0:000000}", Properties.Settings.Default.TestSerial.ToInt());
                }

                //紀錄測試時間;//
                Properties.Settings.Default.LastTestTime = DateTime.Now;

                //儲存資訊;//
                Properties.Settings.Default.Save();
            });

            //紀錄結果資訊;//
            DaoSQL.Instance.SaveTestResult(tbSerial.Text, m_Machine, m_User, m_PN, isSuccess == true ? "OK" : "NG", Properties.Settings.Default.LastTestTime);

            if (ByOp == false)
            {
                if (m_LastTest == null)
                {
                    m_LastTest = new DaoLastTestResult();
                }
                m_LastTest.isSuccess = isSuccess;
                m_LastTest.PN        = m_PN;
                m_LastTest.Serial    = tbSerial.Text;
                m_LastTest.TestTime  = Properties.Settings.Default.LastTestTime;
            }

            //列印結果標籤;//
            //TscTtp247.Instance.PrintLabel(tbSerial.Text, m_Machine, m_PN, isSuccess == true ? "OK" : "NG", Properties.Settings.Default.LastTestTime);
            if (isSuccess == true)
            {
                TscTtp247.Instance.PrintOK(tbSerial.Text, m_Machine, m_PN, Properties.Settings.Default.LastTestTime);
            }
            else
            {
                TscTtp247.Instance.PrintNG(Properties.Settings.Default.LastTestTime);
            }

            if (m_LastTest != null)
            {
                LastTestResultEvent?.Invoke(m_LastTest);
            }
        }