Data.cs 1.1 KB

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