ltwork пре 1 година
родитељ
комит
88d12348ff

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

@@ -74,6 +74,8 @@ namespace BlankApp1
 
             containerRegistry.RegisterForNavigation<DeviceTestCardView, DeviceTestCardViewModel>();
             containerRegistry.RegisterForNavigation<ProjectTestView, ProjectTestViewModel>();
+            containerRegistry.RegisterForNavigation<DeviceResultCardView, DeviceResultCardViewModel>();
+            containerRegistry.RegisterForNavigation<ProjectTestResultView, ProjectTestResultViewModel>();
             containerRegistry.RegisterDialog<AddDetailView, AddDetailViewModel>();
             containerRegistry.RegisterDialog<AutoTestView, AutoTestViewModel>();
             containerRegistry.RegisterDialog<ManualTestView, ManualTestViewModel>();

+ 56 - 0
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/DeviceResultCardViewModel.cs

@@ -0,0 +1,56 @@
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+using System.Windows;
+
+namespace PLCTool.ViewModels.BusinessManageViewModel
+{
+    public class DeviceResultCardViewModel : BindableBase
+    {
+        private readonly IRegionManager _regionManager;
+        public DeviceResultCardViewModel(IRegionManager regionManager)
+        {
+            this._regionManager = regionManager;
+            DoubleClickCommand = new DelegateCommand<object>(DoubleClickCard);
+        }
+
+        private void DoubleClickCard(object obj)
+        {
+            if (obj == null)
+            {
+                MessageBox.Show("参数为空!", "确认", MessageBoxButton.OK, MessageBoxImage.Warning);
+
+                return;
+            }
+            try
+            {
+
+
+                //参数转换
+                TextBlock txtbl = obj as TextBlock;
+                string projectName = txtbl.Text;
+                NavigationParameters parm = new NavigationParameters();
+                parm.Add("Key", projectName);
+
+                _regionManager.Regions["ContentRegion"].RequestNavigate("ResultQueryView", async callback =>
+                {
+
+
+                }, parm);
+            }
+            catch
+            {
+
+            }
+        }
+        #region 命令绑定
+        public DelegateCommand<object> DoubleClickCommand { get; set; }
+        #endregion
+    }
+}

+ 49 - 12
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/DeviceTestViewModel.cs

@@ -24,6 +24,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
 
     public class DeviceTestViewModel : BindableBase, INavigationAware
     {
+        private readonly IRegionManager _regionManager;
         private readonly IBasicDeviceService _iBasicDeviceService;
         private readonly IBasicDeviceKindService _iBasicDeviceKindService;
         private readonly IBasicProjectService _iBasicProjectService;
@@ -35,8 +36,9 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         private List<BasDeviceWithSchModel> allDeviceList = new List<BasDeviceWithSchModel>();//所有设备
         private List<BasDeviceWithSchModel> conditionDevices = new List<BasDeviceWithSchModel>();//符合条件的方案
         private string selectProjectName;
-        public DeviceTestViewModel(IBasicDeviceService iBasicDeviceService, IBasicDeviceKindService iBasicDeviceKindService, IBasicProjectService iBasicProjectService, IBasicPlcTestSchemeService basicPlcTestSchemeService, IMapper mapper, IDialogService dialog, ILogger logger)
+        public DeviceTestViewModel(IRegionManager regionManager,IBasicDeviceService iBasicDeviceService, IBasicDeviceKindService iBasicDeviceKindService, IBasicProjectService iBasicProjectService, IBasicPlcTestSchemeService basicPlcTestSchemeService, IMapper mapper, IDialogService dialog, ILogger logger)
         {
+            _regionManager = regionManager;
             _iBasicDeviceService = iBasicDeviceService;
             _iBasicDeviceKindService = iBasicDeviceKindService;
             _iBasicProjectService = iBasicProjectService;
@@ -52,14 +54,11 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             //手动  自动测试
             AutoTestCommand = new DelegateCommand<object>(AutoDest);
             ManualTestCommand = new DelegateCommand<object>(ManualTest);
-         
+            DgSelectChangeCommand = new DelegateCommand<object>(DgSelect);
+            GoBackCommand =new DelegateCommand<object>(GoBack);
         }
 
-
-
-
-
-
+       
 
 
         #region 私有方法
@@ -96,7 +95,29 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             StartTime = string.Empty;
             EndTime = string.Empty;
         }
