| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
-
- 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)
- {
- //自动调用API接口模块 xuwei add 2023-07-24
- case "AA":
- ServerSocket = new ApiAuto();
- break;
- //======================================================
- //自动识别模块 xuwei add 2022-03-12=====================
- case "GA":
- ServerSocket = new GoodsAuto();
- break;
- //======================================================
- // 自动轮询任务 xuwei add 2022-04-18
- case "EPTS_GA":
- ServerSocket = new EPTS_GoodsAuto();
- ServerSocket.EPTS_CODE = PLC_S_S.EPTS_CODE;
- ServerSocket.Interval = PLC_S_S.Interval;
- break;
- //======================================================
- // 自动设备参数轮询任务 xuwei add 2022-05-21
- case "EPTS_DA":
- ServerSocket = new EPTS_DeviceAuto();
- ServerSocket.EPTS_CODE = PLC_S_S.EPTS_CODE;
- ServerSocket.Interval = PLC_S_S.Interval;
- 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;
- }
- }
- }
|