Files
T-DAS/Epost.TestToolsWeb/Controllers/ServerController.cs
2025-06-16 10:32:02 +08:00

173 lines
4.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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(BatchModel model)
{
lock (lockinit)
{
ResultModel res = new ResultModel();
try
{
ResultModel result = contrbll.TestStart(model.batchno);
return result;
}
catch (Exception ex)
{
LogHelper.WriteLogInfo("TestStart异常" + 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
}
}