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