12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- using EZSockets;
- using RequestServer.HttpServer;
- using ResponseServer.HttpServer;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net.NetworkInformation;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- namespace HttpServer.mitsubishi
- {
- class MitsubishiServer
- {
- private static string ON_LINE_STATE = "在线";
- public static Dictionary<string, MitCom> deviceList { get; set; } = new Dictionary<string, MitCom>();
-
- public ResponseBody requestHttpServer(RequestBody<ToolData> requestBody)
- {
- string ip = requestBody.serverUrl;
- string port = requestBody.port;
- string fun = requestBody.type;
-
- ResponseBody responseBody = new ResponseBody();
- //先ping
- Ping pingSender = new Ping();
- PingReply reply = pingSender.Send(requestBody.serverUrl);
- if (reply.Status != IPStatus.Success)
- {
- //responseBody.result = true;
- responseBody.msg = "调用失败";
- }
- else
- {
- try
- {
- MitCom mitCom = new MitCom(requestBody.serverUrl);
- mitCom.GetSimConnect("M700M", "1", "10", ip);
- responseBody.deviceState = ON_LINE_STATE;
- if (fun == ActionTypeEnum.Collect.ToString())
- {
-
- }
- }
- catch (Exception e)
- {
- responseBody.msg = "调用失败";
- YG.Log.Instance.WriteLogAdd($"三菱连接结果-ex-->> " + e.Message);
- //deviceList.Remove(requestBody.serverUrl);
- }
-
- }
-
- return responseBody;
- }
- }
- }
|