Files
T-DAS/Epost.TestToolsWeb/Controllers/HomeController.cs
2023-04-17 14:10:34 +08:00

138 lines
3.4 KiB
C#

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