user_lt 1 год назад
Родитель
Сommit
48783da2e5

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

@@ -65,6 +65,7 @@ namespace BlankApp1
             containerRegistry.RegisterDialog<AddOrEditSchView, AddOrEditSchViewModel>();
             containerRegistry.RegisterDialog<AddDetailView, AddDetailViewModel>();
             containerRegistry.RegisterDialog<AutoTestView, AutoTestViewModel>();
+            containerRegistry.RegisterDialog<ManualTestView, ManualTestViewModel>();
         }
 
         private IMapper GetMapper(IContainerProvider container)

+ 17 - 24
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/AutoTestViewModel.cs

@@ -40,15 +40,13 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             _mapper = mapper;
             //_logger = logger;
             CloseCommand = new DelegateCommand(Close);
-            
-            ResetCommand = new DelegateCommand<string>(ResetMethod);
-            
-           
+            StartCommand = new DelegateCommand<Object>(Start);
             BeforeConList = new ObservableCollection<BasPlcItemConfigDto>();
             InConList = new ObservableCollection<BasPlcItemConfigDto>();
             OutConList = new ObservableCollection<BasPlcItemConfigDto>();
             GetConfigOption();
         }
+      
 
         #region idialog接口实现
         public string Title { set; get; } = "自动测试";
@@ -160,10 +158,18 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         }
 
         #endregion
-       
+        #region 私有方法
+
+    
+        /// <summary>
+        /// 开始检测
+        /// </summary>
+        /// <param name="obj"></param>
+        private void Start(object obj)
+        {
+
+        }
 
-      
-        
 
         /// <summary>
         /// 获取配置
@@ -200,13 +206,6 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
 
         }
 
-
-      
-
-        /// <summary>
-        /// 初始化
-        /// </summary>
-
         /// <summary>
         /// 关闭按钮
         /// </summary>
@@ -318,24 +317,18 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             string prefixJsonStr = JsonConvert.SerializeObject(prefixJsonModel);
             return prefixJsonStr;
         }
-        /// <summary>
-        /// 重置
-        /// </summary>
-        /// <param name="obj"></param>
-        private void ResetMethod(string obj)
-        {
 
-        }
-       
 
 
+        #endregion
+
 
         #region 命令绑定
         public DelegateCommand CloseCommand { set; get; }
         
-        public DelegateCommand<string> ResetCommand { set; get; }
-  
+        public DelegateCommand<object> StartCommand { set; get; }
 
+        
         #endregion
         #region 变量绑定
         /// <summary>

+ 549 - 0
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/ManualTestViewModel.cs

