using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.Mvc;
|
using System.Web.Script.Serialization;
|
using BLL.DAL;
|
using Common;
|
using Json;
|
using Lib;
|
using Model;
|
|
using wms.Task;
|
|
namespace wms.Areas.Wcs.Controllers
|
{
|
public class TaskMonitorController : MasterPage
|
{
|
// GET: Wcs/TaskMonitor
|
[LoginFilter]
|
public ActionResult Index()
|
{
|
ViewBag.Title = "任务管理";
|
ViewBag.AccessList = LocalHelper.GetDictionaryCodeHtml("Access");
|
ViewBag.DepotsRow = LocalHelper.GetDepotsNumHtml2("DepotsRow");
|
ViewBag.DepotsColumn = LocalHelper.GetDepotsNumHtml2("DepotsColumn");
|
ViewBag.DepotsLayer = LocalHelper.GetDepotsNumHtml2("DepotsLayer");
|
|
return View();
|
}
|
|
[LoginFilter]
|
public ActionResult AddEdit()
|
{
|
return View();
|
}
|
|
[LoginFilter]
|
public ActionResult EditDemo()
|
{
|
string Demo = Request.QueryString.Get("Demo");
|
//ViewBag.TaskInfo = new UserInfo();
|
ViewBag.Demo = Demo;
|
return View();
|
}
|
}
|
|
public class TaskMonitorAjaxController : AjaxPage
|
{
|
[HttpPost]
|
public ActionResult GetTaskList()
|
{
|
var dd = Request["ajaxdata"];
|
var models = new JavaScriptSerializer().Deserialize<AjaxGetTaskList>(dd);
|
|
if (models != null)
|
{
|
DAL_TaskMonitor provider = new DAL_TaskMonitor();
|
PageInfo pageInfo = new PageInfo() { PageIndex = models.pageIndex, PageSize = models.pageSize };
|
List<WCSTasks> entity = provider.GetList(models, ref pageInfo).ToList();
|
|
string json = JsonHelper.IListToJson(entity, "List");
|
string pjson = ConvertJson.Serializer(pageInfo);
|
|
ReturnJson.AddProperty("Result", new JsonObject(json));
|
ReturnJson.AddProperty("PageInfo", new JsonObject(pjson));
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("TuojiStatue", TaskAction.tuoji);
|
ReturnJson.AddProperty("Message", "响应成功");
|
|
return Content(this.ReturnJson.ToString());
|
}
|
return Content(null);
|
}
|
|
public ActionResult GetTaskMonitorList()
|
{
|
var dd = Request["ajaxdata"];
|
var models = new JavaScriptSerializer().Deserialize<AjaxGetTaskDetailList>(dd);
|
|
if (models != null)
|
{
|
DAL_TaskMonitor provider = new DAL_TaskMonitor();
|
PageInfo pageInfo = new PageInfo() { PageIndex = models.pageIndex, PageSize = models.pageSize };
|
List<WCSTasksMonitor> entity = provider.GetDetailList(models, ref pageInfo).ToList();
|
|
string json = JsonHelper.IListToJson(entity, "List");
|
string pjson = ConvertJson.Serializer(pageInfo);
|
|
ReturnJson.AddProperty("Result", new JsonObject(json));
|
ReturnJson.AddProperty("PageInfo", new JsonObject(pjson));
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "响应成功");
|
|
return Content(this.ReturnJson.ToString());
|
}
|
return Content(null);
|
}
|
|
/// <summary>
|
/// 新增任务
|
/// </summary>
|
/// <returns></returns>
|
[HttpPost]
|
public ActionResult AddTask()
|
{
|
try
|
{
|
var dd = Request["ajaxdata"];
|
var models = new JavaScriptSerializer().Deserialize<WCSTasks>(dd);
|
|
DAL_TaskMonitor provider = new DAL_TaskMonitor();
|
models.Origin = "WCS";
|
bool value = provider.AddTask(models, this.LoginUser.RealName);
|
|
if (value)
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "添加任务成功");
|
}
|
else
|
{
|
ReturnJson.AddProperty("Code", -1);
|
ReturnJson.AddProperty("Message", "添加任务失败");
|
}
|
}
|
catch (Exception e)
|
{
|
ReturnJson.AddProperty("Code", -1);
|
ReturnJson.AddProperty("Message", $"{e.Message}!!!");
|
}
|
|
return Content(this.ReturnJson.ToString());
|
}
|
|
/// <summary>
|
/// 编辑备注
|
/// </summary>
|
/// <returns></returns>
|
[HttpPost]
|
public ActionResult UpdateTaskDemo()
|
{
|
try
|
{
|
var dd = Request["ajaxdata"];
|
var models = new JavaScriptSerializer().Deserialize<WCSTasks>(dd);
|
|
DAL_TaskMonitor provider = new DAL_TaskMonitor();
|
bool value = provider.UpdateTaskDemo(models, this.LoginUser.ID.ToString());
|
|
if (value)
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "编辑备注成功");
|
}
|
else
|
{
|
ReturnJson.AddProperty("Code", -1);
|
ReturnJson.AddProperty("Message", "编辑备注失败");
|
}
|
}
|
catch (Exception e)
|
{
|
ReturnJson.AddProperty("Code", -1);
|
ReturnJson.AddProperty("Message", $"{e.Message}!!!");
|
}
|
|
return Content(this.ReturnJson.ToString());
|
}
|
|
/// <summary>
|
/// 完成任务
|
/// </summary>
|
/// <returns></returns>
|
[HttpPost]
|
public ActionResult CompleteTaskMonitor()
|
{
|
string dd = Request["list"];
|
ArrayList models = new JavaScriptSerializer().Deserialize<ArrayList>(dd);
|
string[] list = (string[])models.ToArray(typeof(string));
|
if (models != null)
|
{
|
DAL_TaskMonitor provider = new DAL_TaskMonitor();
|
bool value = provider.TaskMonitorComplete(list,this.LoginUser.ID.ToString(), TaskAction.tuoji);
|
|
if (value)
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "完成成功");
|
}
|
else
|
{
|
ReturnJson.AddProperty("Code", -1);
|
ReturnJson.AddProperty("Message", "完成失败");
|
}
|
|
return Content(this.ReturnJson.ToString());
|
}
|
return Content(null);
|
}
|
|
/// <summary>
|
/// 取消任务
|
/// </summary>
|
/// <returns></returns>
|
[HttpPost]
|
public ActionResult CancelTaskMonitor()
|
{
|
string dd = Request["list"];
|
ArrayList models = new JavaScriptSerializer().Deserialize<ArrayList>(dd);
|
string[] list = (string[])models.ToArray(typeof(string));
|
if (models != null)
|
{
|
DAL_TaskMonitor provider = new DAL_TaskMonitor();
|
bool value = provider.TaskMonitorCancel(list,this.LoginUser.ID.ToString());
|
|
if (value)
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "取消成功");
|
}
|
else
|
{
|
ReturnJson.AddProperty("Code", -1);
|
ReturnJson.AddProperty("Message", "取消失败");
|
}
|
|
return Content(this.ReturnJson.ToString());
|
}
|
return Content(null);
|
}
|
|
/// <summary>
|
/// 手动再次回传WMS
|
/// </summary>
|
/// <returns></returns>
|
[HttpPost]
|
public ActionResult BackhaulTaskMonitor()
|
{
|
string dd = Request["list"];
|
ArrayList models = new JavaScriptSerializer().Deserialize<ArrayList>(dd);
|
string[] list = (string[])models.ToArray(typeof(string));
|
if (models != null)
|
{
|
DAL_TaskMonitor provider = new DAL_TaskMonitor();
|
bool value = provider.TaskMonitorBackhaul(list, this.LoginUser.ID.ToString());
|
|
if (value)
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "回传成功");
|
}
|
else
|
{
|
ReturnJson.AddProperty("Code", -1);
|
ReturnJson.AddProperty("Message", "回传失败");
|
}
|
|
return Content(this.ReturnJson.ToString());
|
}
|
return Content(null);
|
}
|
|
/// <summary>
|
/// 同步WMS
|
/// </summary>
|
/// <returns></returns>
|
[HttpPost]
|
public ActionResult BackhaulTaskMonitor1()
|
{
|
string dd = Request["list"];
|
ArrayList models = new JavaScriptSerializer().Deserialize<ArrayList>(dd);
|
string[] list = (string[])models.ToArray(typeof(string));
|
if (models != null)
|
{
|
DAL_TaskMonitor provider = new DAL_TaskMonitor();
|
bool value = provider.TaskMonitorBackhaul1(list, this.LoginUser.RealName, TaskAction.tuoji);
|
|
if (value)
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "同步成功");
|
}
|
else
|
{
|
ReturnJson.AddProperty("Code", -1);
|
ReturnJson.AddProperty("Message", "同步失败");
|
}
|
|
return Content(this.ReturnJson.ToString());
|
}
|
return Content(null);
|
}
|
/// <summary>
|
/// 置顶出库数据
|
/// </summary>
|
/// <returns></returns>
|
[HttpPost]
|
public ActionResult StickyAlarm()
|
{
|
string dd = Request["list"];
|
ArrayList models = new JavaScriptSerializer().Deserialize<ArrayList>(dd);
|
string[] list = (string[])models.ToArray(typeof(string));
|
if (models != null)
|
{
|
DAL_TaskMonitor provider = new DAL_TaskMonitor();
|
bool value = provider.StickyAlarm(list, this.LoginUser.ID.ToString());
|
|
if (value)
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "置顶成功");
|
}
|
else
|
{
|
ReturnJson.AddProperty("Code", -1);
|
ReturnJson.AddProperty("Message", "置顶失败");
|
}
|
|
return Content(this.ReturnJson.ToString());
|
}
|
return Content(null);
|
}
|
/// <summary>
|
/// 取消置顶出库数据
|
/// </summary>
|
/// <returns></returns>
|
[HttpPost]
|
public ActionResult NotStickyAlarm()
|
{
|
string dd = Request["list"];
|
ArrayList models = new JavaScriptSerializer().Deserialize<ArrayList>(dd);
|
string[] list = (string[])models.ToArray(typeof(string));
|
if (models != null)
|
{
|
DAL_TaskMonitor provider = new DAL_TaskMonitor();
|
bool value = provider.NotStickyAlarm(list, this.LoginUser.ID.ToString());
|
|
if (value)
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "取消置顶成功");
|
}
|
else
|
{
|
ReturnJson.AddProperty("Code", -1);
|
ReturnJson.AddProperty("Message", "取消置顶失败");
|
}
|
|
return Content(this.ReturnJson.ToString());
|
}
|
return Content(null);
|
}
|
}
|
|
|
}
|