Jelajahi Sumber

手动测试修改

ltwork 1 tahun lalu
induk
melakukan
5ac334c680

+ 1 - 1
BlankApp1/BlankApp1/App.xaml.cs

@@ -66,7 +66,7 @@ namespace BlankApp1
             containerRegistry.RegisterForNavigation<DeviceKindView, DeviceKindViewModel>();
             containerRegistry.RegisterForNavigation<DeviceView, DeviceViewModel>();
             containerRegistry.RegisterForNavigation<ProjectView, ProjectViewModel>();
-
+            containerRegistry.RegisterForNavigation<DeviceTestView, DeviceTestViewModel>();
             containerRegistry.RegisterDialog<AddOrEditSchView, AddOrEditSchViewModel>();
             containerRegistry.RegisterDialog<AddDetailView, AddDetailViewModel>();
             containerRegistry.RegisterDialog<AutoTestView, AutoTestViewModel>();

+ 472 - 0
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/DeviceTestViewModel.cs

@@ -0,0 +1,472 @@
+using AutoMapper;
+using BizService;
+using Microsoft.Extensions.Logging;
+using MiniExcelLibs;
+using Model.Dto;
+using Model.Entities;
+using PLCTool.Common;
+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 DeviceTestViewModel : BindableBase
+    {
+        private readonly IBasicDeviceService _iBasicDeviceService;
+        private readonly IBasicDeviceKindService _iBasicDeviceKindService;
+        private readonly IBasicProjectService _iBasicProjectService;
+        private readonly IBasicPlcTestSchemeService _basicPlcTestSchemeService;
+        private readonly IMapper _mapper;
+        private readonly IDialogService _dialog;
+        private readonly ILogger _logger;
+        private List<BasDeviceWithSchModel> allDeviceList = new List<BasDeviceWithSchModel>();//所有方案
+        private List<BasDeviceWithSchModel> conditionDevices = new List<BasDeviceWithSchModel>();//符合条件的方案
+        public DeviceTestViewModel(IBasicDeviceService iBasicDeviceService, IBasicDeviceKindService iBasicDeviceKindService, IBasicProjectService iBasicProjectService, IBasicPlcTestSchemeService basicPlcTestSchemeService, IMapper mapper, IDialogService dialog, ILogger logger)
+        {
+            _iBasicDeviceService = iBasicDeviceService;
+            _iBasicDeviceKindService = iBasicDeviceKindService;
+            _iBasicProjectService = iBasicProjectService;
+            _basicPlcTestSchemeService = basicPlcTestSchemeService;
+            _mapper = mapper;
+            _dialog = dialog;
+            _logger = logger;
+            QueryCommand = new DelegateCommand<object>(Query);
+            AddCommand = new DelegateCommand<object>(Add);
+            ExportCommand = new DelegateCommand<string>(Export);
+            EditCommand = new DelegateCommand<object>(Edit);
+            DeleteCommand = new DelegateCommand<object>(Delete);
+            ResetCommand = new DelegateCommand<object>(Reset);
+            OnLoadCommand = new DelegateCommand(OnLoad);
+            //手动  自动测试
+            AutoTestCommand = new DelegateCommand<object>(AutoDest);
+            ManualTestCommand = new DelegateCommand<object>(ManualTest);
+            GetPprojectConfig();
+        }
+
+
+
+
+
+
+
+
+        #region 私有方法
+        /// <summary>
+        /// 加载页面
+        /// </summary>
+        private void OnLoad()
+        {
+            DeviceKindNameList = _iBasicDeviceKindService.FindAllDeviceKind();
+            ProjectNameList = _iBasicProjectService.FindAllProject();
+        }
+        private void Reset(object obj)
+        {
+            DeviceNo = string.Empty;
+            DeviceName = string.Empty;
+
+
+        }
+
+        /// <summary>
+        /// 自动测试
+        /// </summary>
+        /// <param name="obj"></param>
+        private void AutoDest(object obj)
+        {
+            //测试方案明细主键ID
+            long id = Convert.ToInt64(obj);
+            DialogParameters parm = new DialogParameters();
+            parm.Add("Key", id);
+            //弹出详情对话框
+            //弹出详情对话框
+            _dialog.ShowDialog("AutoTestView", parm, async callback =>
+            {
+                if (callback.Result == ButtonResult.OK)
+                {
+                    //更新表格,重新获取
+            
+                }
+
+            });
+        }
+
+        private void ManualTest(object obj)
+        {
+            //测试方案主键ID
+            long id = Convert.ToInt64(obj);
+            DialogParameters parm = new DialogParameters();
+            parm.Add("Key", id);
+            //弹出详情对话框
+            //弹出详情对话框
+            _dialog.ShowDialog("ManualTestView", parm, async callback =>
+            {
+                if (callback.Result == ButtonResult.OK)
+                {
+                    //更新表格,重新获取
+                   
+                }
+
+            });
+        }
+        /// <summary>
+        /// 修改
+        /// </summary>
+        /// <param name="obj"></param>
+        private void Edit(object obj)
+        {
+            int id = Convert.ToInt32(obj);
+            var findDevice = allDeviceList.FirstOrDefault(x => (x.DeviceId == id));
+            DialogParameters parm = new DialogParameters();
+            parm.Add("Key", findDevice);
+            //弹出详情对话框
+            _dialog.ShowDialog("AddOrEditDeviceView", parm, async callback =>
+            {
+                if (callback.Result == ButtonResult.OK)
+                {
+                    BasDeviceDto returnValue = callback.Parameters.GetValue<BasDeviceDto>("ReturnValue");
+
+                    if (returnValue != null)
+                    {
+                        //更新时间
+                        returnValue.UpdateTime = DateTime.Now;
+                        returnValue.UpdateBy = Appsession.UserName;
+                        //创建时间
+                        returnValue.CreateTime = findDevice.CreateTime;
+                        returnValue.CreateBy = findDevice?.CreateBy;
+
+                        var deviceKindCon = _mapper.Map<BasDeviceDto, bas_device>(returnValue);
+                        var findPlcs = allDeviceList.FindAll(x => (x.DeviceName == returnValue.DeviceName) || (x.DeviceNo == returnValue.DeviceNo));
+                        foreach (var item in findPlcs)
+                        {
+                            if (item.DeviceId != id)
+                            {
+                                MessageBox.Show("已有此设备编号,请更改名称!", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
+                                return;
+                            }
+                        }
+
+                        //修改
+                        deviceKindCon.device_id = id;
+                        bool isSucc = _iBasicDeviceService.Edit(deviceKindCon);
+                        if (isSucc)
+                        {
+                            //重新读取PLC
+                            GetPprojectConfig();
+                            _logger.LogInformation($"修改项目成功");
+                            MessageBox.Show("修改项目成功", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
+                        }
+                    }
+                }
+
+            });
+        }
+
+        private void Delete(object obj)
+        {
+            int id = Convert.ToInt32(obj);
+            MessageBoxResult boxResult = MessageBox.Show("确认删除此条数据?", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Question);
+            if (boxResult == MessageBoxResult.OK)
+            {
+                var del = _iBasicDeviceService.Delete(id);
+                if (del)
+                {
+                    MessageBox.Show("删除成功!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
+                    GetPprojectConfig();
+                }
+
+            }
+        }
+
+        /// <summary>
+        /// 查询
+        /// </summary>
+        /// <param name="obj"></param>
+        private void Query(object obj)
+        {
+            conditionDevices = (from a in allDeviceList
+                                where (string.IsNullOrEmpty(DeviceName) ? true : (a.DeviceName == DeviceName))
+                                && (string.IsNullOrEmpty(DeviceNo) ? true : (a.DeviceNo == DeviceNo))
+                                && (string.IsNullOrEmpty(DeviceKindName) ? true : (a.DeviceKindName == DeviceKindName))
+                                select a).ToList();
+            //默认显示的第一页
+            conditionDevices = conditionDevices.OrderBy(x => x.DeviceId).ToList();
+            Getpage();
+        }
+
+        private void Export(string 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();
+
+                        //获取文件内容
+                        MiniExcel.SaveAs(localFilePath, DeviceItemList);
+                    }
+                    catch (Exception ex)
+                    {
+                        _logger.LogError(ex.ToString());
+                    }
+
+
+                }
+
+            }
+        }
+        /// <summary>
+        /// 添加PLC变量
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <exception cref="NotImplementedException"></exception>
+        private void Add(object obj)
+        {
+
+            //弹出详情对话框
+            _dialog.ShowDialog("AddOrEditDeviceView", async callback =>
+            {
+                if (callback.Result == ButtonResult.OK)
+                {
+                    BasDeviceDto returnValue = callback.Parameters.GetValue<BasDeviceDto>("ReturnValue");
+                    if (returnValue != null)
+                    {
+                        returnValue.CreateTime = DateTime.Now;
+                        returnValue.CreateBy = Appsession.UserName;
+                        returnValue.UpdateTime = DateTime.Now;
+                        returnValue.UpdateBy = Appsession.UserName;
+                        var deviceCon = _mapper.Map<BasDeviceDto, bas_device>(returnValue);
+                        var findPlc = allDeviceList.FirstOrDefault(x => (x.DeviceName == returnValue.DeviceName) || (x.DeviceNo == returnValue.DeviceNo));
+                        if (findPlc != null)
+                        {
+                            MessageBox.Show("已有此项目名称或编号,请更改!", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
+                            return;
+                        }
+                        bool isSucc = _iBasicDeviceService.Add(deviceCon);
+                        if (isSucc)
+                        {
+                            //重新读取PLC
+                            GetPprojectConfig();
+                            _logger.LogInformation($"添加项目成功");
+                            MessageBox.Show("添加项目成功!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
+                        }
+                    }
+                }
+
+            });
+        }
+        /// <summary>
+        /// 获取所有项目
+        /// </summary>
+        private void GetPprojectConfig()
+        {
+            allDeviceList.Clear();
+            conditionDevices.Clear();
+            var projectlist = _iBasicDeviceService.QueryList();
+            var allDeviceKinds = _mapper.Map<List<bas_device>, List<BasDeviceDto>>(projectlist);
+            //所有测试方案
+            var schlist = _basicPlcTestSchemeService.QueryList();
+            var schDtoList = _mapper.Map<List<bas_plc_test_scheme>, List<BasicPlcTestSchemeDto>>(schlist);
+            
+
+            foreach (var item in allDeviceKinds)
+            {
+                string deviceKind = item.DeviceKindName;
+                //在测试方案中查找此设备类型的所有方案
+                var schs= schDtoList.FindAll(x => x.DeviceKindName == deviceKind);
+                //设备方案
+                foreach (var sch in schs)
+                {
+                    allDeviceList.Add(new BasDeviceWithSchModel()
+                    {
+                        DeviceId = item.DeviceId,
+                        DeviceNo = item.DeviceNo,
+                        DeviceName = item.DeviceName,
+                        DeviceKindName = item.DeviceKindName,
+                        ProjectName = item.ProjectName,
+                        SchemeName = sch.SchemeName,
+                        SchemeId=sch.SchemeId,
+                    }) ;
+                    conditionDevices.Add(new BasDeviceWithSchModel()
+                    {
+                        DeviceId = item.DeviceId,
+                        DeviceNo = item.DeviceNo,
+                        DeviceName = item.DeviceName,
+                        DeviceKindName = item.DeviceKindName,
+                        ProjectName = item.ProjectName,
+                        SchemeName = sch.SchemeName,
+                        SchemeId = sch.SchemeId,
+                    });
+                }
+             
+            }
+            conditionDevices = conditionDevices.OrderBy(x => x.DeviceId).ToList();
+            Getpage();
+        }
+        /// <summary>
+        /// 获取页面
+        /// </summary>
+        private void Getpage()
+        {
+            CurrentPage = 1;
+            TotalCount = conditionDevices.Count;
+            CurrentPageChanged();
+
+
+        }
+        /// <summary>
+        /// 页面变化
+        /// </summary>
+        private void CurrentPageChanged()
+        {
+
+            DeviceItemList.Clear();
+
+            foreach (var i in conditionDevices.Skip((CurrentPage - 1) * CountPerPage).Take(CountPerPage))
+            {
+                DeviceItemList.Add(i);
+            }
+        }
+
+        #endregion
+        #region 命令绑定
+
+        public DelegateCommand<object> QueryCommand { set; get; }
+        public DelegateCommand<object> AddCommand { set; get; }
+        public DelegateCommand<string> ExportCommand { set; get; }
+
+        /// <summary>
+        /// 表格删除
+        /// </summary>
+        public DelegateCommand<Object> DeleteCommand { set; get; }
+        /// <summary>
+        /// 表格编辑按钮
+        /// </summary>
+        public DelegateCommand<Object> EditCommand { set; get; }
+        public DelegateCommand<object> ResetCommand { set; get; }
+
+        public DelegateCommand OnLoadCommand { set; get; }
+
+        public DelegateCommand<object> AutoTestCommand { set; get; }
+
+        public DelegateCommand<object> ManualTestCommand { set; get; }
+        #endregion
+
+        #region 数据绑定
+        private ObservableCollection<BasDeviceWithSchModel> deviceItemList = new ObservableCollection<BasDeviceWithSchModel>();
+        public ObservableCollection<BasDeviceWithSchModel> DeviceItemList
+        {
+            get { return deviceItemList; }
+            set { deviceItemList = value; RaisePropertyChanged(); }
+        }
+
+        /// <summary>
+        /// 设备编号
+        /// </summary>
+        private string devicedNo;
+        public string DeviceNo
+        {
+            get { return devicedNo; }
+            set { devicedNo = value; RaisePropertyChanged(); }
+        }
+
+        /// <summary>
+        /// 设备类型名称
+        /// </summary>
+        private string deviceName;
+        public string DeviceName
+        {
+            get { return deviceName; }
+            set { deviceName = value; RaisePropertyChanged(); }
+        }
+
+        private string projectName;
+        public string ProjectName
+        {
+            get { return projectName; }
+            set { projectName = value; RaisePropertyChanged(); }
+        }
+        private string deviceKindName;
+        public string DeviceKindName
+        {
+            get { return deviceKindName; }
+            set { deviceKindName = value; RaisePropertyChanged(); }
+        }
+
+        /// <summary>
+        /// 项目名称
+        /// </summary>
+        private List<string> projectNameList;
+        public List<string> ProjectNameList
+        {
+            get { return projectNameList; }
+            set { projectNameList = value; RaisePropertyChanged(); }
+        }
+        /// <summary>
+        /// 设备类型
+        /// </summary>
+        private List<string> deviceKindNameList;
+        public List<string> DeviceKindNameList
+        {
+            get { return deviceKindNameList; }
+            set { deviceKindNameList = value; RaisePropertyChanged(); }
+        }
+        /// <summary>
+        /// 总条数
+        /// </summary>
+        private int totalCount;
+        public int TotalCount
+        {
+            get { return totalCount; }
+            set { totalCount = value; RaisePropertyChanged(); CurrentPageChanged(); }
+        }
+        /// <summary>
+        /// 每页数量
+        /// </summary>
+        private int countPerPage = 15;
+        public int CountPerPage
+        {
+            get { return countPerPage; }
+            set { countPerPage = value; RaisePropertyChanged(); CurrentPageChanged(); }
+        }
+        /// <summary>
+        /// 单前页
+        /// </summary>
+        private int currentPage = 1;
+        public int CurrentPage
+        {
+            get { return currentPage; }
+            set { currentPage = value; RaisePropertyChanged(); CurrentPageChanged(); }
+        }
+
+        #endregion
+    }
+}

+ 65 - 8
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/ManualTestViewModel.cs

@@ -64,6 +64,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             PreviousCommand = new DelegateCommand<object>(Previous);
             NextCommand = new DelegateCommand<object>(Next);
             DoneCommand = new DelegateCommand<object>(Done);
+            ItemChangeCommand = new DelegateCommand(ItemChange);
             BeforeConList = new ObservableCollection<BasPlcItemConfigDto>();
             InConList = new ObservableCollection<BasPlcItemConfigDto>();
             OutConList = new ObservableCollection<BasPlcItemConfigDto>();
@@ -71,7 +72,19 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
            
         }
 
