ManualTestViewModel.cs 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444
  1. using AutoMapper;
  2. using BizService;
  3. using Microsoft.Extensions.Logging;
  4. using Model.Dto;
  5. using Model.Entities;
  6. using NetTaste;
  7. using Newtonsoft.Json;
  8. using OmronFinsTCP.Net;
  9. using PLCTool.Common;
  10. using Prism.Commands;
  11. using Prism.Events;
  12. using Prism.Mvvm;
  13. using Prism.Services.Dialogs;
  14. using System;
  15. using System.Collections.Generic;
  16. using System.Collections.ObjectModel;
  17. using System.Configuration;
  18. using System.Linq;
  19. using System.Text;
  20. using System.Threading.Tasks;
  21. using System.Windows;
  22. using WPFDevelopers.Controls.Runtimes.Shell32;
  23. using static System.Windows.Forms.VisualStyles.VisualStyleElement.ListView;
  24. namespace PLCTool.ViewModels.BusinessManageViewModel
  25. {
  26. public class ManualTestViewModel : BindableBase, IDialogAware
  27. {
  28. private readonly IDialogService _dialog;
  29. private readonly IEventAggregator _aggregator;
  30. private readonly IOptionConfigService _optionConfigService;
  31. private readonly IBasicPlcTestSchemeService _basicPlcTestSchemeService;
  32. private readonly IBasicPlcTestSchemeDtlService _basicPlcTestSchemeDtlService;
  33. private readonly IBizTestRecordService _iBizTestRecordService;
  34. private readonly IBizTestRecordDtlService _iBizTestRecordDtlService;
  35. private readonly IMapper _mapper;
  36. private readonly ILogger _logger;
  37. private List<OptionConfigDto> _optionConfigs;
  38. private DateTime startTime= DateTime.Now;
  39. private DateTime endTime=DateTime.Now;
  40. private int testStatus = 0; //测试状态
  41. private int testResult = 0; //测试结果
  42. private long schId = 0; //方案ID
  43. private long globalSchDetailId = 0; //测试方案明细ID
  44. private BizTestRecordDtlDto bizTestRecordDtlDto = new BizTestRecordDtlDto(); //测试方案明细表
  45. private const string TestMode = "手动测试";
  46. private int delayTime = 20;
  47. public ManualTestViewModel(IDialogService dialog, IEventAggregator aggregator, IOptionConfigService optionConfigService, IBasicPlcTestSchemeService basicPlcTestSchemeService, IBasicPlcTestSchemeDtlService basicPlcTestSchemeDtlService, IBizTestRecordService iBizTestRecordService, IBizTestRecordDtlService iBizTestRecordDtlService,IMapper mapper,ILogger logger)
  48. {
  49. _dialog = dialog;
  50. _aggregator = aggregator;
  51. _optionConfigService = optionConfigService;
  52. _basicPlcTestSchemeService = basicPlcTestSchemeService;
  53. _basicPlcTestSchemeDtlService = basicPlcTestSchemeDtlService;
  54. _iBizTestRecordDtlService = iBizTestRecordDtlService;
  55. _iBizTestRecordService= iBizTestRecordService;
  56. _mapper = mapper;
  57. _logger = logger;
  58. CloseCommand = new DelegateCommand(Close);
  59. StartCommand = new DelegateCommand<object>(Start);
  60. PreviousCommand = new DelegateCommand<object>(Previous);
  61. NextCommand = new DelegateCommand<object>(Next);
  62. DoneCommand = new DelegateCommand<object>(Done);
  63. ItemChangeCommand = new DelegateCommand(ItemChange);
  64. BeforeConList = new ObservableCollection<BasPlcItemConfigDto>();
  65. InConList = new ObservableCollection<BasPlcItemConfigDto>();
  66. OutConList = new ObservableCollection<BasPlcItemConfigDto>();
  67. GetConfigOption();
  68. }
  69. private void ItemChange()
  70. {
  71. var findDtlMsg = _basicPlcTestSchemeDtlService.FindAllBySchId(schId)?.FirstOrDefault(X => X.item_name == SelectItem);
  72. if(findDtlMsg != null)
  73. {
  74. int id = Convert.ToInt32(findDtlMsg.scheme_dtl_id);
  75. // 根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
  76. globalSchDetailId = id;
  77. GetDetailInfo(id);
  78. }
  79. }
  80. #region idialog接口实现
  81. public string Title { set; get; } = "手动测试";
  82. public event Action<IDialogResult> RequestClose;
  83. public bool CanCloseDialog()
  84. {
  85. return true;
  86. }
  87. public void OnDialogClosed()
  88. {
  89. }
  90. public void OnDialogOpened(IDialogParameters parameters)
  91. {
  92. //编辑
  93. var getMsg = parameters.GetValues<long>("Key");
  94. ///值不为空,表示修改
  95. if (getMsg != null)
  96. {
  97. foreach (var item in getMsg)
  98. {
  99. //测试方案号
  100. schId = item;
  101. var schDtls=_basicPlcTestSchemeDtlService.FindAllBySchId(schId).OrderBy(x => x.scheme_dtl_id).ToList(); ;
  102. foreach(var sch in schDtls)
  103. {
  104. long dtlId = sch.scheme_dtl_id;
  105. SchItems.Add(sch.item_name);
  106. }
  107. //默认显示第一个测试项的信息
  108. if(schDtls.Count!=0)
  109. {
  110. int id = Convert.ToInt32(schDtls[0].scheme_dtl_id);
  111. globalSchDetailId = id;
  112. // 根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
  113. GetDetailInfo(id);
  114. SelectItemIndex = 0;
  115. }
  116. //globalSchDetailId = item; //测试方案明细ID
  117. //int id = Convert.ToInt32(item);
  118. //// 根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
  119. //GetDetailInfo(id);
  120. }
  121. }
  122. }
  123. /// <summary>
  124. /// //根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
  125. /// </summary>
  126. /// <param name="id"></param>
  127. private void GetDetailInfo(int schDetailId)
  128. {
  129. //根据 测试方案明细主键ID 查找测试方案id 及方案名和设备名
  130. var findEntity = _basicPlcTestSchemeDtlService.Find(schDetailId);
  131. var findresult = _mapper.Map<bas_plc_test_scheme_dtl, BasicPlcTestSchemeDtlDto>(findEntity);
  132. if (findresult != null)
  133. {
  134. //根据方案id 在方案表中查找方案名 设备名
  135. schId = findresult.SchemeId.Value; //方案id,方便下一步查找
  136. int intSchId = Convert.ToInt32(findresult.SchemeId);
  137. var findSch = _basicPlcTestSchemeService.Find(intSchId);
  138. if (findSch != null)
  139. {
  140. ScheduleName = findSch.scheme_name;
  141. DeviceKindName = findSch.devicekind_name;
  142. }
  143. TestName = findresult.ItemName;
  144. SelectTest = findresult.ItemType;
  145. //前置项解析
  146. string preconStr = findresult.Precondition.ToString();
  147. if (!string.IsNullOrEmpty(preconStr))
  148. {
  149. JsonModel preconditionModel = JsonConvert.DeserializeObject<JsonModel>(preconStr);
  150. BeforeSelectJudge = preconditionModel.ItemType;
  151. SelectLogic = preconditionModel.ItemLogical;
  152. BeforeDetail = preconditionModel.Description;
  153. BeforeConList.Clear();
  154. foreach (var detail in preconditionModel.DetailInfo)
  155. {
  156. BasPlcItemConfigDto basPlcItemConfigDto = new BasPlcItemConfigDto();
  157. basPlcItemConfigDto.Id=detail.Id;
  158. basPlcItemConfigDto.PlcItem = detail.PlcItem;
  159. basPlcItemConfigDto.PlcAddress = detail.PlcAddress;
  160. basPlcItemConfigDto.PlcAddType = detail.PlcAddType;
  161. basPlcItemConfigDto.PlcValue = detail.PlcValue;
  162. basPlcItemConfigDto.Remark = detail.Remark;
  163. BeforeConList.Add(basPlcItemConfigDto);
  164. }
  165. }
  166. //输入项解析
  167. string inStr = findresult.Action.ToString();
  168. if (!string.IsNullOrEmpty(inStr))
  169. {
  170. JsonModel inModel = JsonConvert.DeserializeObject<JsonModel>(inStr);
  171. SelectInJudge = inModel.ItemType;
  172. InSelectLogic = inModel.ItemLogical;
  173. InDetail = inModel.Description;
  174. InConList.Clear();
  175. foreach (var detail in inModel.DetailInfo)
  176. {
  177. BasPlcItemConfigDto basPlcItemConfigDto = new BasPlcItemConfigDto();
  178. basPlcItemConfigDto.Id = detail.Id;
  179. basPlcItemConfigDto.PlcItem = detail.PlcItem;
  180. basPlcItemConfigDto.PlcAddress = detail.PlcAddress;
  181. basPlcItemConfigDto.PlcAddType = detail.PlcAddType;
  182. basPlcItemConfigDto.PlcValue = detail.PlcValue;
  183. basPlcItemConfigDto.Remark = detail.Remark;
  184. InConList.Add(basPlcItemConfigDto);
  185. }
  186. }
  187. //输出项解析
  188. string outStr = findresult.JudgementResult.ToString();
  189. if (!string.IsNullOrEmpty(outStr))
  190. {
  191. JsonModel outModel = JsonConvert.DeserializeObject<JsonModel>(outStr);
  192. SelectOutJudge = outModel.ItemType;
  193. OutSelectLogic = outModel.ItemLogical;
  194. OutDetail = outModel.Description;
  195. OutConList.Clear();
  196. foreach (var detail in outModel.DetailInfo)
  197. {
  198. BasPlcItemConfigDto basPlcItemConfigDto = new BasPlcItemConfigDto();
  199. basPlcItemConfigDto.Id = detail.Id;
  200. basPlcItemConfigDto.PlcItem = detail.PlcItem;
  201. basPlcItemConfigDto.PlcAddress = detail.PlcAddress;
  202. basPlcItemConfigDto.PlcAddType = detail.PlcAddType;
  203. basPlcItemConfigDto.PlcValue = detail.PlcValue;
  204. basPlcItemConfigDto.Remark = detail.Remark;
  205. OutConList.Add(basPlcItemConfigDto);
  206. }
  207. }
  208. }
  209. }
  210. #endregion
  211. #region 私有发方法
  212. /// <summary>
  213. /// 增加或更新测试记录
  214. /// </summary>
  215. private void AddTestRecord()
  216. {
  217. //记录记录主表中是否有这个方案的记录,没有则添加
  218. var findRecord = _iBizTestRecordService.FindRecorddBySchname(ScheduleName);
  219. if (findRecord == null)
  220. {
  221. //状态status 没有赋值
  222. BizTestRecordDto bizTestRecordDto = new BizTestRecordDto();
  223. bizTestRecordDto.RecordName = ScheduleName + "_Record";
  224. bizTestRecordDto.SchemeName = ScheduleName;
  225. bizTestRecordDto.Tester = Appsession.UserName;
  226. bizTestRecordDto.StartTestTime = startTime;
  227. bizTestRecordDto.FinishTestTime = endTime;
  228. bizTestRecordDto.CreateBy = Appsession.UserName;
  229. bizTestRecordDto.CreateTime = DateTime.Now;
  230. bizTestRecordDto.UpdateBy = Appsession.UserName;
  231. bizTestRecordDto.UpdateTime = DateTime.Now;
  232. var testRecord = _mapper.Map<BizTestRecordDto, biz_test_record>(bizTestRecordDto);
  233. _iBizTestRecordService.Add(testRecord);
  234. }
  235. }
  236. /// <summary>
  237. /// 增加测试记录明细
  238. /// </summary>
  239. private void AddOrEditTesDtltRecord(long schDetailId)
  240. {
  241. //查找record ID
  242. long recordId = 0;
  243. var findRecordID = _iBizTestRecordService.FindRecorddBySchname(ScheduleName);
  244. if (findRecordID != null)
  245. {
  246. recordId = findRecordID.record_id;
  247. }
  248. testStatus = 99;//测试状态赋值为99
  249. //状态status 没有赋值
  250. //记录记录明细表中是否有这个方案明细ID的记录,没有则添加,有则更新记录状态
  251. var findRecordDetail = _iBizTestRecordDtlService.FindRecordDetailBySchDtlID(schDetailId);
  252. if (findRecordDetail == null)
  253. {
  254. BizTestRecordDtlDto newBizTestEwDetail=new BizTestRecordDtlDto();
  255. newBizTestEwDetail.RecordId = recordId;
  256. newBizTestEwDetail.SchemeDtlId = schDetailId;
  257. newBizTestEwDetail.StartTestTime = startTime;
  258. newBizTestEwDetail.FinishTestTime = endTime;
  259. newBizTestEwDetail.TestMode = TestMode;
  260. newBizTestEwDetail.Status = testStatus;
  261. newBizTestEwDetail.TestResult = GetTestResult();
  262. newBizTestEwDetail.CreateBy = Appsession.UserName;
  263. newBizTestEwDetail.CreateTime = startTime;
  264. newBizTestEwDetail.UpdateBy = Appsession.UserName;
  265. newBizTestEwDetail.UpdateTime = DateTime.Now;
  266. var testRecordDtl = _mapper.Map<BizTestRecordDtlDto, biz_test_record_dtl>(newBizTestEwDetail);
  267. _iBizTestRecordDtlService.Add(testRecordDtl);
  268. }
  269. else
  270. {
  271. bizTestRecordDtlDto.RecordDtlId = findRecordDetail.record_dtl_id;
  272. bizTestRecordDtlDto.RecordId = recordId;
  273. bizTestRecordDtlDto.SchemeDtlId = schDetailId;
  274. bizTestRecordDtlDto.StartTestTime = startTime;
  275. bizTestRecordDtlDto.FinishTestTime = endTime;
  276. bizTestRecordDtlDto.TestMode = TestMode;
  277. bizTestRecordDtlDto.Status = testStatus;
  278. bizTestRecordDtlDto.TestResult = GetTestResult();
  279. bizTestRecordDtlDto.CreateBy = Appsession.UserName;
  280. bizTestRecordDtlDto.CreateTime = startTime;
  281. bizTestRecordDtlDto.UpdateBy = Appsession.UserName;
  282. bizTestRecordDtlDto.UpdateTime = DateTime.Now;
  283. //更新时间
  284. bizTestRecordDtlDto.UpdateBy = Appsession.UserName;
  285. bizTestRecordDtlDto.UpdateTime = DateTime.Now;
  286. UpdateTesDtltRecord();
  287. }
  288. }
  289. /// <summary>
  290. /// 判定结果
  291. /// </summary>
  292. /// <returns></returns>
  293. private int GetTestResult()
  294. {
  295. //前置项
  296. int beforeResult = 0;
  297. int inResult= 0;
  298. int outResult = 0;
  299. if(BeforeConList.Count==0)
  300. {
  301. beforeResult = 1;
  302. }
  303. else
  304. {
  305. if (SelectLogic == "OR")
  306. {
  307. var find = BeforeConList.FirstOrDefault(x => x.TestResult == "通过");
  308. if (find != null)
  309. {
  310. beforeResult = 1;
  311. }
  312. else
  313. {
  314. beforeResult = 0;
  315. }
  316. }
  317. else
  318. {
  319. if (SelectLogic == "AND" || SelectLogic == "ONLY")
  320. {
  321. var find = BeforeConList.FirstOrDefault(x => x.TestResult == "不通过");
  322. if (find != null)
  323. {
  324. beforeResult = 0;
  325. }
  326. }
  327. else
  328. {
  329. if (SelectLogic == "NULL")
  330. {
  331. beforeResult = 1;
  332. }
  333. }
  334. }
  335. }
  336. //输入项
  337. if(InConList.Count==0)
  338. {
  339. inResult = 1;
  340. }
  341. else
  342. {
  343. if (InSelectLogic == "OR")
  344. {
  345. var find = InConList.FirstOrDefault(x => x.TestResult == "通过");
  346. if (find != null)
  347. {
  348. inResult = 1;
  349. }
  350. else
  351. {
  352. inResult = 0;
  353. }
  354. }
  355. else
  356. {
  357. if (InSelectLogic == "AND" || InSelectLogic == "ONLY")
  358. {
  359. var find = InConList.FirstOrDefault(x => x.TestResult == "不通过");
  360. if (find != null)
  361. {
  362. inResult = 0;
  363. }
  364. else
  365. {
  366. inResult = 1;
  367. }
  368. }
  369. else
  370. {
  371. if (InSelectLogic == "NULL")
  372. {
  373. inResult = 1;
  374. }
  375. }
  376. }
  377. }
  378. //输出项
  379. if(OutConList.Count==0)
  380. {
  381. outResult = 1;
  382. }
  383. else
  384. {
  385. if (OutSelectLogic == "OR")
  386. {
  387. var find = OutConList.FirstOrDefault(x => x.TestResult == "通过");
  388. if (find != null)
  389. {
  390. outResult = 1;
  391. }
  392. else
  393. {
  394. outResult = 0;
  395. }
  396. }
  397. else
  398. {
  399. if (OutSelectLogic == "AND" || OutSelectLogic == "ONLY")
  400. {
  401. var find = OutConList.FirstOrDefault(x => x.TestResult == "不通过");
  402. if (find != null)
  403. {
  404. outResult = 0;
  405. }
  406. else
  407. {
  408. outResult = 1;
  409. }
  410. }
  411. else
  412. {
  413. if (OutSelectLogic == "NULL")
  414. {
  415. outResult = 1;
  416. }
  417. }
  418. }
  419. }
  420. if(beforeResult==1&&inResult==1&&outResult==1)
  421. {
  422. return 1;
  423. }
  424. else
  425. {
  426. return 0;
  427. }
  428. }
  429. /// <summary>
  430. /// 更新测试记录
  431. /// </summary>
  432. private void UpdateTesDtltRecord()
  433. {
  434. var testRecordDtl = _mapper.Map<BizTestRecordDtlDto, biz_test_record_dtl>(bizTestRecordDtlDto);
  435. _iBizTestRecordDtlService.Edit(testRecordDtl);
  436. }
  437. /// <summary>
  438. /// 完成时间
  439. /// </summary>
  440. /// <param name="obj"></param>
  441. private void Done(object obj)
  442. {
  443. endTime = DateTime.Now;
  444. RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
  445. }
  446. private void Next(object obj)
  447. {
  448. StepIndex = 0;
  449. ///查找方案下的所有方案明细,并排序,
  450. var basicSchDtls = _basicPlcTestSchemeDtlService.FindAllBySchId(schId)?.OrderBy(x=>x.scheme_dtl_id);
  451. foreach(var item in basicSchDtls)
  452. {
  453. //在测试结果明细中查看
  454. long schDetailId = item.scheme_dtl_id;
  455. if(schDetailId>globalSchDetailId)
  456. {
  457. globalSchDetailId = schDetailId;
  458. int id = Convert.ToInt32(schDetailId);
  459. SelectItemIndex++;
  460. //界面显示
  461. GetDetailInfo(id);
  462. //记录记录明细表中是否有这个方案明细ID的记录,没有则添加,有则更新记录状态
  463. break;
  464. }
  465. long maxDtlId = basicSchDtls.Select(x => x.scheme_dtl_id).Max();
  466. if (globalSchDetailId == maxDtlId)
  467. {
  468. MessageBox.Show("已是此测试方案最后一个测试项!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
  469. break;
  470. }
  471. }
  472. }
  473. private void Previous(object obj)
  474. {
  475. StepIndex = 0;
  476. ///查找方案下的所有方案明细,并排序,
  477. var basicSchDtls = _basicPlcTestSchemeDtlService.FindAllBySchId(schId)?.OrderByDescending(x => x.scheme_dtl_id);
  478. foreach (var item in basicSchDtls)
  479. {
  480. //在测试结果明细中查看
  481. long schDetailId = item.scheme_dtl_id;
  482. if (schDetailId< globalSchDetailId)
  483. {
  484. globalSchDetailId = schDetailId;
  485. int id = Convert.ToInt32(schDetailId);
  486. SelectItemIndex--;
  487. //界面显示
  488. GetDetailInfo(id);
  489. //记录记录明细表中是否有这个方案明细ID的记录,没有则添加,有则更新记录状态
  490. break;
  491. }
  492. }
  493. long maxDtlId = basicSchDtls.Select(x => x.scheme_dtl_id).Min();
  494. if (globalSchDetailId == maxDtlId)
  495. {
  496. SelectItemIndex = 0;
  497. MessageBox.Show("已是此测试方案的第一个测试项!", "确认", MessageBoxButton.OK, MessageBoxImage.Information);
  498. }
  499. }
  500. /// <summary>
  501. /// 开始检测
  502. /// </summary>
  503. /// <param name="obj"></param>
  504. private async void Start(object obj)
  505. {
  506. StartEnalbe = false;
  507. _logger.LogInformation($"开始手动测试。方案名{ScheduleName},测试项{TestName}");
  508. //开始时间
  509. startTime = DateTime.Now;
  510. //增加测试记录主表
  511. AddTestRecord();
  512. //前置项
  513. bool preBool=TestPreceditionMethod();
  514. if(!preBool)
  515. {
  516. StepIndex = 0;
  517. StartEnalbe = true;
  518. return;
  519. }
  520. //输入项
  521. bool isAction=TestActionMethod();
  522. if (!isAction)
  523. {
  524. StepIndex = 0;
  525. StartEnalbe = true;
  526. return;
  527. }
  528. //输出项
  529. bool isJudgeResult=await TestJudgementMethod();
  530. if (!isJudgeResult)
  531. {
  532. StepIndex = 0;
  533. StartEnalbe = true;
  534. return;
  535. }
  536. _logger.LogInformation($"手动测试完成。方案名{ScheduleName},测试项{TestName}");
  537. StartEnalbe = true;
  538. }
  539. /// <summary>
  540. /// 更新测试结果
  541. /// </summary>
  542. private void UpdateTestRecord()
  543. {
  544. }
  545. /// <summary>
  546. /// 测试前置项目
  547. /// </summary>
  548. private bool TestPreceditionMethod()
  549. {
  550. switch (BeforeSelectJudge)
  551. {
  552. case "人工判定":
  553. //弹出确认的对话框
  554. if(string.IsNullOrEmpty(BeforeDetail))
  555. {
  556. return true;
  557. }
  558. MessageBoxResult boxResult = MessageBox.Show(BeforeDetail, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
  559. if (boxResult == MessageBoxResult.OK)
  560. {
  561. //前置项测试结果json转化
  562. string prefixJsonStr = ModelToJsonToStr(BeforeSelectJudge, SelectLogic, BeforeDetail, BeforeConList);
  563. //json字符串
  564. bizTestRecordDtlDto.PreconditionFinal = prefixJsonStr;
  565. bizTestRecordDtlDto.PreconditionResult = "通过";
  566. StepIndex = 1;
  567. }
  568. else
  569. {
  570. return false;
  571. }
  572. break;
  573. case "自动判定":
  574. //读取plc的值
  575. switch (SelectLogic)
  576. {
  577. case "NULL":
  578. //弹出确认的对话框
  579. if (string.IsNullOrEmpty(BeforeDetail))
  580. {
  581. return true;
  582. }
  583. MessageBoxResult boxResultAuto = MessageBox.Show(BeforeDetail, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
  584. if (boxResultAuto == MessageBoxResult.OK)
  585. {
  586. //前置项测试结果json转化
  587. string prefixJsonStr = ModelToJsonToStr(BeforeSelectJudge, SelectLogic, BeforeDetail, BeforeConList);
  588. //json字符串
  589. bizTestRecordDtlDto.PreconditionFinal = prefixJsonStr;
  590. bizTestRecordDtlDto.PreconditionResult = "通过";
  591. StepIndex = 1;
  592. }
  593. else
  594. {
  595. return false;
  596. }
  597. break;
  598. case "AND":
  599. case "ONLY":
  600. case "OR":
  601. ReadPredice(SelectLogic);
  602. break;
  603. case "ORDER":
  604. break;
  605. }
  606. break;
  607. }
  608. //更新测试记录
  609. AddOrEditTesDtltRecord(globalSchDetailId);
  610. return true;
  611. }
  612. private void ReadPredice(string strLogic)
  613. {
  614. int countCond = 0;
  615. foreach (var item in BeforeConList.OrderBy(x=>x.Id))
  616. {
  617. string plcAddress = item.PlcAddress;
  618. string plcAddType = item.PlcAddType;
  619. string plcValue = item.PlcValue;
  620. switch (plcAddType)
  621. {
  622. case "bool":
  623. string readResult = PLCCom.GetInstance().ReadPlcObject(plcAddress, VarType.Bit);
  624. ///实时值记录
  625. item.RealValue = readResult;
  626. item.TestTime = DateTime.Now;
  627. if (readResult.Trim() == plcValue?.Trim())
  628. {
  629. item.TestResult = "通过";
  630. countCond++;
  631. }
  632. else
  633. {
  634. item.TestResult = "不通过";
  635. }
  636. break;
  637. case "word":
  638. break;
  639. }
  640. }
  641. //测试记录存入数据库
  642. //前置项测试结果json转化
  643. string prefixJsonStr = ModelToJsonToStr(BeforeSelectJudge, SelectLogic, BeforeDetail, BeforeConList);
  644. //json字符串
  645. bizTestRecordDtlDto.PreconditionFinal = prefixJsonStr;
  646. //条件满足
  647. switch (strLogic)
  648. {
  649. case "AND":
  650. case "ONLY":
  651. if ((countCond == BeforeConList.Count) && (countCond != 0))
  652. {
  653. bizTestRecordDtlDto.PreconditionResult = "通过";
  654. }
  655. else
  656. {
  657. bizTestRecordDtlDto.PreconditionResult = "不通过";
  658. }
  659. break;
  660. case "OR":
  661. if ( (countCond != 0))
  662. {
  663. bizTestRecordDtlDto.PreconditionResult = "通过";
  664. }
  665. else
  666. {
  667. bizTestRecordDtlDto.PreconditionResult = "不通过";
  668. }
  669. break;
  670. }
  671. StepIndex = 1;
  672. }
  673. /// <summary>
  674. /// 输入项写入
  675. /// </summary>
  676. private bool TestActionMethod()
  677. {
  678. bool isActionResult = true;
  679. switch (SelectInJudge)
  680. {
  681. case "人工判定":
  682. //弹出确认的对话框
  683. MessageBoxResult boxResult = MessageBox.Show(InDetail, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
  684. if (boxResult == MessageBoxResult.OK)
  685. {
  686. //前置项测试结果json转化
  687. string actionJsonStr = ModelToJsonToStr(SelectInJudge, InSelectLogic, InDetail, InConList);
  688. //json字符串
  689. bizTestRecordDtlDto.ActionFinal = actionJsonStr;
  690. bizTestRecordDtlDto.ActionResult = "通过";
  691. StepIndex = 2;
  692. }
  693. else
  694. {
  695. isActionResult= false;
  696. }
  697. break;
  698. case "自动判定":
  699. //读取plc的值
  700. switch (InSelectLogic)
  701. {
  702. case "NULL":
  703. //弹出确认的对话框
  704. MessageBoxResult boxResultAction = MessageBox.Show(InDetail, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
  705. if (boxResultAction == MessageBoxResult.OK)
  706. {
  707. //前置项测试结果json转化
  708. string actionJsonStr = ModelToJsonToStr(SelectInJudge, InSelectLogic, InDetail, InConList);
  709. //json字符串
  710. bizTestRecordDtlDto.ActionFinal = actionJsonStr;
  711. bizTestRecordDtlDto.ActionResult = "通过";
  712. StepIndex = 2;
  713. }
  714. else
  715. {
  716. isActionResult = false;
  717. }
  718. break;
  719. case "AND":
  720. case "ONLY":
  721. case "OR":
  722. isActionResult =SendActionToPLC(InSelectLogic);
  723. break;
  724. case "ORDER":
  725. break;
  726. }
  727. break;
  728. }
  729. //更新测试记录
  730. //更新测试记录
  731. AddOrEditTesDtltRecord(globalSchDetailId);
  732. return isActionResult;
  733. }
  734. /// <summary>
  735. /// 发送命令给PLC
  736. /// </summary>
  737. private bool SendActionToPLC(string strActionLogic)
  738. {
  739. bool isAction = true;
  740. int countCond = 0;
  741. foreach (var item in InConList.OrderBy(x => x.Id))
  742. {
  743. string plcAddress = item.PlcAddress;
  744. string plcAddType = item.PlcAddType;
  745. string plcValue = item.PlcValue;
  746. switch (plcAddType)
  747. {
  748. case "bool":
  749. DialogParameters parm = new DialogParameters();
  750. parm.Add("Key", plcAddress);
  751. parm.Add("Key2", plcValue);
  752. //弹出写入对话框
  753. _dialog.ShowDialog("WritePLCView", parm, async callback =>
  754. {
  755. if (callback.Result == ButtonResult.OK)
  756. {
  757. string plcRealValue = callback.Parameters.GetValue<string>("ReturnValue");
  758. bool writeResult = PLCCom.GetInstance().WritePlcObject(plcAddress, VarType.Bit, plcRealValue);
  759. ///实时值记录
  760. item.RealValue = plcRealValue;
  761. item.TestTime = DateTime.Now;
  762. if (writeResult)
  763. {
  764. ///单个测试项通过
  765. item.TestResult = "通过";
  766. countCond++;
  767. }
  768. else
  769. {
  770. item.TestResult = "不通过";
  771. }
  772. }
  773. else
  774. {
  775. isAction= false;
  776. }
  777. });
  778. break;
  779. case "word":
  780. DialogParameters parm2 = new DialogParameters();
  781. parm2.Add("Key", plcAddress);
  782. parm2.Add("Key2", plcValue);
  783. //弹出写入对话框
  784. _dialog.ShowDialog("WritePLCView", parm2, async callback =>
  785. {
  786. if (callback.Result == ButtonResult.OK)
  787. {
  788. string plcRealValue = callback.Parameters.GetValue<string>("ReturnValue");
  789. bool writeResult = PLCCom.GetInstance().WritePlcObject(plcAddress, VarType.Word, plcRealValue);
  790. ///实时值记录
  791. item.RealValue = plcRealValue;
  792. item.TestTime = DateTime.Now;
  793. if (writeResult)
  794. {
  795. ///单个测试项通过
  796. item.TestResult = "通过";
  797. countCond++;
  798. }
  799. else
  800. {
  801. item.TestResult = "不通过";
  802. }
  803. }
  804. else
  805. {
  806. isAction = false;
  807. }
  808. });
  809. break;
  810. }
  811. }
  812. if(!isAction)
  813. {
  814. return isAction;
  815. }
  816. //测试记录存入数据库
  817. //前置项测试结果json转化
  818. string actionJsonStr = ModelToJsonToStr(SelectInJudge, InSelectLogic, InDetail, InConList);
  819. //json字符串
  820. bizTestRecordDtlDto.ActionFinal = actionJsonStr;
  821. //条件满足
  822. //条件满足
  823. switch (strActionLogic)
  824. {
  825. case "AND":
  826. case "ONLY":
  827. if ((countCond == BeforeConList.Count) && (countCond != 0))
  828. {
  829. bizTestRecordDtlDto.ActionResult = "通过";
  830. }
  831. else
  832. {
  833. bizTestRecordDtlDto.ActionResult = "不通过";
  834. }
  835. break;
  836. case "OR":
  837. if ((countCond != 0))
  838. {
  839. bizTestRecordDtlDto.ActionResult = "通过";
  840. }
  841. else
  842. {
  843. bizTestRecordDtlDto.ActionResult = "不通过";
  844. }
  845. break;
  846. }
  847. StepIndex = 2;
  848. return isAction;
  849. }
  850. /// <summary>
  851. /// 结果项判定
  852. /// </summary>
  853. private async Task<bool> TestJudgementMethod()
  854. {
  855. bool isJudge = true;
  856. switch (SelectOutJudge)
  857. {
  858. case "人工判定":
  859. //弹出确认的对话框
  860. MessageBoxResult boxResult = MessageBox.Show(OutDetail, "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
  861. if (boxResult == MessageBoxResult.OK)
  862. {
  863. bizTestRecordDtlDto.JudgementResult = "通过";
  864. StepIndex = 3;
  865. }
  866. else
  867. {
  868. isJudge = false;
  869. }
  870. break;
  871. case "自动判定":
  872. //读取plc的值
  873. switch (OutSelectLogic)
  874. {
  875. case "NULL":
  876. bizTestRecordDtlDto.JudgementResult = "通过";
  877. StepIndex = 3;
  878. break;
  879. case "AND":
  880. case "ONLY":
  881. case "OR":
  882. await ReadJudge(OutSelectLogic);
  883. break;
  884. case "ORDER":
  885. break;
  886. }
  887. break;
  888. }
  889. //更新测试记录
  890. //更新测试记录
  891. endTime = DateTime.Now;
  892. AddOrEditTesDtltRecord(globalSchDetailId);
  893. return isJudge;
  894. }
  895. /// <summary>
  896. /// 读取结果
  897. /// </summary>
  898. private async Task ReadJudge(String strLogic)
  899. {
  900. int countCond = 0;
  901. DateTime entryTime = DateTime.Now;
  902. foreach (var item in OutConList.OrderBy(x => x.Id))
  903. {
  904. string plcAddress = item.PlcAddress;
  905. string plcAddType = item.PlcAddType;
  906. string plcValue = item.PlcValue;
  907. switch (plcAddType)
  908. {
  909. case "bool":
  910. string readResult = string.Empty;
  911. //一直读
  912. await Task.Run(async () =>
  913. {
  914. while (entryTime.AddMilliseconds(delayTime * 1000) > DateTime.Now)
  915. {
  916. //显示进度条
  917. System.Windows.Application.Current.Dispatcher.Invoke((delegate
  918. {
  919. ProVisibility = Visibility.Visible;
  920. }));
  921. readResult = PLCCom.GetInstance().ReadPlcObject(plcAddress, VarType.Bit);
  922. if (readResult == item.PlcValue)
  923. {
  924. break;
  925. }
  926. await Task.Delay(1000);
  927. }
  928. });
  929. //可能有多个条件判定的,第二次时间到了直接跳出延时,直接读取,不用在延时20s
  930. readResult = PLCCom.GetInstance().ReadPlcObject(plcAddress, VarType.Bit);
  931. ProVisibility = Visibility.Hidden;
  932. ///实时值记录
  933. item.RealValue = readResult;
  934. item.TestTime = DateTime.Now;
  935. if (readResult.Trim() == plcValue?.Trim())
  936. {
  937. item.TestResult = "通过";
  938. countCond++;
  939. }
  940. else
  941. {
  942. item.TestResult = "不通过";
  943. }
  944. break;
  945. case "word":
  946. // DateTime entryTime2 = DateTime.Now;
  947. string readResult2 = string.Empty;
  948. //一直读
  949. await Task.Run(async () =>
  950. {
  951. while (entryTime.AddMilliseconds(delayTime * 1000) > DateTime.Now)
  952. {
  953. //显示进度条
  954. System.Windows.Application.Current.Dispatcher.Invoke((delegate
  955. {
  956. ProVisibility = Visibility.Visible;
  957. }));
  958. readResult2 = PLCCom.GetInstance().ReadPlcObject(plcAddress, VarType.Word);
  959. if (readResult2 == item.PlcValue)
  960. {
  961. break;
  962. }
  963. await Task.Delay(1000);
  964. }
  965. });
  966. //可能有多个条件判定的,第二次直接跳出延时,直接读取
  967. readResult2 = PLCCom.GetInstance().ReadPlcObject(plcAddress, VarType.Word);
  968. ProVisibility = Visibility.Hidden;
  969. ///实时值记录
  970. item.RealValue = readResult2;
  971. item.TestTime = DateTime.Now;
  972. if (readResult2.Trim() == plcValue?.Trim())
  973. {
  974. item.TestResult = "通过";
  975. countCond++;
  976. }
  977. else
  978. {
  979. item.TestResult = "不通过";
  980. }
  981. break;
  982. }
  983. }
  984. //测试记录存入数据库
  985. //输出项测试结果json转化
  986. string prefixJsonStr = ModelToJsonToStr(SelectOutJudge, OutSelectLogic, OutDetail, OutConList);
  987. //json字符串
  988. bizTestRecordDtlDto.JudgementResultFinal = prefixJsonStr;
  989. //条件满足
  990. switch(strLogic)
  991. {
  992. case "AND":
  993. case "ONLY":
  994. if ((countCond == OutConList.Count) && (countCond != 0))
  995. {
  996. bizTestRecordDtlDto.JudgementResult = "通过";
  997. }
  998. else
  999. {
  1000. bizTestRecordDtlDto.JudgementResult = "不通过";
  1001. }
  1002. break;
  1003. case "OR":
  1004. if ( countCond != 0)
  1005. {
  1006. bizTestRecordDtlDto.JudgementResult = "通过";
  1007. }
  1008. else
  1009. {
  1010. bizTestRecordDtlDto.JudgementResult = "不通过";
  1011. }
  1012. break;
  1013. }
  1014. StepIndex = 3;
  1015. }
  1016. /// <summary>
  1017. /// 获取配置
  1018. /// </summary>
  1019. private void GetConfigOption()
  1020. {
  1021. var configList = _optionConfigService.QueryList();
  1022. _optionConfigs = _mapper.Map<List<OptionConfig>, List<OptionConfigDto>>(configList);
  1023. var tests = _optionConfigs.FindAll(x => x.TypeID == 1);
  1024. TestKinds = new List<string>();
  1025. foreach (var test in tests)
  1026. {
  1027. TestKinds.Add(test.ContentOption);
  1028. }
  1029. //测试项类型
  1030. var judges = _optionConfigs.FindAll(x => x.TypeID == 2);
  1031. foreach (var judge in judges)
  1032. {
  1033. BeforeJudgeKinds.Add(judge.ContentOption);
  1034. InJudgeKinds.Add(judge.ContentOption);
  1035. OutJudgeKinds.Add(judge.ContentOption);
  1036. }
  1037. //判定逻辑
  1038. var logics = _optionConfigs.FindAll(x => x.TypeID == 3);
  1039. foreach (var logic in logics)
  1040. {
  1041. JudgeLogicKinds.Add(logic.ContentOption);
  1042. InJudgeLogicKinds.Add(logic.ContentOption);
  1043. OutJudgeLogicKinds.Add(logic.ContentOption);
  1044. }
  1045. }
  1046. /// <summary>
  1047. /// 关闭按钮
  1048. /// </summary>
  1049. private void Close()
  1050. {
  1051. MessageBoxResult boxResult = MessageBox.Show("确认退出自动测试", "确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);
  1052. if (boxResult == MessageBoxResult.OK)
  1053. {
  1054. RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
  1055. }
  1056. }
  1057. /// <summary>
  1058. /// mode转json
  1059. /// </summary>
  1060. /// <param name="itemType"></param>
  1061. /// <param name="itemLogical"></param>
  1062. /// <param name="description"></param>
  1063. /// <param name="conList"></param>
  1064. /// <returns></returns>
  1065. private string ModelToJsonToStr(string itemType, string itemLogical, string description, ObservableCollection<BasPlcItemConfigDto> conList)
  1066. {
  1067. JsonModel prefixJsonModel = new JsonModel();
  1068. prefixJsonModel.ItemType = itemType;
  1069. prefixJsonModel.ItemLogical = itemLogical;
  1070. prefixJsonModel.Description = description;
  1071. prefixJsonModel.DetailInfo = new List<DetailPLC>();
  1072. foreach (var item in conList)
  1073. {
  1074. DetailPLC plcItem = new DetailPLC();
  1075. plcItem.Id = item.Id;
  1076. plcItem.PlcItem = item.PlcItem;
  1077. plcItem.PlcAddress = item.PlcAddress;
  1078. plcItem.PlcAddType = item.PlcAddType;
  1079. plcItem.PlcValue = item.PlcValue;
  1080. plcItem.RealValue = item.RealValue;
  1081. plcItem.TestTime = item.TestTime;
  1082. plcItem.TestResult = item.TestResult;
  1083. plcItem.Remark = item.Remark;
  1084. prefixJsonModel.DetailInfo.Add(plcItem);
  1085. }
  1086. string prefixJsonStr = JsonConvert.SerializeObject(prefixJsonModel);
  1087. return prefixJsonStr;
  1088. }
  1089. #endregion
  1090. #region 命令绑定
  1091. public DelegateCommand CloseCommand { set; get; }
  1092. public DelegateCommand<object> StartCommand { set; get; }
  1093. public DelegateCommand<object> PreviousCommand { set; get; }
  1094. public DelegateCommand<object> NextCommand { set; get; }
  1095. public DelegateCommand<object> DoneCommand { set; get; }
  1096. public DelegateCommand ItemChangeCommand { set; get; }
  1097. #endregion
  1098. #region 变量绑定
  1099. /// <summary>
  1100. /// 测试方案编码
  1101. /// </summary>
  1102. private string scheduleName;
  1103. public string ScheduleName
  1104. {
  1105. get { return scheduleName; }
  1106. set { scheduleName = value; RaisePropertyChanged(); }
  1107. }
  1108. /// <summary>
  1109. /// 设备名称
  1110. /// </summary>
  1111. private string deviceKindName;
  1112. public string DeviceKindName
  1113. {
  1114. get { return deviceKindName; }
  1115. set { deviceKindName = value; RaisePropertyChanged(); }
  1116. }
  1117. /// <summary>
  1118. /// 测试项名称
  1119. /// </summary>
  1120. private string testName;
  1121. public string TestName
  1122. {
  1123. get { return testName; }
  1124. set { testName = value; RaisePropertyChanged(); }
  1125. }
  1126. /// <summary>
  1127. /// 测试项类型
  1128. /// </summary>
  1129. private List<string> testKinds = new List<string>();
  1130. public List<string> TestKinds
  1131. {
  1132. get { return testKinds; }
  1133. set { testKinds = value; RaisePropertyChanged(); }
  1134. }
  1135. /// <summary>
  1136. ///
  1137. /// </summary>
  1138. private string selectTest;
  1139. public string SelectTest
  1140. {
  1141. get { return selectTest; }
  1142. set { selectTest = value; RaisePropertyChanged(); }
  1143. }
  1144. /// <summary>
  1145. /// 判定类型(前置项)
  1146. /// </summary>
  1147. private List<string> beforeJudgeKinds = new List<string>();
  1148. public List<string> BeforeJudgeKinds
  1149. {
  1150. get { return beforeJudgeKinds; }
  1151. set { beforeJudgeKinds = value; RaisePropertyChanged(); }
  1152. }
  1153. private string beforeSelectJudge;
  1154. public string BeforeSelectJudge
  1155. {
  1156. get { return beforeSelectJudge; }
  1157. set { beforeSelectJudge = value; RaisePropertyChanged(); }
  1158. }
  1159. /// <summary>
  1160. /// 逻辑判断
  1161. /// </summary>
  1162. private List<string> judgeLogicKinds = new List<string>();
  1163. public List<string> JudgeLogicKinds
  1164. {
  1165. get { return judgeLogicKinds; }
  1166. set { judgeLogicKinds = value; RaisePropertyChanged(); }
  1167. }
  1168. private string selectLogic;
  1169. public string SelectLogic
  1170. {
  1171. get { return selectLogic; }
  1172. set { selectLogic = value; RaisePropertyChanged(); }
  1173. }
  1174. private string beforeDetail;
  1175. public string BeforeDetail
  1176. {
  1177. get { return beforeDetail; }
  1178. set { beforeDetail = value; RaisePropertyChanged(); }
  1179. }
  1180. private ObservableCollection<BasPlcItemConfigDto> beforeConList;
  1181. public ObservableCollection<BasPlcItemConfigDto> BeforeConList
  1182. {
  1183. get { return beforeConList; }
  1184. set { beforeConList = value; RaisePropertyChanged(); }
  1185. }
  1186. /// <summary>
  1187. /// 判定类型(输入项)
  1188. /// </summary>
  1189. private List<string> inJudgeKinds = new List<string>();
  1190. public List<string> InJudgeKinds
  1191. {
  1192. get { return inJudgeKinds; }
  1193. set { inJudgeKinds = value; RaisePropertyChanged(); }
  1194. }
  1195. private string selectInJudge;
  1196. public string SelectInJudge
  1197. {
  1198. get { return selectInJudge; }
  1199. set { selectInJudge = value; RaisePropertyChanged(); }
  1200. }
  1201. /// <summary>
  1202. /// 逻辑判断
  1203. /// </summary>
  1204. private List<string> inJudgeLogicKinds = new List<string>();
  1205. public List<string> InJudgeLogicKinds
  1206. {
  1207. get { return inJudgeLogicKinds; }
  1208. set { inJudgeLogicKinds = value; RaisePropertyChanged(); }
  1209. }
  1210. private string inSelectLogic;
  1211. public string InSelectLogic
  1212. {
  1213. get { return inSelectLogic; }
  1214. set { inSelectLogic = value; RaisePropertyChanged(); }
  1215. }
  1216. private string inDetail;
  1217. public string InDetail
  1218. {
  1219. get { return inDetail; }
  1220. set { inDetail = value; RaisePropertyChanged(); }
  1221. }
  1222. private ObservableCollection<BasPlcItemConfigDto> inConList;
  1223. public ObservableCollection<BasPlcItemConfigDto> InConList
  1224. {
  1225. get { return inConList; }
  1226. set { inConList = value; RaisePropertyChanged(); }
  1227. }
  1228. /// <summary>
  1229. /// 判定类型(结果项)
  1230. /// </summary>
  1231. private List<string> outJudgeKinds = new List<string>();
  1232. public List<string> OutJudgeKinds
  1233. {
  1234. get { return outJudgeKinds; }
  1235. set { outJudgeKinds = value; RaisePropertyChanged(); }
  1236. }
  1237. private string selectOutJudge;
  1238. public string SelectOutJudge
  1239. {
  1240. get { return selectOutJudge; }
  1241. set { selectOutJudge = value; RaisePropertyChanged(); }
  1242. }
  1243. /// <summary>
  1244. /// 逻辑判断
  1245. /// </summary>
  1246. private List<string> outJudgeLogicKinds = new List<string>();
  1247. public List<string> OutJudgeLogicKinds
  1248. {
  1249. get { return outJudgeLogicKinds; }
  1250. set { outJudgeLogicKinds = value; RaisePropertyChanged(); }
  1251. }
  1252. private string outSelectLogic;
  1253. public string OutSelectLogic
  1254. {
  1255. get { return outSelectLogic; }
  1256. set { outSelectLogic = value; RaisePropertyChanged(); }
  1257. }
  1258. private string outDetail;
  1259. public string OutDetail
  1260. {
  1261. get { return outDetail; }
  1262. set { outDetail = value; RaisePropertyChanged(); }
  1263. }
  1264. private ObservableCollection<BasPlcItemConfigDto> outConList;
  1265. public ObservableCollection<BasPlcItemConfigDto> OutConList
  1266. {
  1267. get { return outConList; }
  1268. set { outConList = value; RaisePropertyChanged(); }
  1269. }
  1270. private int stepIndex = 0;
  1271. public int StepIndex
  1272. {
  1273. get { return stepIndex; }
  1274. set { stepIndex = value; RaisePropertyChanged(); }
  1275. }
  1276. private Visibility proVisibility =Visibility.Hidden;
  1277. public Visibility ProVisibility
  1278. {
  1279. get { return proVisibility; }
  1280. set { proVisibility = value; RaisePropertyChanged(); }
  1281. }
  1282. private bool startEnalbe = true;
  1283. public bool StartEnalbe
  1284. {
  1285. get { return startEnalbe; }
  1286. set { startEnalbe = value; RaisePropertyChanged(); }
  1287. }
  1288. //所有测试项列表
  1289. private List<string> schItems = new List<string>();
  1290. public List<string> SchItems
  1291. {
  1292. get { return schItems; }
  1293. set { schItems = value; RaisePropertyChanged(); }
  1294. }
  1295. //所选测试方案
  1296. private string selectItem;
  1297. public string SelectItem
  1298. {
  1299. get { return selectItem; }
  1300. set { selectItem = value; RaisePropertyChanged(); }
  1301. }
  1302. private int selectItemIndex;
  1303. public int SelectItemIndex
  1304. {
  1305. get { return selectItemIndex; }
  1306. set { selectItemIndex = value; RaisePropertyChanged(); }
  1307. }
  1308. #endregion
  1309. }
  1310. }