-
+        /// <summary>
+        /// 单元格查看
+        /// </summary>
+        /// <param name="obj"></param>
+        private void DgSelect(object obj)
+        {
+            BasDeviceWithSchModel dtlSch = (BasDeviceWithSchModel)obj;
+            if(dtlSch != null)
+            {
+                SchItemList = new ObservableCollection<BasDeviceWithSchModel>(allDeviceAndSchList.FindAll(x => ((x.ProjectName == dtlSch.ProjectName) && (x.DeviceName == dtlSch.DeviceName))));
+            }
+          
+        }
+        /// <summary>
+        /// 返回界面
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <exception cref="NotImplementedException"></exception>
+        private void GoBack(object obj)
+        {
+            _regionManager.Regions["ContentRegion"].RequestNavigate("ProjectTestView");
+         
+        }
         /// <summary>
         /// 自动测试
         /// </summary>
@@ -253,6 +274,8 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
                         ProjectName = projectName,
                         SchemeName = sch.SchemeName,
                         SchemeId = sch.SchemeId,
+                        CreateBy=sch.CreateBy,
+                        CreateTime = item.CreateTime,
                     });
                  
                 }
@@ -266,7 +289,9 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
                         DeviceName = item.DeviceName,
                         DeviceKindName = deviceKindName,
                         ProjectName = projectName,
-                
+                        CreateBy = item.CreateBy,
+                        CreateTime = item.CreateTime,
+
                     });
                     conditionDevices.Add(new BasDeviceWithSchModel()
                     {
@@ -275,7 +300,9 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
                         DeviceName = item.DeviceName,
                         DeviceKindName = deviceKindName,
                         ProjectName = projectName,
-                        
+                        CreateBy = item.CreateBy,
+                        CreateTime = item.CreateTime,
+
                     });
                 }
 
@@ -348,6 +375,10 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         public DelegateCommand<object> AutoTestCommand { set; get; }
 
         public DelegateCommand<object> ManualTestCommand { set; get; }
+        public DelegateCommand<object> DgSelectChangeCommand { set; get; }
+        public DelegateCommand<object> GoBackCommand { set; get; }
+        
+
         #endregion
 
         #region 数据绑定
@@ -357,7 +388,13 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             get { return deviceItemList; }
             set { deviceItemList = value; RaisePropertyChanged(); }
         }
-
+        private ObservableCollection<BasDeviceWithSchModel> schItemList = new ObservableCollection<BasDeviceWithSchModel>();
+        public ObservableCollection<BasDeviceWithSchModel> SchItemList
+        {
+            get { return schItemList; }
+            set { schItemList = value; RaisePropertyChanged(); }
+        }
+        
         /// <summary>
         /// 设备编号
         /// </summary>
@@ -409,7 +446,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             get { return deviceKindNameList; }
             set { deviceKindNameList = value; RaisePropertyChanged(); }
         }
-
+        
         /// <summary>
         /// 开始时间
         /// </summary>

+ 272 - 0
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/ProjectTestResultViewModel.cs

