This commit is contained in:
jl
2023-12-05 14:35:20 +08:00
parent 9d64ef5d7a
commit 40557a235e
11 changed files with 501 additions and 511 deletions

View File

@ -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
}
}