Browse Source

修改测试结果

ltwork 1 year ago
parent
commit
ca3a5e05da

+ 2 - 2
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/ResultQueryViewModel.cs

@@ -137,7 +137,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         /// <param name="obj"></param>
         private void CheckDetail(object obj)
         {
-            //设备ID
+            //recordID
             long id = Convert.ToInt64(obj);
             DialogParameters parm = new DialogParameters();
             parm.Add("Key", id);
@@ -320,7 +320,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
                         //把
                         allDeviceAndSchResultList.Add(new DeviceDtlWithResultModel()
                         {
-
+                            RecordId = sch.record_id,
                             DeviceId = deviceMsg.device_id,
                             DeviceNo = deviceMsg.device_no,
                             DeviceName = deviceMsg.device_name,

+ 46 - 153
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/RetryTestViewModel.cs

@@ -25,10 +25,6 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         private readonly IDialogService _dialog;
         private readonly IEventAggregator _aggregator;
         private readonly IOptionConfigService _optionConfigService;
-        private readonly IBasicDeviceService _iBasicDeviceService;
-        private readonly IBasicDeviceKindService _iBasicDeviceKindService;
-        private readonly IBasicProjectService _iBasicProjectService;
-        private readonly IBasicPlcTestSchemeDtlService _iBasicPlcTestSchemeDtlService;
         private readonly IBasicPlcTestSchemeService _basicPlcTestSchemeService;
         private readonly IBasicPlcTestSchemeDtlService _basicPlcTestSchemeDtlService;
         private readonly IBizTestRecordService _iBizTestRecordService;
@@ -41,22 +37,18 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         private DateTime endTime = DateTime.Now;
         private int testStatus = 0;  //测试状态 
         private int testResult = 0; //测试结果
-        private long globalSchID = 0; //方案ID
+        private long schId = 0; //方案ID
         private long globalSchDetailId = 0; //测试方案明细ID
         private long globalDeviceId = 0; //设备ID
         private BizTestRecordDtlDto bizTestRecordDtlDto = new BizTestRecordDtlDto(); //测试方案明细表
         private const string TestMode = "重新测试";
 
         private int delayTime = 20;
-        public RetryTestViewModel(IDialogService dialog, IEventAggregator aggregator, IOptionConfigService optionConfigService, IBasicDeviceService iBasicDeviceService, IBasicDeviceKindService iBasicDeviceKindService, IBasicProjectService iBasicProjectService, IBasicPlcTestSchemeDtlService iBasicPlcTestSchemeDtlService, IBasicPlcTestSchemeService basicPlcTestSchemeService, IBasicPlcTestSchemeDtlService basicPlcTestSchemeDtlService, IBizTestRecordService iBizTestRecordService, IBizTestRecordDtlService iBizTestRecordDtlService, IMapper mapper, ILogger logger)
+        public RetryTestViewModel(IDialogService dialog, IEventAggregator aggregator, IOptionConfigService optionConfigService, IBasicPlcTestSchemeService basicPlcTestSchemeService, IBasicPlcTestSchemeDtlService basicPlcTestSchemeDtlService, IBizTestRecordService iBizTestRecordService, IBizTestRecordDtlService iBizTestRecordDtlService, IMapper mapper, ILogger logger)
         {
             _dialog = dialog;
             _aggregator = aggregator;
             _optionConfigService = optionConfigService;
-            _iBasicDeviceService = iBasicDeviceService;
-            _iBasicDeviceKindService = iBasicDeviceKindService;
-            _iBasicProjectService = iBasicProjectService;
-            _iBasicPlcTestSchemeDtlService = iBasicPlcTestSchemeDtlService;
             _basicPlcTestSchemeService = basicPlcTestSchemeService;
             _basicPlcTestSchemeDtlService = basicPlcTestSchemeDtlService;
             _iBizTestRecordDtlService = iBizTestRecordDtlService;
@@ -69,7 +61,6 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             NextCommand = new DelegateCommand<object>(Next);
             DoneCommand = new DelegateCommand<object>(Done);
             ItemChangeCommand = new DelegateCommand(ItemChange);
-            DgSelectChangeCommand = new DelegateCommand<object>(DgSelect);
             BeforeConList = new ObservableCollection<BasPlcItemConfigDto>();
             InConList = new ObservableCollection<BasPlcItemConfigDto>();
             OutConList = new ObservableCollection<BasPlcItemConfigDto>();
@@ -81,7 +72,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         /// </summary>
         private void ItemChange()
         {
-            var findDtlMsg = _basicPlcTestSchemeDtlService.FindAllBySchId(globalSchID)?.FirstOrDefault(X => X.item_name == SelectItem);
+            var findDtlMsg = _basicPlcTestSchemeDtlService.FindAllBySchId(schId)?.FirstOrDefault(X => X.item_name == SelectItem);
             if (findDtlMsg != null)
             {
                 int id = Convert.ToInt32(findDtlMsg.scheme_dtl_id);
@@ -118,7 +109,42 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             {
                 foreach (var item in getMsg)
                 {
-                 
+                    //测试方案号
+                    schId = item;
+                    var schDtls = _basicPlcTestSchemeDtlService.FindAllBySchId(schId).OrderBy(x => x.scheme_dtl_id).ToList(); ;
+                    //不合格项目集合
+                    List<bas_plc_test_scheme_dtl> reTrysList = new List<bas_plc_test_scheme_dtl>();
+                    //查找不合格项目
+                    foreach (var sch in schDtls)
+                    {
+
+                        long dtlId = sch.scheme_dtl_id;
+                        var dtlResult = _iBizTestRecordDtlService.FindRecordDetailBySchDtlID(dtlId)?.OrderByDescending(x => x.start_test_time)?.ToArray();
+                        if ((dtlResult != null) && (dtlResult.Length != 0))
+                        {
+                            //时间最新的结果 ,不通过
+                            if (dtlResult[0].test_result == 0)
+                            {
+                                SchItems.Add(sch.item_name);
+
+                                reTrysList.Add(sch);
+                            }
+
+
+                        }
+
+                    }
+                    //默认显示第一个测试项的信息
+                    if (reTrysList.Count != 0)
+                    {
+                        int id = Convert.ToInt32(reTrysList[0].scheme_dtl_id);
+                        globalSchDetailId = id;
+                        // 根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
+                        GetDetailInfo(id);
+                        SelectItemIndex = 0;
+                    }
+
+
                 }
 
             }
@@ -129,7 +155,6 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
                 foreach (var item in getDes)
                 {
                     globalDeviceId = item;
-                    GetSchByDeviceID(globalDeviceId);
                 }
             }
         }
@@ -146,7 +171,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             if (findresult != null)
             {
                 //根据方案id 在方案表中查找方案名 设备名
-                //globalSchID = findresult.SchemeId.Value; //方案id,方便下一步查找
+                schId = findresult.SchemeId.Value; //方案id,方便下一步查找
                 int intSchId = Convert.ToInt32(findresult.SchemeId);
 
                 var findSch = _basicPlcTestSchemeService.Find(intSchId);
@@ -230,133 +255,6 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
 
         #region 私有发方法
         /// <summary>
-        /// 获取不合格项
-        /// </summary>
-        /// <param name="schId"></param>
-        private void GetNoPass(long schId)
-        {
-            SchItems.Clear();
-                //测试方案号
-           var schDtls = _basicPlcTestSchemeDtlService.FindAllBySchId(schId).OrderBy(x => x.scheme_dtl_id).ToList(); ;
-            //不合格项目集合
-            List<bas_plc_test_scheme_dtl> reTrysList = new List<bas_plc_test_scheme_dtl>();
-            //查找不合格项目
-            foreach (var sch in schDtls)
-            {
-
-                long dtlId = sch.scheme_dtl_id;
-                var dtlResult = _iBizTestRecordDtlService.FindRecordDetailBySchDtlID(dtlId)?.OrderByDescending(x => x.start_test_time)?.ToArray();
-                if ((dtlResult != null) && (dtlResult.Length != 0))
-                {
-                    //时间最新的结果 ,不通过
-                    if (dtlResult[0].test_result == 0)
-                    {
-                        SchItems.Add(sch.item_name);
-
-                        reTrysList.Add(sch);
-                    }
-
-
-                }
-
-            }
-            //默认显示第一个测试项的信息
-            if (reTrysList.Count != 0)
-            {
-                int id = Convert.ToInt32(reTrysList[0].scheme_dtl_id);
-                globalSchDetailId = id;
-                // 根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
-                GetDetailInfo(id);
-                SelectItemIndex = 0;
-            }
-
-
-            
-        }
-        /// <summary>
-        /// datagrid变化
-        /// </summary>
-        /// <param name="obj"></param>
-        private void DgSelect(object obj)
-        {
-            DeviceDtlWithResultModel dtlMsg = (DeviceDtlWithResultModel)obj;
-            GetNoPass(dtlMsg.SchemeId);
-            globalSchID=dtlMsg.SchemeId;
-        }
-        /// <summary>
-        /// 根据设备id获取所有测试方案
-        /// </summary>
-        /// <param name="deviceId"></param>
-        private void GetSchByDeviceID(long deviceId)
-        {
-            DeviceResultItemList.Clear();
-            var deviceMsg = _iBasicDeviceService.Find(((int)deviceId));
-            if (deviceMsg != null)
-            {
-                string deviceKindName = _iBasicDeviceKindService.Find((int)deviceMsg.device_kind_id)?.devicekind_name;
-                string projectName = _iBasicProjectService.Find((int)deviceMsg.project_id)?.project_name;
-                //记录设备下的方案通过个数
-                int deviceCountResult = 0;
-                string deviceTestResult = string.Empty;
-                //查找哦记录有的方案
-
-                var recordMsgs = _iBizTestRecordService.FindRecordByDeviceId(deviceId);
-                foreach (var sch in recordMsgs)
-                {
-
-                    long schId = (long)_basicPlcTestSchemeService.FindByNameAndType(sch.scheme_name, deviceKindName)?.scheme_id;
-                    //计算测试结果
-                    string testResult = string.Empty;
-                    int countResult = 0;
-                    var records = _iBizTestRecordDtlService.FindRecordDetailByRecordID(sch.record_id);
-                    //
-                    var schDtls = _iBasicPlcTestSchemeDtlService.FindAllBySchId(schId);
-                    //循环所有测试项,有一个不合格,则整个测试方案不合格
-                    foreach (var dtl in schDtls)
-                    {
-                        //选取开始时间最大的一个数据,查看测试结果
-                        long schDtId = dtl.scheme_dtl_id;
-                        var findRecords = records.FindAll(x => x.scheme_dtl_id == schDtId).OrderByDescending(x => x.start_test_time).ToArray();
-                        if (findRecords.Length > 0)
-                        {
-                            int result = (int)findRecords[0]?.test_result.Value;
-                            if (result == 0)
-                            {
-                                testResult = "不通过";
-                                break;
-                            }
-                            else
-                            {
-                                countResult++;
-                            }
-                        }
-                    }
-                    //测试结果
-                    if (countResult == schDtls.Count)
-                    {
-                        testResult = "通过";
-                    }
-
-
-                    DeviceResultItemList.Add(new DeviceDtlWithResultModel()
-                    {
-                        RecordId = sch.record_id,
-                        DeviceId = deviceMsg.device_id,
-                        DeviceNo = deviceMsg.device_no,
-                        DeviceName = deviceMsg.device_name,
-                        DeviceKindName = deviceKindName,
-                        ProjectName = projectName,
-                        SchemeName = sch.scheme_name,
-                        SchemeId = schId,
-                        StartTestTime = sch.start_test_time.Value,
-                        TestResult = testResult
-                    });
-
-                }
-
-            }
-        }
-        /// <summary>
         /// 增加或更新测试记录
         /// </summary>
         private void AddTestRecord()
@@ -595,7 +493,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         {
             StepIndex = 0;
             ///查找方案下的所有方案明细,并排序,
-            var basicSchDtls = _basicPlcTestSchemeDtlService.FindAllBySchId(globalSchID)?.OrderBy(x => x.scheme_dtl_id);
+            var basicSchDtls = _basicPlcTestSchemeDtlService.FindAllBySchId(schId)?.OrderBy(x => x.scheme_dtl_id);
             foreach (var item in basicSchDtls)
             {
                 //在测试结果明细中查看
@@ -625,7 +523,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         {
             StepIndex = 0;
             ///查找方案下的所有方案明细,并排序,
-            var basicSchDtls = _basicPlcTestSchemeDtlService.FindAllBySchId(globalSchID)?.OrderByDescending(x => x.scheme_dtl_id);
+            var basicSchDtls = _basicPlcTestSchemeDtlService.FindAllBySchId(schId)?.OrderByDescending(x => x.scheme_dtl_id);
             foreach (var item in basicSchDtls)
             {
                 //在测试结果明细中查看
@@ -1320,7 +1218,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
 
         public DelegateCommand<object> DoneCommand { set; get; }
         public DelegateCommand ItemChangeCommand { set; get; }
-        public DelegateCommand<object> DgSelectChangeCommand { set; get; }
+
         #endregion
         #region 变量绑定
         /// <summary>
@@ -1519,8 +1417,8 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             set { startEnalbe = value; RaisePropertyChanged(); }
         }
         //所有测试项列表
-        private ObservableCollection<string> schItems = new ObservableCollection<string>();
-        public ObservableCollection<string> SchItems
+        private List<string> schItems = new List<string>();
+        public List<string> SchItems
         {
             get { return schItems; }
             set { schItems = value; RaisePropertyChanged(); }
@@ -1539,12 +1437,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             get { return selectItemIndex; }
             set { selectItemIndex = value; RaisePropertyChanged(); }
         }
-        private ObservableCollection<DeviceDtlWithResultModel> deviceResultItemList = new ObservableCollection<DeviceDtlWithResultModel>();
-        public ObservableCollection<DeviceDtlWithResultModel> DeviceResultItemList
-        {
-            get { return deviceResultItemList; }
-            set { deviceResultItemList = value; RaisePropertyChanged(); }
-        }
+
         #endregion
 
     }

+ 56 - 161
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/TestResultDetailViewModel.cs

@@ -20,22 +20,19 @@ using static System.Windows.Forms.VisualStyles.VisualStyleElement.ListView;
 namespace PLCTool.ViewModels.BusinessManageViewModel
 {
    
+
     public class TestResultDetailViewModel : BindableBase, IDialogAware
     {
         private readonly IDialogService _dialog;
         private readonly IEventAggregator _aggregator;
         private readonly IOptionConfigService _optionConfigService;
-        private readonly IBasicDeviceService _iBasicDeviceService;
-        private readonly IBasicDeviceKindService _iBasicDeviceKindService;
-        private readonly IBasicProjectService _iBasicProjectService;
-        private readonly IBasicPlcTestSchemeDtlService _iBasicPlcTestSchemeDtlService;
         private readonly IBasicPlcTestSchemeService _basicPlcTestSchemeService;
         private readonly IBasicPlcTestSchemeDtlService _basicPlcTestSchemeDtlService;
         private readonly IBizTestRecordService _iBizTestRecordService;
         private readonly IBizTestRecordDtlService _iBizTestRecordDtlService;
         private readonly IMapper _mapper;
         private readonly ILogger _logger;
-        private List<OptionConfigDto> _optionConfigs=new List<OptionConfigDto>();
+        private List<OptionConfigDto> _optionConfigs = new List<OptionConfigDto>();
         private List<BizTestRecordDtlDto> conditionRecordList = new List<BizTestRecordDtlDto>();
         private DateTime startTime = DateTime.Now;
         private DateTime endTime = DateTime.Now;
@@ -44,31 +41,28 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
 
         private string passPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Images", "Pass.png");
         private string noPassPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Images", "NoPass.png");
-        public TestResultDetailViewModel(IDialogService dialog, IEventAggregator aggregator, IBasicDeviceService iBasicDeviceService, IBasicDeviceKindService iBasicDeviceKindService, IBasicProjectService iBasicProjectService, IBasicPlcTestSchemeDtlService iBasicPlcTestSchemeDtlService, IOptionConfigService optionConfigService, IBasicPlcTestSchemeService basicPlcTestSchemeService, IBasicPlcTestSchemeDtlService basicPlcTestSchemeDtlService, IBizTestRecordService iBizTestRecordService, IBizTestRecordDtlService iBizTestRecordDtlService, IMapper mapper)
+        public TestResultDetailViewModel(IDialogService dialog, IEventAggregator aggregator, IOptionConfigService optionConfigService, IBasicPlcTestSchemeService basicPlcTestSchemeService, IBasicPlcTestSchemeDtlService basicPlcTestSchemeDtlService, IBizTestRecordService iBizTestRecordService, IBizTestRecordDtlService iBizTestRecordDtlService, IMapper mapper)
         {
             _dialog = dialog;
             _aggregator = aggregator;
-            _iBasicDeviceService = iBasicDeviceService;
-            _iBasicDeviceKindService = iBasicDeviceKindService;
-            _iBasicProjectService = iBasicProjectService;
-            _iBasicPlcTestSchemeDtlService = iBasicPlcTestSchemeDtlService;
             _optionConfigService = optionConfigService;
             _basicPlcTestSchemeService = basicPlcTestSchemeService;
             _basicPlcTestSchemeDtlService = basicPlcTestSchemeDtlService;
             _iBizTestRecordDtlService = iBizTestRecordDtlService;
             _iBizTestRecordService = iBizTestRecordService;
             _mapper = mapper;
-        
-       
+
+
             BeforeConList = new ObservableCollection<BasPlcItemConfigDto>();
             InConList = new ObservableCollection<BasPlcItemConfigDto>();
             OutConList = new ObservableCollection<BasPlcItemConfigDto>();
             ItemChangeCommand = new DelegateCommand(ItemChange);
-            DgSelectChangeCommand = new DelegateCommand<object>(DgSelect);
             GetConfigOption();
         }
 
 
+
+
         #region idialog接口实现
         public string Title { set; get; } = "测试结果查询";
 
@@ -86,8 +80,8 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
 
         public void OnDialogOpened(IDialogParameters parameters)
         {
-        
-            
+
+
             //编辑
             var getMsg = parameters.GetValues<long>("Key");
             ///值不为空,表示修改
@@ -97,148 +91,55 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
                 {
                     foreach (var item in getMsg)
                     {
-                        long deviceId = item;
-                        GetSchByDeviceID(deviceId);
-                    }
-                }
-                catch(Exception ex)
-                {
-                    _logger.LogError(ex.ToString());
-                }
-                
+                        long recordId = item;
+                        var records = _iBizTestRecordDtlService.FindRecordDetailByRecordID(recordId).OrderBy(x => x.record_dtl_id).ToList();
+                        List<biz_test_record_dtl> recordNotNulls = new List<biz_test_record_dtl>(); //测试项名称不是空的集合
+                        foreach (var record in records)
+                        {
+                            long dtlId = record.scheme_dtl_id;
+                            string itemName = _basicPlcTestSchemeDtlService.Find((int)dtlId)?.item_name;
+                            if (!String.IsNullOrEmpty(itemName))
+                            {
 
-            }
-        }
+                                //在左侧listbox中添加测试项
+                                //查找测试结果
+                                int result = (int)_iBizTestRecordDtlService.Find((int)record.record_dtl_id)?.test_result;
+
+                                SchItems.Add(new ImageAndItemModel()
+                                {
+
+                                    ImgSource = result == 1 ? passPath : noPassPath,
+                                    ItemName = itemName
+                                });
+
+                                recordNotNulls.Add(record);
+                                //在集合中添加满足条件的测试结果
+                                conditionRecordList.Add(new BizTestRecordDtlDto()
+                                {
+                                    RecordDtlId = record.record_dtl_id,
+                                    SchemeDtlId = record.scheme_dtl_id,
+                                });
+                                //默认显示第一个测试项
+                                int schDtlId = Convert.ToInt32((long)recordNotNulls?.First()?.scheme_dtl_id);
+                                int recordDtlId = Convert.ToInt32((long)recordNotNulls?.First()?.record_dtl_id);
+                                //显示
+                                DisplayDetail(schDtlId, recordDtlId);
 
-        private void DgSelect(object obj)
-        {
-            DeviceDtlWithResultModel dtlMsg = (DeviceDtlWithResultModel)obj;
-            GetDetailsByRecordId(dtlMsg.RecordId);
-        }
-        /// <summary>
-        /// 获取测试项的详细测试信息
-        /// </summary>
-        /// <param name="recordId"></param>
-        private void GetDetailsByRecordId(long recordId)
-        {
-            SchItems.Clear();
-            conditionRecordList.Clear();
-                var records = _iBizTestRecordDtlService.FindRecordDetailByRecordID(recordId).OrderBy(x => x.record_dtl_id).ToList();
-                List<biz_test_record_dtl> recordNotNulls = new List<biz_test_record_dtl>(); //测试项名称不是空的集合
-                foreach (var record in records)
-                {
-                    long dtlId = record.scheme_dtl_id;
-                    string itemName = _basicPlcTestSchemeDtlService.Find((int)dtlId)?.item_name;
-                    if (!String.IsNullOrEmpty(itemName))
-                    {
+                            }
 
-                        //在左侧listbox中添加测试项
-                        //查找测试结果
-                        int result = (int)_iBizTestRecordDtlService.Find((int)record.record_dtl_id)?.test_result;
 
-                        SchItems.Add(new ImageAndItemModel()
-                        {
+                        }
 
-                            ImgSource = result == 1 ? passPath : noPassPath,
-                            ItemName = itemName
-                        });
 
-                        recordNotNulls.Add(record);
-                        //在集合中添加满足条件的测试结果
-                        conditionRecordList.Add(new BizTestRecordDtlDto()
-                        {
-                            RecordDtlId = record.record_dtl_id,
-                            SchemeDtlId = record.scheme_dtl_id,
-                        });
-                        //默认显示第一个测试项
-                        int schDtlId = Convert.ToInt32((long)recordNotNulls?.First()?.scheme_dtl_id);
-                        int recordDtlId = Convert.ToInt32((long)recordNotNulls?.First()?.record_dtl_id);
-                        //显示
-                        DisplayDetail(schDtlId, recordDtlId);
 
                     }
-
-
                 }
-
-
-
-            
-        }
-
-
-        private void GetSchByDeviceID(long deviceId)
-        {
-            DeviceResultItemList.Clear();
-            var deviceMsg = _iBasicDeviceService.Find(((int)deviceId));
-            if (deviceMsg != null)
-            {
-                string deviceKindName = _iBasicDeviceKindService.Find((int)deviceMsg.device_kind_id)?.devicekind_name;
-                string projectName = _iBasicProjectService.Find((int)deviceMsg.project_id)?.project_name;
-                //记录设备下的方案通过个数
-                int deviceCountResult = 0;
-                string deviceTestResult = string.Empty;
-                //查找哦记录有的方案
-
-                var recordMsgs = _iBizTestRecordService.FindRecordByDeviceId(deviceId);
-                foreach (var sch in recordMsgs)
+                catch (Exception ex)
                 {
-
-                    long schId = (long)_basicPlcTestSchemeService.FindByNameAndType(sch.scheme_name, deviceKindName)?.scheme_id;
-                    //计算测试结果
-                    string testResult = string.Empty;
-                    int countResult = 0;
-                    var records = _iBizTestRecordDtlService.FindRecordDetailByRecordID(sch.record_id);
-                    //
-                    var schDtls = _iBasicPlcTestSchemeDtlService.FindAllBySchId(schId);
-                    //循环所有测试项,有一个不合格,则整个测试方案不合格
-                    foreach (var dtl in schDtls)
-                    {
-                        //选取开始时间最大的一个数据,查看测试结果
-                        long schDtId = dtl.scheme_dtl_id;
-                        var findRecords = records.FindAll(x => x.scheme_dtl_id == schDtId).OrderByDescending(x => x.start_test_time).ToArray();
-                        if (findRecords.Length > 0)
-                        {
-                            int result = (int)findRecords[0]?.test_result.Value;
-                            if (result == 0)
-                            {
-                                testResult = "不通过";
-                                break;
-                            }
-                            else
-                            {
-                                countResult++;
-                            }
-                        }
-                    }
-                    //测试结果
-                    if (countResult == schDtls.Count)
-                    {
-                        testResult = "通过";
-                    }
-
-
-                    DeviceResultItemList.Add(new DeviceDtlWithResultModel()
-                    {
-                        RecordId = sch.record_id,
-                        DeviceId = deviceMsg.device_id,
-                        DeviceNo = deviceMsg.device_no,
-                        DeviceName = deviceMsg.device_name,
-                        DeviceKindName = deviceKindName,
-                        ProjectName = projectName,
-                        SchemeName = sch.scheme_name,
-                        SchemeId = schId,
-                        StartTestTime = sch.start_test_time.Value,
-                        TestResult = testResult
-                    });
-
-
-
-
+                    _logger.LogError(ex.ToString());
+                }
 
 
-                }
-                
             }
         }
         /// <summary>
@@ -246,9 +147,9 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         /// </summary>
         /// <param name="schDtlId"></param>
         //
-        private void DisplayDetail(int schDtlId,int recordDtlId)
+        private void DisplayDetail(int schDtlId, int recordDtlId)
         {
-           
+
             //根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
             var findEntity = _basicPlcTestSchemeDtlService.Find(schDtlId);
             var findresult = _mapper.Map<bas_plc_test_scheme_dtl, BasicPlcTestSchemeDtlDto>(findEntity);
@@ -352,7 +253,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
                             TestDtlResult = "通过";
                             break;
                     }
-                    
+
                 }
 
 
@@ -372,7 +273,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         private void ItemChange()
         {
             //获取选择的recordid
-            if((SelectIndex!=-1)&&(SelectIndex < conditionRecordList.Count))
+            if (SelectIndex < conditionRecordList.Count)
             {
                 int schDtlId = (int)conditionRecordList[SelectIndex].SchemeDtlId;
                 int recordDtlId = (int)conditionRecordList[SelectIndex].RecordDtlId;
@@ -483,11 +384,11 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
 
 
         #region 命令绑定
-    
+
 
         public DelegateCommand<object> StartCommand { set; get; }
 
-    
+
 
 
         #endregion
@@ -676,8 +577,8 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         }
 
         //所有测试项列表
-        private ObservableCollection<ImageAndItemModel> schItems = new ObservableCollection<ImageAndItemModel>();
-        public ObservableCollection<ImageAndItemModel> SchItems
+        private List<ImageAndItemModel> schItems = new List<ImageAndItemModel>();
+        public List<ImageAndItemModel> SchItems
         {
             get { return schItems; }
             set { schItems = value; RaisePropertyChanged(); }
@@ -698,17 +599,10 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             get { return testDtlResult; }
             set { testDtlResult = value; RaisePropertyChanged(); }
         }
-        private ObservableCollection<DeviceDtlWithResultModel> deviceResultItemList = new ObservableCollection<DeviceDtlWithResultModel>();
-        public ObservableCollection<DeviceDtlWithResultModel> DeviceResultItemList
-        {
-            get { return deviceResultItemList; }
-            set { deviceResultItemList = value; RaisePropertyChanged(); }
-        }
+
         #endregion
         #region 命令绑定
         public DelegateCommand ItemChangeCommand { set; get; }
-        public DelegateCommand<object> DgSelectChangeCommand { set; get; }
-        
         #endregion
 
     }
@@ -719,3 +613,4 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         public string ItemName { get; set; }
     }
 }
+

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

@@ -129,7 +129,7 @@ ItemsSource="{Binding SchItemResultList}" IsReadOnly="True" Padding="0"  >
                             <DataTemplate>
                                 <UniformGrid Columns="3">
                                     <Button  Width="auto" Background="Transparent" HorizontalContentAlignment ="Left" Foreground="Black" Height="25" BorderThickness="0"
-        Command="{Binding DataContext.CheckDetailCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid}}" CommandParameter="{Binding DeviceId}"  Cursor="Hand" Margin="0,0,5,0" >
+        Command="{Binding DataContext.CheckDetailCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid}}" CommandParameter="{Binding RecordId}"  Cursor="Hand" Margin="0,0,5,0" >
 
                                         <StackPanel Orientation="Horizontal">
                                             <TextBlock  Text="查看详情" VerticalAlignment="Center" Foreground="Blue"/>

+ 259 - 290
BlankApp1/BlankApp1/Views/BusinessManageView/RetryTestView.xaml

@@ -4,12 +4,12 @@
              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: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="800" Width="1100" >
+             Height="600" Width="1050" >
 
     <UserControl.Resources>
         <Style TargetType="TextBlock" x:Key="textBlockStyle">
@@ -32,320 +32,289 @@
     </UserControl.Resources>
 
     <Grid>
-        <Grid.RowDefinitions>
-            <RowDefinition Height="200"/>
-            <RowDefinition/>
-        </Grid.RowDefinitions>
-        <Grid Grid.Row="0">
-            <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 DeviceResultItemList}" IsReadOnly="True" Padding="0"  >
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="auto"/>
+            <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 DataContext.DgSelectChangeCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid}}" 
-                                                CommandParameter="{Binding Path=SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"/>
+                        <b:InvokeCommandAction Command="{Binding ItemChangeCommand}"/>
                     </b:EventTrigger>
                 </b:Interaction.Triggers>
-                <DataGrid.Columns >
-
-                    <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="测试时间" Width="150" Binding="{Binding StartTestTime,StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-                    <DataGridTextColumn Header="测试结果" Binding="{Binding TestResult}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-
-                </DataGrid.Columns>
-
-            </DataGrid>
-        </Grid>
-        <Grid Grid.Row="1">
- 
-            <Grid.ColumnDefinitions>
-                <ColumnDefinition Width="auto"/>
-                <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>
-
-                <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>
-
+            </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>
+
+            <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>
 
-                                </RichTextBox>
-                            </DockPanel>
-                        </Grid>
+            </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.Column="2" >
-                        <Grid.RowDefinitions>
-                            <RowDefinition Height="30"/>
-                            <RowDefinition/>
-                        </Grid.RowDefinitions>
-                        <DockPanel LastChildFill="False">
-                            <TextBlock Text="前置项明细:"   Style="{StaticResource textBlockStyle}" />
-
+                    <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>
+
+                            </RichTextBox>
                         </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.Columns>
-
-                        </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.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.Columns>
+
+                    </DataGrid>
 
-                                </RichTextBox>
-                            </DockPanel>
-                        </Grid>
+                </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.Column="2" >
-                        <Grid.RowDefinitions>
-                            <RowDefinition Height="30"/>
-                            <RowDefinition/>
-                        </Grid.RowDefinitions>
-                        <DockPanel LastChildFill="False">
-                            <TextBlock Text="输入项明细:"   Style="{StaticResource textBlockStyle}" />
-
+                    <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>
-                        <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>
-
                     </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 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}"/>