@@ -0,0 +1,272 @@
+using AutoMapper;
+using BizService;
+using Microsoft.Extensions.Logging;
+using Model.Dto;
+using Model.Entities;
+using PLCTool.Views.BusinessManageView;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PLCTool.ViewModels.BusinessManageViewModel
+{
+    class ProjectTestResultViewModel : BindableBase
+    {
+        private readonly IBasicDeviceService _iBasicDeviceService;
+        private readonly IBasicDeviceKindService _iBasicDeviceKindService;
+        private readonly IBasicProjectService _iBasicProjectService;
+        private readonly IBasicPlcTestSchemeService _basicPlcTestSchemeService;
+        private readonly IMapper _mapper;
+        private readonly IDialogService _dialog;
+        private readonly ILogger _logger;
+        private readonly IBizTestRecordService _iBizTestRecordService;
+        private readonly IBasicPlcTestSchemeDtlService _iBasicPlcTestSchemeDtlService;
+        private readonly IBizTestRecordDtlService _iBizTestRecordDtlService;
+        private ObservableCollection<DeviceResultCardView> allProjectResultPicList = new ObservableCollection<DeviceResultCardView>();
+        public ProjectTestResultViewModel(IBasicDeviceService iBasicDeviceService, IBasicDeviceKindService iBasicDeviceKindService, IBasicProjectService iBasicProjectService, IBasicPlcTestSchemeService basicPlcTestSchemeService, IBizTestRecordService iBizTestRecordService, IBasicPlcTestSchemeDtlService iBasicPlcTestSchemeDtlService, IBizTestRecordDtlService iBizTestRecordDtlService,IMapper mapper, IDialogService dialog, ILogger logger)
+        {
+            _iBasicDeviceService = iBasicDeviceService;
+            _iBasicDeviceKindService = iBasicDeviceKindService;
+            _iBasicProjectService = iBasicProjectService;
+            _basicPlcTestSchemeService = basicPlcTestSchemeService;
+            _iBizTestRecordService = iBizTestRecordService;
+            _iBasicPlcTestSchemeDtlService= iBasicPlcTestSchemeDtlService;
+            _iBizTestRecordDtlService = iBizTestRecordDtlService;
+            _mapper = mapper;
+            _dialog = dialog;
+            _logger = logger;
+            OnLoadCommand = new DelegateCommand(OnLoad);
+            QueryCommand = new DelegateCommand<object>(Query);
+            ResetCommand = new DelegateCommand<object>(Reset);
+        }
+        #region 私有方法
+        private void Reset(object obj)
+        {
+            ProjectNo = string.Empty;
+            ProjectLeader = string.Empty;
+            ProjectName = string.Empty;
+            StartTime = string.Empty;
+            EndTime = string.Empty;
+        }
+
+        private void Query(object obj)
+        {
+            var conditions = (from a in allProjectResultPicList
+                              where (string.IsNullOrEmpty(ProjectNo) ? true : (a.txtProjectNo.Text == ProjectNo))
+                              && (string.IsNullOrEmpty(ProjectName) ? true : (a.txtName.Text == ProjectName))
+                                && (string.IsNullOrEmpty(ProjectLeader) ? true : (a.txtProjectLeader.Text == ProjectLeader))
+                              select a).ToList();
+            ProjectResultPicList = new ObservableCollection<DeviceResultCardView>(conditions);
+        }
+
+        private void OnLoad()
+        {
+            GetProjectConfig();
+        }
+
+        /// <summary>
+        /// 获取所有项目
+        /// </summary>
+        private void GetProjectConfig()
+        {
+            allProjectResultPicList.Clear();
+            ProjectResultPicList.Clear();
+            List<DeviceDtlWithResultModel> allDeviceList = new List<DeviceDtlWithResultModel>();//所有方案
+            //所有测试方案
+            var schlist = _basicPlcTestSchemeService.QueryList();
+            var schDtoList = _mapper.Map<List<bas_plc_test_scheme>, List<BasicPlcTestSchemeDto>>(schlist);
+            //测试记录中的所有设备
+            var deviceIds = _iBizTestRecordService.QueryList().Select(X => X.device_id).Distinct();
+            foreach (var deviceId in deviceIds)
+            {
+                List<DateTime> startDateTimes = new List<DateTime>();
+                var deviceMsg = _iBasicDeviceService.Find(((int)deviceId));
+                if (deviceMsg != null)
+                {
+                    string deviceKind = _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, deviceKind)?.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 = "通过";
+                        }
+
+                        //计算这个设备是否通过
+                        if (testResult == "通过")
+                        {
+                            deviceCountResult++;
+                        }
+                        //加入时间集合
+                        startDateTimes.Add(sch.start_test_time.Value);
+                    }
+                    //计算这个设备是否所有的方案都通过
+                    if ((deviceCountResult != 0) && (deviceCountResult == recordMsgs.Count))
+                    {
+                        deviceTestResult = "通过";
+                    }
+                    else
+                    {
+                        deviceTestResult = "不通过";
+                    }
+                    //这里不添加方案名称
+                    allDeviceList.Add(new DeviceDtlWithResultModel()
+                    {
+
+                        DeviceId = deviceMsg.device_id,
+                        DeviceNo = deviceMsg.device_no,
+                        DeviceName = deviceMsg.device_name,
+                        DeviceKindName = deviceKind,
+                        ProjectName = projectName,
+                        StartTestTime = startDateTimes.Min(),//取最小时间
+                        TestResult = deviceTestResult
+                    }); 
+            
+                }
+
+            }
+
+            //所有新项目
+            List<string> projectNames = allDeviceList.Select(x => x.ProjectName).Distinct().ToList();
+            foreach (var project in projectNames)
+            {
+                DeviceResultCardView deviceCard = new DeviceResultCardView();
+                deviceCard.txtName.Text = project;
+                deviceCard.txtProjectNo.Text = _iBasicProjectService.FindByProjectName(project)?.project_no;
+                deviceCard.txtProjectLeader.Text = _iBasicProjectService.FindByProjectName(project)?.project_leader;
+                //赋值
+                allProjectResultPicList.Add(deviceCard);
+            }
+            foreach (var item in allProjectResultPicList)
+            {
+                ProjectResultPicList.Add(item);
+            }
+            //计算行数
+            if (projectNames.Count % 4 == 0)
+            {
+                RowsCount = projectNames.Count / 4;
+            }
+            else
+            {
+                RowsCount = projectNames.Count / 4 + 1;
+            }
+            if (RowsCount < 2)
+            {
+                RowsCount = 2;
+            }
+
+
+
+        }
+        #endregion
+
+        #region 命令绑定
+        public DelegateCommand OnLoadCommand { set; get; }
+        public DelegateCommand<object> QueryCommand { set; get; }
+
+
+
+
+        public DelegateCommand<object> ResetCommand { set; get; }
+
+        #endregion
+
+        #region 数据绑定
+        /// <summary>
+        /// 设备卡片
+        /// </summary>
+
+        private ObservableCollection<DeviceResultCardView> projectResultPicList = new ObservableCollection<DeviceResultCardView>();
+        public ObservableCollection<DeviceResultCardView> ProjectResultPicList
+        {
+            get { return projectResultPicList; }
+            set { projectResultPicList = value; RaisePropertyChanged(); }
+        }
+
+        private int rowsCount = 2;
+        public int RowsCount
+        {
+            get { return rowsCount; }
+            set { rowsCount = value; RaisePropertyChanged(); }
+        }
+
+        private string projectNo;
+        public string ProjectNo
+        {
+            get { return projectNo; }
+            set { projectNo = value; RaisePropertyChanged(); }
+        }
+
+        private string projectName;
+        public string ProjectName
+        {
+            get { return projectName; }
+            set { projectName = value; RaisePropertyChanged(); }
+        }
+        private string projectLeader;
+        public string ProjectLeader
+        {
+            get { return projectLeader; }
+            set { projectLeader = value; RaisePropertyChanged(); }
+        }
+
+        /// <summary>
+        /// 开始时间
+        /// </summary>
+        private string startTime = DateTime.Now.AddDays(-1).ToString();
+        public string StartTime
+        {
+            get { return startTime; }
+            set { startTime = value; RaisePropertyChanged(); }
+        }
+        private string endTime = DateTime.Now.ToString();
+        public string EndTime
+        {
+            get { return endTime; }
+            set { endTime = value; RaisePropertyChanged(); }
+        }
+
+        #endregion
+    }
+}

