| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
-
- using System;
- using Curtain.Net.Sockets.PLC;
- using PLC_S.EPTS;
- using PLC_S.ServerModel;
- namespace PLC_S
- {
- public class PLC_Server
- {
- public static PLC_S_S PLC_S_S = null;
- public static IWindowsServer ServerSocket = null;
- public static void Start()
- {
- try
- {
- if (ServerSocket != null)
- {
- Stop();
- }
- }
- catch { }
- PLC_S_S = PLC_S_S.Get();
- switch (PLC_S_S.PLCServiceType)
- {
- //自动识别模块 xuwei add 2022-03-12=====================
- case "GA":
- ServerSocket = new GoodsAuto();
- break;
- //======================================================
- // 产品型号
- case "GC":
- ServerSocket = new GoodsCode();
- break;
- // 工序计件
- case "PW":
- ServerSocket = new PieceWork();
- break;
- // 打磨【房号+计件】
- case "EPTS_GP":
- ServerSocket = new EPTS_GoodsPolish();
- ServerSocket.EPTS_CODE = PLC_S_S.EPTS_CODE;
- ServerSocket.Interval = PLC_S_S.Interval;
- break;
- //// 条码打印
- //case "BP":
- // ServerSocket = new BarcodePrint();
- // break;
- //// 高压注浆
- //case "HPG":
- // ServerSocket = new HighPressureGrouting();
- // break;
- //// 登窑
- //case "KL":
- // ServerSocket = new KilnLoad();
- // break;
- //// 入窑
- //case "KI":
- // ServerSocket = new KilnInput();
- // break;
- //// 卸窑
- //case "KUL":
- // ServerSocket = new KilnUnLoad();
- // break;
- default:
- throw new NotImplementedException(PLC_S_S.PLCServiceType);
- }
- ServerSocket.Start(PLC_S_S.Port);
- return;
- }
- public static void Stop()
- {
- ServerSocket?.Stop();
- ServerSocket?.Dispose();
- ServerSocket = null;
- }
- }
- }
|