+
+                        </DataGrid.Columns>
+
+                    </DataGrid>
 
-                                </RichTextBox>
-                            </DockPanel>
-                        </Grid>
+                </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.Column="2" >
-                        <Grid.RowDefinitions>
-                            <RowDefinition Height="30"/>
-                            <RowDefinition/>
-                        </Grid.RowDefinitions>
-                        <DockPanel LastChildFill="False">
-                            <TextBlock Text="输出项明细:"   Style="{StaticResource textBlockStyle}" />
+                    <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>
-                        <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}"/>
-
-                            </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:StepBarItem Content="结果判定完成"/>
+                <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}"/>
 
-                    </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}">
+                        </DataGrid.Columns>
+
+                    </DataGrid>
 
-                        </hc:CircleProgressBar>
-                        <TextBlock  Text="判定中..." Foreground="#409EFF" FontSize="30" Visibility="{Binding ProVisibility }"  Width="AUTO" Margin="0,5"/>
-                    </StackPanel>
                 </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="结果判定完成"/>
+
 
+                </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>
+            </Grid>
         </Grid>
+
     </Grid>
+
 </UserControl>

+ 17 - 45
BlankApp1/BlankApp1/Views/BusinessManageView/TestResultDetailView.xaml

@@ -11,9 +11,9 @@
              Height="600" Width="1050" >
 
     <UserControl.Resources>