+ 81 - 8
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/ProjectTestViewModel.cs

@@ -27,8 +27,8 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         private readonly IMapper _mapper;
         private readonly IDialogService _dialog;
         private readonly ILogger _logger;
-        private List<BasDeviceWithSchModel> allDeviceList = new List<BasDeviceWithSchModel>();//所有方案
-
+        
+        private ObservableCollection<DeviceTestCardView> allProjectePicList = new ObservableCollection<DeviceTestCardView>();
         public ProjectTestViewModel(IBasicDeviceService iBasicDeviceService, IBasicDeviceKindService iBasicDeviceKindService, IBasicProjectService iBasicProjectService, IBasicPlcTestSchemeService basicPlcTestSchemeService, IMapper mapper, IDialogService dialog, ILogger logger)
         {
             _iBasicDeviceService = iBasicDeviceService;
@@ -39,6 +39,27 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             _dialog = dialog;
             _logger = logger;
             OnLoadCommand = new DelegateCommand(OnLoad);
+            QueryCommand = new DelegateCommand<object>(Query);
+            ResetCommand = new DelegateCommand<object>(Reset);
+        }
+        #region 私有方法
+        private void Reset(object obj)
+        {
+            ProjectNo = string.Empty;
+            ProjectLeader = string.Empty;
+            ProjectName = string.Empty;
+            StartTime = string.Empty;
+            EndTime = string.Empty;
+        }
+
+        private void Query(object obj)
+        {
+            var conditions = (from a in allProjectePicList
+                              where (string.IsNullOrEmpty(ProjectNo) ? true : (a.txtProjectNo.Text == ProjectNo))
+                              && (string.IsNullOrEmpty(ProjectName) ? true : (a.txtName.Text == ProjectName))
+                                && (string.IsNullOrEmpty(ProjectLeader) ? true : (a.txtPProjectLeader.Text == ProjectLeader))
+                              select a).ToList();
+            ProjectePicList = new ObservableCollection<DeviceTestCardView>(conditions);
         }
 
         private void OnLoad()
