Example #1
0
        public static bool NeedScanSN()
        {
            if (!Convert.ToBoolean(TestContext.m_dicConfig[tmMarcos.kConfigScanBarcode]))
            {
                return(false);
            }
            for (int i = 0; i < 6; i++)
            {
                string key     = string.Format("{0}{1}", tmMarcos.kUUTEnable, i);
                bool   bEnable = Convert.ToBoolean(TestContext.m_dicConfig[key]);
                if (bEnable)
                {
                    TestContext context = GT_UserInterface.GetTestContext(i);
                    string      sn      = context.m_dicContext[tmMarcos.kContextMLBSN] as string;
                    if (sn == null)
                    {
                        return(true);
                    }

                    if (sn.Trim().Length == 0)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Example #2
0
        private void tbUnitSN_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                SetMLBSNContext(tbUnitSN.Text);
//if only one UUT enable
                int count = 0;
                for (int i = 0; i < 6; i++)
                {
                    string key     = string.Format("{0}{1}", tmMarcos.kUUTEnable, i);
                    bool   bEnable = Convert.ToBoolean(TestContext.m_dicConfig[key]);
                    if (!bEnable)
                    {
                        continue;
                    }
                    count++;
                }
                if (count == 1)
                {
                    for (int i = 0; i < 6; i++)
                    {
                        string key     = string.Format("{0}{1}", tmMarcos.kUUTEnable, i);
                        bool   bEnable = Convert.ToBoolean(TestContext.m_dicConfig[key]);
                        if (!bEnable)
                        {
                            continue;
                        }
                        string      sn      = tbUnitSN.Text;
                        TestContext context = GT_UserInterface.GetTestContext(i);
                        context.m_dicContext[tmMarcos.kContextMLBSN] = sn;
                        (this.MdiParent as MainForm).m_frmState.SetSN(sn, i);
                    }
                    return;
                }
//
                frmSN frm = new frmSN(tbUnitSN.Text);
                if (frm.ShowDialog(this) == DialogResult.OK)
                {
                    for (int i = 0; i < 6; i++)
                    {
                        string key     = string.Format("{0}{1}", tmMarcos.kUUTEnable, i);
                        bool   bEnable = Convert.ToBoolean(TestContext.m_dicConfig[key]);
                        if (!bEnable)
                        {
                            continue;
                        }
                        string      sn      = frm.GetSN(i);
                        TestContext context = GT_UserInterface.GetTestContext(i);
                        context.m_dicContext[tmMarcos.kContextMLBSN] = sn;
                        (this.MdiParent as MainForm).m_frmState.SetSN(sn, i);
                    }
                }

                TestContext.m_dicConfig[tmMarcos.kConfigScanBarcode] = 1;//直接设置成false
                checkBoxNeedCode.Checked = true;
            }
        }
Example #3
0
        public int OnStartTest(Notification nf)
        {
            TestContext context = GT_UserInterface.GetTestContext(0);
            string      sn      = context.m_dicContext[tmMarcos.kContextMLBSNBuffer] as string;

            UUT0.tbUnitSN.Text = "";
            if (sn != "")
            {
                context.m_dicContext[tmMarcos.kContextMLBSN] = sn;
                (UUT0.MdiParent as MainForm).m_frmState.SetSN(sn, 0);
            }
            m_frmState.StartTest();
            return(0);
        }
Example #4
0
 void Initial_Test()
 {
     foreach (ListViewItem it in lvTestItem.Items)
     {
         for (int i = 4; i < 6; i++)
         {
             it.SubItems[i].ForeColor = Color.Black;
             it.SubItems[i].Text      = "";
         }
     }
     progressBar.Value = 0;
     lampctrl.ResetAllLampStatue();
     UpdateMinMaxListView(-1, 0, null, 0);
     //tc.m_dicContext[tmMarcos.kContextMLBSN] = "NG";
     for (int i = 0; i < 6; i++)
     {
         TestContext context = GT_UserInterface.GetTestContext(i);
         context.m_dicContext[tmMarcos.kContextMLBSN] = "";
     }
 }
Example #5
0
        int OnTestFinish(object sender, object arg)
        {
            //把显示的状态置空
            DictionaryEx dic   = arg as DictionaryEx;
            int          id    = (int)dic["id"];
            int          state = (int)dic["state"];

            if (this.MdiParent != null)
            {
                (this.MdiParent as MainForm).m_frmState.OnNotifyShowTestFinish(id, state);
            }
            TestContext context     = GT_UserInterface.GetTestContext(id);
            DateTime    starttime   = DateTime.ParseExact(context.m_dicContext[tmMarcos.kContextStartTime] as string, "yyyy-MM-dd_HH:mm:ss", null);
            DateTime    datetimenow = DateTime.Now;

            TimeSpan ts1 = new TimeSpan(datetimenow.Ticks);
            TimeSpan ts2 = new TimeSpan(starttime.Ticks);
            TimeSpan ts  = ts1.Subtract(ts2).Duration();

            context.m_dicContext[tmMarcos.kContextEndTime]  = System.DateTime.Now.ToString("yyyy-MM-dd_HH:mm:ss");
            context.m_dicContext[tmMarcos.kContextTestTime] = string.Format("{0:f2}", ts.TotalSeconds);
            Console.WriteLine(context.m_dicContext[tmMarcos.kContextTestTime] as string);
            return(0);
        }
Example #6
0
        //UI update callback   userInterface中发消息,引起此操作
        int OnTestStart(object sender, object arg)//这里是显示测试状态的操作
        {
            if (this.InvokeRequired)
            {
                //前面建一个委托,后面是参数数组。
                return((int)Invoke(new delegateUiMessage(OnTestStart), new object[] { sender, arg }));
            }
            DictionaryEx dic = arg as DictionaryEx;
            int          id  = (int)dic["id"];

            Initial_Test();
            try
            {
                tc.m_dicContext[tmMarcos.kContextStartTime] = System.DateTime.Now.ToString("yyyy/MM/dd_HH:mm:ss");

                TestContext.m_dicConfig[tmMarcos.kStarttime] = System.DateTime.Now.ToString("yyyy/MM/dd_HH:mm:ss");

                TestContext context = GT_UserInterface.GetTestContext(id);
                context.m_dicContext[tmMarcos.kStarttime] = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                m_dicTestResult[tmMarcos.kTimeStamp] = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                if (TestContext.m_dicConfig[tmMarcos.kProjectType] != null)
                {
                    m_dicTestResult[tmMarcos.kProjectType] = TestContext.m_dicConfig[tmMarcos.kProjectType].ToString();
                }
                if (TestContext.m_dicConfig[tmMarcos.kStationType] != null)
                {
                    m_dicTestResult[tmMarcos.kStationType] = TestContext.m_dicConfig[tmMarcos.kStationType].ToString();
                }
                if (TestContext.m_dicConfig[tmMarcos.kDutType] != null)
                {
                    m_dicTestResult[tmMarcos.kDutType] = TestContext.m_dicConfig[tmMarcos.kDutType].ToString();
                }
                if (TestContext.m_dicConfig[tmMarcos.kStatinNum] != null)
                {
                    m_dicTestResult[tmMarcos.kStatinNum] = TestContext.m_dicConfig[tmMarcos.kStatinNum].ToString();
                }
                if (TestContext.m_dicConfig[tmMarcos.kAppVerSion] != null)
                {
                    m_dicTestResult[tmMarcos.kAppVerSion] = TestContext.m_dicConfig[tmMarcos.kAppVerSion].ToString();
                }

                if (TestContext.m_dicConfig[tmMarcos.kAppBuilderTime] != null)
                {
                    m_dicTestResult[tmMarcos.kAppBuilderTime] = TestContext.m_dicConfig[tmMarcos.kAppBuilderTime].ToString();
                }
                if (TestContext.m_dicConfig[tmMarcos.kWorkOrder] != null)
                {
                    m_dicTestResult[tmMarcos.kWorkOrder] = TestContext.m_dicConfig[tmMarcos.kWorkOrder].ToString();
                }
                if (TestContext.m_dicConfig[tmMarcos.kCusTomer] != null)
                {
                    m_dicTestResult[tmMarcos.kCusTomer] = TestContext.m_dicConfig[tmMarcos.kCusTomer].ToString();
                }

                StringBuilder Testflowpath = new StringBuilder();
                if (TestContext.m_dicConfig[tmMarcos.kConfigTestFlowPath] != null)
                {
                    Testflowpath.Append(TestContext.m_dicConfig[tmMarcos.kConfigTestFlowPath].ToString());
                }
                Testflowpath.Append("\\");
                if (TestContext.m_dicConfig[tmMarcos.kStationType] != null)
                {
                    Testflowpath.Append(TestContext.m_dicConfig[tmMarcos.kStationType].ToString());
                }
                Testflowpath.Append("_");
                if (tc.m_dicContext[tmMarcos.kContextMLBSN] != null)
                {
                    Testflowpath.Append(tc.m_dicContext[tmMarcos.kContextMLBSN].ToString());
                    Testflowpath.Append("_");
                }

                Testflowpath.Append(m_UUTID.ToString());
                Testflowpath.Append("_");
                Testflowpath.Append(System.DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss"));
                Testflowpath.Append("_flow.txt");
                testflow.SetFilepath(Testflowpath.ToString());//更新文件名
                testflow.push_testflowlog("Test start");
            }
            catch (Exception)
            {
            }
            //update the display.
            tbUnitSN.Text = "";
            tbUnitSN.Focus();
            if (this.MdiParent != null)
            {
                (this.MdiParent as MainForm).m_frmState.ShowTestStart(id);
            }
            return(0);
        }