|
@@ -6,6 +6,7 @@ using LiveCharts.Wpf;
|
|
using Microsoft.Extensions.Logging;
|
|
using Microsoft.Extensions.Logging;
|
|
using Model.Dto;
|
|
using Model.Dto;
|
|
using Model.Entities;
|
|
using Model.Entities;
|
|
|
|
+using PLCTool.Common;
|
|
using PLCTool.Events;
|
|
using PLCTool.Events;
|
|
using PLCTool.Models;
|
|
using PLCTool.Models;
|
|
using Prism.Commands;
|
|
using Prism.Commands;
|
|
@@ -33,6 +34,7 @@ namespace BlankApp1.ViewModels
|
|
private readonly IBasicProjectService _iBasicProjectService;
|
|
private readonly IBasicProjectService _iBasicProjectService;
|
|
private readonly IBizTestRecordService _iBizTestRecordService;
|
|
private readonly IBizTestRecordService _iBizTestRecordService;
|
|
private readonly IBasicPlcTestSchemeDtlService _iBasicPlcTestSchemeDtlService;
|
|
private readonly IBasicPlcTestSchemeDtlService _iBasicPlcTestSchemeDtlService;
|
|
|
|
+ private readonly IRoleProjectService _iRoleProjectService;
|
|
private readonly ILogger _logger;
|
|
private readonly ILogger _logger;
|
|
private readonly IMapper _mapper;
|
|
private readonly IMapper _mapper;
|
|
private readonly IEventAggregator _aggregator;
|
|
private readonly IEventAggregator _aggregator;
|
|
@@ -40,7 +42,7 @@ namespace BlankApp1.ViewModels
|
|
private List<DeviceDtlWithResultModel> conditionDevices = new List<DeviceDtlWithResultModel>();//符合条件的方案
|
|
private List<DeviceDtlWithResultModel> conditionDevices = new List<DeviceDtlWithResultModel>();//符合条件的方案
|
|
private int allSchCount = 0; //所有测试项
|
|
private int allSchCount = 0; //所有测试项
|
|
private List<CrumbViewModel> breadCrumbs = new List<CrumbViewModel>();
|
|
private List<CrumbViewModel> breadCrumbs = new List<CrumbViewModel>();
|
|
- public StatisticsViewModel(IDialogService dialog, IMenuService menuService, IOptionConfigService optionConfigService, IBasicPlcTestSchemeService basicPlcTestSchemeService, IBasicPlcTestSchemeDtlService basicPlcTestSchemeDtlService, IBizTestRecordDtlService iBizTestRecordDtlService, IBasicDeviceKindService iBasicDeviceKindService, IBasicProjectService iBasicProjectService, IBizTestRecordService iBizTestRecordService, IBasicPlcTestSchemeDtlService iBasicPlcTestSchemeDtlService, IBasicDeviceService iBasicDeviceService,IMapper mapper, ILogger logger,IEventAggregator aggregator)
|
|
|
|
|
|
+ public StatisticsViewModel(IDialogService dialog, IMenuService menuService, IOptionConfigService optionConfigService, IBasicPlcTestSchemeService basicPlcTestSchemeService, IBasicPlcTestSchemeDtlService basicPlcTestSchemeDtlService, IBizTestRecordDtlService iBizTestRecordDtlService, IBasicDeviceKindService iBasicDeviceKindService, IBasicProjectService iBasicProjectService, IBizTestRecordService iBizTestRecordService, IBasicPlcTestSchemeDtlService iBasicPlcTestSchemeDtlService, IBasicDeviceService iBasicDeviceService, IRoleProjectService iRoleProjectService,IMapper mapper, ILogger logger,IEventAggregator aggregator)
|
|
{
|
|
{
|
|
_dialog = dialog;
|
|
_dialog = dialog;
|
|
_optionConfigService = optionConfigService;
|
|
_optionConfigService = optionConfigService;
|
|
@@ -53,6 +55,7 @@ namespace BlankApp1.ViewModels
|
|
_iBizTestRecordService = iBizTestRecordService;
|
|
_iBizTestRecordService = iBizTestRecordService;
|
|
_iBasicPlcTestSchemeDtlService = iBasicPlcTestSchemeDtlService;
|
|
_iBasicPlcTestSchemeDtlService = iBasicPlcTestSchemeDtlService;
|
|
_iBasicDeviceService = iBasicDeviceService;
|
|
_iBasicDeviceService = iBasicDeviceService;
|
|
|
|
+ _iRoleProjectService = iRoleProjectService;
|
|
_logger = logger;
|
|
_logger = logger;
|
|
_mapper = mapper;
|
|
_mapper = mapper;
|
|
_aggregator=aggregator;
|
|
_aggregator=aggregator;
|
|
@@ -95,9 +98,17 @@ namespace BlankApp1.ViewModels
|
|
List<DateTime> startDateTimes = new List<DateTime>();
|
|
List<DateTime> startDateTimes = new List<DateTime>();
|
|
var deviceMsg = _iBasicDeviceService.Find(((int)deviceId));
|
|
var deviceMsg = _iBasicDeviceService.Find(((int)deviceId));
|
|
if (deviceMsg != null)
|
|
if (deviceMsg != null)
|
|
- {
|
|
|
|
|
|
+ {
|
|
|
|
+ //根据角色显示所拥有的项目
|
|
|
|
+ var roleProject = _iRoleProjectService.FindByRoleIdAndPro(Appsession.RoleId, (int)deviceMsg.project_id);
|
|
|
|
+ if(roleProject==null)
|
|
|
|
+ {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
string deviceKind = _iBasicDeviceKindService.Find((int)deviceMsg.device_kind_id)?.devicekind_name;
|
|
string deviceKind = _iBasicDeviceKindService.Find((int)deviceMsg.device_kind_id)?.devicekind_name;
|
|
string projectName = _iBasicProjectService.Find((int)deviceMsg.project_id)?.project_name;
|
|
string projectName = _iBasicProjectService.Find((int)deviceMsg.project_id)?.project_name;
|
|
|
|
+
|
|
|
|
+
|
|
//记录设备下的方案通过个数
|
|
//记录设备下的方案通过个数
|
|
int deviceCountResult = 0;
|
|
int deviceCountResult = 0;
|
|
string deviceTestResult = string.Empty;
|
|
string deviceTestResult = string.Empty;
|
|
@@ -145,33 +156,6 @@ namespace BlankApp1.ViewModels
|
|
testResult = "通过";
|
|
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 == "通过")
|
|
if (testResult == "通过")
|
|
{
|
|
{
|