This commit is contained in:
@ -15,11 +15,16 @@ using Microsoft.Owin.BuilderProperties;
|
||||
|
||||
namespace Epost.DPS.Controllers
|
||||
{
|
||||
[RoutePrefix("api/TaskAPI")]
|
||||
[RoutePrefix("api/WebAPI")]
|
||||
public class ServerController : ApiController
|
||||
{
|
||||
AddressstorageBLL addrbll = new AddressstorageBLL();
|
||||
LightControlCacheDAL cachedal = new LightControlCacheDAL();
|
||||
private static object lockinit = new object();
|
||||
|
||||
|
||||
OrderControlBLL contrbll = new OrderControlBLL();
|
||||
|
||||
MainControl lig = new MainControl();
|
||||
#region 连接
|
||||
[Route("CONNECT")]
|
||||
@ -36,7 +41,7 @@ namespace Epost.DPS.Controllers
|
||||
{
|
||||
if (item.status == "1")//连接
|
||||
{
|
||||
DataTable dt = addrbll.QueryControlList(" and waveno ='" + item.wallNo + "'");
|
||||
DataTable dt = addrbll.QueryControlList(" ");
|
||||
if (dt != null && dt.Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow rowitem in dt.Rows)
|
||||
@ -131,7 +136,7 @@ namespace Epost.DPS.Controllers
|
||||
{
|
||||
|
||||
//根据播种墙号查询灯带IP
|
||||
DataTable dt = addrbll.QueryControlList(" and waveno ='" + item.wallNo + "'");
|
||||
DataTable dt = addrbll.QueryControlList(" ");
|
||||
if (dt != null && dt.Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow rowitem in dt.Rows)
|
||||
@ -225,7 +230,7 @@ namespace Epost.DPS.Controllers
|
||||
foreach (DisplayjobModelReq item in data)
|
||||
{
|
||||
//根据播种墙号查询灯带IP
|
||||
DataTable dt = addrbll.QueryControlList(" and waveno ='" + item.wallNo + "'");
|
||||
DataTable dt = addrbll.QueryControlList("");
|
||||
if (dt != null && dt.Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow rowitem in dt.Rows)
|
||||
@ -235,7 +240,7 @@ namespace Epost.DPS.Controllers
|
||||
if (conlist != null && conlist.Count > 0)
|
||||
{
|
||||
MainControl control = conlist.FirstOrDefault().maincontrol;
|
||||
DataTable locdt = addrbll.QueryAddrList(" and waveno ='" + item.wallNo + "' and location ='" + item.location + "' and controlip='" + ipaddress + "'");
|
||||
DataTable locdt = addrbll.QueryAddrList(" and location ='" + item.location + "' and controlip='" + ipaddress + "'");
|
||||
if (locdt != null && locdt.Rows.Count > 0)
|
||||
{
|
||||
List<LightParagraph> list = new List<LightParagraph>();
|
||||
@ -305,6 +310,71 @@ namespace Epost.DPS.Controllers
|
||||
#endregion
|
||||
|
||||
|
||||
//初始化
|
||||
[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("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