Esempio n. 1
0
        private void ConnectAction()
        {
            if (MeasurementTasks.Count < 1)
            {
                FormMessageBox.SetShow(null, "测试错误", "请至少选择一个产品测试", 4);
                while (!IsStop && FormMessageBox.MessageBoxResult == 0)
                {
                    System.Threading.Thread.Sleep(500);
                }

                IsStop = true;
                return;
            }

            if (Framework.MeasurementSystemSetting.SystemData.Setting.Profile.DuplicationCheckType > 0)
            {
                var c = new ModifyTestInfo();
                foreach (var task in MeasurementTasks)
                {
                    var temp = c.GetLastTestInfo(MeasurementJob.ProductInfo.ProductID, MeasurementJob.StationInfo.StationID, task.TestSN, true);
                    if (temp.Status)
                    {
                        if (temp.Data != null && temp.Data != Guid.Empty)
                        {
                            tipCallback?.Invoke(task.TestOrderID, 2, $"{task.TestSN}重复测试", 0);
                            FormMessageBox.SetShow(null, "重复测试", $"系统检查到 {task.TestSN} 已经测试\r\n请确认SN号码是否重号或者产品多次测试。", 3);
                            while (!IsStop && FormMessageBox.MessageBoxResult == 0)
                            {
                                System.Threading.Thread.Sleep(500);
                            }
                            if (FormMessageBox.MessageBoxResult != 1)
                            {
                                IsStop = true;
                                return;
                            }
                        }
                    }
                }
            }

            if (!MeasurementController.Connect())
            {
                FormMessageBox.SetShow(null, "仪器错误", $"连接仪器失败\r\n{MeasurementController.ErrorString}", 4);
                while (!IsStop && FormMessageBox.MessageBoxResult == 0)
                {
                    System.Threading.Thread.Sleep(500);
                }

                IsStop = true;
                return;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 仪器连接
        /// </summary>
        private void ConnectAction()
        {
            //清空测试内容
            foreach (var testItem in TestItems)
            {
                testItem.ValueString = "";
                testResultCallback(testItem.ItemID, "", testItem.LastValueString, 0);
            }
            var item = TestItems.FirstOrDefault(q => q.TestTypeID == TestTypes[0]);

            testResultCallback(item.ItemID, "正在连接", "", 3);
            if (!MeasurementController.Connect())
            {
                testResultCallback(item.ItemID, MeasurementController.ErrorString, "", 2);
                ShowMessage(4, MeasurementController.ErrorString);
                IsStop = true;
            }
            else
            {
                item.LastValueString = "已连接";
                item.ValueString     = "OK";
                testResultCallback(item.ItemID, "通过", "", 1);
            }
        }