SajetConnect.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.InteropServices;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace MesAdaptor
  8. {
  9. public enum MesType
  10. {
  11. none,
  12. shinewave,
  13. sajet,
  14. sajet2,
  15. test
  16. }
  17. public class SajetConnect
  18. {
  19. public static ISajetConnect Instance { get; private set; }
  20. //public static bool IsEmsEnabled { get; set; } = true;
  21. private static MesType _Type = MesType.none;
  22. public static MesType Type
  23. {
  24. get => _Type;
  25. set
  26. {
  27. _Type = value;
  28. switch (_Type)
  29. {
  30. case MesType.none:
  31. Instance = null;
  32. break;
  33. case MesType.sajet:
  34. Instance = new SajectConnectSajet();
  35. break;
  36. case MesType.shinewave:
  37. Instance = new SajetConnectShinewave();
  38. break;
  39. case MesType.test:
  40. Instance = new SajectConnectTest();
  41. break;
  42. }
  43. }
  44. }
  45. public static bool SajetTransStart() => Instance.SajetTransStart();
  46. public static bool SajetTransClose() => Instance.SajetTransClose();
  47. public static bool SajetTransSignIn(ref string data) => Instance.SajetTransSignIn(ref data);
  48. public static bool SajetTransWoCheck(ref string workOrder) => Instance.SajetTransWoCheck(ref workOrder);
  49. public static bool SajetTransSnCheck(ref string serialNumber) => Instance.SajetTransWoCheck(ref serialNumber);
  50. public static bool SajetTranFinishSuccess() => Instance.SajetTranFinishSuccess();
  51. public static bool SajetTranFinishFail(MesErrorCode errorCode) => Instance.SajetTranFinishFail(errorCode);
  52. public static string SajetTransRegisterHeader(string model, string header) => Instance.SajetTransRegisterHeader(model, header);
  53. public static bool SajetTransReport(Dictionary<string, string> reportPair) => Instance.SajetTransReport(reportPair);
  54. public static bool SajetTransLog(string data) => Instance.SajetTransLog(data);
  55. }
  56. }