添加项目文件。
This commit is contained in:
172
Epost.TestToolsWeb/Controllers/ServerController.cs
Normal file
172
Epost.TestToolsWeb/Controllers/ServerController.cs
Normal file
@ -0,0 +1,172 @@
|
||||
using Epost.BLL;
|
||||
using Epost.Common;
|
||||
using Epost.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace Epost.DPS.Controllers
|
||||
{
|
||||
[RoutePrefix("api/WebAPI")]
|
||||
public class ServerController : ApiController
|
||||
{
|
||||
private static object lockinit = new object();
|
||||
|
||||
OrderControlBLL contrbll = new OrderControlBLL();
|
||||
|
||||
//初始化
|
||||
[Route("DISPLAYJOB")]
|
||||
[HttpPost]
|
||||
public ResultModel DISPLAYJOB(OrderModel model)
|
||||
{
|
||||
lock (lockinit)
|
||||
{
|
||||
ResultModel res = new ResultModel();
|
||||
try
|
||||
{
|
||||
LogHelper.WriteLogInfo(JsonHelper.SerializeObject(model));
|
||||
res.result = "0";
|
||||
res.msg = "成功!";
|
||||
return res;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogInfo("GetDataList异常:" + ex.Message);
|
||||
res.msg = "请求异常!";
|
||||
res.result = "-1";
|
||||
return res;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//初始化
|
||||
[Route("ClearALL")]
|
||||
[HttpPost]
|
||||
public ResultModel ClearALL()
|
||||
{
|
||||
lock (lockinit)
|
||||
{
|
||||
ResultModel res = new ResultModel();
|
||||
try
|
||||
{
|
||||
|
||||
res = contrbll.ClearALL();
|
||||
return res;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogInfo("GetDataList异常:" + ex.Message);
|
||||
res.msg = "请求异常!";
|
||||
res.result = "-1";
|
||||
return res;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Route("StartWork")]
|
||||
[HttpPost]
|
||||
public ResultModel StartWork()
|
||||
{
|
||||
lock (lockinit)
|
||||
{
|
||||
ResultModel res = new ResultModel();
|
||||
try
|
||||
{
|
||||
contrbll.StartWork();
|
||||
res.msg = "成功!";
|
||||
res.result = "0";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
LogHelper.WriteLogInfo("启动作业异常" + ex.ToString(), LogHelper.Log_Type.ERROR);
|
||||
res.msg = "启动作业异常!";
|
||||
res.result = "-1";
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#region 设备检测
|
||||
[Route("TestStart")]
|
||||
[HttpPost]
|
||||
public ResultModel TestStart()
|
||||
{
|
||||
lock (lockinit)
|
||||
{
|
||||
ResultModel res = new ResultModel();
|
||||
try
|
||||
{
|
||||
ResultModel result = contrbll.TestStart();
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogInfo("GetDataList异常:" + ex.Message);
|
||||
res.msg = "请求异常!";
|
||||
res.result = "-1";
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 停止检测
|
||||
[Route("TestEnd")]
|
||||
[HttpPost]
|
||||
public ResultModel TestEnd()
|
||||
{
|
||||
lock (lockinit)
|
||||
{
|
||||
ResultModel res = new ResultModel();
|
||||
contrbll.TestEnd();
|
||||
res.msg = "成功!";
|
||||
res.result = "0";
|
||||
return res;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 停止作业
|
||||
[Route("EndWork")]
|
||||
[HttpPost]
|
||||
public ResultModel EndWork()
|
||||
{
|
||||
lock (lockinit)
|
||||
{
|
||||
ResultModel res = new ResultModel();
|
||||
contrbll.EndWork();
|
||||
res.msg = "成功!";
|
||||
res.result = "0";
|
||||
return res;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user