添加项目文件。
This commit is contained in:
137
Epost.TestToolsWeb/Controllers/HomeController.cs
Normal file
137
Epost.TestToolsWeb/Controllers/HomeController.cs
Normal file
@ -0,0 +1,137 @@
|
||||
using Epost.BLL;
|
||||
using Epost.Common;
|
||||
using Epost.DAL;
|
||||
using Epost.DAL.Cache;
|
||||
using Epost.DPS.Controllers;
|
||||
using Epost.Model;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using static Epost.Common.LogHelper;
|
||||
using static Epost.DAL.Enum.ShowViewType;
|
||||
|
||||
namespace Epost.TestToolsWeb.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
OrderBLL bll = new OrderBLL();
|
||||
CommandBLL combll = new CommandBLL();
|
||||
AddressstorageBLL addrbll = new AddressstorageBLL();
|
||||
JobModelCacheDAL cache = new JobModelCacheDAL();
|
||||
ScanModelCacheDAL ScanCache = new ScanModelCacheDAL();
|
||||
UserModelCacheDAL userCache = new UserModelCacheDAL();
|
||||
OrderControlBLL contrbll = new OrderControlBLL();
|
||||
JobDownCacheDAL downCache = new JobDownCacheDAL();
|
||||
OrdersQueueBLL qubll = new OrdersQueueBLL();
|
||||
BoxQueueBLL quboxbll = new BoxQueueBLL();
|
||||
public static bool isShow = false;
|
||||
public static int isClear = 0;
|
||||
public static int isWork = 0;
|
||||
public static bool mes = true;
|
||||
|
||||
ConfigurationOperator txtbll = new ConfigurationOperator();
|
||||
|
||||
// GET: Home 000000
|
||||
public ActionResult Index()
|
||||
{
|
||||
|
||||
|
||||
ViewBag.isClear = isClear;
|
||||
ViewBag.isWork = isWork;
|
||||
return View();
|
||||
}
|
||||
|
||||
|
||||
#region 初始化
|
||||
public ActionResult ClearALL()
|
||||
{
|
||||
|
||||
bool result = false;
|
||||
isShow = true;
|
||||
try
|
||||
{
|
||||
|
||||
ResultModel resultModel = contrbll.ClearALL();
|
||||
return Json(new { Success = resultModel.result, Message = resultModel.msg });
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
return Json(new { Success = result, Message = "失败" });
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 开始作业
|
||||
|
||||
public ActionResult StartWork()
|
||||
{
|
||||
isShow = true;
|
||||
|
||||
contrbll.StartWork();
|
||||
isWork = 1;
|
||||
return Json(new { Success = true, Message = "成功" });
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 设备检测
|
||||
public ActionResult TestStart()
|
||||
{
|
||||
|
||||
ResultModel result = contrbll.TestStart();
|
||||
if (result.result == "1")
|
||||
{
|
||||
return Json(new { Success = result, Message = result.msg });
|
||||
}
|
||||
else
|
||||
{
|
||||
return Json(new { Success = result, Message = result.msg });
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 停止检测
|
||||
public ActionResult TestEnd()
|
||||
{
|
||||
contrbll.TestEnd();
|
||||
return Json(new { Success = true, Message = "成功" });
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 结束作业
|
||||
public ActionResult EndWork()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
isShow = false;
|
||||
isWork = 0;
|
||||
isClear = 0;
|
||||
contrbll.EndWork();
|
||||
return Json(new { Success = true, Message = "成功" });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogInfo("结束作业异常" + ex.Message);
|
||||
return Json(new { Success = false, Message = "失败" });
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
103
Epost.TestToolsWeb/Controllers/WebAPIController.cs
Normal file
103
Epost.TestToolsWeb/Controllers/WebAPIController.cs
Normal file
@ -0,0 +1,103 @@
|
||||
using ComposerSDK;
|
||||
using Epost.BLL;
|
||||
using Epost.Common;
|
||||
using Epost.DAL.Cache;
|
||||
using Epost.DAL.Enum;
|
||||
using Epost.DPS.Controllers;
|
||||
using Epost.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Web.Http;
|
||||
using static Epost.Common.LogHelper;
|
||||
using static Epost.DAL.Enum.ShowViewType;
|
||||
|
||||
namespace Epost.TestToolsWeb.Controllers
|
||||
{
|
||||
[RoutePrefix("api/WebAPI")]
|
||||
public class WebAPIController : ApiController
|
||||
{
|
||||
BLL.OrderBLL orderBLL = new BLL.OrderBLL();
|
||||
BLL.CommandBLL combll = new BLL.CommandBLL();
|
||||
BLL.AddressstorageBLL addrbll = new BLL.AddressstorageBLL();
|
||||
JobModelCacheDAL cache = new JobModelCacheDAL();
|
||||
ScanModelCacheDAL ScanCache = new ScanModelCacheDAL();
|
||||
UserModelCacheDAL userCache = new UserModelCacheDAL();
|
||||
JobDownCacheDAL downCache = new JobDownCacheDAL();
|
||||
OrdersQueueBLL qubll = new OrdersQueueBLL();
|
||||
XgateCacheDAL xageDAL = new XgateCacheDAL();
|
||||
BoxQueueBLL quboxbll = new BoxQueueBLL();
|
||||
JobDownCacheDAL JobCache = new JobDownCacheDAL();
|
||||
HttpHelper http = new HttpHelper();
|
||||
[Route("ProcessingResult")]
|
||||
[HttpPost]
|
||||
public string ProcessingResult([FromBody]ResultMessageModel data)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
LogHelper.WriteLogInfo(JsonHelper.SerializeObject(data));
|
||||
LogHelper.WriteLogInfo("设备拍下:IP:" + data.IP + "Address:" + data.Address + "Command:" + data.Command + "Uid:" + data.Uid +"===Loc:" + data.Loc+"===Quantity:" + data.Quantity + "===W_Quanitty:" + data.W_Quantity + "===RFcode:" + data.Rfcode+ "===Result:" + data.Result+ "===Parameter:" + data.Parameter, Log_Type.JOB_DONE);
|
||||
DataTable sdt = orderBLL.getArea(data.Address,data.IP);
|
||||
if (sdt != null && sdt.Rows.Count > 0)
|
||||
{
|
||||
data.Area = sdt.Rows[0]["area"].ToString();
|
||||
data.Block = sdt.Rows[0]["Block"].ToString();
|
||||
data.Type = sdt.Rows[0]["type"].ToString();
|
||||
data.Way = sdt.Rows[0]["way"].ToString();
|
||||
}
|
||||
if (data.Command == "QUERY_SPECIAL_STATUS")//扫描枪返回
|
||||
{
|
||||
|
||||
|
||||
LogHelper.WriteLogInfo("*************Command:" + data.Command + "Parameter:" + data.Parameter, Log_Type.JOB_DONE);
|
||||
string scanStr = data.Parameter.Trim();
|
||||
data.Parameter = scanStr;
|
||||
data.ScanCode = scanStr;
|
||||
// JobDownCacheDAL JobCache = new JobDownCacheDAL();
|
||||
data.Status = "0";
|
||||
JobCache.UpdateJobDownModelList(new List<ResultMessageModel>() { data }, EdownCommend.Create);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (data.Command == "JOB_DONE")
|
||||
{
|
||||
|
||||
data.Status = "0";
|
||||
data.Port = data.Loc;
|
||||
data.IsChange =data.Result;
|
||||
data.Parameter =data.Quantity;
|
||||
|
||||
|
||||
JobCache.UpdateJobDownModelList(new List<ResultMessageModel>() { data }, EdownCommend.Create);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
LogHelper.WriteLogInfo("设备返回异常:" + ex.Message);
|
||||
|
||||
}
|
||||
|
||||
|
||||
string sendStr = "OK";
|
||||
return sendStr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user