1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615 |
- using AutoMapper;
- using BizService;
- using Microsoft.Extensions.Logging;
- using Model.Dto;
- using Model.Entities;
- using NetTaste;
- using Newtonsoft.Json;
- using OmronFinsTCP.Net;
- using PLCTool.Common;
- using PLCTool.Events;
- using Prism.Commands;
- using Prism.Events;
- using Prism.Mvvm;
- using Prism.Services.Dialogs;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Configuration;
- using System.Linq;
- using System.Linq.Expressions;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using WPFDevelopers.Controls.Runtimes.Shell32;
- using static System.Windows.Forms.VisualStyles.VisualStyleElement.ListView;
- namespace PLCTool.ViewModels.BusinessManageViewModel
- {
-
- public class ManualTestViewModel : BindableBase, IDialogAware
- {
- private readonly IDialogService _dialog;
- private readonly IEventAggregator _aggregator;
- private readonly IOptionConfigService _optionConfigService;
- private readonly IBasicPlcTestSchemeService _basicPlcTestSchemeService;
- private readonly IBasicPlcTestSchemeDtlService _basicPlcTestSchemeDtlService;
- private readonly IBizTestRecordService _iBizTestRecordService;
- private readonly IBizTestRecordDtlService _iBizTestRecordDtlService;
- private readonly IMapper _mapper;
- private readonly ILogger _logger;
- private List<OptionConfigDto> _optionConfigs;
- private DateTime startTime= DateTime.Now;
- private DateTime endTime=DateTime.Now;
- private int testStatus = 0; //测试状态
- private int testResult = 0; //测试结果
- private long schId = 0; //方案ID
- private long globalSchDetailId = 0; //测试方案明细ID
- private long globalDeviceId = 0; //设备ID
- private long globalSort = 0; //排序
- private BizTestRecordDtlDto bizTestRecordDtlDto = new BizTestRecordDtlDto(); //测试方案明细表
- private const string TestMode = "手动测试";
- private List<bas_plc_test_scheme_dtl> allSchDtlsById = new List<bas_plc_test_scheme_dtl>(); //测试方案明细项目
- private int defaultDelayTime = Convert.ToInt32(ConfigurationManager.AppSettings["DelayTime"]);
- private int delayTime;
- public ManualTestViewModel(IDialogService dialog, IEventAggregator aggregator, IOptionConfigService optionConfigService, IBasicPlcTestSchemeService basicPlcTestSchemeService, IBasicPlcTestSchemeDtlService basicPlcTestSchemeDtlService, IBizTestRecordService iBizTestRecordService, IBizTestRecordDtlService iBizTestRecordDtlService,IMapper mapper,ILogger logger)
- {
- _dialog = dialog;
- _aggregator = aggregator;
- _optionConfigService = optionConfigService;
- _basicPlcTestSchemeService = basicPlcTestSchemeService;
- _basicPlcTestSchemeDtlService = basicPlcTestSchemeDtlService;
- _iBizTestRecordDtlService = iBizTestRecordDtlService;
- _iBizTestRecordService= iBizTestRecordService;
- _mapper = mapper;
- _logger = logger;
- CloseCommand = new DelegateCommand(Close);
- StartCommand = new DelegateCommand<object>(Start);
- PreviousCommand = new DelegateCommand<object>(Previous);
- NextCommand = new DelegateCommand<object>(Next);
- DoneCommand = new DelegateCommand<object>(Done);
- ItemChangeCommand = new DelegateCommand(ItemChange);
- ResetCommand = new DelegateCommand(Reset);
- BeforeConList = new ObservableCollection<BasPlcItemConfigDto>();
- InConList = new ObservableCollection<BasPlcItemConfigDto>();
- OutConList = new ObservableCollection<BasPlcItemConfigDto>();
- GetConfigOption();
-
- }
- /// <summary>
- /// 选中测试项
- /// </summary>
- private void ItemChange()
- {
- var findDtlMsg = allSchDtlsById?.FirstOrDefault(X => X.item_name == SelectItem);
- if(findDtlMsg != null)
- {
- int id = Convert.ToInt32(findDtlMsg.scheme_dtl_id);
- // 根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
- globalSchDetailId = id;
- globalSort = findDtlMsg.sort;
- GetDetailInfo(id);
- }
- }
- /// <summary>
- /// 复位PLC
- /// </summary>
- private async void Reset()
- {
- PLCConnectionFactory.CreatePLCCont().ResetPLC("1.00", VarType.Bit, "0");
- await Task.Delay(1000);
- PLCConnectionFactory.CreatePLCCont().ResetPLC("1.00", VarType.Bit, "1");
- await Task.Delay(1000);
- bool isResult=PLCConnectionFactory.CreatePLCCont().ResetPLC("1.00", VarType.Bit, "0");
- if(isResult)
- {
- MessageBox.Show("复位成功!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
- }
- }
- #region idialog接口实现
- public string Title { set; get; } = "手动测试";
- public event Action<IDialogResult> RequestClose;
- public bool CanCloseDialog()
- {
- return true;
- }
- public void OnDialogClosed()
- {
- }
- public void OnDialogOpened(IDialogParameters parameters)
- {
- //编辑
- var getMsg = parameters.GetValues<long>("Key");
- ///值不为空,表示修改
- if (getMsg != null)
- {
- foreach (var item in getMsg)
- {
- //测试方案号
- schId = item;
- allSchDtlsById = _basicPlcTestSchemeDtlService.FindAllBySchId(schId);
- var schDtls= allSchDtlsById.OrderBy(x => x.sort).ThenBy(x => x.scheme_dtl_id).ToList(); ;
- foreach(var sch in schDtls)
- {
- long dtlId = sch.scheme_dtl_id;
- SchItems.Add(sch.item_name);
- }
- //默认显示第一个测试项的信息
- if(schDtls.Count!=0)
- {
- int id = Convert.ToInt32(schDtls[0].scheme_dtl_id);
- globalSchDetailId = id;
- // 根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
- GetDetailInfo(id);
- SelectItemIndex = 0;
- }
-
- //globalSchDetailId = item; //测试方案明细ID
- //int id = Convert.ToInt32(item);
- //// 根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
- //GetDetailInfo(id);
- }
- }
- //获取设备id
- var getDes = parameters.GetValues<long>("Key2");
- if(getDes != null)
- {
- foreach(var item in getDes)
- {
- globalDeviceId = item;
- }
- }
- }
- /// <summary>
- /// 发送log之界面显示
- /// </summary>
- /// <param name="msg"></param>
- private void SendLogToDis(string msg)
- {
- _aggregator.GetEvent<LogEvent>().Publish(new LogMessage
- {
- LogTime = DateTime.Now,
- LogMsg = msg
- });
- }
- /// <summary>
- /// //根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
- /// </summary>
- /// <param name="id"></param>
- private void GetDetailInfo(int schDetailId)
- {
- //根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
- var findEntity = _basicPlcTestSchemeDtlService.Find(schDetailId);
- var findresult = _mapper.Map<bas_plc_test_scheme_dtl, BasicPlcTestSchemeDtlDto>(findEntity);
- if (findresult != null)
- {
- //根据方案id 在方案表中查找方案名 设备名
- schId = findresult.SchemeId.Value; //方案id,方便下一步查找
- int intSchId = Convert.ToInt32(findresult.SchemeId);
-
- var findSch = _basicPlcTestSchemeService.Find(intSchId);
- if (findSch != null)
- {
- ScheduleName = findSch.scheme_name;
- DeviceKindName = findSch.devicekind_name;
-
- }
- TestName = findresult.ItemName;
- SelectTest = findresult.ItemType;
- //测试时间
- if(findresult.ItemTime == 0)
- {
- delayTime = defaultDelayTime;
- }
- else
- {
- delayTime = findresult.ItemTime;
- }
-
- //前置项解析
- string preconStr = findresult.Precondition.ToString();
- if (!string.IsNullOrEmpty(preconStr))
- {
- JsonModel preconditionModel = JsonConvert.DeserializeObject<JsonModel>(preconStr);
- BeforeSelectJudge = preconditionModel.ItemType;
- SelectLogic = preconditionModel.ItemLogical;
- BeforeDetail = preconditionModel.Description;
- BeforeConList.Clear();
- foreach (var detail in preconditionModel.DetailInfo)
- {
- BasPlcItemConfigDto basPlcItemConfigDto = new BasPlcItemConfigDto();
- basPlcItemConfigDto.Id=detail.Id;
- basPlcItemConfigDto.PlcItem = detail.PlcItem;
- basPlcItemConfigDto.PlcAddress = detail.PlcAddress;
- basPlcItemConfigDto.PlcAddType = detail.PlcAddType;
- basPlcItemConfigDto.PlcValue = detail.PlcValue;
- basPlcItemConfigDto.Remark = detail.Remark;
- BeforeConList.Add(basPlcItemConfigDto);
- }
- }
- //输入项解析
- string inStr = findresult.Action.ToString();
- if (!string.IsNullOrEmpty(inStr))
- {
- JsonModel inModel = JsonConvert.DeserializeObject<JsonModel>(inStr);
- SelectInJudge = inModel.ItemType;
- InSelectLogic = inModel.ItemLogical;
- InDetail = inModel.Description;
- InConList.Clear();
- foreach (var detail in inModel.DetailInfo)
- {
- BasPlcItemConfigDto basPlcItemConfigDto = new BasPlcItemConfigDto();
- basPlcItemConfigDto.Id = detail.Id;
- basPlcItemConfigDto.PlcItem = detail.PlcItem;
- basPlcItemConfigDto.PlcAddress = detail.PlcAddress;
- basPlcItemConfigDto.PlcAddType = detail.PlcAddType;
- basPlcItemConfigDto.PlcValue = detail.PlcValue;
- basPlcItemConfigDto.Remark = detail.Remark;
- InConList.Add(basPlcItemConfigDto);
- }
- }
- //输出项解析
- string outStr = findresult.JudgementResult.ToString();
- if (!string.IsNullOrEmpty(outStr))
- {
- JsonModel outModel = JsonConvert.DeserializeObject<JsonModel>(outStr);
- SelectOutJudge = outModel.ItemType;
- OutSelectLogic = outModel.ItemLogical;
- OutDetail = outModel.Description;
- OutConList.Clear();
- foreach (var detail in outModel.DetailInfo)
- {
- BasPlcItemConfigDto basPlcItemConfigDto = new BasPlcItemConfigDto();
- basPlcItemConfigDto.Id = detail.Id;
- basPlcItemConfigDto.PlcItem = detail.PlcItem;
- basPlcItemConfigDto.PlcAddress = detail.PlcAddress;
- basPlcItemConfigDto.PlcAddType = detail.PlcAddType;
- basPlcItemConfigDto.PlcValue = detail.PlcValue;
- basPlcItemConfigDto.Remark = detail.Remark;
- OutConList.Add(basPlcItemConfigDto);
- }
- }
- }
- }
- #endregion
- #region 私有发方法
- /// <summary>
- /// 增加或更新测试记录
- /// </summary>
- private void AddTestRecord()
- {
-
- //记录记录主表中是否有这个方案的记录,没有则添加
- var findRecord = _iBizTestRecordService.FindRecorddByDeviceIdAndSchname(globalDeviceId,ScheduleName);
- if (findRecord == null)
- {
- //状态status 没有赋值
- BizTestRecordDto bizTestRecordDto = new BizTestRecordDto();
- bizTestRecordDto.RecordName = ScheduleName + "_Record";
- bizTestRecordDto.SchemeName = ScheduleName;
- bizTestRecordDto.DeviceId = globalDeviceId;
- bizTestRecordDto.Tester = Appsession.UserName;
- bizTestRecordDto.StartTestTime = startTime;
- bizTestRecordDto.FinishTestTime = endTime;
- bizTestRecordDto.CreateBy = Appsession.UserName;
- bizTestRecordDto.CreateTime = DateTime.Now;
- bizTestRecordDto.UpdateBy = Appsession.UserName;
- bizTestRecordDto.UpdateTime = DateTime.Now;
- var testRecord = _mapper.Map<BizTestRecordDto, biz_test_record>(bizTestRecordDto);
- _iBizTestRecordService.Add(testRecord);
- }
-
- }
- /// <summary>
- /// 获取记录明细
- /// </summary>
- private void AddDtltRecord(long schDetailId)
- {
- //查找record ID
- long recordId = 0;
- var findRecordID = _iBizTestRecordService.FindRecorddByDeviceIdAndSchname(globalDeviceId, ScheduleName);
- if (findRecordID != null)
- {
- recordId = findRecordID.record_id;
- }
- testStatus = 99;//测试状态赋值为99
- //状态status 没有赋值
- DateTime finishTime = DateTime.Now;
- bizTestRecordDtlDto.RecordId = recordId;
- bizTestRecordDtlDto.SchemeDtlId = schDetailId;
- bizTestRecordDtlDto.StartTestTime = startTime;
- bizTestRecordDtlDto.FinishTestTime = endTime;
- bizTestRecordDtlDto.TestMode = TestMode;
- bizTestRecordDtlDto.Status = testStatus;
- bizTestRecordDtlDto.TestResult = GetTestResult();
- bizTestRecordDtlDto.CreateBy = Appsession.UserName;
- bizTestRecordDtlDto.CreateTime = startTime;
- bizTestRecordDtlDto.UpdateBy = Appsession.UserName;
- bizTestRecordDtlDto.UpdateTime = finishTime;
-
-
- var testRecordDtl = _mapper.Map<BizTestRecordDtlDto, biz_test_record_dtl>(bizTestRecordDtlDto);
- _iBizTestRecordDtlService.Add(testRecordDtl);
- //跟新测试记录的_iBizTestRecord的完成时间
- var findRecord = _iBizTestRecordService.Find((int)recordId);
- if (findRecord != null)
- {
-
- findRecord.finish_test_time = finishTime;
- _iBizTestRecordService.Edit(findRecord);
- }
- }
- /// <summary>
- /// 前置项结果判定
- /// </summary>
- /// <returns></returns>
- private int GetPrecedtionResult()
- {
- //前置项
- int beforeResult = 0;
-
- if (BeforeConList.Count == 0)
- {
- beforeResult = 1;
- }
- else
- {
- if (SelectLogic == "OR")
- {
- var find = BeforeConList.FirstOrDefault(x => x.TestResult == "通过");
- if (find != null)
- {
- beforeResult = 1;
- }
- else
- {
- beforeResult = 0;
- }
- }
- else
- {
- if (SelectLogic == "AND" || SelectLogic == "ONLY")
- {
- var find = BeforeConList.FirstOrDefault(x => x.TestResult == "不通过");
- if (find != null)
- {
- beforeResult = 0;
- }
- else
- {
- beforeResult = 1;
- }
- }
- else
- {
- if (SelectLogic == "NULL")
- {
- beforeResult = 1;
- }
- }
- }
- }
- return beforeResult;
- }
- /// <summary>
- /// 判定结果
- /// </summary>
- /// <returns></returns>
- private int GetTestResult()
- {
- //前置项
- int beforeResult = 0;
- int inResult= 0;
- int outResult = 0;
- if(BeforeConList.Count==0)
- {
- beforeResult = 1;
- }
- else
- {
- if (SelectLogic == "OR")
- {
- var find = BeforeConList.FirstOrDefault(x => x.TestResult == "通过");
- if (find != null)
- {
- beforeResult = 1;
- }
- else
- {
- beforeResult = 0;
- }
- }
- else
- {
- if (SelectLogic == "AND" || SelectLogic == "ONLY")
- {
- var find = BeforeConList.FirstOrDefault(x => x.TestResult == "不通过");
- if (find != null)
- {
- beforeResult = 0;
- }
- else
- {
- beforeResult = 1;
- }
- }
- else
- {
- if (SelectLogic == "NULL")
- {
- beforeResult = 1;
- }
- }
- }
- }
-
-
- //输入项
- if(InConList.Count==0)
- {
- inResult = 1;
- }
- else
- {
- if (InSelectLogic == "OR")
- {
- var find = InConList.FirstOrDefault(x => x.TestResult == "通过");
- if (find != null)
- {
- inResult = 1;
- }
- else
- {
- inResult = 0;
- }
- }
- else
- {
- if (InSelectLogic == "AND" || InSelectLogic == "ONLY")
- {
- var find = InConList.FirstOrDefault(x => x.TestResult == "不通过");
- if (find != null)
- {
- inResult = 0;
- }
- else
- {
- inResult = 1;
- }
- }
- else
- {
- if (InSelectLogic == "NULL")
- {
- inResult = 1;
- }
- }
- }
- }
-
- //输出项
- if(OutConList.Count==0)
- {
- outResult = 1;
- }
- else
- {
- if (OutSelectLogic == "OR")
- {
- var find = OutConList.FirstOrDefault(x => x.TestResult == "通过");
- if (find != null)
- {
- outResult = 1;
- }
- else
- {
- outResult = 0;
- }
- }
- else
- {
- if (OutSelectLogic == "AND" || OutSelectLogic == "ONLY")
- {
- var find = OutConList.FirstOrDefault(x => x.TestResult == "不通过");
- if (find != null)
- {
- outResult = 0;
- }
- else
- {
- outResult = 1;
- }
- }
- else
- {
- if (OutSelectLogic == "NULL")
- {
- outResult = 1;
- }
- }
- }
- }
-
- if(beforeResult==1&&inResult==1&&outResult==1)
- {
- return 1;
- }
- else
- {
- return 0;
- }
-
- }
- /// <summary>
- /// 更新测试记录
- /// </summary>
- private void UpdateTesDtltRecord()
- {
- var testRecordDtl = _mapper.Map<BizTestRecordDtlDto, biz_test_record_dtl>(bizTestRecordDtlDto);
- _iBizTestRecordDtlService.Edit(testRecordDtl);
- }
- /// <summary>
- /// 完成时间
- /// </summary>
- /// <param name="obj"></param>
- private void Done(object obj)
- {
- endTime = DateTime.Now;
- RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
-
- }
- private void Next(object obj)
- {
- StepIndex = 0;
- long maxSort = allSchDtlsById.Select(x => x.sort).Max();
- ///查找方案下的所有方案明细,并排序,
- if (maxSort!=0)
- {
- if(globalSort< maxSort)
- {
- globalSort++;
- var findSort = allSchDtlsById.FirstOrDefault(x => x.sort == globalSort);
- if (findSort != null)
- {
- int id = Convert.ToInt32(findSort.scheme_dtl_id);
- globalSchDetailId = findSort.scheme_dtl_id;
- SelectItemIndex++;
- //界面显示
- GetDetailInfo(id);
- }
- }
- else
- {
- MessageBox.Show("已是此测试方案最后一个测试项!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
-
- }
- }
- //兼容没加排序字段以前的
- else
- {
- var basicSchDtls = allSchDtlsById?.OrderBy(x => x.scheme_dtl_id);
- foreach (var item in basicSchDtls)
- {
- //在测试结果明细中查看
- long schDetailId = item.scheme_dtl_id;
- if (schDetailId > globalSchDetailId)
- {
- globalSchDetailId = schDetailId;
- int id = Convert.ToInt32(schDetailId);
- SelectItemIndex++;
- //界面显示
- GetDetailInfo(id);
- //记录记录明细表中是否有这个方案明细ID的记录,没有则添加,有则更新记录状态
- break;
- }
- long maxDtlId = basicSchDtls.Select(x => x.scheme_dtl_id).Max();
- if (globalSchDetailId == maxDtlId)
- {
- MessageBox.Show("已是此测试方案最后一个测试项!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
- break;
- }
- }
- }
-
-
-
-
- }
- private void Previous(object obj)
- {
- StepIndex = 0;
- int maxSort = allSchDtlsById.Select(x => x.sort).Max();
- if(maxSort!=0)
- {
- if (globalSort>1)
- {
- globalSort--;
- var findSort = allSchDtlsById.FirstOrDefault(x => x.sort == globalSort);
- if (findSort != null)
- {
- int id = Convert.ToInt32(findSort.scheme_dtl_id);
- globalSchDetailId = findSort.scheme_dtl_id;
- SelectItemIndex--;
- //界面显示
- GetDetailInfo(id);
- }
- }
- else
- {
- SelectItemIndex = 0;
- MessageBox.Show("已是此测试方案的第一个测试项!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
- }
- }
- else
- {///查找方案下的所有方案明细,并排序,
- var basicSchDtls = allSchDtlsById?.OrderByDescending(x => x.sort).ThenByDescending(x => x.scheme_dtl_id);
- foreach (var item in basicSchDtls)
- {
- //在测试结果明细中查看
- long schDetailId = item.scheme_dtl_id;
- if (schDetailId < globalSchDetailId)
- {
- globalSchDetailId = schDetailId;
- int id = Convert.ToInt32(schDetailId);
- SelectItemIndex--;
- //界面显示
- GetDetailInfo(id);
- //记录记录明细表中是否有这个方案明细ID的记录,没有则添加,有则更新记录状态
- break;
- }
- }
- long maxDtlId = basicSchDtls.Select(x => x.scheme_dtl_id).Min();
- if (globalSchDetailId == maxDtlId)
- {
- SelectItemIndex = 0;
- MessageBox.Show("已是此测试方案的第一个测试项!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
- }
- }
-
-
- }
- /// <summary>
- /// 开始检测
- /// </summary>
- /// <param name="obj"></param>
- private async void Start(object obj)
- {
-
-
- StartEnalbe = false;
- _logger.LogInformation($"开始手动测试。方案名{ScheduleName},测试项{TestName}");
- SendLogToDis($"开始手动测试。方案名{ScheduleName},测试项{TestName}");
- //开始时间
- startTime = DateTime.Now;
- //增加测试记录主表
- AddTestRecord();
-
- //前置项
- bool preBool=TestPreceditionMethod();
- if(!preBool)
- {
- StepIndex = 0;
- StartEnalbe = true;
- return;
- }
- //前置项结果判断
- int preceditionResult=GetPrecedtionResult();
- if( preceditionResult == 0 )
- {
- MessageBoxResult boxResult = MessageBox.Show("前置项条件不满足,请确认前置条件!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
- StartEnalbe = true;
- return;
-
- }
- //输入项
- bool isAction=TestActionMethod();
- if (!isAction)
- {
- StepIndex = 0;
- StartEnalbe = true;
- return;
- }
-
- //输出项
- bool isJudgeResult=await TestJudgementMethod();
- if (!isJudgeResult)
- {
- StepIndex = 0;
- StartEnalbe = true;
- return;
- }
- //将测试结果添加到数据库
- AddDtltRecord(globalSchDetailId);
- SendLogToDis($"手动测试完成。方案名{ScheduleName},测试项{TestName}");
- _logger.LogInformation($"手动测试完成。方案名{ScheduleName},测试项{TestName}");
- StartEnalbe = true;
- }
- /// <summary>
- /// 更新测试结果
- /// </summary>
- private void UpdateTestRecord()
- {
- }
- /// <summary>
- /// 测试前置项目
- /// </summary>
- private bool TestPreceditionMethod()
- {
- switch (BeforeSelectJudge)
- {
- case "人工判定":
- //弹出确认的对话框
- if(string.IsNullOrEmpty(BeforeDetail))
- {
- return true;
- }
- MessageBoxResult boxResult = MessageBox.Show(BeforeDetail, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
- if (boxResult == MessageBoxResult.OK)
- {
- //前置项测试结果json转化
- string prefixJsonStr = ModelToJsonToStr(BeforeSelectJudge, SelectLogic, BeforeDetail, BeforeConList);
- //json字符串
- bizTestRecordDtlDto.PreconditionFinal = prefixJsonStr;
- bizTestRecordDtlDto.PreconditionResult = "通过";
- StepIndex = 1;
- }
- else
- {
- return false;
- }
- break;
- case "自动判定":
- //读取plc的值
- switch (SelectLogic)
- {
- case "NULL":
- //弹出确认的对话框
- if (string.IsNullOrEmpty(BeforeDetail))
- {
- return true;
- }
- MessageBoxResult boxResultAuto = MessageBox.Show(BeforeDetail, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
- if (boxResultAuto == MessageBoxResult.OK)
- {
- //前置项测试结果json转化
- string prefixJsonStr = ModelToJsonToStr(BeforeSelectJudge, SelectLogic, BeforeDetail, BeforeConList);
- //json字符串
- bizTestRecordDtlDto.PreconditionFinal = prefixJsonStr;
- bizTestRecordDtlDto.PreconditionResult = "通过";
- StepIndex = 1;
- }
- else
- {
- return false;
- }
- break;
- case "AND":
- case "ONLY":
- case "OR":
- ReadPredice(SelectLogic);
- break;
-
- case "ORDER":
- break;
- }
- break;
- }
-
- return true;
- }
- private void ReadPredice(string strLogic)
- {
- int countCond = 0;
- foreach (var item in BeforeConList.OrderBy(x=>x.Id))
- {
- string plcAddress = item.PlcAddress;
- string plcAddType = item.PlcAddType;
- string plcValue = item.PlcValue;
- switch (plcAddType)
- {
- case "bool":
- string readResult = PLCConnectionFactory.CreatePLCCont().ReadPlcObject(plcAddress, VarType.Bit);
- ///实时值记录
- item.RealValue = readResult;
- item.TestTime = DateTime.Now;
- if (readResult.Trim() == plcValue?.Trim())
- {
- item.TestResult = "通过";
- countCond++;
- }
- else
- {
- item.TestResult = "不通过";
- }
- break;
- case "word":
- break;
- }
- }
- //测试记录存入数据库
- //前置项测试结果json转化
- string prefixJsonStr = ModelToJsonToStr(BeforeSelectJudge, SelectLogic, BeforeDetail, BeforeConList);
- //json字符串
- bizTestRecordDtlDto.PreconditionFinal = prefixJsonStr;
- //条件满足
- switch (strLogic)
- {
- case "AND":
- case "ONLY":
- if ((countCond == BeforeConList.Count) && (countCond != 0))
- {
- bizTestRecordDtlDto.PreconditionResult = "通过";
-
- }
- else
- {
- bizTestRecordDtlDto.PreconditionResult = "不通过";
- }
- break;
- case "OR":
- if ( (countCond != 0))
- {
- bizTestRecordDtlDto.PreconditionResult = "通过";
-
- }
- else
- {
- bizTestRecordDtlDto.PreconditionResult = "不通过";
- }
- break;
- }
- StepIndex = 1;
- }
- /// <summary>
- /// 输入项写入
- /// </summary>
- private bool TestActionMethod()
- {
- bool isActionResult = true;
- switch (SelectInJudge)
- {
- case "人工判定":
- //弹出确认的对话框
- MessageBoxResult boxResult = MessageBox.Show(InDetail, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
- if (boxResult == MessageBoxResult.OK)
- {
- //前置项测试结果json转化
- string actionJsonStr = ModelToJsonToStr(SelectInJudge, InSelectLogic, InDetail, InConList);
- //json字符串
- bizTestRecordDtlDto.ActionFinal = actionJsonStr;
- bizTestRecordDtlDto.ActionResult = "通过";
- StepIndex = 2;
- }
- else
- {
- isActionResult= false;
- }
- break;
- case "自动判定":
- //读取plc的值
- switch (InSelectLogic)
- {
- case "NULL":
- //弹出确认的对话框
- MessageBoxResult boxResultAction = MessageBox.Show(InDetail, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
- if (boxResultAction == MessageBoxResult.OK)
- {
- //前置项测试结果json转化
- string actionJsonStr = ModelToJsonToStr(SelectInJudge, InSelectLogic, InDetail, InConList);
- //json字符串
- bizTestRecordDtlDto.ActionFinal = actionJsonStr;
- bizTestRecordDtlDto.ActionResult = "通过";
- StepIndex = 2;
- }
- else
- {
- isActionResult = false;
- }
- break;
- case "AND":
- case "ONLY":
- case "OR":
- isActionResult =SendActionToPLC(InSelectLogic);
- break;
- case "ORDER":
- break;
- }
- break;
- }
-
- return isActionResult;
- }
- /// <summary>
- /// 发送命令给PLC
- /// </summary>
- private bool SendActionToPLC(string strActionLogic)
- {
- bool isAction = true;
- int countCond = 0;
- foreach (var item in InConList.OrderBy(x => x.Id))
- {
- string plcAddress = item.PlcAddress;
- string plcAddType = item.PlcAddType;
- string plcValue = item.PlcValue;
- switch (plcAddType)
- {
- case "bool":
- DialogParameters parm = new DialogParameters();
- parm.Add("Key", plcAddress);
- parm.Add("Key2", plcValue);
- //弹出写入对话框
- _dialog.ShowDialog("WritePLCView", parm, async callback =>
- {
- if (callback.Result == ButtonResult.OK)
- {
- string plcRealValue = callback.Parameters.GetValue<string>("ReturnValue");
- bool writeResult = PLCConnectionFactory.CreatePLCCont().WritePlcObject(plcAddress, VarType.Bit, plcRealValue);
- ///实时值记录
- item.RealValue = plcRealValue;
- item.TestTime = DateTime.Now;
- if (writeResult)
- {
- ///单个测试项通过
- item.TestResult = "通过";
- countCond++;
- }
- else
- {
- item.TestResult = "不通过";
- }
- }
- else
- {
- isAction= false;
- }
- });
- break;
- case "word":
- DialogParameters parm2 = new DialogParameters();
- parm2.Add("Key", plcAddress);
- parm2.Add("Key2", plcValue);
- //弹出写入对话框
- _dialog.ShowDialog("WritePLCView", parm2, async callback =>
- {
- if (callback.Result == ButtonResult.OK)
- {
- string plcRealValue = callback.Parameters.GetValue<string>("ReturnValue");
- bool writeResult = PLCConnectionFactory.CreatePLCCont().WritePlcObject(plcAddress, VarType.Word, plcRealValue);
- ///实时值记录
- item.RealValue = plcRealValue;
- item.TestTime = DateTime.Now;
- if (writeResult)
- {
- ///单个测试项通过
- item.TestResult = "通过";
- countCond++;
- }
- else
- {
- item.TestResult = "不通过";
- }
- }
- else
- {
- isAction = false;
- }
- });
- break;
- }
- }
- if(!isAction)
- {
- return isAction;
- }
- //测试记录存入数据库
- //前置项测试结果json转化
- string actionJsonStr = ModelToJsonToStr(SelectInJudge, InSelectLogic, InDetail, InConList);
- //json字符串
- bizTestRecordDtlDto.ActionFinal = actionJsonStr;
- //条件满足
- //条件满足
- switch (strActionLogic)
- {
- case "AND":
- case "ONLY":
- if ((countCond == BeforeConList.Count) && (countCond != 0))
- {
- bizTestRecordDtlDto.ActionResult = "通过";
- }
- else
- {
- bizTestRecordDtlDto.ActionResult = "不通过";
- }
- break;
- case "OR":
- if ((countCond != 0))
- {
- bizTestRecordDtlDto.ActionResult = "通过";
- }
- else
- {
- bizTestRecordDtlDto.ActionResult = "不通过";
- }
- break;
- }
-
- StepIndex = 2;
- return isAction;
- }
- /// <summary>
- /// 结果项判定
- /// </summary>
- private async Task<bool> TestJudgementMethod()
- {
- bool isJudge = true;
- switch (SelectOutJudge)
- {
- case "人工判定":
- //弹出确认的对话框
- MessageBoxResult boxResult = MessageBox.Show(OutDetail, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
- if (boxResult == MessageBoxResult.OK)
- {
- bizTestRecordDtlDto.JudgementResult = "通过";
- StepIndex = 3;
- }
- else
- {
- isJudge = false;
- }
- break;
- case "自动判定":
- //读取plc的值
- switch (OutSelectLogic)
- {
- case "NULL":
- bizTestRecordDtlDto.JudgementResult = "通过";
- StepIndex = 3;
- break;
- case "AND":
- case "ONLY":
- case "OR":
- await ReadJudge(OutSelectLogic);
- break;
- case "ORDER":
- break;
- }
- break;
- }
- //更新测试记录
- //更新测试记录
- endTime = DateTime.Now;
-
- return isJudge;
- }
- /// <summary>
- /// 读取结果
- /// </summary>
- private async Task ReadJudge(String strLogic)
- {
- int countCond = 0;
- DateTime entryTime = DateTime.Now;
- foreach (var item in OutConList.OrderBy(x => x.Id))
- {
- string plcAddress = item.PlcAddress;
- string plcAddType = item.PlcAddType;
- string plcValue = item.PlcValue;
-
- switch (plcAddType)
- {
- case "bool":
-
- string readResult = string.Empty;
- //一直读
- await Task.Run(async () =>
- {
- while (entryTime.AddMilliseconds(delayTime * 1000) > DateTime.Now)
- {
- //显示进度条
- System.Windows.Application.Current.Dispatcher.Invoke((delegate
- {
- ProVisibility = Visibility.Visible;
- }));
- //先延时,在读取,避免读取传感器刚开始的数据
- await Task.Delay(1000);
- readResult = PLCConnectionFactory.CreatePLCCont().ReadPlcObject(plcAddress, VarType.Bit);
- if (readResult == item.PlcValue)
- {
- break;
- }
-
- }
- });
- //可能有多个条件判定的,第二次时间到了直接跳出延时,直接读取,不用在延时20s
- readResult = PLCConnectionFactory.CreatePLCCont().ReadPlcObject(plcAddress, VarType.Bit);
- ProVisibility = Visibility.Hidden;
- ///实时值记录
- item.RealValue = readResult;
- item.TestTime = DateTime.Now;
- if (readResult.Trim() == plcValue?.Trim())
- {
- item.TestResult = "通过";
- countCond++;
- }
- else
- {
- item.TestResult = "不通过";
- }
- break;
- case "word":
- // DateTime entryTime2 = DateTime.Now;
- string readResult2 = string.Empty;
- //一直读
- await Task.Run(async () =>
- {
- while (entryTime.AddMilliseconds(delayTime * 1000) > DateTime.Now)
- {
- //显示进度条
- System.Windows.Application.Current.Dispatcher.Invoke((delegate
- {
- ProVisibility = Visibility.Visible;
- }));
- readResult2 = PLCConnectionFactory.CreatePLCCont().ReadPlcObject(plcAddress, VarType.Word);
- if (readResult2 == item.PlcValue)
- {
- break;
- }
- await Task.Delay(1000);
- }
- });
- //可能有多个条件判定的,第二次直接跳出延时,直接读取
- readResult2 = PLCConnectionFactory.CreatePLCCont().ReadPlcObject(plcAddress, VarType.Word);
- ProVisibility = Visibility.Hidden;
- ///实时值记录
- item.RealValue = readResult2;
- item.TestTime = DateTime.Now;
- if (readResult2.Trim() == plcValue?.Trim())
- {
- item.TestResult = "通过";
- countCond++;
- }
- else
- {
- item.TestResult = "不通过";
- }
- break;
-
- }
- }
-
- //测试记录存入数据库
- //输出项测试结果json转化
- string prefixJsonStr = ModelToJsonToStr(SelectOutJudge, OutSelectLogic, OutDetail, OutConList);
- //json字符串
- bizTestRecordDtlDto.JudgementResultFinal = prefixJsonStr;
- //条件满足
- switch(strLogic)
- {
- case "AND":
- case "ONLY":
- if ((countCond == OutConList.Count) && (countCond != 0))
- {
- bizTestRecordDtlDto.JudgementResult = "通过";
- }
- else
- {
- bizTestRecordDtlDto.JudgementResult = "不通过";
- }
- break;
- case "OR":
- if ( countCond != 0)
- {
- bizTestRecordDtlDto.JudgementResult = "通过";
- }
- else
- {
- bizTestRecordDtlDto.JudgementResult = "不通过";
- }
- break;
- }
-
- StepIndex = 3;
- }
- /// <summary>
- /// 获取配置
- /// </summary>
- private void GetConfigOption()
- {
- var configList = _optionConfigService.QueryList();
- _optionConfigs = _mapper.Map<List<OptionConfig>, List<OptionConfigDto>>(configList);
- var tests = _optionConfigs.FindAll(x => x.TypeID == 1);
- TestKinds = new List<string>();
- foreach (var test in tests)
- {
- TestKinds.Add(test.ContentOption);
- }
- //测试项类型
- var judges = _optionConfigs.FindAll(x => x.TypeID == 2);
- foreach (var judge in judges)
- {
- BeforeJudgeKinds.Add(judge.ContentOption);
- InJudgeKinds.Add(judge.ContentOption);
- OutJudgeKinds.Add(judge.ContentOption);
- }
- //判定逻辑
- var logics = _optionConfigs.FindAll(x => x.TypeID == 3);
- foreach (var logic in logics)
- {
- JudgeLogicKinds.Add(logic.ContentOption);
- InJudgeLogicKinds.Add(logic.ContentOption);
- OutJudgeLogicKinds.Add(logic.ContentOption);
- }
- }
- /// <summary>
- /// 关闭按钮
- /// </summary>
- private void Close()
- {
- MessageBoxResult boxResult = MessageBox.Show("确认退出自动测试", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
- if (boxResult == MessageBoxResult.OK)
- {
-
- RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
- }
-
- }
- /// <summary>
- /// mode转json
- /// </summary>
- /// <param name="itemType"></param>
- /// <param name="itemLogical"></param>
- /// <param name="description"></param>
- /// <param name="conList"></param>
- /// <returns></returns>
- private string ModelToJsonToStr(string itemType, string itemLogical, string description, ObservableCollection<BasPlcItemConfigDto> conList)
- {
- JsonModel prefixJsonModel = new JsonModel();
- prefixJsonModel.ItemType = itemType;
- prefixJsonModel.ItemLogical = itemLogical;
- prefixJsonModel.Description = description;
- prefixJsonModel.DetailInfo = new List<DetailPLC>();
- foreach (var item in conList)
- {
- DetailPLC plcItem = new DetailPLC();
- plcItem.Id = item.Id;
- plcItem.PlcItem = item.PlcItem;
- plcItem.PlcAddress = item.PlcAddress;
- plcItem.PlcAddType = item.PlcAddType;
- plcItem.PlcValue = item.PlcValue;
- plcItem.RealValue = item.RealValue;
- plcItem.TestTime = item.TestTime;
- plcItem.TestResult = item.TestResult;
- plcItem.Remark = item.Remark;
- prefixJsonModel.DetailInfo.Add(plcItem);
- }
- string prefixJsonStr = JsonConvert.SerializeObject(prefixJsonModel);
- return prefixJsonStr;
- }
- #endregion
- #region 命令绑定
- public DelegateCommand CloseCommand { set; get; }
- public DelegateCommand<object> StartCommand { set; get; }
- public DelegateCommand<object> PreviousCommand { set; get; }
- public DelegateCommand<object> NextCommand { set; get; }
- public DelegateCommand<object> DoneCommand { set; get; }
- public DelegateCommand ItemChangeCommand { set; get; }
- public DelegateCommand ResetCommand { set; get; }
-
- #endregion
- #region 变量绑定
- /// <summary>
- /// 测试方案编码
- /// </summary>
- private string scheduleName;
- public string ScheduleName
- {
- get { return scheduleName; }
- set { scheduleName = value; RaisePropertyChanged(); }
- }
- /// <summary>
- /// 设备名称
- /// </summary>
- private string deviceKindName;
- public string DeviceKindName
- {
- get { return deviceKindName; }
- set { deviceKindName = value; RaisePropertyChanged(); }
- }
- /// <summary>
- /// 测试项名称
- /// </summary>
- private string testName;
- public string TestName
- {
- get { return testName; }
- set { testName = value; RaisePropertyChanged(); }
- }
- /// <summary>
- /// 测试项类型
- /// </summary>
- private List<string> testKinds = new List<string>();
- public List<string> TestKinds
- {
- get { return testKinds; }
- set { testKinds = value; RaisePropertyChanged(); }
- }
- /// <summary>
- ///
- /// </summary>
- private string selectTest;
- public string SelectTest
- {
- get { return selectTest; }
- set { selectTest = value; RaisePropertyChanged(); }
- }
- /// <summary>
- /// 判定类型(前置项)
- /// </summary>
- private List<string> beforeJudgeKinds = new List<string>();
- public List<string> BeforeJudgeKinds
- {
- get { return beforeJudgeKinds; }
- set { beforeJudgeKinds = value; RaisePropertyChanged(); }
- }
- private string beforeSelectJudge;
- public string BeforeSelectJudge
- {
- get { return beforeSelectJudge; }
- set { beforeSelectJudge = value; RaisePropertyChanged(); }
- }
- /// <summary>
- /// 逻辑判断
- /// </summary>
- private List<string> judgeLogicKinds = new List<string>();
- public List<string> JudgeLogicKinds
- {
- get { return judgeLogicKinds; }
- set { judgeLogicKinds = value; RaisePropertyChanged(); }
- }
- private string selectLogic;
- public string SelectLogic
- {
- get { return selectLogic; }
- set { selectLogic = value; RaisePropertyChanged(); }
- }
- private string beforeDetail;
- public string BeforeDetail
- {
- get { return beforeDetail; }
- set { beforeDetail = value; RaisePropertyChanged(); }
- }
- private ObservableCollection<BasPlcItemConfigDto> beforeConList;
- public ObservableCollection<BasPlcItemConfigDto> BeforeConList
- {
- get { return beforeConList; }
- set { beforeConList = value; RaisePropertyChanged(); }
- }
- /// <summary>
- /// 判定类型(输入项)
- /// </summary>
- private List<string> inJudgeKinds = new List<string>();
- public List<string> InJudgeKinds
- {
- get { return inJudgeKinds; }
- set { inJudgeKinds = value; RaisePropertyChanged(); }
- }
- private string selectInJudge;
- public string SelectInJudge
- {
- get { return selectInJudge; }
- set { selectInJudge = value; RaisePropertyChanged(); }
- }
- /// <summary>
- /// 逻辑判断
- /// </summary>
- private List<string> inJudgeLogicKinds = new List<string>();
- public List<string> InJudgeLogicKinds
- {
- get { return inJudgeLogicKinds; }
- set { inJudgeLogicKinds = value; RaisePropertyChanged(); }
- }
- private string inSelectLogic;
- public string InSelectLogic
- {
- get { return inSelectLogic; }
- set { inSelectLogic = value; RaisePropertyChanged(); }
- }
- private string inDetail;
- public string InDetail
- {
- get { return inDetail; }
- set { inDetail = value; RaisePropertyChanged(); }
- }
- private ObservableCollection<BasPlcItemConfigDto> inConList;
- public ObservableCollection<BasPlcItemConfigDto> InConList
- {
- get { return inConList; }
- set { inConList = value; RaisePropertyChanged(); }
- }
- /// <summary>
- /// 判定类型(结果项)
- /// </summary>
- private List<string> outJudgeKinds = new List<string>();
- public List<string> OutJudgeKinds
- {
- get { return outJudgeKinds; }
- set { outJudgeKinds = value; RaisePropertyChanged(); }
- }
- private string selectOutJudge;
- public string SelectOutJudge
- {
- get { return selectOutJudge; }
- set { selectOutJudge = value; RaisePropertyChanged(); }
- }
- /// <summary>
- /// 逻辑判断
- /// </summary>
- private List<string> outJudgeLogicKinds = new List<string>();
- public List<string> OutJudgeLogicKinds
- {
- get { return outJudgeLogicKinds; }
- set { outJudgeLogicKinds = value; RaisePropertyChanged(); }
- }
- private string outSelectLogic;
- public string OutSelectLogic
- {
- get { return outSelectLogic; }
- set { outSelectLogic = value; RaisePropertyChanged(); }
- }
- private string outDetail;
- public string OutDetail
- {
- get { return outDetail; }
- set { outDetail = value; RaisePropertyChanged(); }
- }
- private ObservableCollection<BasPlcItemConfigDto> outConList;
- public ObservableCollection<BasPlcItemConfigDto> OutConList
- {
- get { return outConList; }
- set { outConList = value; RaisePropertyChanged(); }
- }
- private int stepIndex = 0;
- public int StepIndex
- {
- get { return stepIndex; }
- set { stepIndex = value; RaisePropertyChanged(); }
- }
- private Visibility proVisibility =Visibility.Hidden;
- public Visibility ProVisibility
- {
- get { return proVisibility; }
- set { proVisibility = value; RaisePropertyChanged(); }
- }
- private bool startEnalbe = true;
- public bool StartEnalbe
- {
- get { return startEnalbe; }
- set { startEnalbe = value; RaisePropertyChanged(); }
- }
- //所有测试项列表
- private List<string> schItems = new List<string>();
- public List<string> SchItems
- {
- get { return schItems; }
- set { schItems = value; RaisePropertyChanged(); }
- }
- //所选测试方案
- private string selectItem;
- public string SelectItem
- {
- get { return selectItem; }
- set { selectItem = value; RaisePropertyChanged(); }
- }
- private int selectItemIndex;
- public int SelectItemIndex
- {
- get { return selectItemIndex; }
- set { selectItemIndex = value; RaisePropertyChanged(); }
- }
-
- #endregion
- }
- }
|