-    
+        private void ItemChange()
+        {
+            var findDtlMsg = _basicPlcTestSchemeDtlService.FindAllBySchId(schId)?.FirstOrDefault(X => X.item_name == SelectItem);
+            if(findDtlMsg != null)
+            {
+                int id = Convert.ToInt32(findDtlMsg.scheme_dtl_id);
+                // 根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
+                globalSchDetailId = id;
+                GetDetailInfo(id);
+            }
+        }
+
+
 
 
         #region idialog接口实现
@@ -98,10 +111,29 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             {
                 foreach (var item in getMsg)
                 {
-                    globalSchDetailId = item; //测试方案明细ID
-                    int id = Convert.ToInt32(item);
-                    // 根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
-                    GetDetailInfo(id);
+                    //测试方案号
+                    schId = item;
+                    var schDtls=_basicPlcTestSchemeDtlService.FindAllBySchId(schId).OrderBy(x => x.scheme_dtl_id).ToList(); ;
+                    foreach(var sch in schDtls)
+                    {
+                        long dtlId = sch.scheme_dtl_id;
+
+                        SchItems.Add(sch.item_name);
+                    }
+                    //默认显示第一个测试项的信息
+                    if(schDtls.Count!=0)
+                    {
+                        int id = Convert.ToInt32(schDtls[0].scheme_dtl_id);
+                        globalSchDetailId = id;
+                        // 根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
+                        GetDetailInfo(id);
+                        SelectItemIndex = 0;
+                    }
+                 
+                    //globalSchDetailId = item; //测试方案明细ID
+                    //int id = Convert.ToInt32(item);
+                    //// 根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
+                    //GetDetailInfo(id);
 
                 }
 
@@ -473,6 +505,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
                 {
                     globalSchDetailId = schDetailId;
                     int id = Convert.ToInt32(schDetailId);
+                    SelectItemIndex++;
                     //界面显示
                     GetDetailInfo(id);
                     //记录记录明细表中是否有这个方案明细ID的记录,没有则添加,有则更新记录状态
@@ -485,7 +518,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
                     MessageBox.Show("已是此测试方案最后一个测试项!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
                     break;
                 }
-
+             
             }
         }
 
