Explorar o código

修改方案配置

user_lt hai 1 ano
pai
achega
4295664c86

+ 19 - 4
BlankApp1/BlankApp1/ViewModels/BasicConfigViewModel/AddPlanViewModel.cs

@@ -5,6 +5,7 @@ using Model.Dto;
 using Model.Entities;
 using NetTaste;
 using Newtonsoft.Json;
+using NLog;
 using PLCTool.Common;
 using Prism.Commands;
 using Prism.Events;
@@ -30,9 +31,9 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
         private readonly IBasicPlcTestSchemeService _basicPlcTestSchemeService;
         private readonly IBasicPlcTestSchemeDtlService _basicPlcTestSchemeDtlService;
         private readonly IMapper _mapper;
-
+        private readonly ILogger _logger;
         private List<OptionConfigDto> _optionConfigs;
-        public AddPlanViewModel(IDialogService dialog, IEventAggregator aggregator, IOptionConfigService optionConfigService,IBasicPlcTestSchemeService basicPlcTestSchemeService, IBasicPlcTestSchemeDtlService basicPlcTestSchemeDtlService,IMapper mapper)
+        public AddPlanViewModel(IDialogService dialog, IEventAggregator aggregator, IOptionConfigService optionConfigService,IBasicPlcTestSchemeService basicPlcTestSchemeService, IBasicPlcTestSchemeDtlService basicPlcTestSchemeDtlService,IMapper mapper,ILogger logger)
         {
             _dialog = dialog;
             _aggregator = aggregator;
@@ -40,6 +41,7 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
             _basicPlcTestSchemeService= basicPlcTestSchemeService;
             _basicPlcTestSchemeDtlService= basicPlcTestSchemeDtlService;
             _mapper = mapper;
+            _logger = logger;
             CloseCommand = new DelegateCommand(Close);
             SureCommand = new DelegateCommand<string>(Sure);
             ResetCommand = new DelegateCommand<string>(ResetMethod);
@@ -342,6 +344,7 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
                 var finsSche = _basicPlcTestSchemeService.FindByName(ScheduleName);
                 if (finsSche != null)
                 {
+                    
                     MessageBoxResult boxResult = MessageBox.Show("测试方案名称已存在,请填写其他名称", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
                     return;
                 }
@@ -399,7 +402,18 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
             bas_plc_test_scheme_dtl schDtlEntity = _mapper.Map<BasicPlcTestSchemeDtlDto, bas_plc_test_scheme_dtl>(schDtlDto);
             if(Title=="新增方案")
             {
-                _basicPlcTestSchemeDtlService.Add(schDtlEntity);
+
+                bool isAddSucc=_basicPlcTestSchemeDtlService.Add(schDtlEntity);
+                if (isAddSucc)
+                {
+                    _logger.Info($"新增方案成功。方案名{ScheduleName},测试项{TestName}");
+                     MessageBoxResult boxResult = MessageBox.Show("更新成功", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
+                }
+                else
+                {
+                    MessageBoxResult boxResult = MessageBox.Show("更新失败", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
+                    return;
+                }
             }
             else
             {
@@ -414,6 +428,7 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
                         bool isSucc=_basicPlcTestSchemeDtlService.Edit(schDtlEntityEdit);
                         if(isSucc)
                         {
+                            _logger.Info($"更新方案成功。方案名{ScheduleName},测试项{TestName}");
                             MessageBoxResult boxResult = MessageBox.Show("更新成功", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
                         }
                         else
@@ -530,7 +545,7 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
             set { testName = value; RaisePropertyChanged(); }
         }
         /// <summary>
-        /// 测试项
+        /// 测试项类型
         /// </summary>
         private List<string> testKinds=new List<string>();
         public List<string> TestKinds

+ 128 - 27
BlankApp1/BlankApp1/ViewModels/BasicConfigViewModel/BaseConfigViewModel.cs

@@ -31,6 +31,11 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
         private readonly ILogger _logger;
         private readonly IMapper _mapper;
         private readonly IMenuService _menuService;
+
+        private List<BasicPlcTestSchemeDto> allConfigList = new List<BasicPlcTestSchemeDto>();//所有方案
+        private List<BasicPlcTestSchemeDto> conditionConfig = new List<BasicPlcTestSchemeDto>();//所有方案
+
+        private const int PageCount = 1; //每一页显示个数
         public BaseConfigViewModel(IDialogService dialog, IMenuService menuService, IOptionConfigService optionConfigService, IBasicPlcTestSchemeService basicPlcTestSchemeService, IBasicPlcTestSchemeDtlService basicPlcTestSchemeDtlService ,IMapper mapper, ILogger logger)
         {
             _dialog = dialog;
@@ -40,15 +45,66 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
             _logger = logger;
             _mapper = mapper;
             _menuService = menuService;
-           
+            QueryCommand = new DelegateCommand<object>(Query);
+            ResetCommand = new DelegateCommand<object>(Reset);
             ExportCommand = new DelegateCommand<string>(Export);
             AddPlanCommand = new DelegateCommand<string>(AddPlan);
             EditCommand = new DelegateCommand<object>(Edit);
             DeleteCommand = new DelegateCommand<object>(Delete);
+            PageUpdatedCmd = new DelegateCommand(PageUpdated);
             GetConfigOption();
             GetContent();
         }
 
+
+
+
+        #region 私有方法
+        /// <summary>
+        /// 上下页
+        /// </summary>
+        /// <param name="obj"></param>
+        private void PageUpdated()
+        {
+            var disDatas = conditionConfig.Skip((PageIndex - 1) * PageCount).Take(PageCount).ToList();
+            BaseConfigList = new ObservableCollection<BasicPlcTestSchemeDto>(disDatas);
+        }
+        private void Reset(object obj)
+        {
+            ScheduleName = string.Empty;
+            DeviceName = string.Empty;
+            TestName = string.Empty;
+            SelectTest = string.Empty;
+        }
+
+        private void Query(object obj)
+        {
+            if((!string.IsNullOrEmpty(StartTime))&&(!string.IsNullOrEmpty(EndTime)))
+            {
+                if (Convert.ToDateTime(StartTime) > Convert.ToDateTime( EndTime))
+                {
+                    MessageBox.Show("起始时间大于结束时间,请重新输入", "确认", MessageBoxButton.OK, MessageBoxImage.Warning);
+                    return;
+                }
+                if (Convert.ToDateTime(StartTime).AddDays(2) < Convert.ToDateTime(EndTime))
+                {
+                    MessageBox.Show("起始时间和结束时间间隔不能大于2天,请重新输入", "确认", MessageBoxButton.OK, MessageBoxImage.Warning);
+                    return;
+                }
+            }
+           
+            conditionConfig = (from a in allConfigList
+                                      where (EndTime == string.Empty ? true : (a.CreateTime < Convert.ToDateTime(EndTime)) && (Convert.ToDateTime(StartTime) < a.CreateTime))
+                                       && (string.IsNullOrEmpty(ScheduleName) ? true : (a.SchemeName == ScheduleName))
+                                        && (string.IsNullOrEmpty(TestName) ? true : (a.ItemName == TestName))
+                                         && (string.IsNullOrEmpty(DeviceName) ? true : (a.DeviceName == DeviceName))
+                                           && (string.IsNullOrEmpty(SelectTest) ? true : (a.ItemType == SelectTest))
+                               select a).ToList();
+            //默认显示的第一页
+            PageIndex = 1;
+            PageUpdated();
+            //BaseConfigList = new ObservableCollection<BasicPlcTestSchemeDto>(conditionConfig);
+        }
         /// <summary>
         /// 获取配置
         /// </summary>
@@ -100,7 +156,10 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
                 GetContent();
             }
         }
-
+        /// <summary>
+        /// 新增按钮
+        /// </summary>
+        /// <param name="obj"></param>
         private void AddPlan(string obj)
         {
 
@@ -115,7 +174,10 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
 
             });
         }
-
+        /// <summary>
+        /// excel导出
+        /// </summary>
+        /// <param name="obj"></param>
         private void Export(object obj)
         {
 
@@ -170,6 +232,8 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
             var configList = _mapper.Map<List<bas_plc_test_scheme>, List<BasicPlcTestSchemeDto>>(schlist);
             //清空集合
             BaseConfigList.Clear();
+            allConfigList.Clear();
+            conditionConfig.Clear();
             //查找测试项名称
             foreach (var sch in configList)
             {
@@ -198,39 +262,63 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
                     basicPlcTestSchemeDto.ItemName=item.item_name;
                     basicPlcTestSchemeDto.CreateBy=sch.CreateBy;
                     basicPlcTestSchemeDto.CreateTime = sch.CreateTime;
-                    BaseConfigList.Add(basicPlcTestSchemeDto);
+                  
+                    allConfigList.Add(basicPlcTestSchemeDto);
+                    conditionConfig.Add(basicPlcTestSchemeDto);
+                   
                 }
-
+                //默认显示的第一页
+                PageIndex = 1;
+                PageUpdated();
             }
           
         }
 