@@ -51,8 +72,10 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
         /// </summary>
         private void GetProjectConfig()
         {
-            allDeviceList.Clear();
-     
+          
+            ProjectePicList.Clear();
+            allProjectePicList.Clear();
+            List<BasDeviceWithSchModel> allDeviceList = new List<BasDeviceWithSchModel>();//所有方案
             var devicelist = _iBasicDeviceService.QueryList();
             var allDeviceKinds = _mapper.Map<List<bas_device>, List<BasDeviceDto>>(devicelist);
             //所有测试方案
@@ -78,12 +101,12 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
                         SchemeName = sch.SchemeName,
                         SchemeId = sch.SchemeId,
                     });
-               
+
                 }
-            
+
             }
             //所有新项目
-            List<string> projectNames = allDeviceList.Select(x => x.ProjectName).ToList();
+            List<string> projectNames = allDeviceList.Select(x => x.ProjectName).Distinct().ToList();
             foreach (var project in projectNames)
             {
                 DeviceTestCardView deviceCard = new DeviceTestCardView();
@@ -91,7 +114,11 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
                 deviceCard.txtProjectNo.Text = _iBasicProjectService.FindByProjectName(project)?.project_no;
                 deviceCard.txtPProjectLeader.Text = _iBasicProjectService.FindByProjectName(project)?.project_leader;
                 //赋值
-                ProjectePicList.Add(deviceCard);
+                allProjectePicList.Add(deviceCard);
+            }
+            foreach (var item in allProjectePicList)
+            {
+                ProjectePicList.Add(item);
             }
             //计算行数
             if (projectNames.Count % 4 == 0)
@@ -110,8 +137,17 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
 
 
         }
+        #endregion
+
         #region 命令绑定
         public DelegateCommand OnLoadCommand { set; get; }
+        public DelegateCommand<object> QueryCommand { set; get; }
+
+
+
+
+        public DelegateCommand<object> ResetCommand { set; get; }
+       
         #endregion
 
         #region 数据绑定
@@ -132,6 +168,43 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
             get { return rowsCount; }
             set { rowsCount = value; RaisePropertyChanged(); }
         }
+
+        private string projectNo;
+        public string ProjectNo
+        {
+            get { return projectNo; }
+            set { projectNo = value; RaisePropertyChanged(); }
+        }
+
+        private string projectName;
+        public string ProjectName
+        {
+            get { return projectName; }
+            set { projectName = value; RaisePropertyChanged(); }
+        }
+        private string projectLeader;
+        public string ProjectLeader
+        {
+            get { return projectLeader; }
+            set { projectLeader = value; RaisePropertyChanged(); }
+        }
+
+        /// <summary>
+        /// 开始时间
+        /// </summary>
+        private string startTime = DateTime.Now.AddDays(-1).ToString();
+        public string StartTime
+        {
+            get { return startTime; }
+            set { startTime = value; RaisePropertyChanged(); }
+        }
+        private string endTime = DateTime.Now.ToString();
+        public string EndTime
+        {
+            get { return endTime; }
+            set { endTime = value; RaisePropertyChanged(); }
+        }
+
         #endregion
     }
 }

+ 1 - 28
BlankApp1/BlankApp1/ViewModels/BusinessManageViewModel/ResultQueryViewModel.cs

@@ -277,34 +277,7 @@ namespace PLCTool.ViewModels.BusinessManageViewModel
                         {
                             testResult = "通过";
                         }
