|
@@ -11,90 +11,51 @@ namespace MesAdaptor
|
|
|
{
|
|
|
none,
|
|
|
shinewave,
|
|
|
- sajet
|
|
|
+ sajet,
|
|
|
+ sajet2,
|
|
|
+ test
|
|
|
}
|
|
|
|
|
|
public class SajetConnect
|
|
|
{
|
|
|
- public static bool IsEmsEnabled { get; set; } = true;
|
|
|
+ public static ISajetConnect Instance { get; private set; }
|
|
|
|
|
|
+ //public static bool IsEmsEnabled { get; set; } = true;
|
|
|
+
|
|
|
+ private static MesType _Type = MesType.none;
|
|
|
public static MesType Type
|
|
|
{
|
|
|
- get => SajetConnectDLLSelector.Type;
|
|
|
- set => SajetConnectDLLSelector.Type = value;
|
|
|
+ get => _Type;
|
|
|
+ set
|
|
|
+ {
|
|
|
+ _Type = value;
|
|
|
+ switch (_Type)
|
|
|
+ {
|
|
|
+ case MesType.none:
|
|
|
+ Instance = null;
|
|
|
+ break;
|
|
|
+ case MesType.sajet:
|
|
|
+ Instance = new SajectConnectSajet();
|
|
|
+ break;
|
|
|
+ case MesType.shinewave:
|
|
|
+ Instance = new SajetConnectShinewave();
|
|
|
+ break;
|
|
|
+ case MesType.test:
|
|
|
+ Instance = new SajectConnectTest();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- public static bool SajetTransStart()
|
|
|
- => IsEmsEnabled ? SajetConnectDLLSelector.SajetTransStart() : true;
|
|
|
-
|
|
|
- public static bool SajetTransClose()
|
|
|
- => IsEmsEnabled ? SajetConnectDLLSelector.SajetTransClose() : true;
|
|
|
-
|
|
|
- public static bool SajetTransSignIn(ref string data)
|
|
|
- => IsEmsEnabled ? SajetConnectDLLSelector.SajetTransSignIn(ref data) : true;
|
|
|
-
|
|
|
- public static bool SajetTransWoCheck(ref string workOrder)
|
|
|
- => IsEmsEnabled ? SajetConnectDLLSelector.SajetTransWoCheck(ref workOrder) : true;
|
|
|
- public static bool SajetTransSnCheck(ref string serialNumber)
|
|
|
- => IsEmsEnabled ? SajetConnectDLLSelector.SajetTransSnCheck(ref serialNumber) : true;
|
|
|
- //public static bool SajetTranFinish(bool Result)
|
|
|
- // => IsEmsEnabled ? SajetConnectDLLSelector.SajetTranFinish(Result) : true;
|
|
|
- public static bool SajetTranFinishSuccess()
|
|
|
- => IsEmsEnabled ? SajetConnectDLLSelector.SajetTranFinishSuccess() : true;
|
|
|
- public static bool SajetTranFinishFail(MesErrorCode errorCode)
|
|
|
- => IsEmsEnabled ? SajetConnectDLLSelector.SajetTranFinishFail(errorCode.ToMesCodeString()) : true;
|
|
|
- public static string SajetTransRegisterHeader(string model, string header)
|
|
|
- => IsEmsEnabled ? SajetConnectDLLSelector.SajetTransRegisterHeader(model, header) : "";
|
|
|
- //public static bool SajetTransReport(Dictionary<string, int> resultPair, Dictionary<string, string> codePair)
|
|
|
- // => IsEmsEnabled ? SajetConnectDLLSelector.SajetTransReport(resultPair, codePair) : true;
|
|
|
- public static bool SajetTransReport(Dictionary<string, string> reportPair)
|
|
|
- => IsEmsEnabled ? SajetConnectDLLSelector.SajetTransReport(reportPair) : true;
|
|
|
- public static bool SajetTransLog(string data)
|
|
|
- => IsEmsEnabled ? SajetConnectDLLSelector.SajetTransLog(data) : true;
|
|
|
- }
|
|
|
-
|
|
|
- public static class SajetConnectDLLSelector
|
|
|
- {
|
|
|
- public static MesType Type { get; set; }
|
|
|
-
|
|
|
- public static bool SajetTransStart()
|
|
|
- => Type == MesType.shinewave ?
|
|
|
- SajetConnectShinewave.SajetTransStart() : SajectConnectSajet.SajetTransStart();
|
|
|
-
|
|
|
- public static bool SajetTransClose()
|
|
|
- => Type == MesType.shinewave ?
|
|
|
- SajetConnectShinewave.SajetTransClose() : SajectConnectSajet.SajetTransClose();
|
|
|
-
|
|
|
- public static bool SajetTransSignIn(ref string data)
|
|
|
- => Type == MesType.shinewave ?
|
|
|
- SajetConnectShinewave.SajetTransSignIn(ref data) : SajectConnectSajet.SajetTransSignIn(ref data);
|
|
|
-
|
|
|
- public static bool SajetTransWoCheck(ref string workOrder)
|
|
|
- => Type == MesType.shinewave ?
|
|
|
- SajetConnectShinewave.SajetTransWoCheck(ref workOrder) : SajectConnectSajet.SajetTransWoCheck(ref workOrder);
|
|
|
- public static bool SajetTransSnCheck(ref string serialNumber)
|
|
|
- => Type == MesType.shinewave ?
|
|
|
- SajetConnectShinewave.SajetTransSnCheck(ref serialNumber) : SajectConnectSajet.SajetTransSnCheck(ref serialNumber);
|
|
|
- //public static bool SajetTranFinish(bool Result)
|
|
|
- // => Type == MesType.shinewave ?
|
|
|
- // SajetConnectShinewave.SajetTranFinish(Result) : SajectConnectSajet.SajetTranFinish(Result);
|
|
|
- public static bool SajetTranFinishSuccess()
|
|
|
- => Type == MesType.shinewave ?
|
|
|
- SajetConnectShinewave.SajetTranFinishSuccess() : SajectConnectSajet.SajetTranFinishSuccess();
|
|
|
- public static bool SajetTranFinishFail(string errorCode)
|
|
|
- => Type == MesType.shinewave ?
|
|
|
- SajetConnectShinewave.SajetTranFinishFail(errorCode) : SajectConnectSajet.SajetTranFinishFail(errorCode);
|
|
|
- public static string SajetTransRegisterHeader(string model, string header)
|
|
|
- => Type == MesType.shinewave ?
|
|
|
- SajetConnectShinewave.SajetTransRegisterHeader(model, header) : SajectConnectSajet.SajetTransRegisterHeader(model, header);
|
|
|
- //public static bool SajetTransReport(Dictionary<string, int> resultPair, Dictionary<string, string> codePair)
|
|
|
- // => Type == MesType.shinewave ?
|
|
|
- // SajetConnectShinewave.SajetTransReport(resultPair, codePair) : SajectConnectSajet.SajetTransReport(resultPair, codePair);
|
|
|
- public static bool SajetTransReport(Dictionary<string, string> reportPair)
|
|
|
- => Type == MesType.shinewave ?
|
|
|
- SajetConnectShinewave.SajetTransReport(reportPair) : SajectConnectSajet.SajetTransReport(reportPair);
|
|
|
- public static bool SajetTransLog(string data)
|
|
|
- => Type == MesType.shinewave ?
|
|
|
- SajetConnectShinewave.SajetTransLog(data) : SajectConnectSajet.SajetTransLog(data);
|
|
|
+ public static bool SajetTransStart() => Instance.SajetTransStart();
|
|
|
+ public static bool SajetTransClose() => Instance.SajetTransClose();
|
|
|
+ public static bool SajetTransSignIn(ref string data) => Instance.SajetTransSignIn(ref data);
|
|
|
+ public static bool SajetTransWoCheck(ref string workOrder) => Instance.SajetTransWoCheck(ref workOrder);
|
|
|
+ public static bool SajetTransSnCheck(ref string serialNumber) => Instance.SajetTransWoCheck(ref serialNumber);
|
|
|
+ public static bool SajetTranFinishSuccess() => Instance.SajetTranFinishSuccess();
|
|
|
+ public static bool SajetTranFinishFail(MesErrorCode errorCode) => Instance.SajetTranFinishFail(errorCode);
|
|
|
+ public static string SajetTransRegisterHeader(string model, string header) => Instance.SajetTransRegisterHeader(model, header);
|
|
|
+ public static bool SajetTransReport(Dictionary<string, string> reportPair) => Instance.SajetTransReport(reportPair);
|
|
|
+ public static bool SajetTransLog(string data) => Instance.SajetTransLog(data);
|
|
|
}
|
|
|
}
|