-        private void PopMethod(string obj)
-        {
-            DialogParameters parm = new DialogParameters();
-            parm.Add("Key", MyContent);
-            //弹出详情对话框
-            _dialog.ShowDialog("PopView", parm, async callback =>
-            {
-                if (callback.Result == ButtonResult.OK)
-                {
-                    MyContent = callback.Parameters.GetValue<string>("ReturnValue");
-                }
-
-            });
-        }
+        #endregion
         #region 命令绑定
-        public DelegateCommand<string> AddPlanCommand { set; get; }
-        public DelegateCommand<object> EditCommand { set; get; }
 
+        public DelegateCommand<object> EditCommand { set; get; }
+        public DelegateCommand<string> AddPlanCommand { set; get; }
+        public DelegateCommand<object> QueryCommand { set; get; }
+        public DelegateCommand<object> ResetCommand { set; get; }
         public DelegateCommand<object> DeleteCommand { set; get; }
         public DelegateCommand<string> ExportCommand { set; get; }
+
+        public DelegateCommand PageUpdatedCmd { set; get; }
         #endregion
         #region 数据绑定
-
         /// <summary>
-        /// 测试
+        /// 测试方案编码
         /// </summary>
+        private string scheduleName;
+        public string ScheduleName
+        {
+            get { return scheduleName; }
+            set { scheduleName = value; RaisePropertyChanged(); }
+        }
+        /// <summary>
+        /// 设备名称
+        /// </summary>
+        private string deviceName;
+        public string DeviceName
+        {
+            get { return deviceName; }
+            set { deviceName = value; RaisePropertyChanged(); }
+        }
+        /// <summary>
+        /// 测试项名称
+        /// </summary>
+        private string testName;
+        public string TestName
+        {
+            get { return testName; }
+            set { testName = value; RaisePropertyChanged(); }
+        }
+        /// <summary>
+        /// 测试项类型
+        /// </summary>
+      
+  
         private List<string> testKinds = new List<string>();
         public List<string> TestKinds
         {
@@ -247,11 +335,24 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
             set { selectTest = value; RaisePropertyChanged(); }
         }
 
