ResultQueryViewModel.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. using AutoMapper;
  2. using BizService;
  3. using Microsoft.Extensions.Logging;
  4. using MiniExcelLibs;
  5. using Model.Dto;
  6. using Model.Entities;
  7. using PLCTool.Pdf;
  8. using Prism.Commands;
  9. using Prism.Mvvm;
  10. using Prism.Services.Dialogs;
  11. using QuestPDF.Infrastructure;
  12. using QuestPDF;
  13. using System;
  14. using System.Collections.Generic;
  15. using System.Collections.ObjectModel;
  16. using System.Linq;
  17. using System.Text;
  18. using System.Threading.Tasks;
  19. using Newtonsoft.Json;
  20. using QuestPDF.Fluent;
  21. using System.Windows;
  22. namespace PLCTool.ViewModels.BusinessManageViewModel
  23. {
  24. public class ResultQueryViewModel : BindableBase
  25. {
  26. private readonly IBasicDeviceService _iBasicDeviceService;
  27. private readonly IBasicDeviceKindService _iBasicDeviceKindService;
  28. private readonly IBasicProjectService _iBasicProjectService;
  29. private readonly IBasicPlcTestSchemeService _basicPlcTestSchemeService;
  30. private readonly IBizTestRecordDtlService _iBizTestRecordDtlService;
  31. private readonly IBizTestRecordService _iBizTestRecordService;
  32. private readonly IBasicPlcTestSchemeDtlService _iBasicPlcTestSchemeDtlService;
  33. private readonly IMapper _mapper;
  34. private readonly IDialogService _dialog;
  35. private readonly ILogger _logger;
  36. private List<DeviceDtlWithResultModel> allDeviceList = new List<DeviceDtlWithResultModel>();//所有方案
  37. private List<DeviceDtlWithResultModel> conditionDevices = new List<DeviceDtlWithResultModel>();//符合条件的方案
  38. public ResultQueryViewModel(IBasicDeviceService iBasicDeviceService, IBasicDeviceKindService iBasicDeviceKindService, IBasicProjectService iBasicProjectService, IBasicPlcTestSchemeService basicPlcTestSchemeService, IBizTestRecordDtlService iBizTestRecordDtlService, IBizTestRecordService iBizTestRecordService, IBasicPlcTestSchemeDtlService iBasicPlcTestSchemeDtlService, IMapper mapper, IDialogService dialog, ILogger logger)
  39. {
  40. _iBasicDeviceService = iBasicDeviceService;
  41. _iBasicDeviceKindService = iBasicDeviceKindService;
  42. _iBasicProjectService = iBasicProjectService;
  43. _basicPlcTestSchemeService = basicPlcTestSchemeService;
  44. _iBizTestRecordService= iBizTestRecordService;
  45. _iBizTestRecordDtlService= iBizTestRecordDtlService;
  46. _iBasicPlcTestSchemeDtlService = iBasicPlcTestSchemeDtlService;
  47. _mapper = mapper;
  48. _dialog = dialog;
  49. _logger = logger;
  50. QueryCommand = new DelegateCommand<object>(Query);
  51. ExportCommand = new DelegateCommand<string>(Export);
  52. CheckDetailCommand = new DelegateCommand<object>(CheckDetail);
  53. ResetCommand = new DelegateCommand<object>(Reset);
  54. OnLoadCommand = new DelegateCommand(OnLoad);
  55. PdfReportCommand = new DelegateCommand<object>(CreatePdf);
  56. UnqualifiedCommand = new DelegateCommand<object>(RetryTest);
  57. }
  58. #region 私有方法
  59. /// <summary>
  60. /// 重新测试不合格项
  61. /// </summary>
  62. /// <param name="obj"></param>
  63. private void RetryTest(object obj)
  64. {
  65. object[] multiObj = obj as object[];
  66. //测试方案明细主键ID
  67. long id = (long)multiObj[0];
  68. long deviceId = (long)multiObj[1];
  69. DialogParameters parm = new DialogParameters();
  70. parm.Add("Key", id);
  71. parm.Add("Key2", deviceId);
  72. //弹出详情对话框
  73. //弹出详情对话框
  74. _dialog.ShowDialog("RetryTestView", parm, async callback =>
  75. {
  76. if (callback.Result == ButtonResult.OK)
  77. {
  78. //更新表格,重新获取
  79. }
  80. });
  81. }
  82. /// <summary>
  83. /// 加载页面
  84. /// </summary>
  85. private void OnLoad()
  86. {
  87. DeviceKindNameList.Clear();
  88. DeviceKindNameList.Add("---");
  89. ProjectNameList.Clear();
  90. ProjectNameList.Add("---");
  91. var Kinds = _iBasicDeviceKindService.FindAllDeviceKind();
  92. foreach (var kind in Kinds)
  93. {
  94. DeviceKindNameList.Add(kind);
  95. }
  96. var projects = _iBasicProjectService.FindAllProject();
  97. foreach (var project in projects)
  98. {
  99. ProjectNameList.Add(project);
  100. }
  101. DeviceKindName = "---";
  102. ProjectName = "---";
  103. GetProjectConfig();
  104. }
  105. private void Reset(object obj)
  106. {
  107. DeviceNo = string.Empty;
  108. DeviceName = string.Empty;
  109. DeviceKindName = "---";
  110. ProjectName = "---";
  111. StartTime = string.Empty;
  112. EndTime = string.Empty;
  113. }
  114. /// <summary>
  115. /// 查看详情
  116. /// </summary>
  117. /// <param name="obj"></param>
  118. private void CheckDetail(object obj)
  119. {
  120. //测试方案明细主键ID
  121. long id = Convert.ToInt64(obj);
  122. DialogParameters parm = new DialogParameters();
  123. parm.Add("Key", id);
  124. //弹出详情对话框
  125. //弹出详情对话框
  126. _dialog.ShowDialog("TestResultDetailView", parm, async callback =>
  127. {
  128. if (callback.Result == ButtonResult.OK)
  129. {
  130. //更新表格,重新获取
  131. //GetContent();
  132. }
  133. });
  134. }
  135. /// <summary>
  136. /// 查询
  137. /// </summary>
  138. /// <param name="obj"></param>
  139. private void Query(object obj)
  140. {
  141. if ((!string.IsNullOrEmpty(StartTime)) && (!string.IsNullOrEmpty(EndTime)))
  142. {
  143. if (Convert.ToDateTime(StartTime) > Convert.ToDateTime(EndTime))
  144. {
  145. MessageBox.Show("起始时间大于结束时间,请重新输入", "确认", MessageBoxButton.OK, MessageBoxImage.Warning);
  146. return;
  147. }
  148. }
  149. conditionDevices = (from a in allDeviceList
  150. where (string.IsNullOrEmpty(DeviceName) ? true : (a.DeviceName == DeviceName))
  151. && (string.IsNullOrEmpty(DeviceNo) ? true : (a.DeviceNo == DeviceNo))
  152. && ((DeviceKindName == "---") ? true : (a.DeviceKindName == DeviceKindName))
  153. && ((ProjectName == "---") ? true : (a.ProjectName == ProjectName))
  154. && (EndTime == string.Empty ? true : (a.CreateTime < Convert.ToDateTime(EndTime)) && (Convert.ToDateTime(StartTime) < a.CreateTime))
  155. select a).ToList();
  156. //默认显示的第一页
  157. conditionDevices = conditionDevices.OrderBy(x => x.DeviceId).ToList();
  158. Getpage();
  159. }
  160. private void Export(string obj)
  161. {
  162. using (System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog()
  163. {
  164. //设置文件类型
  165. //书写规则例如:txt files(*.txt)|*.txt
  166. Filter = "Excel files(*.xlsx)|*.xlsx|All files(*.*)|*.*",
  167. //设置默认文件名(可以不设置)
  168. FileName = "项目配置表",
  169. //获取或设置一个值,该值指示如果用户省略扩展名,文件对话框是否自动在文件名中添加扩展名。(可以不设置)
  170. AddExtension = true,
  171. //保存对话框是否记忆上次打开的目录
  172. RestoreDirectory = true
  173. })
  174. {
  175. // Show save file dialog box
  176. //点了保存按钮进入
  177. if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  178. {
  179. try
  180. {
  181. //获得文件路径
  182. string localFilePath = saveFileDialog.FileName.ToString();
  183. //获取文件内容
  184. MiniExcel.SaveAs(localFilePath, DeviceResultItemList);
  185. }
  186. catch (Exception ex)
  187. {
  188. _logger.LogError(ex.ToString());
  189. }
  190. }
  191. }
  192. }
  193. /// <summary>
  194. /// 获取所有项目
  195. /// </summary>
  196. private void GetProjectConfig()
  197. {
  198. allDeviceList.Clear();
  199. conditionDevices.Clear();
  200. //所有测试方案
  201. var schlist = _basicPlcTestSchemeService.QueryList();
  202. var schDtoList = _mapper.Map<List<bas_plc_test_scheme>, List<BasicPlcTestSchemeDto>>(schlist);
  203. //测试记录中的所有设备
  204. var deviceIds=_iBizTestRecordService.QueryList().Select(X => X.device_id).Distinct();
  205. foreach (var deviceId in deviceIds)
  206. {
  207. List<DateTime> startDateTimes = new List<DateTime>();
  208. var deviceMsg = _iBasicDeviceService.Find(((int)deviceId));
  209. if(deviceMsg != null)
  210. {
  211. string deviceKind = _iBasicDeviceKindService.Find((int)deviceMsg.device_kind_id)?.devicekind_name;
  212. string projectName = _iBasicProjectService.Find((int)deviceMsg.project_id)?.project_name;
  213. //记录设备下的方案通过个数
  214. int deviceCountResult = 0;
  215. string deviceTestResult = string.Empty;
  216. //查找哦记录有的方案
  217. var recordMsgs=_iBizTestRecordService.FindRecordByDeviceId(deviceId);
  218. foreach ( var sch in recordMsgs)
  219. {
  220. long schId=(long)_basicPlcTestSchemeService.FindByNameAndType(sch.scheme_name, deviceKind)?.scheme_id;
  221. //计算测试结果
  222. string testResult = string.Empty;
  223. int countResult = 0;
  224. var records = _iBizTestRecordDtlService.FindRecordDetailByRecordID(sch.record_id);
  225. //
  226. var schDtls=_iBasicPlcTestSchemeDtlService.FindAllBySchId(schId);
  227. //循环所有测试项,有一个不合格,则整个测试方案不合格
  228. foreach(var dtl in schDtls)
  229. {
  230. //选取开始时间最大的一个数据,查看测试结果
  231. long schDtId = dtl.scheme_dtl_id;
  232. var findRecords=records.FindAll(x => x.scheme_dtl_id == schDtId).OrderByDescending(x=>x.start_test_time).ToArray();
  233. if(findRecords.Length>0)
  234. {
  235. int result = (int)findRecords[0]?.test_result.Value;
  236. if(result==0)
  237. {
  238. testResult = "不通过";
  239. break;
  240. }
  241. else
  242. {
  243. countResult++;
  244. }
  245. }
  246. }
  247. //测试结果
  248. if(countResult== schDtls.Count)
  249. {
  250. testResult = "通过";
  251. }
  252. //计算这个设备是否通过
  253. if(testResult == "通过")
  254. {
  255. deviceCountResult++;
  256. }
  257. //加入时间集合
  258. startDateTimes.Add(sch.start_test_time.Value);
  259. }
  260. //计算这个设备是否所有的方案都通过
  261. if ((deviceCountResult!=0)&&(deviceCountResult == recordMsgs.Count))
  262. {
  263. deviceTestResult = "通过";
  264. }
  265. else
  266. {
  267. deviceTestResult = "不通过";
  268. }
  269. //这里不添加方案名称
  270. allDeviceList.Add(new DeviceDtlWithResultModel()
  271. {
  272. DeviceId = deviceMsg.device_id,
  273. DeviceNo = deviceMsg.device_no,
  274. DeviceName = deviceMsg.device_name,
  275. DeviceKindName = deviceKind,
  276. ProjectName = projectName,
  277. StartTestTime = startDateTimes.Min(),//取最小时间
  278. TestResult = deviceTestResult
  279. }); ;
  280. conditionDevices.Add(new DeviceDtlWithResultModel()
  281. {
  282. DeviceId = deviceMsg.device_id,
  283. DeviceNo = deviceMsg.device_no,
  284. DeviceName = deviceMsg.device_name,
  285. DeviceKindName = deviceKind,
  286. ProjectName = projectName,
  287. StartTestTime = startDateTimes.Min(),//取最小时间
  288. TestResult = deviceTestResult
  289. });
  290. }
  291. }
  292. conditionDevices = conditionDevices.OrderBy(x => x.DeviceId).ToList();
  293. Getpage();
  294. }
  295. /// <summary>
  296. /// 获取页面
  297. /// </summary>
  298. private void Getpage()
  299. {
  300. CurrentPage = 1;
  301. TotalCount = conditionDevices.Count;
  302. CurrentPageChanged();
  303. }
  304. /// <summary>
  305. /// 页面变化
  306. /// </summary>
  307. private void CurrentPageChanged()
  308. {
  309. DeviceResultItemList.Clear();
  310. foreach (var i in conditionDevices.Skip((CurrentPage - 1) * CountPerPage).Take(CountPerPage))
  311. {
  312. DeviceResultItemList.Add(i);
  313. }
  314. }
  315. /// <summary>
  316. /// 生成pdf
  317. /// </summary>
  318. /// <param name="obj"></param>
  319. public void CreatePdf(object obj)
  320. {
  321. List<biz_test_record_dtl> allRecordDtls = new List<biz_test_record_dtl>();
  322. object[] multiObj = obj as object[];
  323. //测试结果和设备id
  324. string testResult = (string)multiObj[0];
  325. long deviceId = (long)multiObj[1];
  326. //项目名称
  327. string projectName = (string)multiObj[2];
  328. //查找recordid
  329. var recordMsgs=_iBizTestRecordService.FindRecordByDeviceId((int)deviceId);
  330. //查找这个id的所有测试记录
  331. foreach(var recordMsg in recordMsgs)
  332. {
  333. //一条reoordid对应可能有多次测试记录
  334. var recordDtls = _iBizTestRecordDtlService.FindRecordDetailByRecordID(recordMsg.record_id);
  335. foreach(var record in recordDtls)
  336. {
  337. allRecordDtls.Add(record);
  338. }
  339. }
  340. //查找详细记录
  341. string deviceName = _iBasicDeviceService.Find((int)deviceId).device_name;
  342. try
  343. {
  344. Settings.License = LicenseType.Community;
  345. var model = GetReportPLCInfo(projectName,deviceName, allRecordDtls,testResult);
  346. var document = new InvoiceDocument(model);
  347. //pdf名称为轴编号+时间
  348. //输出文件
  349. using (System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog()
  350. {
  351. //设置文件类型
  352. //书写规则例如:txt files(*.txt)|*.txt
  353. Filter = "pdf文件|*.pdf",
  354. //设置默认文件名(可以不设置)
  355. FileName = "报表" + string.Format("{0:yyyyMMddHHmm}", DateTime.Now),
  356. //获取或设置一个值,该值指示如果用户省略扩展名,文件对话框是否自动在文件名中添加扩展名。(可以不设置)
  357. AddExtension = true,
  358. //保存对话框是否记忆上次打开的目录
  359. RestoreDirectory = true
  360. })
  361. {
  362. //点了保存按钮进入
  363. if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  364. {
  365. //获得文件路径
  366. string localFilePath = saveFileDialog.FileName.ToString();
  367. document.GeneratePdf(localFilePath);
  368. }
  369. }
  370. }
  371. catch (Exception ex)
  372. {
  373. _logger.LogError(ex.ToString());
  374. }
  375. }
  376. /// <summary>
  377. /// pdf报告相关信息
  378. /// </summary>
  379. /// <param name="schDtlId"></param>
  380. /// <returns></returns>
  381. private InvoiceModel GetReportPLCInfo(string projectName,string deviceName,List<biz_test_record_dtl> recordDtls,string testResult)
  382. {
  383. //测试方案明细主键ID
  384. InvoiceModel invoiceModel = new InvoiceModel();
  385. invoiceModel.ReportPLCModels = new List<ReportPLCModel>();
  386. invoiceModel.ProjectName = projectName;
  387. invoiceModel.DeviceName = deviceName;
  388. foreach (var each in recordDtls)
  389. {
  390. long recordId = each.record_id.Value;
  391. long schDtlid = each.scheme_dtl_id;
  392. var schDtlRelt = _iBasicPlcTestSchemeDtlService.Find((int)schDtlid);
  393. if(schDtlRelt != null)
  394. {
  395. //查找方案名
  396. long schId = schDtlRelt.scheme_id.Value;
  397. string schEachName = _basicPlcTestSchemeService.Find((int)schId)?.scheme_name;
  398. string schItemName = schDtlRelt.item_name;
  399. string schItemType = string.Empty;
  400. int typeNo = schDtlRelt.item_type.Value;
  401. switch (typeNo)
  402. {
  403. case 0:
  404. schItemType = "前置项";
  405. break;
  406. case 1:
  407. schItemType = "PLC点位测试项";
  408. break;
  409. case 2:
  410. schItemType = "Robot动作测试";
  411. break;
  412. }
  413. //根据测试结果明细
  414. if (each != null)
  415. { //前置项结果解析
  416. string preconStr = each.precondition_final?.ToString();
  417. if (!string.IsNullOrEmpty(preconStr))
  418. {
  419. JsonModel preconditionModel = JsonConvert.DeserializeObject<JsonModel>(preconStr);
  420. foreach (var detail in preconditionModel.DetailInfo)
  421. {
  422. invoiceModel.ReportPLCModels.Add(new ReportPLCModel()
  423. {
  424. SchName= schEachName,
  425. ItemName = schItemName,
  426. ItemType = schItemType,
  427. Type = "前置项",
  428. JudgeType = preconditionModel.ItemType,
  429. SelectLogic = preconditionModel.ItemLogical,
  430. Detail = preconditionModel.Description,
  431. Id = detail.Id,
  432. PlcAddress = detail.PlcAddress,
  433. PlcItem = detail.PlcItem,
  434. PlcValue = detail.PlcValue,
  435. Remark = detail.Remark,
  436. TestTime = detail.TestTime,
  437. RealValue = detail.RealValue,
  438. TestResult = detail.TestResult,
  439. });
  440. }
  441. }
  442. //输入项解析
  443. string inStr = each.action_final?.ToString();
  444. if (!string.IsNullOrEmpty(inStr))
  445. {
  446. JsonModel inModel = JsonConvert.DeserializeObject<JsonModel>(inStr);
  447. foreach (var detail in inModel.DetailInfo)
  448. {
  449. invoiceModel.ReportPLCModels.Add(new ReportPLCModel()
  450. {
  451. SchName = schEachName,
  452. ItemName = schItemName,
  453. ItemType = schItemType,
  454. Type = "输入项",
  455. JudgeType = inModel.ItemType,
  456. SelectLogic = inModel.ItemLogical,
  457. Detail = inModel.Description,
  458. Id = detail.Id,
  459. PlcAddress = detail.PlcAddress,
  460. PlcItem = detail.PlcItem,
  461. PlcValue = detail.PlcValue,
  462. Remark = detail.Remark,
  463. TestTime = detail.TestTime,
  464. RealValue = detail.RealValue,
  465. TestResult = detail.TestResult,
  466. });
  467. }
  468. }
  469. //输出项解析
  470. string outStr = each.judgement_result_final?.ToString();
  471. if (!string.IsNullOrEmpty(outStr))
  472. {
  473. JsonModel outModel = JsonConvert.DeserializeObject<JsonModel>(outStr);
  474. foreach (var detail in outModel.DetailInfo)
  475. {
  476. invoiceModel.ReportPLCModels.Add(new ReportPLCModel()
  477. {
  478. SchName = schEachName,
  479. ItemName = schItemName,
  480. ItemType = schItemType,
  481. Type = "结果项",
  482. JudgeType = outModel.ItemType,
  483. SelectLogic = outModel.ItemLogical,
  484. Detail = outModel.Description,
  485. Id = detail.Id,
  486. PlcAddress = detail.PlcAddress,
  487. PlcItem = detail.PlcItem,
  488. PlcValue = detail.PlcValue,
  489. Remark = detail.Remark,
  490. TestTime = detail.TestTime,
  491. RealValue = detail.RealValue,
  492. TestResult = detail.TestResult,
  493. });
  494. }
  495. }
  496. }
  497. }
  498. }
  499. //判断方案结果是否通过
  500. //var testCount = allDeviceList.FindAll(X => X.SchemeName == findSch.scheme_name && X.TestResult == "通过")?.Count;
  501. //if (testCount == allResult.Count)
  502. //{
  503. // invoiceModel.FinalReuslt = "通过";
  504. //}
  505. //else
  506. //{
  507. // invoiceModel.FinalReuslt = "不通过";
  508. //}
  509. invoiceModel.FinalReuslt = testResult;
  510. return invoiceModel;
  511. }
  512. #endregion
  513. #region 命令绑定
  514. public DelegateCommand<object> QueryCommand { set; get; }
  515. public DelegateCommand<string> ExportCommand { set; get; }
  516. public DelegateCommand<object> ResetCommand { set; get; }
  517. public DelegateCommand OnLoadCommand { set; get; }
  518. public DelegateCommand<object> CheckDetailCommand { set; get; }
  519. public DelegateCommand<object> UnqualifiedCommand { set; get; }
  520. public DelegateCommand<object> PdfReportCommand { set; get; }
  521. #endregion
  522. #region 数据绑定
  523. private ObservableCollection<DeviceDtlWithResultModel> deviceResultItemList = new ObservableCollection<DeviceDtlWithResultModel>();
  524. public ObservableCollection<DeviceDtlWithResultModel> DeviceResultItemList
  525. {
  526. get { return deviceResultItemList; }
  527. set { deviceResultItemList = value; RaisePropertyChanged(); }
  528. }
  529. /// <summary>
  530. /// 设备编号
  531. /// </summary>
  532. private string devicedNo;
  533. public string DeviceNo
  534. {
  535. get { return devicedNo; }
  536. set { devicedNo = value; RaisePropertyChanged(); }
  537. }
  538. /// <summary>
  539. /// 设备类型名称
  540. /// </summary>
  541. private string deviceName;
  542. public string DeviceName
  543. {
  544. get { return deviceName; }
  545. set { deviceName = value; RaisePropertyChanged(); }
  546. }
  547. private string projectName;
  548. public string ProjectName
  549. {
  550. get { return projectName; }
  551. set { projectName = value; RaisePropertyChanged(); }
  552. }
  553. private string deviceKindName;
  554. public string DeviceKindName
  555. {
  556. get { return deviceKindName; }
  557. set { deviceKindName = value; RaisePropertyChanged(); }
  558. }
  559. /// <summary>
  560. /// 项目名称
  561. /// </summary>
  562. private ObservableCollection<string> projectNameList = new ObservableCollection<string>();
  563. public ObservableCollection<string> ProjectNameList
  564. {
  565. get { return projectNameList; }
  566. set { projectNameList = value; RaisePropertyChanged(); }
  567. }
  568. /// <summary>
  569. /// 开始时间
  570. /// </summary>
  571. private string startTime = DateTime.Now.AddDays(-1).ToString();
  572. public string StartTime
  573. {
  574. get { return startTime; }
  575. set { startTime = value; RaisePropertyChanged(); }
  576. }
  577. private string endTime = DateTime.Now.ToString();
  578. public string EndTime
  579. {
  580. get { return endTime; }
  581. set { endTime = value; RaisePropertyChanged(); }
  582. }
  583. /// <summary>
  584. /// 设备类型
  585. /// </summary>
  586. private ObservableCollection<string> deviceKindNameList = new ObservableCollection<string>();
  587. public ObservableCollection<string> DeviceKindNameList
  588. {
  589. get { return deviceKindNameList; }
  590. set { deviceKindNameList = value; RaisePropertyChanged(); }
  591. }
  592. /// <summary>
  593. /// 总条数
  594. /// </summary>
  595. private int totalCount;
  596. public int TotalCount
  597. {
  598. get { return totalCount; }
  599. set { totalCount = value; RaisePropertyChanged(); CurrentPageChanged(); }
  600. }
  601. /// <summary>
  602. /// 每页数量
  603. /// </summary>
  604. private int countPerPage = 15;
  605. public int CountPerPage
  606. {
  607. get { return countPerPage; }
  608. set { countPerPage = value; RaisePropertyChanged(); CurrentPageChanged(); }
  609. }
  610. /// <summary>
  611. /// 单前页
  612. /// </summary>
  613. private int currentPage = 1;
  614. public int CurrentPage
  615. {
  616. get { return currentPage; }
  617. set { currentPage = value; RaisePropertyChanged(); CurrentPageChanged(); }
  618. }
  619. #endregion
  620. }
  621. }