@@ -502,6 +535,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
                 {
                     globalSchDetailId = schDetailId;
                     int id = Convert.ToInt32(schDetailId);
+                    SelectItemIndex--;
                     //界面显示
                     GetDetailInfo(id);
                     //记录记录明细表中是否有这个方案明细ID的记录,没有则添加,有则更新记录状态
@@ -513,6 +547,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             long maxDtlId = basicSchDtls.Select(x => x.scheme_dtl_id).Min();
             if (globalSchDetailId == maxDtlId)
             {
+                SelectItemIndex = 0;
                 MessageBox.Show("已是此测试方案的第一个测试项!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
                
             }
@@ -1182,8 +1217,8 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         public DelegateCommand<object> NextCommand { set; get; }
 
         public DelegateCommand<object> DoneCommand { set; get; }
-
-
+        public DelegateCommand ItemChangeCommand { set; get; }
+        
         #endregion
         #region 变量绑定
         /// <summary>
@@ -1381,6 +1416,28 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             get { return startEnalbe; }
             set { startEnalbe = value; RaisePropertyChanged(); }
         }
+        //所有测试项列表
+        private List<string> schItems = new List<string>();
+        public List<string> SchItems
+        {
+            get { return schItems; }
+            set { schItems = value; RaisePropertyChanged(); }
+        }
+        //所选测试方案
+        private string selectItem;
+        public string SelectItem
+        {
+            get { return selectItem; }
+            set { selectItem = value; RaisePropertyChanged(); }
+        }
+
+        private int selectItemIndex;
+        public int SelectItemIndex
+        {
+            get { return selectItemIndex; }
+            set { selectItemIndex = value; RaisePropertyChanged(); }
+        }
+        
         #endregion
 
     }

+ 128 - 0
BlankApp1/BlankApp1/Views/BusinessManageView/DeviceTestView.xaml