-        private string myContent = string.Empty;
-        public string MyContent
+        private string startTime=string.Empty;
+        public string StartTime
+        {
+            get { return startTime; }
+            set { startTime = value; RaisePropertyChanged(); }
+        }
+        private string endTime=string.Empty;
+        public string EndTime
+        {
+            get { return endTime; }
+            set { endTime = value; RaisePropertyChanged(); }
+        }
+
+        private int pageIndex = 1;
+        public int PageIndex
         {
-            get { return myContent; }
-            set { SetProperty(ref myContent, value); }
+            get { return pageIndex; }
+            set { pageIndex = value; RaisePropertyChanged(); }
         }
 
         private ObservableCollection<BasicPlcTestSchemeDto> baseConfigList = new ObservableCollection<BasicPlcTestSchemeDto>();

+ 259 - 0
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/TestOperViewModel.cs

@@ -0,0 +1,259 @@
+using AutoMapper;
+using BizService;
+using MiniExcelLibs;
+using Model.Dto;
+using Model.Entities;
+using NLog;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace PLCTool.ViewModels.BusinessManageViewModel
+{
+    public class TestOperViewModel: BindableBase
+    {
+        private readonly IDialogService _dialog;
+        private readonly IOptionConfigService _optionConfigService;
+        private readonly IBasicPlcTestSchemeService _basicPlcTestSchemeService;
+        private readonly IBasicPlcTestSchemeDtlService _basicPlcTestSchemeDtlService;
+        private readonly ILogger _logger;
+        private readonly IMapper _mapper;
+        private readonly IMenuService _menuService;
+        public TestOperViewModel(IDialogService dialog, IMenuService menuService, IOptionConfigService optionConfigService, IBasicPlcTestSchemeService basicPlcTestSchemeService, IBasicPlcTestSchemeDtlService basicPlcTestSchemeDtlService, IMapper mapper, ILogger logger)
+        {
+            _dialog = dialog;
+            _optionConfigService = optionConfigService;
+            _basicPlcTestSchemeService = basicPlcTestSchemeService;
+            _basicPlcTestSchemeDtlService = basicPlcTestSchemeDtlService;
+            _logger = logger;
+            _mapper = mapper;
+            _menuService = menuService;
+            ExportCommand = new DelegateCommand<string>(Export);
+            AddPlanCommand = new DelegateCommand<string>(AddPlan);
+            EditCommand = new DelegateCommand<object>(Edit);
+            DeleteCommand = new DelegateCommand<object>(Delete);
+            GetConfigOption();
+            GetContent();
+           
+        }
+        #region 私有方法
+
+
+        /// <summary>
+        /// 获取配置
+        /// </summary>
+        private void GetConfigOption()
+        {
+            var configList = _optionConfigService.QueryList();
+            var _optionConfigs = _mapper.Map<List<OptionConfig>, List<OptionConfigDto>>(configList);
+            var tests = _optionConfigs.FindAll(x => x.TypeID == 1);
+            TestKinds = new List<string>();
+            foreach (var test in tests)
+            {
+                TestKinds.Add(test.ContentOption);
+            }
+        }
+        /// <summary>
+        /// 编辑
+        /// </summary>
+        /// <param name="obj"></param>
+        private void Edit(object obj)
+        {
+            //测试方案明细主键ID
+            long id = Convert.ToInt64(obj);
+            DialogParameters parm = new DialogParameters();
+            parm.Add("Key", id);
+            //弹出详情对话框
+            _dialog.ShowDialog("AddPlanView", parm, async callback =>
+            {
+                if (callback.Result == ButtonResult.OK)
+                {
+                    //更新表格,重新获取
+                    GetContent();
+                }
+
+            });
+        }
+        /// <summary>
+        /// 删除操作
+        /// </summary>
+        /// <param name="obj"></param>
+        private void Delete(object obj)
+        {
+            int id = Convert.ToInt32(obj);
+            MessageBoxResult boxResult = MessageBox.Show("确认删除此条数据?", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question);
+            if (boxResult == MessageBoxResult.OK)
+            {
+
+                _basicPlcTestSchemeDtlService.Delete(id);
+                //更新表格,重新获取
+                GetContent();
+            }
+        }
+        /// <summary>
+        /// 新增按钮
+        /// </summary>
+        /// <param name="obj"></param>
+        private void AddPlan(string obj)
+        {
+
+            //弹出详情对话框
+            _dialog.ShowDialog("AddPlanView", async callback =>
+            {
+                if (callback.Result == ButtonResult.OK)
+                {
+                    //更新表格,重新获取
+                    GetContent();
+                }
+
+            });
+        }
+        /// <summary>
+        /// excel导出
+        /// </summary>
+        /// <param name="obj"></param>
+        private void Export(object obj)
+        {
+
+
+            using (System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog()
+            {
+                //设置文件类型
+                //书写规则例如:txt files(*.txt)|*.txt
+                Filter = "Excel files(*.xlsx)|*.xlsx|All files(*.*)|*.*",
+                //设置默认文件名(可以不设置)
+                FileName = "配置导出",
+
+                //获取或设置一个值,该值指示如果用户省略扩展名,文件对话框是否自动在文件名中添加扩展名。(可以不设置)
+                AddExtension = true,
+
+                //保存对话框是否记忆上次打开的目录
+                RestoreDirectory = true
+            })
+            {
+                // Show save file dialog box
+
+                //点了保存按钮进入
+                if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+                {
+                    try
+                    {
+                        //获得文件路径
+                        string localFilePath = saveFileDialog.FileName.ToString();
+
+                        //string filePathWithName = localFilePath + ".xlsx";
+
+                        //获取文件内容
+                        MiniExcel.SaveAs(localFilePath, BaseConfigList);
+                    }
+                    catch (Exception ex)
+                    {
+
+                    }
+
+
+                }
+
+            }
+        }
+        /// <summary>
+        /// 获取解决方案
+        /// </summary>
+        private void GetContent()
+        {
+            //所有测试方案
+            var schlist = _basicPlcTestSchemeService.QueryList();
+            var configList = _mapper.Map<List<bas_plc_test_scheme>, List<BasicPlcTestSchemeDto>>(schlist);
+            //清空集合
+            BaseConfigList.Clear();
+            //查找测试项名称
+            foreach (var sch in configList)
+            {
+                long schId = sch.SchemeId;
+                //在解决方案详细表中查找所有的测试项
+                var items = _basicPlcTestSchemeDtlService.FindAllBySchId(schId);
+                foreach (var item in items)
+                {
+                    BasicPlcTestSchemeDto basicPlcTestSchemeDto = new BasicPlcTestSchemeDto();
+                    basicPlcTestSchemeDto.SchemeId = item.scheme_dtl_id;
+                    basicPlcTestSchemeDto.SchemeName = sch.SchemeName;
+                    basicPlcTestSchemeDto.DeviceName = sch.DeviceName;
+                    switch (item.item_type)
+                    {
+                        case 0:
+                            basicPlcTestSchemeDto.ItemType = "前置项";
+                            break;
+                        case 1:
+                            basicPlcTestSchemeDto.ItemType = "PLC点位测试项";
+                            break;
+                        case 2:
+                            basicPlcTestSchemeDto.ItemType = "Robot动作测试";
+                            break;
+                    }
+
+                    basicPlcTestSchemeDto.ItemName = item.item_name;
+                    basicPlcTestSchemeDto.CreateBy = sch.CreateBy;
+                    basicPlcTestSchemeDto.CreateTime = sch.CreateTime;
+                    BaseConfigList.Add(basicPlcTestSchemeDto);
+                }
+
+            }
+
+        }
+
+        #endregion
+        #region 命令绑定
+        public DelegateCommand<string> AddPlanCommand { set; get; }
+        public DelegateCommand<object> EditCommand { set; get; }
+
+        public DelegateCommand<object> DeleteCommand { set; get; }
+        public DelegateCommand<string> ExportCommand { set; get; }
+        #endregion
+        #region 数据绑定
+
+        /// <summary>
+        /// 测试项
+        /// </summary>
+        private List<string> testKinds = new List<string>();
+        public List<string> TestKinds
+        {
+            get { return testKinds; }
+            set { testKinds = value; RaisePropertyChanged(); }
+        }
+        /// <summary>
+        /// 
+        /// </summary>
+        private string selectTest;
+        public string SelectTest
+        {
+            get { return selectTest; }
+            set { selectTest = value; RaisePropertyChanged(); }
+        }
+
+        private string myContent = string.Empty;
+        public string MyContent
+        {
+            get { return myContent; }
+            set { SetProperty(ref myContent, value); }
+        }
+
+        private ObservableCollection<BasicPlcTestSchemeDto> baseConfigList = new ObservableCollection<BasicPlcTestSchemeDto>();
+        public ObservableCollection<BasicPlcTestSchemeDto> BaseConfigList
+        {
+            get { return baseConfigList; }
+            set { SetProperty(ref baseConfigList, value); }
+        }
+
+        #endregion
+
+    }
+}
+
+