@@ -0,0 +1,549 @@
+using AutoMapper;
+using BizService;
+using Model.Dto;
+using Model.Entities;
+using Newtonsoft.Json;
+using NLog;
+using PLCTool.Common;
+using Prism.Commands;
+using Prism.Events;
+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 ManualTestViewModel : BindableBase, IDialogAware
+    {
+        private readonly IDialogService _dialog;
+        private readonly IEventAggregator _aggregator;
+        private readonly IOptionConfigService _optionConfigService;
+        private readonly IBasicPlcTestSchemeService _basicPlcTestSchemeService;
+        private readonly IBasicPlcTestSchemeDtlService _basicPlcTestSchemeDtlService;
+        private readonly IMapper _mapper;
+        private readonly ILogger _logger;
+        private List<OptionConfigDto> _optionConfigs;
+        public ManualTestViewModel(IDialogService dialog, IEventAggregator aggregator, IOptionConfigService optionConfigService, IBasicPlcTestSchemeService basicPlcTestSchemeService, IBasicPlcTestSchemeDtlService basicPlcTestSchemeDtlService, IMapper mapper)
+        {
+            _dialog = dialog;
+            _aggregator = aggregator;
+            _optionConfigService = optionConfigService;
+            _basicPlcTestSchemeService = basicPlcTestSchemeService;
+            _basicPlcTestSchemeDtlService = basicPlcTestSchemeDtlService;
+            _mapper = mapper;
+            //_logger = logger;
+            CloseCommand = new DelegateCommand(Close);
+            StartCommand = new DelegateCommand<object>(Start);
+            PreviousCommand = new DelegateCommand<object>(Previous);
+            NextCommand = new DelegateCommand<object>(Next);
+            DoneCommand = new DelegateCommand<object>(Done);
+            BeforeConList = new ObservableCollection<BasPlcItemConfigDto>();
+            InConList = new ObservableCollection<BasPlcItemConfigDto>();
+            OutConList = new ObservableCollection<BasPlcItemConfigDto>();
+            GetConfigOption();
+        }
+
+    
+
+
+        #region idialog接口实现
+        public string Title { set; get; } = "手动测试";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            //编辑
+            var getMsg = parameters.GetValues<long>("Key");
+            ///值不为空,表示修改
+            if (getMsg != null)
+            {
+                foreach (var item in getMsg)
+                {
+
+                    int id = Convert.ToInt32(item);
+                    //根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
+                    var findEntity = _basicPlcTestSchemeDtlService.Find(id);
+                    var findresult = _mapper.Map<bas_plc_test_scheme_dtl, BasicPlcTestSchemeDtlDto>(findEntity);
+                    if (findresult != null)
+                    {
+                        //根据方案id 在方案表中查找方案名 设备名
+                        int schID = Convert.ToInt32(findresult.SchemeId);
+                        var findSch = _basicPlcTestSchemeService.Find(schID);
+                        if (findSch != null)
+                        {
+                            ScheduleName = findSch.scheme_name;
+                            DeviceName = findSch.device_name;
+
+                        }
+                        TestName = findresult.ItemName;
+                        SelectTest = findresult.ItemType;
+                        //前置项解析
+                        string preconStr = findresult.Precondition.ToString();
+                        if (!string.IsNullOrEmpty(preconStr))
+                        {
+                            JsonModel preconditionModel = JsonConvert.DeserializeObject<JsonModel>(preconStr);
+                            BeforeSelectJudge = preconditionModel.ItemType;
+                            SelectLogic = preconditionModel.ItemLogical;
+                            BeforeDetail = preconditionModel.Description;
+                            BeforeConList.Clear();
+                            foreach (var detail in preconditionModel.DetailInfo)
+                            {
+                                BasPlcItemConfigDto basPlcItemConfigDto = new BasPlcItemConfigDto();
+                                basPlcItemConfigDto.PlcItem = detail.PlcItem;
+                                basPlcItemConfigDto.PlcAddress = detail.PlcAddress;
+                                basPlcItemConfigDto.PlcValue = detail.PlcValue;
+                                basPlcItemConfigDto.Remark = detail.Remark;
+                                beforeConList.Add(basPlcItemConfigDto);
+                            }
+                        }
+
+                        //输入项解析
+                        string inStr = findresult.Action.ToString();
+                        if (!string.IsNullOrEmpty(inStr))
+                        {
+                            JsonModel inModel = JsonConvert.DeserializeObject<JsonModel>(inStr);
+                            SelectInJudge = inModel.ItemType;
+                            InSelectLogic = inModel.ItemLogical;
+                            InDetail = inModel.Description;
+                            InConList.Clear();
+                            foreach (var detail in inModel.DetailInfo)
+                            {
+                                BasPlcItemConfigDto basPlcItemConfigDto = new BasPlcItemConfigDto();
+                                basPlcItemConfigDto.PlcItem = detail.PlcItem;
+                                basPlcItemConfigDto.PlcAddress = detail.PlcAddress;
+                                basPlcItemConfigDto.PlcValue = detail.PlcValue;
+                                basPlcItemConfigDto.Remark = detail.Remark;
+                                InConList.Add(basPlcItemConfigDto);
+                            }
+                        }
+
+                        //输出项解析
+                        string outStr = findresult.JudgementResult.ToString();
+                        if (!string.IsNullOrEmpty(outStr))
+                        {
+                            JsonModel outModel = JsonConvert.DeserializeObject<JsonModel>(outStr);
+                            SelectOutJudge = outModel.ItemType;
+                            OutSelectLogic = outModel.ItemLogical;
+                            OutDetail = outModel.Description;
+                            OutConList.Clear();
+                            foreach (var detail in outModel.DetailInfo)
+                            {
+                                BasPlcItemConfigDto basPlcItemConfigDto = new BasPlcItemConfigDto();
+                                basPlcItemConfigDto.PlcItem = detail.PlcItem;
+                                basPlcItemConfigDto.PlcAddress = detail.PlcAddress;
+                                basPlcItemConfigDto.PlcValue = detail.PlcValue;
+                                basPlcItemConfigDto.Remark = detail.Remark;
+                                OutConList.Add(basPlcItemConfigDto);
+                            }
+                        }
+
+                    }
+
+                }
+
+            }
+        }
+
+        #endregion
+
+        #region 私有发方法
+
+
+
+        private void Done(object obj)
+        {
+
+        }
+
+        private void Next(object obj)
+        {
+
+        }
+
+        private void Previous(object obj)
+        {
+
+        }
+        /// <summary>
+        /// 开始检测
+        /// </summary>
+        /// <param name="obj"></param>
+        private void Start(object obj)
+        {
+
+        }
+
+        /// <summary>
+        /// 获取配置
+        /// </summary>
+        private void GetConfigOption()
+        {
+            var configList = _optionConfigService.QueryList();
+            _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);
+            }
+
+            //测试项类型
+            var judges = _optionConfigs.FindAll(x => x.TypeID == 2);
+            foreach (var judge in judges)
+            {
+                BeforeJudgeKinds.Add(judge.ContentOption);
+                InJudgeKinds.Add(judge.ContentOption);
+                OutJudgeKinds.Add(judge.ContentOption);
+            }
+
+            //判定逻辑
+            var logics = _optionConfigs.FindAll(x => x.TypeID == 3);
+            foreach (var logic in logics)
+            {
+                JudgeLogicKinds.Add(logic.ContentOption);
+                InJudgeLogicKinds.Add(logic.ContentOption);
+                OutJudgeLogicKinds.Add(logic.ContentOption);
+
+            }
+
+        }
+
+
+
+
+
+
+        /// <summary>
+        /// 关闭按钮
+        /// </summary>
+        private void Close()
+        {
+            RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
+
+
+        /// <summary>
+        /// 方案明细添加到数据库
+        /// </summary>
+        private void AddOrEditDetailsToDb(long scheduleId)
+        {
+            //前置项json转化
+            string prefixJsonStr = ModelToJsonToStr(BeforeSelectJudge, SelectLogic, BeforeDetail, BeforeConList);
+            //输入项json转化
+            string inJsonStr = ModelToJsonToStr(SelectInJudge, InSelectLogic, InDetail, InConList);
+            //输出项json转化
+            string outJsonStr = ModelToJsonToStr(SelectOutJudge, OutSelectLogic, OutDetail, OutConList);
+            //添加达到测试主表
+            //增加测试方案
+            BasicPlcTestSchemeDtlDto schDtlDto = new BasicPlcTestSchemeDtlDto();
+            schDtlDto.SchemeId = scheduleId;
+            schDtlDto.ItemName = TestName;
+
+            schDtlDto.ItemType = SelectTest;
+            schDtlDto.Precondition = prefixJsonStr;
+            schDtlDto.PreconditionDescribe = BeforeDetail;
+            schDtlDto.Action = inJsonStr;
+            schDtlDto.ActionDescribe = InDetail;
+            schDtlDto.JudgementResult = outJsonStr;
+            schDtlDto.JudgementResultDescribe = OutDetail;
+            schDtlDto.CreateBy = Appsession.UserName;
+            schDtlDto.CreateTime = DateTime.Now;
+            schDtlDto.UpdateTime = DateTime.Now;
+            schDtlDto.UpdateBy = Appsession.UserName;
+            bas_plc_test_scheme_dtl schDtlEntity = _mapper.Map<BasicPlcTestSchemeDtlDto, bas_plc_test_scheme_dtl>(schDtlDto);
+            if (Title == "新增方案")
+            {
+
+                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
+            {
+                if (Title == "编辑方案")
+                {
+                    //修改 必须给主键SchemeDtlId值
+                    var schDtl = _basicPlcTestSchemeDtlService.FindSchDtlIdBySchIdAndItem(scheduleId, TestName);
+                    if (schDtl != null)
+                    {
+                        schDtlDto.SchemeDtlId = schDtl.scheme_dtl_id;
+                        bas_plc_test_scheme_dtl schDtlEntityEdit = _mapper.Map<BasicPlcTestSchemeDtlDto, bas_plc_test_scheme_dtl>(schDtlDto);
+                        bool isSucc = _basicPlcTestSchemeDtlService.Edit(schDtlEntityEdit);
+                        if (isSucc)
+                        {
+                            _logger.Info($"更新方案成功。方案名{ScheduleName},测试项{TestName}");
+                            MessageBoxResult boxResult = MessageBox.Show("更新成功", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
+                        }
+                        else
+                        {
+                            MessageBoxResult boxResult = MessageBox.Show("更新失败", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
+                            return;
+                        }
+
+                    }
+
+                }
+            }
+
+        }
+        /// <summary>
+        /// mode转json
+        /// </summary>
+        /// <param name="itemType"></param>
+        /// <param name="itemLogical"></param>
+        /// <param name="description"></param>
+        /// <param name="conList"></param>
+        /// <returns></returns>
+
+        private string ModelToJsonToStr(string itemType, string itemLogical, string description, ObservableCollection<BasPlcItemConfigDto> conList)
+        {
+            JsonModel prefixJsonModel = new JsonModel();
+            prefixJsonModel.ItemType = itemType;
+            prefixJsonModel.ItemLogical = itemLogical;
+            prefixJsonModel.Description = description;
+            prefixJsonModel.DetailInfo = new List<DetailPLC>();
+            foreach (var item in conList)
+            {
+                DetailPLC plcItem = new DetailPLC();
+                plcItem.PlcItem = item.PlcItem;
+                plcItem.PlcAddress = item.PlcAddress;
+                plcItem.PlcValue = item.PlcValue;
+                plcItem.Remark = item.Remark;
+                prefixJsonModel.DetailInfo.Add(plcItem);
+
+            }
+            string prefixJsonStr = JsonConvert.SerializeObject(prefixJsonModel);
+            return prefixJsonStr;
+        }
+
+
+        #endregion
+
+
+        #region 命令绑定
+        public DelegateCommand CloseCommand { set; get; }
+
+        public DelegateCommand<object> StartCommand { set; get; }
+        public DelegateCommand<object> PreviousCommand { set; get; }
+
+        public DelegateCommand<object> NextCommand { set; get; }
+
+        public DelegateCommand<object> DoneCommand { 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
+        {
+            get { return testKinds; }
+            set { testKinds = value; RaisePropertyChanged(); }
+        }
+        /// <summary>
+        /// 
+        /// </summary>
+        private string selectTest;
+        public string SelectTest
+        {
+            get { return selectTest; }
+            set { selectTest = value; RaisePropertyChanged(); }
+        }
+        /// <summary>
+        /// 判定类型(前置项)
+        /// </summary>
+        private List<string> beforeJudgeKinds = new List<string>();
+        public List<string> BeforeJudgeKinds
+        {
+            get { return beforeJudgeKinds; }
+            set { beforeJudgeKinds = value; RaisePropertyChanged(); }
+        }
+        private string beforeSelectJudge;
+        public string BeforeSelectJudge
+        {
+            get { return beforeSelectJudge; }
+            set { beforeSelectJudge = value; RaisePropertyChanged(); }
+        }
+        /// <summary>
+        /// 逻辑判断
+        /// </summary>
+        private List<string> judgeLogicKinds = new List<string>();
+        public List<string> JudgeLogicKinds
+        {
+            get { return judgeLogicKinds; }
+            set { judgeLogicKinds = value; RaisePropertyChanged(); }
+        }
+        private string selectLogic;
+        public string SelectLogic
+        {
+            get { return selectLogic; }
+            set { selectLogic = value; RaisePropertyChanged(); }
+        }
+        private string beforeDetail;
+        public string BeforeDetail
+        {
+            get { return beforeDetail; }
+            set { beforeDetail = value; RaisePropertyChanged(); }
+        }
+
+        private ObservableCollection<BasPlcItemConfigDto> beforeConList;
+        public ObservableCollection<BasPlcItemConfigDto> BeforeConList
+        {
+            get { return beforeConList; }
+            set { beforeConList = value; RaisePropertyChanged(); }
+        }
+
+        /// <summary>
+        /// 判定类型(输入项)
+        /// </summary>
+        private List<string> inJudgeKinds = new List<string>();
+        public List<string> InJudgeKinds
+        {
+            get { return inJudgeKinds; }
+            set { inJudgeKinds = value; RaisePropertyChanged(); }
+        }
+        private string selectInJudge;
+        public string SelectInJudge
+        {
+            get { return selectInJudge; }
+            set { selectInJudge = value; RaisePropertyChanged(); }
+        }
+        /// <summary>
+        /// 逻辑判断
+        /// </summary>
+        private List<string> inJudgeLogicKinds = new List<string>();
+        public List<string> InJudgeLogicKinds
+        {
+            get { return inJudgeLogicKinds; }
+            set { inJudgeLogicKinds = value; RaisePropertyChanged(); }
+        }
+        private string inSelectLogic;
+        public string InSelectLogic
+        {
+            get { return inSelectLogic; }
+            set { inSelectLogic = value; RaisePropertyChanged(); }
+        }
+        private string inDetail;
+        public string InDetail
+        {
+            get { return inDetail; }
+            set { inDetail = value; RaisePropertyChanged(); }
+        }
+
+        private ObservableCollection<BasPlcItemConfigDto> inConList;
+        public ObservableCollection<BasPlcItemConfigDto> InConList
+        {
+            get { return inConList; }
+            set { inConList = value; RaisePropertyChanged(); }
+        }
+        /// <summary>
+        /// 判定类型(结果项)
+        /// </summary>
+        private List<string> outJudgeKinds = new List<string>();
+        public List<string> OutJudgeKinds
+        {
+            get { return outJudgeKinds; }
+            set { outJudgeKinds = value; RaisePropertyChanged(); }
+        }
+        private string selectOutJudge;
+        public string SelectOutJudge
+        {
+            get { return selectOutJudge; }
+            set { selectOutJudge = value; RaisePropertyChanged(); }
+        }
+        /// <summary>
+        /// 逻辑判断
+        /// </summary>
+        private List<string> outJudgeLogicKinds = new List<string>();
+        public List<string> OutJudgeLogicKinds
+        {
+            get { return outJudgeLogicKinds; }
+            set { outJudgeLogicKinds = value; RaisePropertyChanged(); }
+        }
+        private string outSelectLogic;
+        public string OutSelectLogic
+        {
+            get { return outSelectLogic; }
+            set { outSelectLogic = value; RaisePropertyChanged(); }
+        }
+
+        private string outDetail;
+        public string OutDetail
+        {
+            get { return outDetail; }
+            set { outDetail = value; RaisePropertyChanged(); }
+        }
+        private ObservableCollection<BasPlcItemConfigDto> outConList;
+        public ObservableCollection<BasPlcItemConfigDto> OutConList
+        {
+            get { return outConList; }
+            set { outConList = value; RaisePropertyChanged(); }
+        }
+
+        private int stepIndex = 0;
+        public int StepIndex
+        {
+            get { return stepIndex; }
+            set { stepIndex = value; RaisePropertyChanged(); }
+        }
+        #endregion
+
+    }
+}

+ 1 - 1
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/TestOperViewModel.cs

@@ -60,7 +60,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         private void ManualTest(object obj)
         {
             //弹出详情对话框
-            _dialog.ShowDialog("AutoTestView", async callback =>
+            _dialog.ShowDialog("ManualTestView", async callback =>
             {
                 if (callback.Result == ButtonResult.OK)
                 {

+ 5 - 1
BlankApp1/BlankApp1/Views/BusinessManageView/AutoTestView.xaml

@@ -26,7 +26,8 @@
             <RowDefinition />
             <RowDefinition />
             <RowDefinition />
-            <RowDefinition Height="60" />
+            <RowDefinition Height="50" />
+            <RowDefinition Height="50" />
         </Grid.RowDefinitions>
 
         <StackPanel Orientation="Horizontal" Grid.Row="0" Margin="10">
@@ -326,5 +327,8 @@
 
             </hc:StepBar>
         </Grid>
+        <Grid Grid.Row="5">
+            <Button  Content="开始检测" Width="80"    Command="{Binding StartCommand}" Style="{StaticResource NormalButtonStyle}" />
+        </Grid>
     </Grid>
 </UserControl>

+ 337 - 0
BlankApp1/BlankApp1/Views/BusinessManageView/ManualTestView.xaml

@@ -0,0 +1,337 @@
+<UserControl x:Class="PLCTool.Views.BusinessManageView.ManualTestView"
+             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:prism="http://prismlibrary.com/" 
+             BorderBrush="#CBCBCB" BorderThickness="1"
+             Height="600" Width="1000" >
+
+    <UserControl.Resources>
+        <Style TargetType="TextBlock" x:Key="textBlockStyle">
+            <Setter Property="Width" Value="80"/>
+            <Setter Property="FontSize" Value="12"/>
+            <Setter Property="VerticalAlignment" Value="Center"/>
+            <Setter Property="TextAlignment" Value="Right"/>
+            <Setter Property="Margin" Value="0,0,5,0"/>
+        </Style>
+    </UserControl.Resources>
+
+    <Grid>
+        <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}" />
+            </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" >
+                <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="160"  Text="{Binding TestName}"/>
+            </StackPanel>
+
+        </StackPanel>
+        <Border Grid.Row="0"  BorderBrush="#CBCBCB" BorderThickness="0,1" />
+        <Grid Grid.Row="1">
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="80"/>
+                <ColumnDefinition/>
+                <ColumnDefinition Width="1.3*"/>
+            </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}"/>
+                        <ComboBox  Height="28" Width="150" ItemsSource="{Binding BeforeJudgeKinds}" SelectedItem="{Binding BeforeSelectJudge}" />
+                    </StackPanel>
+                </Grid>
+                <Grid Grid.Row="1"  >
+                    <StackPanel Orientation="Horizontal" >
+                        <TextBlock Text="明细判定逻辑:"  Style="{StaticResource textBlockStyle}"/>
+                        <ComboBox  Height="28" Width="150" ItemsSource="{Binding JudgeLogicKinds}" SelectedItem="{Binding SelectLogic}"/>
+                    </StackPanel>
+                </Grid>
+                <Grid Grid.Row="2">
+                    <DockPanel LastChildFill="True" >
+                        <TextBlock Text="前置项描述:"   Style="{StaticResource textBlockStyle}" />
+                        <RichTextBox  Margin="0,5,5,5" >
+                            <FlowDocument>
+                                <Paragraph>
+                                    <Run Text="{Binding BeforeDetail,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
+                                </Paragraph>
+                            </FlowDocument>
+
+                        </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" >
+                    <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 RealValue}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                        <DataGridTemplateColumn Header="操作" Width="160"  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.EditBeforeCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid}}" CommandParameter="{Binding Id}" 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.DeleteBeforeCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid}}" CommandParameter="{Binding Id}"   Cursor="Hand" >
+
+                                            <StackPanel Orientation="Horizontal">
+                                                <TextBlock  Text="删除" VerticalAlignment="Center" Foreground="Blue"/>
+                                            </StackPanel>
+                                        </Button>
+
+                                    </UniformGrid>
+                                </DataTemplate>
+                            </DataGridTemplateColumn.CellTemplate>
+                        </DataGridTemplateColumn>
+
+                    </DataGrid.Columns>
+
+                </DataGrid>
+
+            </Grid>
+        </Grid>
+        <Grid Grid.Row="2">
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="80"/>
+                <ColumnDefinition/>
+                <ColumnDefinition Width="1.3*"/>
+            </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}"/>
+                        <ComboBox  Height="28" Width="150" ItemsSource="{Binding InJudgeKinds}" SelectedItem="{Binding SelectInJudge}" />
+                    </StackPanel>
+                </Grid>
+                <Grid Grid.Row="1"  >
+                    <StackPanel Orientation="Horizontal" >
+                        <TextBlock Text="明细判定逻辑:"  Style="{StaticResource textBlockStyle}"/>
+                        <ComboBox  Height="28" Width="150" ItemsSource="{Binding InJudgeLogicKinds}" SelectedItem="{Binding InSelectLogic}"/>
+                    </StackPanel>
+                </Grid>
+                <Grid Grid.Row="2">
+                    <DockPanel LastChildFill="True" >
+                        <TextBlock Text="输入项描述:"   Style="{StaticResource textBlockStyle}" />
+                        <RichTextBox  Margin="0,5,5,5" >
+                            <FlowDocument>
+                                <Paragraph>
+                                    <Run Text="{Binding InDetail,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
+                                </Paragraph>
+                            </FlowDocument>
+
+                        </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}" RowHeaderStyle="{StaticResource RowHeaderStyle}" RowStyle="{StaticResource DataGridRowtyle}"  AlternationCount="2"
+         ItemsSource="{Binding InConList}"  IsReadOnly="True" >
+                    <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 RealValue}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                        <DataGridTemplateColumn Header="操作" Width="160"  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.EditInCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid}}" CommandParameter="{Binding Id}" 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.DeleteInCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid}}" CommandParameter="{Binding Id}"   Cursor="Hand" >
+
+                                            <StackPanel Orientation="Horizontal">
+                                                <TextBlock  Text="删除" VerticalAlignment="Center" Foreground="Blue"/>
+                                            </StackPanel>
+                                        </Button>
+
+                                    </UniformGrid>
+                                </DataTemplate>
+                            </DataGridTemplateColumn.CellTemplate>
+                        </DataGridTemplateColumn>
+
+                    </DataGrid.Columns>
+
+                </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.3*"/>
+            </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}"/>
+                        <ComboBox  Height="28" Width="150" ItemsSource="{Binding OutJudgeKinds}" SelectedItem="{Binding SelectOutJudge}" />
+                    </StackPanel>
+                </Grid>
+                <Grid Grid.Row="1"  >
+                    <StackPanel Orientation="Horizontal" >
+                        <TextBlock Text="明细判定逻辑:"  Style="{StaticResource textBlockStyle}"/>
+                        <ComboBox  Height="28" Width="150" ItemsSource="{Binding OutJudgeLogicKinds}" SelectedItem="{Binding OutSelectLogic}"/>
+                    </StackPanel>
+                </Grid>
+                <Grid Grid.Row="2">
+                    <DockPanel LastChildFill="True" >
+                        <TextBlock Text="结果项描述:"   Style="{StaticResource textBlockStyle}" />
+                        <RichTextBox  Margin="0,5,5,5" >
+                            <FlowDocument>
+                                <Paragraph>
+                                    <Run Text="{Binding OutDetail,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
+                                </Paragraph>
+                            </FlowDocument>
+
+                        </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}"  RowHeaderStyle="{StaticResource RowHeaderStyle}" RowStyle="{StaticResource DataGridRowtyle}"  AlternationCount="2"
+         ItemsSource="{Binding OutConList}"  IsReadOnly="True" >
+                    <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 RealValue}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
+                        <DataGridTemplateColumn Header="操作" Width="160"  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.EditOutCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid}}" CommandParameter="{Binding Id}" 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.DeleteOutCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid}}" CommandParameter="{Binding Id}"   Cursor="Hand" >
+
+                                            <StackPanel Orientation="Horizontal">
+                                                <TextBlock  Text="删除" VerticalAlignment="Center" Foreground="Blue"/>
+                                            </StackPanel>
+                                        </Button>
+
+                                    </UniformGrid>
+                                </DataTemplate>
+                            </DataGridTemplateColumn.CellTemplate>
+                        </DataGridTemplateColumn>
+
+                    </DataGrid.Columns>
+
+                </DataGrid>
+
+            </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:StepBar>
+        </Grid>
+        <UniformGrid  Grid.Row="5" Columns="4">
+            <Button  Content="开始检测" Width="80"    Command="{Binding StartCommand}" Style="{StaticResource NormalButtonStyle}" />
+            <Button  Content="上一步" Width="80"    Command="{Binding PriviousCommand}" Style="{StaticResource NormalButtonStyle}" />
+            <Button  Content="下一步" Width="80"    Command="{Binding NextCommand}" Style="{StaticResource NormalButtonStyle}" />
+            <Button  Content="完成" Width="80"    Command="{Binding DoneCommand}" Style="{StaticResource NormalButtonStyle}" />
+        </UniformGrid>
+    </Grid>
+</UserControl>

+ 28 - 0
BlankApp1/BlankApp1/Views/BusinessManageView/ManualTestView.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>
+    /// ManualTestView.xaml 的交互逻辑
+    /// </summary>
+    public partial class ManualTestView : UserControl
+    {
+        public ManualTestView()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 1 - 1
BlankApp1/BlankApp1/Views/BusinessManageView/TestOperView.xaml

@@ -69,7 +69,7 @@
                 <DataGridTextColumn Header="测试项名称" Binding="{Binding ItemName}" 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="操作"  CellStyle="{StaticResource MyDataGridCellStyle}">
+                <DataGridTemplateColumn Header="操作" Width="160"  CellStyle="{StaticResource MyDataGridCellStyle}">
                     <DataGridTemplateColumn.CellTemplate>
                         <DataTemplate>
                             <UniformGrid Columns="2">