Browse Source

fix update robot online

jiangjy 2 months ago
parent
commit
1df60f50e1

+ 4 - 0
FrameworkLocal/Common/Communications/AsynSocketClient.cs

@@ -106,6 +106,10 @@ namespace MECF.Framework.Common.Communications
         {
             try
             {
+                if (_address==null)
+                {
+                    return;
+                }
                 _ip = _address.Split(':')[0];
                 _port = int.Parse(_address.Split(':')[1]);
                 IPAddress ipAddress = IPAddress.Parse(_ip);

+ 19 - 4
FrameworkLocal/UIClient/CenterViews/Configs/SystemConfig/SystemConfigView.xaml

@@ -349,15 +349,30 @@
                         </i:Interaction.Triggers>
                     </Button>
                 </Border>
-                <Border Visibility="{Binding IsShowRobotControl,Converter={StaticResource bool2VisibilityConverter}}" BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1"  Grid.Row="4" Grid.Column="0">
+                <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1"  Grid.Row="4" Grid.Column="0">
                     <TextBlock Text="Robot Control" VerticalAlignment="Center" HorizontalAlignment="Center">
 
                     </TextBlock>
                 </Border>
-                <Border   Visibility="{Binding IsShowRobotControl,Converter={StaticResource bool2VisibilityConverter}}" Padding="5"  BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Grid.Row="4" Grid.Column="2">
+                <Border  Padding="5"  BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Grid.Row="4" Grid.Column="2">
                     <StackPanel Orientation="Horizontal">
-                        <Button Content="Online"  Width="110"></Button>
-                        <Button Content="Offline" Width="110" Margin="20,0,0,0"></Button>
+                        <Button Content="Online"  Width="110">
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="Click">
+                                    <micro:ActionMessage MethodName="RobotOnline">
+                                    </micro:ActionMessage>
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
+                        </Button>
+                        <Button Content="Offline" Width="110" Margin="20,0,0,0">
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="Click">
+                                    <micro:ActionMessage MethodName="RobotOffline">
+                                    </micro:ActionMessage>
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
+
+                        </Button>
                     </StackPanel>
                 </Border>
             </Grid>

+ 32 - 1
FrameworkLocal/UIClient/CenterViews/Configs/SystemConfig/SystemConfigViewModel.cs

@@ -4,11 +4,15 @@ using System.Collections.ObjectModel;
 using System.Linq;
 using System.Windows;
 using Aitex.Core.RT.IOCore;
+using Aitex.Core.RT.SCCore;
 using Caliburn.Micro;
 using Caliburn.Micro.Core;
+using DocumentFormat.OpenXml.Wordprocessing;
 using MECF.Framework.Common.DataCenter;
+using MECF.Framework.Common.Equipment;
 using MECF.Framework.Common.IOCore;
 using MECF.Framework.Common.OperationCenter;
+using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.HRC100Robots.GM201LVPRobot;
 using MECF.Framework.UI.Client.CenterViews.Dialogs;
 using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
 using MECF.Framework.UI.Client.CenterViews.Editors.Sequence;
@@ -543,6 +547,33 @@ namespace MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig
             (windowManager as WindowManager)?.ShowDialogWithTitle(shutDonwControlViewModel, null, "UI And RT Control");
 
         }
+        private GM201LVPRobotConnection _connection;
+        public void RobotOnline()
+        {
+            var waferRobot = new GM201LVPRobot("", ModuleName.WaferRobot.ToString(), "Robot", GM201LVPRobot.MaterialType.Wafer, null, null);
+            var carrierRobot = new GM201LVPRobot("", ModuleName.CarrierRobot.ToString(), "Robot", GM201LVPRobot.MaterialType.Carrier, null, null);
+
+            List<GM201LVPRobot> gM201LVPRobots = new List<GM201LVPRobot>() { carrierRobot, waferRobot };
+            foreach (var item in gM201LVPRobots)
+            {
+                var adress = item.Address;
+                item.Connect();
+            }
+
+        }
+        public void RobotOffline()
+        {
+            var waferRobot = new GM201LVPRobot("", ModuleName.WaferRobot.ToString(), "Robot", GM201LVPRobot.MaterialType.Wafer, null, null);
+            var carrierRobot = new GM201LVPRobot("", ModuleName.CarrierRobot.ToString(), "Robot", GM201LVPRobot.MaterialType.Carrier, null, null);
+
+            List<GM201LVPRobot> gM201LVPRobots = new List<GM201LVPRobot>() { carrierRobot, waferRobot };
+            foreach (var item in gM201LVPRobots)
+            {
+                var adress = item.Address;
+                item.Disconnect();
+            }
+
+        }
         public void ClearFilter()
         {
             CurrentCriteria = "";
@@ -569,7 +600,7 @@ namespace MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig
         {
             base.InvokeAfterUpdateProperty(data);
             string _aoKey = $"{SystemName}.PM1.AOList";
-            if (data.ContainsKey(_aoKey)&&data[_aoKey] != null && _isReadPLC)
+            if (data.ContainsKey(_aoKey) && data[_aoKey] != null && _isReadPLC)
             {
                 List<NotifiableIoItem> lstData = (List<NotifiableIoItem>)data[_aoKey];
                 for (int i = 0; i < lstData.Count; i++)