+ 11 - 11
BlankApp1/BlankApp1/Views/BasicConfigView/BaseConfigView.xaml

@@ -18,23 +18,23 @@
         </Grid.RowDefinitions>
         <UniformGrid Grid.Row="0" Columns="4">
             <StackPanel Orientation="Horizontal">
-                <TextBlock Text="测试方案编码:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
-                <TextBox  Height="28" Width="120" />
+                <TextBlock Text="测试方案名称:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
+                <TextBox  Height="28" Width="120" Text="{Binding ScheduleName}" />
             </StackPanel>
             <StackPanel Orientation="Horizontal">
                 <TextBlock Text="设备名称:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
-                <TextBox  Height="28" Width="120" />
-            </StackPanel>
-            <StackPanel Orientation="Horizontal">
-                <TextBlock Text="测试项名称:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
-                <TextBox  Height="28" Width="120" />
+                <TextBox  Height="28" Width="120" Text="{Binding DeviceName}"/>
             </StackPanel>
             <StackPanel Orientation="Horizontal" >
                 <TextBlock Text="测试项类型:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
                 <ComboBox  Height="28" Width="120" ItemsSource="{Binding TestKinds}" SelectedItem="{Binding SelectTest}" />
             </StackPanel>
-          
-            
+            <StackPanel Orientation="Horizontal">
+                <TextBlock Text="测试项名称:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
+                <TextBox  Height="28" Width="120"  Text="{Binding TestName}"/>
+            </StackPanel>
+
+
         </UniformGrid>
         <Grid Grid.Row="1">
             <Grid.ColumnDefinitions>
