Data.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Linq;
  6. using System.Reflection;
  7. using System.Runtime.InteropServices;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace WCS.Core
  11. {
  12. public enum PLCType
  13. {
  14. [Description("西门子")]
  15. Siemens = 1,
  16. [Description("三菱")]
  17. Mitsubishi = 2,
  18. [Description("欧姆龙")]
  19. Omron = 3,
  20. }
  21. public struct PLCInfo
  22. {
  23. public string IP;
  24. public int Port;
  25. public int Slot;
  26. public int Rack;
  27. public PLCType Type;
  28. }
  29. public struct DBInfo
  30. {
  31. public PLCInfo PLCInfo;
  32. public ushort No;
  33. }
  34. public struct ProtocolInfo
  35. {
  36. public DBInfo DBInfo;
  37. public int Position { get; set; }
  38. }
  39. public abstract class DeviceData
  40. {
  41. public string Code { get; set; } = "";
  42. public DateTime Frame { get; set; }
  43. public string Message { get; set; } = "";
  44. }
  45. public abstract class DeviceData<T> : DeviceData
  46. {
  47. public T Data { get; private set; }
  48. protected abstract T Convert<TSource>(TSource source);
  49. }
  50. }