终端一体化运控平台
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

57 строки
2.4 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using BPA.Helper;
  7. using System.Collections.Concurrent;
  8. using System.Collections.ObjectModel;
  9. using System.Windows;
  10. using BPA.Helper;
  11. using BPASmartClient.JXJFoodBigStation.Model;
  12. using BPASmartClient.JXJFoodBigStation.View;
  13. using System.Windows.Forms;
  14. using BPASmartClient.JXJFoodBigStation.Model.HK_PLC;
  15. using System.Reflection;
  16. namespace BPASmartClient.JXJFoodBigStation.ViewModel
  17. {
  18. public class HardwareStatusViewModel : NotifyBase
  19. {
  20. public HardwareStatusViewModel()
  21. {
  22. foreach (PropertyInfo mi in typeof(StockBinName).GetProperties())
  23. {
  24. object ab = GVL_BigStation.stockBinName.GetType().GetProperty(mi.Name).GetValue(GVL_BigStation.stockBinName, null);
  25. if (mi.Name=="RawMaterialName1" || mi.Name == "RawMaterialName2" || mi.Name == "RawMaterialName3" || mi.Name == "RawMaterialName4" || mi.Name == "RawMaterialName5" || mi.Name == "RawMaterialName6" || mi.Name == "RawMaterialName7")
  26. {
  27. TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
  28. {
  29. DeviceName = ab.ToString(),
  30. DeviceNum = TopDeviceCurrentStatuses.Count + 1,
  31. RunStatus = true,
  32. Weight = new Random().Next(0, 100)
  33. });
  34. }
  35. else
  36. {
  37. BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
  38. {
  39. DeviceName = ab.ToString(),
  40. DeviceNum = BottomDeviceCurrentStatuses.Count + 8,
  41. RunStatus = false,
  42. Weight = new Random().Next(0, 100)
  43. });
  44. }
  45. }
  46. }
  47. public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>();
  48. public ObservableCollection<DeviceCurrentStatus> BottomDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>();
  49. public BPARelayCommand<string> UpdateRawMaterName { get; set; }
  50. public BPARelayCommand<string> StartCommand { get; set; }
  51. public BPARelayCommand<string> StopCommand { get; set; }
  52. }
  53. }