@@ -44,7 +44,7 @@
             <StackPanel Grid.Column="0" Orientation="Horizontal">
                 <StackPanel Orientation="Horizontal">
                     <TextBlock Text="创建时间:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
-                    <myContr:MyDateTimePicker ></myContr:MyDateTimePicker>
+                    <myContr:MyDateTimePicker  ></myContr:MyDateTimePicker>
                 </StackPanel>
                 <StackPanel Orientation="Horizontal">
                     <TextBlock Text="至:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
@@ -54,7 +54,7 @@
             <StackPanel Grid.Column="1" Orientation="Horizontal">
 
                 <Button  Content="查询" Width="80"  Margin="5,0"  Command="{Binding QueryCommand}" Style="{StaticResource NormalButtonStyle}" />
-                <Button  Content="重置" Width="80"  Margin="5,0"  Command="{Binding QueryCommand}" Style="{StaticResource NormalButtonStyle}" />
+                <Button  Content="重置" Width="80"  Margin="5,0"  Command="{Binding ResetCommand}" Style="{StaticResource NormalButtonStyle}" />
                 <Button  Content="新增" Width="80"  Margin="5,0"  Command="{Binding AddPlanCommand}" Style="{StaticResource NormalButtonStyle}"/>
 
                 <Button Content="导出Excel" Width="80"  Margin="5,0"  Command="{Binding ExportCommand}" Style="{StaticResource NormalButtonStyle}" />

