终端一体化运控平台
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

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