-
-                        
-                        //allDeviceList.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
-                        //}); 
-                        //conditionDevices.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
-                        //});
+                    
                         //计算这个设备是否通过
                         if(testResult == "通过")
                         {

+ 62 - 0
BlankApp1/BlankApp1/Views/BusinessManageView/DeviceResultCardView.xaml

@@ -0,0 +1,62 @@
+<UserControl x:Class="PLCTool.Views.BusinessManageView.DeviceResultCardView"
+             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:prism="http://prismlibrary.com/"
+              prism:ViewModelLocator.AutoWireViewModel="True"
+             Height="240" Width="280">
+    <Grid>
+
+        <Grid.InputBindings>
+            <MouseBinding MouseAction="LeftDoubleClick" Command="{Binding DoubleClickCommand}" CommandParameter="{Binding ElementName=txtName}">
+            </MouseBinding>
+        </Grid.InputBindings>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="0.6*"/>
+            <RowDefinition/>
+        </Grid.RowDefinitions>
+        <Border BorderBrush="#CBCBCB" Grid.Row="1" BorderThickness="1"/>
+        <Grid Grid.Row="0" Background="#409EFF" >
+            <TextBlock  x:Name="txtName" Text="{Binding ProjectName}" Foreground="White" FontSize="30" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+        </Grid>
+
+        <Grid Grid.Row="1">
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="2*"/>
+                <ColumnDefinition Width="3*"/>
+            </Grid.ColumnDefinitions>
+            <Grid.RowDefinitions>
+                <RowDefinition/>
+                <RowDefinition/>
+                <RowDefinition/>
+                <RowDefinition/>
+                <RowDefinition/>
+                <RowDefinition/>
+            </Grid.RowDefinitions>
+            <Grid.Resources>
+                <Style TargetType="Label">
+                    <Setter Property="FontSize" Value="20"/>
+                    <Setter Property="Width" Value="auto"/>
+                    <Setter Property="HorizontalAlignment" Value="Right"/>
+                    <Setter Property="VerticalAlignment" Value="Center"/>
+                    <Setter Property="Margin" Value="10 0 0 0"/>
+                </Style>
+            </Grid.Resources>
+            <TextBlock Margin="0,10,0,0" Style="{StaticResource NormalTextBlockStyle}"  Grid.Row="0" Text="项目代号:" TextAlignment="Right"/>
+            <TextBlock Margin="0,10,0,0" Style="{StaticResource NormalTextBlockStyle}" Grid.Row="1" Text="负责人:" TextAlignment="Right"/>
+            <TextBlock Margin="0,10,0,0" Style="{StaticResource NormalTextBlockStyle}" Grid.Row="2" Text="设备数量:" TextAlignment="Right"/>
+            <TextBlock Margin="0,10,0,0" Style="{StaticResource NormalTextBlockStyle}" Grid.Row="3" Text="已测设备数量:" TextAlignment="Right"/>
+            <TextBlock Margin="0,10,0,0" Style="{StaticResource NormalTextBlockStyle}" Grid.Row="4" Text="通过设备数量:" TextAlignment="Right"/>
+            <TextBlock Margin="0,10,0,0" Style="{StaticResource NormalTextBlockStyle}" Grid.Row="5" Text="不通过设备数量:" TextAlignment="Right"/>
+            <TextBlock Margin="0,10,0,0" Style="{StaticResource NormalTextBlockStyle}" x:Name="txtProjectNo"  Grid.Row="0" Grid.Column="1" />
+            <TextBlock Margin="0,10,0,0" Style="{StaticResource NormalTextBlockStyle}" x:Name="txtProjectLeader" Grid.Row="1" Grid.Column="1"  HorizontalAlignment="Left"/>
+            <TextBlock Margin="0,10,0,0" Style="{StaticResource NormalTextBlockStyle}" x:Name="txtDeviceCount" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left"/>
+            <TextBlock Margin="0,10,0,0" Style="{StaticResource NormalTextBlockStyle}" x:Name="txtTestCount" Grid.Row="3" Grid.Column="1"  HorizontalAlignment="Left"/>
+            <TextBlock Margin="0,10,0,0" Style="{StaticResource NormalTextBlockStyle}" x:Name="txtPassCount" Grid.Row="4" Grid.Column="1" HorizontalAlignment="Left"/>
+            <TextBlock Margin="0,10,0,0" Style="{StaticResource NormalTextBlockStyle}" x:Name="txtNoPassCount" Grid.Row="5" Grid.Column="1"  HorizontalAlignment="Left"/>
+        </Grid>
+
+    </Grid>
+</UserControl>

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

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

@@ -70,11 +70,18 @@
                 <Button  Content="新增" Width="80"  Margin="5,0"  Command="{Binding AddCommand}" Style="{StaticResource NormalButtonStyle}"/>
 
                 <Button Content="导出Excel" Width="80"  Margin="5,0"  Command="{Binding ExportCommand}" Style="{StaticResource NormalButtonStyle}" />
+                <Button Content="返回" Width="80"  Margin="5,0"  Command="{Binding GoBackCommand}" Style="{StaticResource NormalButtonStyle}" />
             </StackPanel>
         </Grid>
         <DataGrid  Grid.Row="2"  ColumnWidth="*" AutoGenerateColumns="False" HeadersVisibility="All" CanUserAddRows="False"  SelectionUnit="FullRow" SelectionMode="Single"   RowHeaderWidth="0"
                   ColumnHeaderStyle="{StaticResource ColumnHeaderStyle}"  RowHeaderStyle="{StaticResource RowHeaderStyle}" RowStyle="{StaticResource DataGridRowtyle}"  AlternationCount="2"
                  ItemsSource="{Binding DeviceItemList}" IsReadOnly="True" Padding="0"  >
+            <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="序号" Width="50" Binding="{Binding DeviceId}" CellStyle="{StaticResource MyDataGridCellStyle}" />
                 <DataGridTextColumn Header="设备编号" Binding="{Binding DeviceNo}" CellStyle="{StaticResource MyDataGridCellStyle}"/>

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

@@ -0,0 +1,114 @@
+<UserControl x:Class="PLCTool.Views.BusinessManageView.ProjectTestResultView"
+             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:b="http://schemas.microsoft.com/xaml/behaviors"
+             xmlns:hc="https://handyorg.github.io/handycontrol"
+             xmlns:myControl="clr-namespace:PLCTool.Controls"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <UserControl.Resources>
+
+    </UserControl.Resources>
+    <Grid>
+        <b:Interaction.Triggers>
+            <b:EventTrigger EventName="Loaded">
+                <b:InvokeCommandAction Command="{Binding OnLoadCommand}"/>
+            </b:EventTrigger>
+        </b:Interaction.Triggers>
+
+        <Grid.RowDefinitions>
+            <RowDefinition Height="60"/>
+            <RowDefinition Height="60"/>
+            <RowDefinition/>
+        </Grid.RowDefinitions>
+
+
+        <StackPanel  Grid.Row="0" Orientation="Horizontal">
+            <StackPanel Orientation="Horizontal">
+                <TextBlock Text="项目代号:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
+                <TextBox  Height="28" Width="120" Text="{Binding ProjectNo}" />
+            </StackPanel>
+            <StackPanel Orientation="Horizontal">
+                <TextBlock Text="项目名称:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
+                <TextBox  Height="28" Width="120" Text="{Binding ProjectName}"/>
+            </StackPanel>
+            <StackPanel Orientation="Horizontal"  Grid.Row="3" HorizontalAlignment="Center">
+                <TextBlock Text="负责人:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0" TextAlignment="Right" Width="80"/>
+                <TextBox  Height="28" Width="120" Text="{Binding ProjectLeader}"/>
+            </StackPanel>
+
+            <StackPanel Orientation="Horizontal">
+                <TextBlock Text="创建时间:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
+                <hc:DateTimePicker ShowClearButton="True" Style="{StaticResource DateTimePickerExtend}" Height="25" Width="160"  Text="{Binding StartTime, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
+            </StackPanel>
+            <StackPanel Orientation="Horizontal">
+                <TextBlock Text="至:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
+                <hc:DateTimePicker ShowClearButton="True" Style="{StaticResource DateTimePickerExtend}" Height="25" Width="160"  Text="{Binding EndTime, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
+            </StackPanel>
+
+
+        </StackPanel>
+        <Border Grid.Row="1"  BorderBrush="#CBCBCB" BorderThickness="0,1" />
+        <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" >
+
+            <Button  Content="查询" Width="80"  Margin="5,0"  Command="{Binding QueryCommand}" Style="{StaticResource NormalButtonStyle}" />
+            <Button  Content="重置" Width="80"  Margin="15,0"  Command="{Binding ResetCommand}" Style="{StaticResource NormalButtonStyle}" />
+        </StackPanel>
+        <ScrollViewer Grid.Row="2">
+            <ListBox  x:Name="listboxPic"  SnapsToDevicePixels="True" Grid.IsSharedSizeScope="True" ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemsSource="{Binding ProjectResultPicList}"   >
+
+                <ListBox.ItemsPanel>
+                    <ItemsPanelTemplate>
+                        <UniformGrid  x:Name="gridPic" Columns="3" Rows="{Binding RowsCount}"  HorizontalAlignment="Center" VerticalAlignment="Center"  >
+
+                        </UniformGrid>
+                    </ItemsPanelTemplate>
+                </ListBox.ItemsPanel>
+                <ListBox.Template>
+                    <ControlTemplate>
+                        <ItemsPresenter></ItemsPresenter>
+                    </ControlTemplate>
+                </ListBox.Template>
+
+            </ListBox>
+        </ScrollViewer>
+
+        <!--<ScrollViewer Grid.Row="2">
+         <ListBox x:Name="listboxPic" ItemsSource="{Binding ProjectePicList}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible"
+        VerticalAlignment="Center" BorderThickness="0">
+             <ListBox.ItemsPanel>
+                 <ItemsPanelTemplate>
+                     <myControl:MyWrapPanel IsItemsHost="True"/>
+                 </ItemsPanelTemplate>
+             </ListBox.ItemsPanel>
+             <ListBox.Template>
+                 <ControlTemplate>
+                     <ItemsPresenter></ItemsPresenter>
+                 </ControlTemplate>
+             </ListBox.Template>
+            
+         </ListBox>
+     </ScrollViewer>-->
+        <!--<ScrollViewer Grid.Row="2">
+         <ListBox x:Name="listboxPic" ItemsSource="{Binding ProjectePicList}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible"
+ VerticalAlignment="Center" BorderThickness="0">
+             <ListBox.ItemsPanel>
+                 <ItemsPanelTemplate>
+                     
+                         <WrapPanel Orientation="Horizontal" Margin="10" IsItemsHost="True" ScrollViewer.CanContentScroll="True"/>
+                    
+                 </ItemsPanelTemplate>
+             </ListBox.ItemsPanel>
+             <ListBox.Template>
+                 <ControlTemplate>
+                     <ItemsPresenter></ItemsPresenter>
+                 </ControlTemplate>
+             </ListBox.Template>
+
+         </ListBox>
+     </ScrollViewer>-->
+    </Grid>
+</UserControl>

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

+ 11 - 6
BlankApp1/BlankApp1/Views/BusinessManageView/ProjectTestView.xaml

@@ -9,6 +9,9 @@
              xmlns:myControl="clr-namespace:PLCTool.Controls"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
+    <UserControl.Resources>
+        
+    </UserControl.Resources>
     <Grid>
         <b:Interaction.Triggers>
             <b:EventTrigger EventName="Loaded">
@@ -26,16 +29,16 @@
         <StackPanel  Grid.Row="0" Orientation="Horizontal">
                 <StackPanel Orientation="Horizontal">
                     <TextBlock Text="项目代号:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
-                    <TextBox  Height="28" Width="120" Text="{Binding DeviceNo}" />
+                    <TextBox  Height="28" Width="120" Text="{Binding ProjectNo}" />
                 </StackPanel>
                 <StackPanel Orientation="Horizontal">
                     <TextBlock Text="项目名称:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
-                    <TextBox  Height="28" Width="120" Text="{Binding DeviceName}"/>
+                    <TextBox  Height="28" Width="120" Text="{Binding ProjectName}"/>
                 </StackPanel>
                 <StackPanel Orientation="Horizontal"  Grid.Row="3" HorizontalAlignment="Center">
                     <TextBlock Text="负责人:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0" TextAlignment="Right" Width="80"/>
-                    <ComboBox  Height="28" Width="120" ItemsSource="{Binding ProjectNameList}" SelectedItem="{Binding ProjectName}" />
-                </StackPanel>
+                    <TextBox  Height="28" Width="120" Text="{Binding ProjectLeader}"/>
+            </StackPanel>
                
             <StackPanel Orientation="Horizontal">
                 <TextBlock Text="创建时间:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
@@ -52,14 +55,16 @@
         <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" >
 
             <Button  Content="查询" Width="80"  Margin="5,0"  Command="{Binding QueryCommand}" Style="{StaticResource NormalButtonStyle}" />
-            <Button  Content="重置" Width="80"  Margin="5,0"  Command="{Binding ResetCommand}" Style="{StaticResource NormalButtonStyle}" />
+            <Button  Content="重置" Width="80"  Margin="15,0"  Command="{Binding ResetCommand}" Style="{StaticResource NormalButtonStyle}" />
         </StackPanel>
         <ScrollViewer Grid.Row="2">
             <ListBox  x:Name="listboxPic"  SnapsToDevicePixels="True" Grid.IsSharedSizeScope="True" ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemsSource="{Binding ProjectePicList}"   >
 
                 <ListBox.ItemsPanel>
                     <ItemsPanelTemplate>
-                        <UniformGrid  x:Name="gridPic" Columns="3" Rows="{Binding RowsCount}"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  />
+                        <UniformGrid  x:Name="gridPic" Columns="3" Rows="{Binding RowsCount}"  HorizontalAlignment="Center" VerticalAlignment="Center"  >
+                           
+                        </UniformGrid>
                     </ItemsPanelTemplate>
                 </ListBox.ItemsPanel>
                 <ListBox.Template>