@@ -0,0 +1,128 @@
+<UserControl x:Class="PLCTool.Views.BusinessManageView.DeviceTestView"
+             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:b="http://schemas.microsoft.com/xaml/behaviors"
+             xmlns:myContr="clr-namespace:BlankApp1.Controls"
+             xmlns:wpfdev="https://github.com/WPFDevelopersOrg/WPFDevelopers"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <Grid >
+        <b:Interaction.Triggers>
+            <b:EventTrigger EventName="Loaded">
+                <b:InvokeCommandAction Command="{Binding OnLoadCommand}"/>
+            </b:EventTrigger>
+        </b:Interaction.Triggers>
+        <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" Text="{Binding DeviceNo}" />
+            </StackPanel>
+            <StackPanel Orientation="Horizontal">
+                <TextBlock Text="设备名称:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
+                <TextBox  Height="28" Width="120" Text="{Binding DeviceName}"/>
+            </StackPanel>
+            <StackPanel Orientation="Horizontal"  Grid.Row="3" HorizontalAlignment="Center">
+                <TextBlock Text="所属项目:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0" TextAlignment="Right" Width="80"/>
+                <ComboBox  Height="28" Width="120" ItemsSource="{Binding ProjectNameList}" SelectedItem="{Binding ProjectName}" />
+            </StackPanel>
+            <StackPanel Orientation="Horizontal"  Grid.Row="4" HorizontalAlignment="Center">
+                <TextBlock Text="所属设备类型:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0" TextAlignment="Right" Width="80"/>
+                <ComboBox  Height="28" Width="120" ItemsSource="{Binding DeviceKindNameList}" SelectedItem="{Binding DeviceKindName}" />
+            </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"/>
+                    <hc:DateTimePicker ShowClearButton="True" Style="{StaticResource DateTimePickerExtend}" Height="25" Width="160" SelectedDateTime="{Binding StartTime}"/>
+                </StackPanel>
+                <StackPanel Orientation="Horizontal">
+                    <TextBlock Text="至:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
+                    <hc:DateTimePicker ShowClearButton="True" Style="{StaticResource DateTimePickerExtend}" Height="25" Width="160" SelectedDateTime="{Binding EndTime}"/>
+                </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 ResetCommand}" Style="{StaticResource NormalButtonStyle}" />
+                <Button  Content="新增" Width="80"  Margin="5,0"  Command="{Binding AddCommand}" Style="{StaticResource NormalButtonStyle}"/>
+
+                <Button Content="导出Excel" Width="80"  Margin="5,0"  Command="{Binding ExportCommand}" 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 DeviceItemList}" IsReadOnly="True" Padding="0"  >
+            <DataGrid.Columns >
+                <DataGridTextColumn Header="序号" Width="50" Binding="{Binding DeviceId}" CellStyle="{StaticResource MyDataGridCellStyle}" />
+                <DataGridTextColumn Header="设备编号" Binding="{Binding DeviceNo}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                <DataGridTextColumn Header="设备名称" Binding="{Binding DeviceName}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                <DataGridTextColumn Header="项目名称" Binding="{Binding ProjectName}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                <DataGridTextColumn Header="设备类型" Binding="{Binding DeviceKindName}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                <DataGridTextColumn Header="测试方案名称" Binding="{Binding SchemeName}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                <DataGridTextColumn Header="描述" Binding="{Binding Remark}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                <!--<DataGridTextColumn Header="创建者" Binding="{Binding CreateBy}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                <DataGridTextColumn Header="创建时间" Binding="{Binding CreateTime,StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}" CellStyle="{StaticResource MyDataGridCellStyle}"/>-->
+                <DataGridTemplateColumn Header="操作" Width="180" CellStyle="{StaticResource MyDataGridCellStyle}">
+                    <DataGridTemplateColumn.CellTemplate>
+                        <DataTemplate>
+                            <StackPanel Orientation="Horizontal">
+                                <Button  Width="auto" Background="Transparent" HorizontalContentAlignment ="Left" Foreground="Black" Height="25" BorderThickness="0"
+                                        Command="{Binding DataContext.ManualTestCommand, 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.AutoTestCommand, 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>
+
+                            </StackPanel>
+                        </DataTemplate>
+                    </DataGridTemplateColumn.CellTemplate>
+                </DataGridTemplateColumn>
+
+            </DataGrid.Columns>
+
+        </DataGrid>
+        <Grid Grid.Row="3" HorizontalAlignment="Center" VerticalAlignment="Center">
+            <wpfdev:Pagination IsLite="False"    Margin="0"  Width="auto" Height="30" HorizontalAlignment="Center"  
+                       Count="{Binding TotalCount,Mode=TwoWay}" 
+                       CountPerPage="{Binding CountPerPage,Mode=TwoWay}"
+                       Current="{Binding CurrentPage,Mode=TwoWay}"/>
+            <!--<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/DeviceTestView.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>
+    /// DeviceTestView.xaml 的交互逻辑
+    /// </summary>
+    public partial class DeviceTestView : UserControl
+    {
+        public DeviceTestView()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 265 - 234
BlankApp1/BlankApp1/Views/BusinessManageView/ManualTestView.xaml

@@ -7,6 +7,7 @@
              xmlns:hc="https://handyorg.github.io/handycontrol"
              xmlns:prism="http://prismlibrary.com/" 
              xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
+             xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
              BorderBrush="#CBCBCB" BorderThickness="1"
              Height="600" Width="1100" >
 
@@ -18,271 +19,301 @@
             <Setter Property="TextAlignment" Value="Right"/>
             <Setter Property="Margin" Value="0,0,5,0"/>
         </Style>
+        <Style TargetType="ListBoxItem">
+            <Style.Triggers>
+                <Trigger Property="ListBoxItem.IsSelected" Value="True">
+                    <Setter Property="ListBoxItem.Background" Value="red"/>
+                </Trigger>
+           
+            </Style.Triggers>
+        </Style>
+
+     
     </UserControl.Resources>
 
     <Grid>
-        <Grid.RowDefinitions>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="90"/>
+            <ColumnDefinition/>
+        </Grid.ColumnDefinitions>
+        <DockPanel Grid.Column="0" LastChildFill="True">
+            <TextBlock Text="方案名称列表:"  Style="{StaticResource NormalTextBlockStyle}" Margin="5,0,5,0" DockPanel.Dock="Top"/>
+            <ListBox ItemsSource="{Binding SchItems}" SelectedValue="{Binding SelectItem}" SelectedIndex="{Binding SelectItemIndex}" >
+               
+                <b:Interaction.Triggers>
+                    <b:EventTrigger EventName="SelectionChanged">
+                        <b:InvokeCommandAction Command="{Binding ItemChangeCommand}"/>
+                    </b:EventTrigger>
+                </b:Interaction.Triggers>
+            </ListBox>
+          
+        </DockPanel>
+        <Border Grid.Column="0"  BorderBrush="#CBCBCB" BorderThickness="1,0" />
+        <Grid Grid.Column="1">
+            <Grid.RowDefinitions>
 
-            <RowDefinition Height="50" />
-            <RowDefinition />
-            <RowDefinition />
-            <RowDefinition />
-            <RowDefinition Height="50" />
-            <RowDefinition Height="50" />
-        </Grid.RowDefinitions>
+                <RowDefinition Height="50" />
+                <RowDefinition />
+                <RowDefinition />
+                <RowDefinition />
+                <RowDefinition Height="50" />
+                <RowDefinition Height="50" />
+            </Grid.RowDefinitions>
+
+            <StackPanel Orientation="Horizontal" Grid.Row="0" Margin="10">
+                <StackPanel Orientation="Horizontal">
+                    <TextBlock Text="测试方案名称:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
+                    <TextBox  Height="28" Width="120" Text="{Binding ScheduleName}" IsReadOnly="True" />
+                </StackPanel>
+                <StackPanel Orientation="Horizontal">
+                    <TextBlock Text="设备类型:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
+                    <TextBox  Height="28" Width="120" Text="{Binding DeviceKindName}" IsReadOnly="True" />
+                </StackPanel>
+                <StackPanel Orientation="Horizontal" >
+                    <TextBlock Text="测试项类型:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
+                    <TextBox  Height="28" Width="120"  Text="{Binding SelectTest}" IsReadOnly="True"  />
+                </StackPanel>
+                <StackPanel Orientation="Horizontal">
+                    <TextBlock Text="测试项名称:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
+                    <TextBox  Height="28" Width="160"  Text="{Binding TestName}" IsReadOnly="True" />
+                </StackPanel>
 
-        <StackPanel Orientation="Horizontal" Grid.Row="0" Margin="10">
-            <StackPanel Orientation="Horizontal">
-                <TextBlock Text="测试方案名称:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
-                <TextBox  Height="28" Width="120" Text="{Binding ScheduleName}" IsReadOnly="True" />
-            </StackPanel>
-            <StackPanel Orientation="Horizontal">
-                <TextBlock Text="设备类型:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
-                <TextBox  Height="28" Width="120" Text="{Binding DeviceKindName}" IsReadOnly="True" />
-            </StackPanel>
-            <StackPanel Orientation="Horizontal" >
-                <TextBlock Text="测试项类型:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
-                <TextBox  Height="28" Width="120"  Text="{Binding SelectTest}" IsReadOnly="True"  />
-            </StackPanel>
-            <StackPanel Orientation="Horizontal">
-                <TextBlock Text="测试项名称:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
-                <TextBox  Height="28" Width="160"  Text="{Binding TestName}" IsReadOnly="True" />
             </StackPanel>
+            <Border Grid.Row="0"  BorderBrush="#CBCBCB" BorderThickness="0,1" />
+            <Grid Grid.Row="1">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="80"/>
+                    <ColumnDefinition/>
+                    <ColumnDefinition Width="1.6*"/>
+                </Grid.ColumnDefinitions>
+                <TextBlock Grid.Column="0" Text="前置项" Style="{StaticResource NormalTextBlockStyle}" TextAlignment="Center">
+                </TextBlock>
+                <Border Grid.Column="1"  BorderBrush="#CBCBCB" BorderThickness="1,0" />
+                <Grid Grid.Column="1">
+                    <Grid.RowDefinitions>
+                        <RowDefinition/>
+                        <RowDefinition/>
+                        <RowDefinition Height="2*"/>
+                    </Grid.RowDefinitions>
+                    <Grid Grid.Row="0">
+                        <StackPanel Orientation="Horizontal" >
+                            <TextBlock Text="测试项类型:"  Style="{StaticResource textBlockStyle}"/>
+                            <TextBox  Height="28" Width="150"  Text="{Binding BeforeSelectJudge}" IsReadOnly="True"  />
+                        </StackPanel>
+                    </Grid>
+                    <Grid Grid.Row="1"  >
+                        <StackPanel Orientation="Horizontal" >
+                            <TextBlock Text="明细判定逻辑:"  Style="{StaticResource textBlockStyle}"/>
+                            <TextBox  Height="28" Width="150" Text="{Binding SelectLogic}" IsReadOnly="True" />
+                        </StackPanel>
+                    </Grid>
+                    <Grid Grid.Row="2">
+                        <DockPanel LastChildFill="True" >
+                            <TextBlock Text="前置项描述:"   Style="{StaticResource textBlockStyle}" />
+                            <RichTextBox  Margin="0,5,5,5" IsReadOnly="True" >
+                                <FlowDocument>
+                                    <Paragraph>
+                                        <Run Text="{Binding BeforeDetail,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
+                                    </Paragraph>
+                                </FlowDocument>
 
-        </StackPanel>
-        <Border Grid.Row="0"  BorderBrush="#CBCBCB" BorderThickness="0,1" />
-        <Grid Grid.Row="1">
-            <Grid.ColumnDefinitions>
-                <ColumnDefinition Width="80"/>
-                <ColumnDefinition/>
-                <ColumnDefinition Width="1.6*"/>
-            </Grid.ColumnDefinitions>
-            <TextBlock Grid.Column="0" Text="前置项" Style="{StaticResource NormalTextBlockStyle}" TextAlignment="Center">
-            </TextBlock>
-            <Border Grid.Column="1"  BorderBrush="#CBCBCB" BorderThickness="1,0" />
-            <Grid Grid.Column="1">
-                <Grid.RowDefinitions>
-                    <RowDefinition/>
-                    <RowDefinition/>
-                    <RowDefinition Height="2*"/>
-                </Grid.RowDefinitions>
-                <Grid Grid.Row="0">
-                    <StackPanel Orientation="Horizontal" >
-                        <TextBlock Text="测试项类型:"  Style="{StaticResource textBlockStyle}"/>
-                        <TextBox  Height="28" Width="150"  Text="{Binding BeforeSelectJudge}" IsReadOnly="True"  />
-                    </StackPanel>
+                            </RichTextBox>
+                        </DockPanel>
+                    </Grid>
                 </Grid>
-                <Grid Grid.Row="1"  >
-                    <StackPanel Orientation="Horizontal" >
-                        <TextBlock Text="明细判定逻辑:"  Style="{StaticResource textBlockStyle}"/>
-                        <TextBox  Height="28" Width="150" Text="{Binding SelectLogic}" IsReadOnly="True" />
-                    </StackPanel>
-                </Grid>
-                <Grid Grid.Row="2">
-                    <DockPanel LastChildFill="True" >
-                        <TextBlock Text="前置项描述:"   Style="{StaticResource textBlockStyle}" />
-                        <RichTextBox  Margin="0,5,5,5" IsReadOnly="True" >
-                            <FlowDocument>
-                                <Paragraph>
-                                    <Run Text="{Binding BeforeDetail,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
-                                </Paragraph>
-                            </FlowDocument>
+                <Grid Grid.Column="2" >
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="30"/>
+                        <RowDefinition/>
+                    </Grid.RowDefinitions>
+                    <DockPanel LastChildFill="False">
+                        <TextBlock Text="前置项明细:"   Style="{StaticResource textBlockStyle}" />
 
-                        </RichTextBox>
                     </DockPanel>
-                </Grid>
-            </Grid>
-            <Grid Grid.Column="2" >
-                <Grid.RowDefinitions>
-                    <RowDefinition Height="30"/>
-                    <RowDefinition/>
-                </Grid.RowDefinitions>
-                <DockPanel LastChildFill="False">
-                    <TextBlock Text="前置项明细:"   Style="{StaticResource textBlockStyle}" />
-
-                </DockPanel>
-                <DataGrid Grid.Row="1"  ColumnWidth="*" AutoGenerateColumns="False" HeadersVisibility="All" CanUserAddRows="False"  SelectionUnit="FullRow" SelectionMode="Single"   RowHeaderWidth="0" HorizontalScrollBarVisibility="Disabled"
-                  ColumnHeaderStyle="{StaticResource ColumnHeaderStyle}" x:Name="DeviceDataGrid" RowHeaderStyle="{StaticResource RowHeaderStyle}" RowStyle="{StaticResource DataGridRowtyle}"  AlternationCount="2"
-                    ItemsSource="{Binding BeforeConList}"  IsReadOnly="True" Padding="0" >
-                    <DataGrid.Columns >
-                        <DataGridTextColumn Header="序号" Width="40" Binding="{Binding Id}" CellStyle="{StaticResource MyDataGridCellStyle}" />
-                        <DataGridTextColumn Header="PLC地址" Binding="{Binding PlcAddress}" CellStyle="{StaticResource MyDataGridCellStyle}" />
-                        <DataGridTextColumn Header="PLC变量名" Binding="{Binding PlcItem}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-                        <DataGridTextColumn Header="判定值" Binding="{Binding PlcValue}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-                        <DataGridTextColumn Header="描述" Binding="{Binding Remark}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-                        <DataGridTextColumn Header="测试时间" Width="160" Binding="{Binding TestTime,StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-                        <DataGridTextColumn Header="实际值" Binding="{Binding RealValue}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-                        <DataGridTextColumn Header="结果" Binding="{Binding TestResult}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                    <DataGrid Grid.Row="1"  ColumnWidth="*" AutoGenerateColumns="False" HeadersVisibility="All" CanUserAddRows="False"  SelectionUnit="FullRow" SelectionMode="Single"   RowHeaderWidth="0" HorizontalScrollBarVisibility="Disabled"
+            ColumnHeaderStyle="{StaticResource ColumnHeaderStyle}" x:Name="DeviceDataGrid" RowHeaderStyle="{StaticResource RowHeaderStyle}" RowStyle="{StaticResource DataGridRowtyle}"  AlternationCount="2"
+              ItemsSource="{Binding BeforeConList}"  IsReadOnly="True" Padding="0" >
+                        <DataGrid.Columns >
+                            <DataGridTextColumn Header="序号" Width="40" Binding="{Binding Id}" CellStyle="{StaticResource MyDataGridCellStyle}" />
+                            <DataGridTextColumn Header="PLC地址" Binding="{Binding PlcAddress}" CellStyle="{StaticResource MyDataGridCellStyle}" />
+                            <DataGridTextColumn Header="PLC变量名" Binding="{Binding PlcItem}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                            <DataGridTextColumn Header="判定值" Binding="{Binding PlcValue}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                            <DataGridTextColumn Header="描述" Binding="{Binding Remark}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                            <DataGridTextColumn Header="测试时间" Width="160" Binding="{Binding TestTime,StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                            <DataGridTextColumn Header="实际值" Binding="{Binding RealValue}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                            <DataGridTextColumn Header="结果" Binding="{Binding TestResult}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
 
-                    </DataGrid.Columns>
+                        </DataGrid.Columns>
 
-                </DataGrid>
+                    </DataGrid>
 
-            </Grid>
-        </Grid>
-        <Grid Grid.Row="2">
-            <Grid.ColumnDefinitions>
-                <ColumnDefinition Width="80"/>
-                <ColumnDefinition/>
-                <ColumnDefinition Width="1.6*"/>
-            </Grid.ColumnDefinitions>
-            <TextBlock Grid.Column="0" Text="输入项" Style="{StaticResource NormalTextBlockStyle}" TextAlignment="Center">
-            </TextBlock>
-            <Border Grid.Column="1"  BorderBrush="#CBCBCB" BorderThickness="1,0" />
-            <Grid Grid.Column="1">
-                <Grid.RowDefinitions>
-                    <RowDefinition/>
-                    <RowDefinition/>
-                    <RowDefinition Height="2*"/>
-                </Grid.RowDefinitions>
-                <Grid Grid.Row="0">
-                    <StackPanel Orientation="Horizontal" >
-                        <TextBlock Text="测试项类型:"  Style="{StaticResource textBlockStyle}"/>
-                        <TextBox  Height="28" Width="150"  Text="{Binding SelectInJudge}" IsReadOnly="True" />
-                    </StackPanel>
                 </Grid>
-                <Grid Grid.Row="1"  >
-                    <StackPanel Orientation="Horizontal" >
-                        <TextBlock Text="明细判定逻辑:"  Style="{StaticResource textBlockStyle}"/>
-                        <TextBox  Height="28" Width="150"  Text="{Binding InSelectLogic}" IsReadOnly="True" />
-                    </StackPanel>
-                </Grid>
-                <Grid Grid.Row="2">
-                    <DockPanel LastChildFill="True" >
-                        <TextBlock Text="输入项描述:"   Style="{StaticResource textBlockStyle}" />
-                        <RichTextBox  Margin="0,5,5,5" IsReadOnly="True"  >
-                            <FlowDocument>
-                                <Paragraph>
-                                    <Run Text="{Binding InDetail,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
-                                </Paragraph>
-                            </FlowDocument>
+            </Grid>
+            <Grid Grid.Row="2">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="80"/>
+                    <ColumnDefinition/>
+                    <ColumnDefinition Width="1.6*"/>
+                </Grid.ColumnDefinitions>
+                <TextBlock Grid.Column="0" Text="输入项" Style="{StaticResource NormalTextBlockStyle}" TextAlignment="Center">
+                </TextBlock>
+                <Border Grid.Column="1"  BorderBrush="#CBCBCB" BorderThickness="1,0" />
+                <Grid Grid.Column="1">
+                    <Grid.RowDefinitions>
+                        <RowDefinition/>
+                        <RowDefinition/>
+                        <RowDefinition Height="2*"/>
+                    </Grid.RowDefinitions>
+                    <Grid Grid.Row="0">
+                        <StackPanel Orientation="Horizontal" >
+                            <TextBlock Text="测试项类型:"  Style="{StaticResource textBlockStyle}"/>
+                            <TextBox  Height="28" Width="150"  Text="{Binding SelectInJudge}" IsReadOnly="True" />
+                        </StackPanel>
+                    </Grid>
+                    <Grid Grid.Row="1"  >
+                        <StackPanel Orientation="Horizontal" >
+                            <TextBlock Text="明细判定逻辑:"  Style="{StaticResource textBlockStyle}"/>
+                            <TextBox  Height="28" Width="150"  Text="{Binding InSelectLogic}" IsReadOnly="True" />
+                        </StackPanel>
+                    </Grid>
+                    <Grid Grid.Row="2">
+                        <DockPanel LastChildFill="True" >
+                            <TextBlock Text="输入项描述:"   Style="{StaticResource textBlockStyle}" />
+                            <RichTextBox  Margin="0,5,5,5" IsReadOnly="True"  >
+                                <FlowDocument>
+                                    <Paragraph>
+                                        <Run Text="{Binding InDetail,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
+                                    </Paragraph>
+                                </FlowDocument>
 
-                        </RichTextBox>
-                    </DockPanel>
+                            </RichTextBox>
+                        </DockPanel>
+                    </Grid>
                 </Grid>
-            </Grid>
-            <Grid Grid.Column="2" >
-                <Grid.RowDefinitions>
-                    <RowDefinition Height="30"/>
-                    <RowDefinition/>
-                </Grid.RowDefinitions>
-                <DockPanel LastChildFill="False">
-                    <TextBlock Text="输入项明细:"   Style="{StaticResource textBlockStyle}" />
+                <Grid Grid.Column="2" >
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="30"/>
+                        <RowDefinition/>
+                    </Grid.RowDefinitions>
+                    <DockPanel LastChildFill="False">
+                        <TextBlock Text="输入项明细:"   Style="{StaticResource textBlockStyle}" />
 
-                </DockPanel>
-                <DataGrid Grid.Row="1"  ColumnWidth="*" AutoGenerateColumns="False" HeadersVisibility="All" CanUserAddRows="False"  SelectionUnit="FullRow" SelectionMode="Single"   RowHeaderWidth="0" HorizontalScrollBarVisibility="Disabled"
-       ColumnHeaderStyle="{StaticResource ColumnHeaderStyle}" RowHeaderStyle="{StaticResource RowHeaderStyle}" RowStyle="{StaticResource DataGridRowtyle}"  AlternationCount="2"
-         ItemsSource="{Binding InConList}"  IsReadOnly="True" Padding="0">
-                    <DataGrid.Columns >
-                        <DataGridTextColumn Header="序号" Width="40" Binding="{Binding Id}" CellStyle="{StaticResource MyDataGridCellStyle}" />
-                        <DataGridTextColumn Header="PLC地址" Binding="{Binding PlcAddress}" CellStyle="{StaticResource MyDataGridCellStyle}" />
-                        <DataGridTextColumn Header="PLC变量名" Binding="{Binding PlcItem}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-                        <DataGridTextColumn Header="判定值" Binding="{Binding PlcValue}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-                        <DataGridTextColumn Header="描述" Binding="{Binding Remark}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-                        <DataGridTextColumn Header="测试时间" Width="160" Binding="{Binding TestTime,StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-                        <DataGridTextColumn Header="实际值" Binding="{Binding RealValue}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-                        <DataGridTextColumn Header="结果" Binding="{Binding TestResult}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                    </DockPanel>
+                    <DataGrid Grid.Row="1"  ColumnWidth="*" AutoGenerateColumns="False" HeadersVisibility="All" CanUserAddRows="False"  SelectionUnit="FullRow" SelectionMode="Single"   RowHeaderWidth="0" HorizontalScrollBarVisibility="Disabled"
+ ColumnHeaderStyle="{StaticResource ColumnHeaderStyle}" RowHeaderStyle="{StaticResource RowHeaderStyle}" RowStyle="{StaticResource DataGridRowtyle}"  AlternationCount="2"
+   ItemsSource="{Binding InConList}"  IsReadOnly="True" Padding="0">
+                        <DataGrid.Columns >
+                            <DataGridTextColumn Header="序号" Width="40" Binding="{Binding Id}" CellStyle="{StaticResource MyDataGridCellStyle}" />
+                            <DataGridTextColumn Header="PLC地址" Binding="{Binding PlcAddress}" CellStyle="{StaticResource MyDataGridCellStyle}" />
+                            <DataGridTextColumn Header="PLC变量名" Binding="{Binding PlcItem}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                            <DataGridTextColumn Header="判定值" Binding="{Binding PlcValue}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                            <DataGridTextColumn Header="描述" Binding="{Binding Remark}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                            <DataGridTextColumn Header="测试时间" Width="160" Binding="{Binding TestTime,StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                            <DataGridTextColumn Header="实际值" Binding="{Binding RealValue}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                            <DataGridTextColumn Header="结果" Binding="{Binding TestResult}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
 
-                    </DataGrid.Columns>
+                        </DataGrid.Columns>
 
-                </DataGrid>
+                    </DataGrid>
 
-            </Grid>
-        </Grid>
-        <Border Grid.Row="2"  BorderBrush="#CBCBCB" BorderThickness="0,1,0,0" />
-        <Grid Grid.Row="3">
-            <Grid.ColumnDefinitions>
-                <ColumnDefinition Width="80"/>
-                <ColumnDefinition/>
-                <ColumnDefinition Width="1.6*"/>
-            </Grid.ColumnDefinitions>
-            <TextBlock Grid.Column="0" Text="结果项" Style="{StaticResource NormalTextBlockStyle}" TextAlignment="Center">
-            </TextBlock>
-            <Border Grid.Column="1"  BorderBrush="#CBCBCB" BorderThickness="1,0" />
-            <Grid Grid.Column="1">
-                <Grid.RowDefinitions>
-                    <RowDefinition/>
-                    <RowDefinition/>
-                    <RowDefinition Height="2*"/>
-                </Grid.RowDefinitions>
-                <Grid Grid.Row="0">
-                    <StackPanel Orientation="Horizontal" >
-                        <TextBlock Text="测试项类型:"  Style="{StaticResource textBlockStyle}"/>
-                        <TextBox  Height="28" Width="150"  Text="{Binding SelectOutJudge}" IsReadOnly="True" />
-                    </StackPanel>
                 </Grid>
-                <Grid Grid.Row="1"  >
-                    <StackPanel Orientation="Horizontal" >
-                        <TextBlock Text="明细判定逻辑:"  Style="{StaticResource textBlockStyle}"/>
-                        <TextBox  Height="28" Width="150"  Text="{Binding OutSelectLogic}" IsReadOnly="True" />
-                    </StackPanel>
-                </Grid>
-                <Grid Grid.Row="2">
-                    <DockPanel LastChildFill="True" >
-                        <TextBlock Text="结果项描述:"   Style="{StaticResource textBlockStyle}" />
-                        <RichTextBox  Margin="0,5,5,5" IsReadOnly="True" >
-                            <FlowDocument>
-                                <Paragraph>
-                                    <Run Text="{Binding OutDetail,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
-                                </Paragraph>
-                            </FlowDocument>
+            </Grid>
+            <Border Grid.Row="2"  BorderBrush="#CBCBCB" BorderThickness="0,1,0,0" />
+            <Grid Grid.Row="3">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="80"/>
+                    <ColumnDefinition/>
+                    <ColumnDefinition Width="1.6*"/>
+                </Grid.ColumnDefinitions>
+                <TextBlock Grid.Column="0" Text="结果项" Style="{StaticResource NormalTextBlockStyle}" TextAlignment="Center">
+                </TextBlock>
+                <Border Grid.Column="1"  BorderBrush="#CBCBCB" BorderThickness="1,0" />
+                <Grid Grid.Column="1">
+                    <Grid.RowDefinitions>
+                        <RowDefinition/>
+                        <RowDefinition/>
+                        <RowDefinition Height="2*"/>
+                    </Grid.RowDefinitions>
+                    <Grid Grid.Row="0">
+                        <StackPanel Orientation="Horizontal" >
+                            <TextBlock Text="测试项类型:"  Style="{StaticResource textBlockStyle}"/>
+                            <TextBox  Height="28" Width="150"  Text="{Binding SelectOutJudge}" IsReadOnly="True" />
+                        </StackPanel>
+                    </Grid>
+                    <Grid Grid.Row="1"  >
+                        <StackPanel Orientation="Horizontal" >
+                            <TextBlock Text="明细判定逻辑:"  Style="{StaticResource textBlockStyle}"/>
+                            <TextBox  Height="28" Width="150"  Text="{Binding OutSelectLogic}" IsReadOnly="True" />
+                        </StackPanel>
+                    </Grid>
+                    <Grid Grid.Row="2">
+                        <DockPanel LastChildFill="True" >
+                            <TextBlock Text="结果项描述:"   Style="{StaticResource textBlockStyle}" />
+                            <RichTextBox  Margin="0,5,5,5" IsReadOnly="True" >
+                                <FlowDocument>
+                                    <Paragraph>
+                                        <Run Text="{Binding OutDetail,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
+                                    </Paragraph>
+                                </FlowDocument>
 
-                        </RichTextBox>
-                    </DockPanel>
+                            </RichTextBox>
+                        </DockPanel>
+                    </Grid>
                 </Grid>
-            </Grid>
-            <Grid Grid.Column="2" >
-                <Grid.RowDefinitions>
-                    <RowDefinition Height="30"/>
-                    <RowDefinition/>
-                </Grid.RowDefinitions>
-                <DockPanel LastChildFill="False">
-                    <TextBlock Text="输出项明细:"   Style="{StaticResource textBlockStyle}" />
-                </DockPanel>
-                <DataGrid Grid.Row="1"  ColumnWidth="*" AutoGenerateColumns="False" HeadersVisibility="All" CanUserAddRows="False"  SelectionUnit="FullRow" SelectionMode="Single"   RowHeaderWidth="0" HorizontalScrollBarVisibility="Disabled"
-       ColumnHeaderStyle="{StaticResource ColumnHeaderStyle}"  RowHeaderStyle="{StaticResource RowHeaderStyle}" RowStyle="{StaticResource DataGridRowtyle}"  AlternationCount="2"
-         ItemsSource="{Binding OutConList}"  IsReadOnly="True" Padding="0">
-                    <DataGrid.Columns >
+                <Grid Grid.Column="2" >
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="30"/>
+                        <RowDefinition/>
+                    </Grid.RowDefinitions>
+                    <DockPanel LastChildFill="False">
+                        <TextBlock Text="输出项明细:"   Style="{StaticResource textBlockStyle}" />
+                    </DockPanel>
+                    <DataGrid Grid.Row="1"  ColumnWidth="*" AutoGenerateColumns="False" HeadersVisibility="All" CanUserAddRows="False"  SelectionUnit="FullRow" SelectionMode="Single"   RowHeaderWidth="0" HorizontalScrollBarVisibility="Disabled"
+ ColumnHeaderStyle="{StaticResource ColumnHeaderStyle}"  RowHeaderStyle="{StaticResource RowHeaderStyle}" RowStyle="{StaticResource DataGridRowtyle}"  AlternationCount="2"
+   ItemsSource="{Binding OutConList}"  IsReadOnly="True" Padding="0">
+                        <DataGrid.Columns >
 
-                        <DataGridTextColumn Header="序号" Width="40" Binding="{Binding Id}" CellStyle="{StaticResource MyDataGridCellStyle}" />
-                        <DataGridTextColumn Header="PLC地址" Binding="{Binding PlcAddress}" CellStyle="{StaticResource MyDataGridCellStyle}" />
-                        <DataGridTextColumn Header="PLC变量名" Binding="{Binding PlcItem}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-                        <DataGridTextColumn Header="判定值" Binding="{Binding PlcValue}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-                        <DataGridTextColumn Header="描述" Binding="{Binding Remark}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-                        <DataGridTextColumn Header="测试时间" Width="160" Binding="{Binding TestTime,StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-                        <DataGridTextColumn Header="实际值" Binding="{Binding RealValue}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-                        <DataGridTextColumn Header="结果" Binding="{Binding TestResult}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                            <DataGridTextColumn Header="序号" Width="40" Binding="{Binding Id}" CellStyle="{StaticResource MyDataGridCellStyle}" />
+                            <DataGridTextColumn Header="PLC地址" Binding="{Binding PlcAddress}" CellStyle="{StaticResource MyDataGridCellStyle}" />
+                            <DataGridTextColumn Header="PLC变量名" Binding="{Binding PlcItem}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                            <DataGridTextColumn Header="判定值" Binding="{Binding PlcValue}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                            <DataGridTextColumn Header="描述" Binding="{Binding Remark}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                            <DataGridTextColumn Header="测试时间" Width="160" Binding="{Binding TestTime,StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                            <DataGridTextColumn Header="实际值" Binding="{Binding RealValue}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                            <DataGridTextColumn Header="结果" Binding="{Binding TestResult}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
 
-                    </DataGrid.Columns>
+                        </DataGrid.Columns>
 
-                </DataGrid>
+                    </DataGrid>
 
+                </Grid>
             </Grid>
-        </Grid>
-        <Border Grid.Row="3"  BorderBrush="#CBCBCB" BorderThickness="0,1,0,0" />
-        <Grid Grid.Row="4">
-            <hc:StepBar  StepIndex="{Binding StepIndex}" VerticalAlignment="Center" x:Name="ProSetpBar"  >
-                <hc:StepBarItem Content="开始"/>
-                <hc:StepBarItem Content="前置条件满足"/>
-                <hc:StepBarItem Content="输入明细完成"/>
-                <hc:StepBarItem Content="结果判定完成"/>
+            <Border Grid.Row="3"  BorderBrush="#CBCBCB" BorderThickness="0,1,0,0" />
+            <Grid Grid.Row="4">
+                <hc:StepBar  StepIndex="{Binding StepIndex}" VerticalAlignment="Center" x:Name="ProSetpBar"  >
+                    <hc:StepBarItem Content="开始"/>
+                    <hc:StepBarItem Content="前置条件满足"/>
+                    <hc:StepBarItem Content="输入明细完成"/>
+                    <hc:StepBarItem Content="结果判定完成"/>
 
 
-            </hc:StepBar>
-        </Grid>
-        <UniformGrid  Grid.Row="5" Columns="4">
-            <Button  Content="开始检测" Width="80" IsEnabled="{Binding StartEnalbe}" Height="30" FontSize="12"   Command="{Binding StartCommand}" Style="{DynamicResource WD.PrimaryButton}" />
-            <Button  Content="上一步" Width="80" IsEnabled="{Binding StartEnalbe}" Height="30" FontSize="12"   Command="{Binding PreviousCommand}" Style="{DynamicResource WD.PrimaryButton}" />
-            <Button  Content="下一步" Width="80" IsEnabled="{Binding StartEnalbe}" Height="30" FontSize="12"   Command="{Binding NextCommand}" Style="{DynamicResource WD.PrimaryButton}" />
-            <Button  Content="完成" Width="80"  IsEnabled="{Binding StartEnalbe}" Height="30" FontSize="12"  Command="{Binding DoneCommand}" Style="{DynamicResource WD.PrimaryButton}" />
-        </UniformGrid>
-        <Grid Grid.Row="2">
-            <StackPanel Orientation="Vertical" HorizontalAlignment="Center">
-                <hc:CircleProgressBar IsIndeterminate="True" Visibility="{Binding ProVisibility }" Value="50"  Margin="16,0,0,0" Width="100" Height="100" ArcThickness="10" Style="{StaticResource ProgressBarInfoCircle}">
+                </hc:StepBar>
+            </Grid>
+            <UniformGrid  Grid.Row="5" Columns="4">
+                <Button  Content="开始检测" Width="80" IsEnabled="{Binding StartEnalbe}" Height="30" FontSize="12"   Command="{Binding StartCommand}" Style="{DynamicResource WD.PrimaryButton}" />
+                <Button  Content="上一步" Width="80" IsEnabled="{Binding StartEnalbe}" Height="30" FontSize="12"   Command="{Binding PreviousCommand}" Style="{DynamicResource WD.PrimaryButton}" />
+                <Button  Content="下一步" Width="80" IsEnabled="{Binding StartEnalbe}" Height="30" FontSize="12"   Command="{Binding NextCommand}" Style="{DynamicResource WD.PrimaryButton}" />
+                <Button  Content="完成" Width="80"  IsEnabled="{Binding StartEnalbe}" Height="30" FontSize="12"  Command="{Binding DoneCommand}" Style="{DynamicResource WD.PrimaryButton}" />
+            </UniformGrid>
+            <Grid Grid.Row="2">
+                <StackPanel Orientation="Vertical" HorizontalAlignment="Center">
+                    <hc:CircleProgressBar IsIndeterminate="True" Visibility="{Binding ProVisibility }" Value="50"  Margin="16,0,0,0" Width="100" Height="100" ArcThickness="10" Style="{StaticResource ProgressBarInfoCircle}">
 
-                </hc:CircleProgressBar>
-                <TextBlock  Text="判定中..." Foreground="#409EFF" FontSize="30" Visibility="{Binding ProVisibility }"  Width="AUTO" Margin="0,5"/>
-            </StackPanel>
+                    </hc:CircleProgressBar>
+                    <TextBlock  Text="判定中..." Foreground="#409EFF" FontSize="30" Visibility="{Binding ProVisibility }"  Width="AUTO" Margin="0,5"/>
+                </StackPanel>
+            </Grid>
         </Grid>
+      
     </Grid>
 </UserControl>

+ 5 - 0
BlankApp1/BlankApp1/Views/BusinessManageView/ManualTestView.xaml.cs

@@ -24,5 +24,10 @@ namespace PLCTool.Views.BusinessManageView
         {
             InitializeComponent();
         }
+
+        private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+
+        }
     }
 }

+ 24 - 0
BlankApp1/Model/Dto/BasDeviceKindWithSchModel.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Model.Dto
+{
+    /// <summary>
+    /// 设备类型关联有测试方案
+    /// </summary>
+    public  class BasDeviceWithSchModel:BasDeviceDto
+    {
+        /// <summary>
+        /// 测试方案名称
+        /// </summary>
+        public string SchemeName { get; set; }
+
+        /// <summary>
+        /// 测试方案ID
+        /// </summary>
+        public long SchemeId { get; set; }
+    }
+}