+ 114 - 0
BlankApp1/BlankApp1/Views/BusinessManageView/TestOperView.xaml

@@ -0,0 +1,114 @@
+<UserControl x:Class="PLCTool.Views.BusinessManageView.TestOperView"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:PLCTool.Views.BusinessManageView"
+             xmlns:hc="https://handyorg.github.io/handycontrol"
+             xmlns:myContr="clr-namespace:BlankApp1.Controls"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <Grid >
+        <Grid.RowDefinitions>
+            <RowDefinition Height="40"/>
+            <RowDefinition Height="40"/>
+            <RowDefinition/>
+            <RowDefinition Height="40"/>
+
+        </Grid.RowDefinitions>
+        <UniformGrid Grid.Row="0" Columns="4">
+            <StackPanel Orientation="Horizontal">
+                <TextBlock Text="测试方案编码:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
+                <TextBox  Height="28" Width="120" />
+            </StackPanel>
+            <StackPanel Orientation="Horizontal">
+                <TextBlock Text="设备名称:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
+                <TextBox  Height="28" Width="120" />
+            </StackPanel>
+            <StackPanel Orientation="Horizontal">
+                <TextBlock Text="测试项名称:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
+                <TextBox  Height="28" Width="120" />
+            </StackPanel>
+            <StackPanel Orientation="Horizontal" >
+                <TextBlock Text="测试项类型:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
+                <ComboBox  Height="28" Width="120" ItemsSource="{Binding TestKinds}" SelectedItem="{Binding SelectTest}" />
+            </StackPanel>
+
+
+        </UniformGrid>
+        <Grid Grid.Row="1">
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition/>
+                <ColumnDefinition/>
+            </Grid.ColumnDefinitions>
+            <StackPanel Grid.Column="0" Orientation="Horizontal">
+                <StackPanel Orientation="Horizontal">
+                    <TextBlock Text="创建时间:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
+                    <myContr:MyDateTimePicker ></myContr:MyDateTimePicker>
+                </StackPanel>
+                <StackPanel Orientation="Horizontal">
+                    <TextBlock Text="至:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
+                    <myContr:MyDateTimePicker ></myContr:MyDateTimePicker>
+                </StackPanel>
+            </StackPanel>
+            <StackPanel Grid.Column="1" Orientation="Horizontal">
+
+                <Button  Content="查询" Width="80"  Margin="5,0"  Command="{Binding QueryCommand}" Style="{StaticResource NormalButtonStyle}" />
+                <Button  Content="重置" Width="80"  Margin="5,0"  Command="{Binding QueryCommand}" Style="{StaticResource NormalButtonStyle}" />
+                <Button  Content="手动测试" Width="80"  Margin="5,0"  Command="{Binding ManualCommand}" Style="{StaticResource NormalButtonStyle}"/>
+
+                <Button Content="自动测试" Width="80"  Margin="5,0"  Command="{Binding AutoCommand}" Style="{StaticResource NormalButtonStyle}" />
+            </StackPanel>
+        </Grid>
+        <DataGrid  Grid.Row="2"  ColumnWidth="*" AutoGenerateColumns="False" HeadersVisibility="All" CanUserAddRows="False"  SelectionUnit="FullRow" SelectionMode="Single"   RowHeaderWidth="0"
+               ColumnHeaderStyle="{StaticResource ColumnHeaderStyle}"  RowHeaderStyle="{StaticResource RowHeaderStyle}" RowStyle="{StaticResource DataGridRowtyle}"  AlternationCount="2"
+              ItemsSource="{Binding BaseConfigList}" IsReadOnly="True"  >
+            <DataGrid.Columns >
+                <DataGridTextColumn Header="序号" Binding="{Binding SchemeId}" CellStyle="{StaticResource MyDataGridCellStyle}" />
+                <DataGridTextColumn Header="测试方案名称" Binding="{Binding SchemeName}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                <DataGridTextColumn Header="设备名称" Binding="{Binding DeviceName}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                <DataGridTextColumn Header="测试项类型" Binding="{Binding ItemType}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                <DataGridTextColumn Header="测试项名称" Binding="{Binding ItemName}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                <DataGridTextColumn Header="创建者" Binding="{Binding CreateBy}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                <DataGridTextColumn Header="创建时间" Binding="{Binding CreateTime}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                <DataGridTemplateColumn Header="操作"  CellStyle="{StaticResource MyDataGridCellStyle}">
+                    <DataGridTemplateColumn.CellTemplate>
+                        <DataTemplate>
+                            <UniformGrid Columns="2">
+                                <Button  Width="auto" Background="Transparent" HorizontalContentAlignment ="Left" Foreground="Black" Height="25" BorderThickness="0"
+                                     Command="{Binding DataContext.EditCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid}}" CommandParameter="{Binding SchemeId}" Cursor="Hand" Margin="0,0,10,0" >
+
+                                    <StackPanel Orientation="Horizontal">
+                                        <TextBlock  Text="编辑" VerticalAlignment="Center" Foreground="Blue"/>
+                                    </StackPanel>
+                                </Button>
+                                <Button  Width="auto" Background="Transparent" HorizontalContentAlignment ="Left" Foreground="Black" Height="25" BorderThickness="0"
+                                     Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid}}" CommandParameter="{Binding SchemeId}" Cursor="Hand" >
+
+                                    <StackPanel Orientation="Horizontal">
+                                        <TextBlock  Text="删除" VerticalAlignment="Center" Foreground="Blue"/>
+                                    </StackPanel>
+                                </Button>
+
+                            </UniformGrid>
+                        </DataTemplate>
+                    </DataGridTemplateColumn.CellTemplate>
+                </DataGridTemplateColumn>
+
+            </DataGrid.Columns>
+
+        </DataGrid>
+        <Grid Grid.Row="3" HorizontalAlignment="Center" VerticalAlignment="Center">
+
+            <hc:Pagination MaxPageCount="10" PageIndex="{Binding PageIndex}" IsJumpEnabled="True">
+                <hc:Interaction.Triggers>
+                    <hc:EventTrigger EventName="PageUpdated">
+                        <hc:EventToCommand Command="{Binding PageUpdatedCmd}" PassEventArgsToCommand="True" />
+                    </hc:EventTrigger>
+                </hc:Interaction.Triggers>
+            </hc:Pagination>
+        </Grid>
+
+
+    </Grid>
+</UserControl>

+ 28 - 0
BlankApp1/BlankApp1/Views/BusinessManageView/TestOperView.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PLCTool.Views.BusinessManageView
+{
+    /// <summary>
+    /// TestOperView.xaml 的交互逻辑
+    /// </summary>
+    public partial class TestOperView : UserControl
+    {
+        public TestOperView()
+        {
+            InitializeComponent();
+        }
+    }
+}