From 7971d855ba2cf9772b46a7f67e2b669c0afcb91b Mon Sep 17 00:00:00 2001
From: patrick <patrick.xu@broconcentric.com>
Date: 星期二, 22 十月 2019 11:30:35 +0800
Subject: [PATCH] 1. 添加标定操作及界面 2. 修改配置界面方法调用参数 3. SeerAGV添加电池信息监听 4. 添加AGV电池充电操作 5. 修改AGV状态变化操作,添加操作锁

---
 src/A032.Config/ConfigFrm.cs |   58 ++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 38 insertions(+), 20 deletions(-)

diff --git a/src/A032.Config/ConfigFrm.cs b/src/A032.Config/ConfigFrm.cs
index 29bb85e..388f59d 100644
--- a/src/A032.Config/ConfigFrm.cs
+++ b/src/A032.Config/ConfigFrm.cs
@@ -22,6 +22,7 @@
 using Bro.Common.UI;
 using Bro.Common.PubSub;
 using static Bro.Common.Helper.EnumHelper;
+using Bro.Device.HikCamera;
 
 namespace M065.Config
 {
@@ -41,6 +42,8 @@
                 {
                     InitialCalibrationMethod();
                     InitialAllTestMethod();
+
+                    InitialDevices();
                 }
             }
         }
@@ -284,7 +287,7 @@
         private void btnStartCalibration_Click(object sender, EventArgs e)
         {
             btnStartCalibration.Enabled = false;
-
+            IDevice device = cboCalibDevices.SelectedItem as IDevice;
             try
             {
                 IOperationConfig config = propCalibrationConfig.SelectedObject as IOperationConfig;
@@ -293,7 +296,7 @@
                     config.InputPara = null;
                 }
 
-                _calibrationMethod.Invoke(Process, new object[] { config });
+                _calibrationMethod.Invoke(Process, new object[] { config, device });
             }
             catch (Exception ex)
             {
@@ -313,6 +316,16 @@
         #region Test
         Dictionary<ProcessMethodAttribute, MethodInfo> _allTestMethod = new Dictionary<ProcessMethodAttribute, MethodInfo>();
         MethodInfo _testMethod = null;
+
+        List<IDevice> _deviceList = new List<IDevice>();
+        private void InitialDevices()
+        {
+            _deviceList = (Process as ProcessControl).GetDeviceList();
+
+            List<ISimpleDevice> list = _deviceList.Select(u => u as ISimpleDevice).ToList();
+            UIHelper.SetCombo(cboCalibDevices, list, "Name", "Id");
+            UIHelper.SetCombo(cboDevices, list, "Name", "Id");
+        }
 
         private void InitialAllTestMethod()
         {
@@ -336,28 +349,29 @@
 
         private void cboTestMethod_SelectedIndexChanged(object sender, EventArgs e)
         {
-            //if (cboTestMethod.SelectedIndex >= 0)
-            //{
-            //    string methodCode = cboTestMethod.SelectedValue.ToString();
-            //    var attr = _allTestMethod.Keys.FirstOrDefault(u => u.MethodCode == methodCode);
-            //    if (attr == null)
-            //        return;
+            if (cboTestMethod.SelectedIndex >= 0)
+            {
+                string methodCode = cboTestMethod.SelectedValue.ToString();
+                var attr = _allTestMethod.Keys.FirstOrDefault(u => u.MethodCode == methodCode);
+                if (attr == null)
+                    return;
 
-            //    _testMethod = _allTestMethod[attr];
+                _testMethod = _allTestMethod[attr];
 
-            //    if (Process.StationConfig.ProcessOpConfigDict.Keys.Contains(methodCode))
-            //    {
-            //        propGridTestMethod.SelectedObject = Process.StationConfig.ProcessOpConfigDict[methodCode];
-            //    }
-            //    else
-            //    {
-            //        MessageBox.Show(@"Config of " + methodCode + @" is not found");
-            //    }
-            //}
+                if (Process.StationConfig.ProcessOpConfigDict.Keys.Contains(methodCode))
+                {
+                    propGridTestMethod.SelectedObject = Process.StationConfig.ProcessOpConfigDict[methodCode];
+                }
+                else
+                {
+                    MessageBox.Show(@"Config of " + methodCode + @" is not found");
+                }
+            }
         }
 
         private void btnManualTrigger_Click(object sender, EventArgs e)
         {
+            IDevice device = cboDevices.SelectedItem as IDevice;
             new Task((m) =>
             {
                 MethodInfo method = m as MethodInfo;
@@ -369,14 +383,13 @@
                     invokeTimes = 1;
                 }
                 ProcessResponse response = null;
-
                 if (invokeTimes == 1)
                 {
                     try
                     {
                         Stopwatch sw = new Stopwatch();
                         sw.Start();
-                        response = method.Invoke(Process, new object[] { propGridTestMethod.SelectedObject as IOperationConfig }) as ProcessResponse;
+                        response = method.Invoke(Process, new object[] { propGridTestMethod.SelectedObject as IOperationConfig, device }) as ProcessResponse;
                         sw.Stop();
 
                         //RecordMsg($"{method.Name}璋冪敤鑰楁椂锛歿sw.ElapsedMilliseconds}ms");
@@ -727,5 +740,10 @@
                 chkContinueMode.Checked = false;
             }
         }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            (Process as ProcessControl).Robot_Monitor_FullTrayFull(new OperationConfigBase() { InputPara = new List<int>() { 1 } }, new HikCameraDriver { Id = "3680EBF8-D9F8-4E14-8B0D-6E53BE3BB96D" });
+        }
     }
 }

--
Gitblit v1.8.0