浏览代码

新增系统参数“工作模式”和“取料位置”支持

为系统参数添加“工作模式(WorkMode)”和“取料位置(PickPointNum)”字段,实现了从前端界面输入、ViewModel数据绑定、模型存储到PLC写入的全流程支持。界面新增对应输入项,后端同步扩展数据结构和PLC交互逻辑,提升了系统参数的灵活性和可配置性。
孝锋 徐 8 月之前
父节点
当前提交
73baaf4fe8

+ 2 - 0
TeamAAS-VM/Core/Management.cs

@@ -843,6 +843,8 @@ namespace TeamAAS_VP.Core
             var addressConfig = _configService.GetPlcAddresses();
             var plc=_plcService.GetPlcByNumber(addressConfig.PlcNo) as OpcUaClientPLC;
             Dictionary<string,object> nodeValues = new Dictionary<string, object>();
+            nodeValues.Add(addressConfig.WorkMode.Address, systemConfiguration.WorkMode);
+            nodeValues.Add(addressConfig.PickPointNum.Address, systemConfiguration.PickPointNum);
             nodeValues.Add(addressConfig.CameraShotCount.Address, systemConfiguration.CameraShotCount);
             nodeValues.Add(addressConfig.UpperCameraPickShotCount.Address, systemConfiguration.UpperCameraPickShotCount);
             nodeValues.Add(addressConfig.UpperCameraPlaceShotCount.Address, systemConfiguration.UpperCameraPlaceShotCount);

+ 20 - 0
TeamAAS-VM/Models/PlcAddressConfig.cs

@@ -16,6 +16,26 @@ namespace TeamAAS_VP.Models
             set { SetProperty(ref _PlcNo, value); }
         }
 
+        private PlcAddress _WorkMode = new PlcAddress();
+        /// <summary>
+        /// 工作模式 =1 拍1打1 =2 拍1打所有
+        /// </summary>
+        public PlcAddress WorkMode
+        {
+            get { return _WorkMode; }
+            set { SetProperty(ref _WorkMode, value); }
+        }
+
+        private PlcAddress _PickPointNum = new PlcAddress();
+        /// <summary>
+        /// 取料位置 =0 不需要取料 =1 需要取料
+        /// </summary>
+        public PlcAddress PickPointNum
+        {
+            get { return _PickPointNum; }
+            set { SetProperty(ref _PickPointNum, value); }
+        }
+
         private PlcAddress _cameraShotCount = new PlcAddress();
         /// <summary>
         /// 相机拍照次数

+ 20 - 0
TeamAAS-VM/Models/SystemConfiguration.cs

@@ -96,6 +96,26 @@ namespace TeamAAS_VP.Models
 
         // 新增相机/拍照/检测计数属性
 
+        private int _WorkMode = 0;
+        /// <summary>
+        /// 工作模式 =1 拍1打1 =2 拍1打所有
+        /// </summary>
+        public int WorkMode
+        {
+            get { return _WorkMode; }
+            set { SetProperty(ref _WorkMode, value); }
+        }
+
+        private int _PickPointNum = 0;
+        /// <summary>
+        /// 取料位置 =0 不需要取料 =1 需要取料
+        /// </summary>
+        public int PickPointNum
+        {
+            get { return _PickPointNum; }
+            set { SetProperty(ref _PickPointNum, value); }
+        }
+
         private int _cameraShotCount = 0;
         /// <summary>
         /// 相机拍照次数

+ 17 - 0
TeamAAS-VM/ViewModels/SettingViewModel.cs

@@ -12,6 +12,7 @@ using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.ComponentModel;
+using System.Drawing.Drawing2D;
 using System.Globalization;
 using System.Linq;
 using System.Text;
@@ -1236,6 +1237,20 @@ namespace TeamAAS_VP.ViewModels
         }
 
         #region 系统参数
+        private int _WorkMode=0;
+        public int WorkMode
+        {
+            get { return _WorkMode; }
+            set { SetProperty(ref _WorkMode, value); }
+        }
+
+        private int _PickPointNum;
+        public int PickPointNum
+        {
+            get { return _PickPointNum; }
+            set { SetProperty(ref _PickPointNum, value); }
+        }
+
         private int _CameraShotCount;
         public int CameraShotCount { get => _CameraShotCount; set => SetProperty(ref _CameraShotCount, value); }
 
@@ -1264,6 +1279,8 @@ namespace TeamAAS_VP.ViewModels
             if (result != null && result is bool && (bool)result)
             {
                 var sysConfig = _configService.GetSystemConfiguration();
+                sysConfig.WorkMode = WorkMode;
+                sysConfig.PickPointNum = PickPointNum;
                 sysConfig.CameraShotCount = CameraShotCount;
                 sysConfig.UpperCameraPickShotCount = UpperCameraPickShotCount;
                 sysConfig.UpperCameraPlaceShotCount = UpperCameraPlaceShotCount;

+ 34 - 1
TeamAAS-VM/Views/SettingView.xaml

@@ -1828,6 +1828,8 @@
                             <RowDefinition Height="Auto" />
                             <RowDefinition Height="Auto" />
                             <RowDefinition Height="Auto" />
+                            <RowDefinition Height="Auto" />
+                            <RowDefinition Height="Auto" />
                             <RowDefinition Height="40" />
                         </Grid.RowDefinitions>
 
@@ -1942,9 +1944,40 @@
                                            Minimum="0"
                                            Maximum="100"
                                            FontSize="{DynamicResource Font.Size.Body3}" />
+                        <!-- 工作模式  -->
+                        <TextBlock Grid.Row="7"
+                                   Grid.Column="0"
+                                   Style="{StaticResource MaterialDesignSubtitle1TextBlock}"
+                                   VerticalAlignment="Center"
+                                   HorizontalAlignment="Right"
+                                   Margin="0,6,10,6"
+                                   Text="工作模式 :" />
+                        <mah:NumericUpDown Grid.Row="7"
+                                           Grid.Column="1"
+                                           Margin="0,6"
+                                           Value="{Binding WorkMode,Mode=TwoWay}"
+                                           Minimum="0"
+                                           Maximum="100"
+                                           FontSize="{DynamicResource Font.Size.Body3}" />
+
+                        <!-- 取料位置 -->
+                        <TextBlock Grid.Row="8"
+                                   Grid.Column="0"
+                                   Style="{StaticResource MaterialDesignSubtitle1TextBlock}"
+                                   VerticalAlignment="Center"
+                                   HorizontalAlignment="Right"
+                                   Margin="0,6,10,6"
+                                   Text="取料位置:" />
+                        <mah:NumericUpDown Grid.Row="8"
+                                           Grid.Column="1"
+                                           Margin="0,6"
+                                           Value="{Binding PickPointNum,Mode=TwoWay}"
+                                           Minimum="0"
+                                           Maximum="100"
+                                           FontSize="{DynamicResource Font.Size.Body3}" />
 
                         <!-- 保存按钮 -->
-                        <StackPanel Grid.Row="7"
+                        <StackPanel Grid.Row="9"
                                     Grid.ColumnSpan="3"
                                     Orientation="Horizontal"
                                     HorizontalAlignment="Right"