SajetConnect.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 static class SajetConnect
  18. {
  19. public static ISajetConnect Instance { get; internal set; }
  20. public static List<string> DefinedMes = new List<string>() {
  21. "php",
  22. "shinewave",
  23. "phv",
  24. "sajet",
  25. "sajet2"
  26. };
  27. public static bool SajetTransStart() => Instance.SajetTransStart();
  28. public static bool SajetTransClose() => Instance == null ? false : Instance.SajetTransClose();
  29. public static bool SajetTransSignIn(ref string data) => Instance.SajetTransSignIn(ref data);
  30. public static bool SajetTransWoCheck(ref string workOrder) => Instance.SajetTransWoCheck(ref workOrder);
  31. public static bool SajetTransSnCheck(ref string serialNumber) => Instance.SajetTransSnCheck(ref serialNumber);
  32. public static bool SajetTranFinishSuccess() => Instance.SajetTranFinishSuccess();
  33. public static bool SajetTranFinishFail(MesErrorCode errorCode) => Instance.SajetTranFinishFail(errorCode);
  34. public static string SajetTransRegisterHeader(string model, string header) => Instance.SajetTransRegisterHeader(model, header);
  35. public static bool SajetTransReport(ValueReportDatas reportPair) => Instance.SajetTransReport(reportPair);
  36. public static bool SajetTransLog(string data) => Instance.SajetTransLog(data);
  37. public static void SetMes(string mesSetting = "",string mechineCode = "")
  38. {
  39. if (mesSetting is null)
  40. {
  41. SajetConnect.Instance = new SajectConnectTest();
  42. return;
  43. }
  44. mesSetting = mesSetting.ToLower();
  45. switch (mesSetting)
  46. {
  47. case "php":
  48. case "shinewave":
  49. SajetConnect.Instance = new SajetConnectShinewave();
  50. break;
  51. case "sajet":
  52. SajetConnect.Instance = new SajectConnectSajet();
  53. break;
  54. //case "phv":
  55. case "phv":
  56. case "sajet2":
  57. SajetConnect.Instance = new SajectConnectSajet2(mechineCode);
  58. break;
  59. default:
  60. SajetConnect.Instance = new SajectConnectTest();
  61. break;
  62. }
  63. }
  64. }
  65. }