-        
+
         <cvt:StringToImageSourceConverter x:Key="MyImageConverter"/>
-     
+
         <Style TargetType="TextBlock" x:Key="textBlockStyle">
             <Setter Property="Width" Value="80"/>
             <Setter Property="FontSize" Value="12"/>
@@ -24,37 +24,7 @@
     </UserControl.Resources>
 
     <Grid>
-        <Grid.RowDefinitions>
-            <RowDefinition Height="200"/>
-            <RowDefinition/>
-        </Grid.RowDefinitions>
-        <Grid Grid.Row="0">
-            <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 DeviceResultItemList}" IsReadOnly="True" Padding="0"  >
-                <b:Interaction.Triggers>
-                    <b:EventTrigger EventName="SelectionChanged">
-                        <b:InvokeCommandAction  Command="{Binding DataContext.DgSelectChangeCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid}}" 
-                                                CommandParameter="{Binding Path=SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"/>
-                    </b:EventTrigger>
-                </b:Interaction.Triggers>
-                <DataGrid.Columns >
-                   
-                    <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="测试时间" Width="150" Binding="{Binding StartTestTime,StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-                    <DataGridTextColumn Header="测试结果" Binding="{Binding TestResult}" CellStyle="{StaticResource MyDataGridCellStyle}"/>
-                 
-                </DataGrid.Columns>
-
-            </DataGrid>
-        </Grid>
-        <Grid Grid.Row="1">
-   
+
         <Grid.ColumnDefinitions>
             <ColumnDefinition Width="auto"/>
             <ColumnDefinition/>
