1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using FANUC;
- using fanuc采集;
- using HttpServer;
- using RequestServer.HttpServer;
- using ResponseServer.HttpServer;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using static fanuc采集.ConDevice;
- using static HttpServer.Form1;
- namespace Fanuc_HttpServer.fanuc
- {
- class FanucServer
- {
- private static string ON_LINE_STATE = "在线";
- public static ResponseBody requestHttpServer(RequestBody<ToolData> requestBody)
- {
- string ip = requestBody.serverUrl;
- string port = requestBody.port;
- string fun = requestBody.type;
- int ret = 0;
- ConDevice CIF = new ConDevice();
- ResponseBody responseBody = new ResponseBody();
- if (fun == ActionTypeEnum.Collect.ToString())
- {
- ConDevice2 CIF2 = new ConDevice2(ip, port);
-
- }
- else if (fun == ActionTypeEnum.Upload.ToString())
- {
- try
- {
- string prgname = requestBody.prgName;
- YG.Log.Instance.WriteLogAdd(">>>===上传文件名 : >>>>===" + prgname);
- ret = CIF.UploadNcProg(ip, port, prgname);
- if (ret == Fanuc.EW_OK)
- {
- responseBody.deviceState = ON_LINE_STATE;
- }
- else
- {
- responseBody.msg = "上传文件名失败,错误码:" + ret;
- }
- }
- catch (Exception uploadex)
- {
- responseBody.msg = "上传文件名" + uploadex.Message;
- }
- }
- else if (fun == ActionTypeEnum.StartNcProgram.ToString())
- {
- try
- {
- string prgname = requestBody.prgName;
- ret = CIF.ReadPmcMarco(ip, port, prgname);
- if (ret == Fanuc.EW_OK)
- {
- responseBody.deviceState = ON_LINE_STATE;
- }
- else
- {
- responseBody.msg = "调用失败";
- }
- }
- catch (Exception uploadex)
- {
- responseBody.msg = "调用失败" + uploadex.Message;
- }
- }
- else if (fun == ActionTypeEnum.AlmInfo.ToString())
- {
-
- }
- return responseBody;
- }
- }
- }
|