@@ -62,16 +32,19 @@ ItemsSource="{Binding DeviceResultItemList}" IsReadOnly="True" Padding="0"  >
         <DockPanel Grid.Column="0" LastChildFill="True">
             <TextBlock Text="测试项列表:"  Style="{StaticResource NormalTextBlockStyle}" Margin="5,0,5,0" DockPanel.Dock="Top"/>
             <ListBox ItemsSource="{Binding SchItems}"  SelectedIndex="{Binding SelectIndex}" >
-                    <ListBox.ItemTemplate>
-                        <DataTemplate>
-                            <StackPanel Orientation="Horizontal">
-                                <Image Source="{Binding Path=ImgSource,Converter={StaticResource MyImageConverter}}" Stretch="Fill" Margin="0,0,5,0"/>
-                                <TextBlock Text="{Binding ItemName}"/>
-                            </StackPanel>
-
-                        </DataTemplate>
-                    </ListBox.ItemTemplate>
-                    <b:Interaction.Triggers>
+                <ListBox.ItemTemplate>
+                    <DataTemplate>
+                        <StackPanel Orientation="Horizontal">
+                            <Image Source="{Binding Path=ImgSource,Converter={StaticResource MyImageConverter}}" Stretch="Fill" Margin="0,0,5,0"/>
+                            <TextBlock Text="{Binding ItemName}"/>
+                        </StackPanel>
+
+                    </DataTemplate>
+                </ListBox.ItemTemplate>
+
+
+
+                <b:Interaction.Triggers>
                     <b:EventTrigger EventName="SelectionChanged">
                         <b:InvokeCommandAction Command="{Binding ItemChangeCommand}"/>
                     </b:EventTrigger>
@@ -107,7 +80,7 @@ ItemsSource="{Binding DeviceResultItemList}" IsReadOnly="True" Padding="0"  >
                     <TextBlock Text="测试结果:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
                     <TextBlock Text="{Binding TestDtlResult}"  Style="{StaticResource NormalTextBlockStyle}" FontSize="25"/>
                 </StackPanel>
-                
+
             </StackPanel>
             <Border Grid.Row="0"  BorderBrush="#CBCBCB" BorderThickness="0,1" />
             <Grid Grid.Row="1">
@@ -323,7 +296,6 @@ ItemsSource="{Binding DeviceResultItemList}" IsReadOnly="True" Padding="0"  >
         </Grid>
 
 
-        </Grid>
 
     </Grid>
 </UserControl>