using BLL.DAL;
|
using Common;
|
using Json;
|
using Lib;
|
using Model;
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web.Mvc;
|
using System.Web.Script.Serialization;
|
using wms.Task;
|
|
namespace wms.Areas.Wcs.Controllers
|
{
|
public class CheckMonitorController : MasterPage
|
{
|
[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 AddEditStacker()
|
{
|
string id = Request.QueryString.Get("Id");
|
if (id != null) //编辑
|
{
|
var provider = new DAL_ManualControl();
|
var data = provider.GetStacker(id);
|
ViewBag.TaskNo = data.TaskNo;
|
ViewBag.PalletNo = data.PalletNo;
|
|
ViewBag.StartRow = data.StartRow;
|
ViewBag.StartCol = data.StartColumn;
|
ViewBag.StartLayer = data.StartLayer;
|
|
ViewBag.EndRow = data.EndRow;
|
ViewBag.EndCol = data.EndColumn;
|
ViewBag.EndLayer = data.EndLayer;
|
|
ViewBag.WcsPos = data.WcsPos;
|
ViewBag.DjType = LocalHelper.GetDjHtml(data.DjType);
|
ViewBag.Option = "Edit";
|
}
|
else //添加
|
{
|
ViewBag.TaskNo = "";
|
ViewBag.PalletNo = "";
|
|
ViewBag.StartRow = "";
|
ViewBag.StartCol = "";
|
ViewBag.StartLayer = "";
|
|
ViewBag.EndRow = "";
|
ViewBag.EndCol = "";
|
ViewBag.EndLayer = "";
|
|
ViewBag.WcsPos = "";
|
ViewBag.DjType = LocalHelper.GetDjHtml();
|
ViewBag.Option = "Add";
|
}
|
|
|
return View();
|
}
|
|
public ActionResult StackerDetail()
|
{
|
try
|
{
|
string id = Request.QueryString.Get("Id");
|
DAL_ManualControl provider = new DAL_ManualControl();
|
|
if (id != null)
|
{
|
var data = TaskAction.GetPlcOrWcsPosVal(id);
|
ViewBag.PlcTaskNo = data.PlcTaskNo;
|
ViewBag.PlcPalletNo = data.PlcPalletNo;
|
ViewBag.TaskNo = data.TaskNo;
|
ViewBag.PalletNo = data.PalletNo;
|
|
ViewBag.StartRow = data.StartRow;
|
ViewBag.StartCol = data.StartColumn;
|
ViewBag.StartLayer = data.StartLayer;
|
|
ViewBag.EndRow = data.EndRow;
|
ViewBag.EndCol = data.EndColumn;
|
ViewBag.EndLayer = data.EndLayer;
|
|
ViewBag.PlcPos = data.PlcPos;
|
ViewBag.WcsPos = data.WcsPos;
|
}
|
else
|
{
|
}
|
|
return View();
|
}
|
catch (System.Exception)
|
{
|
return View();
|
}
|
}
|
|
}
|
|
public class CheckMonitorAjaxController : AjaxPage
|
{
|
//private static DataTable PlcInfoDt; // 获取所有设备
|
[HttpPost]
|
public ActionResult GetTaskList()
|
{
|
var dd = Request["ajaxdata"];
|
var models = new JavaScriptSerializer().Deserialize<AjaxGetRobotList>(dd);
|
|
if (models != null)
|
{
|
DAL_CheckMonitor provider = new DAL_CheckMonitor();
|
PageInfo pageInfo = new PageInfo() { PageIndex = models.pageIndex, PageSize = models.pageSize };
|
List<WCSPickLino> 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("Message", "响应成功");
|
|
return Content(this.ReturnJson.ToString());
|
}
|
return Content(null);
|
}
|
public ActionResult GetTaskMonitorList()
|
{
|
var dd = Request["ajaxdata"];
|
var models = new JavaScriptSerializer().Deserialize<AjaxGetBindList>(dd);
|
|
if (models != null)
|
{
|
DAL_CheckMonitor provider = new DAL_CheckMonitor();
|
PageInfo pageInfo = new PageInfo() { PageIndex = models.pageIndex, PageSize = models.pageSize };
|
List<PickLinoBind> 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 BindTask()
|
{
|
try
|
{
|
var dd = Request["ajaxdata"];
|
var models = new JavaScriptSerializer().Deserialize<WCSTasks>(dd);
|
|
DAL_CheckMonitor provider = new DAL_CheckMonitor();
|
models.Origin = "WCS";
|
bool value = provider.BindTask(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 ForbiddenMonitor()
|
{
|
string dd = Request["list"];
|
ArrayList models = new JavaScriptSerializer().Deserialize<ArrayList>(dd);
|
string[] list = (string[])models.ToArray(typeof(string));
|
if (models != null)
|
{
|
DAL_CheckMonitor provider = new DAL_CheckMonitor();
|
bool value = provider.MonitorForbidden(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 CancelTaskMonitor()
|
{
|
string dd = Request["list"];
|
ArrayList models = new JavaScriptSerializer().Deserialize<ArrayList>(dd);
|
string[] list = (string[])models.ToArray(typeof(string));
|
if (models != null)
|
{
|
DAL_CheckMonitor provider = new DAL_CheckMonitor();
|
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>
|
/// 手动结批
|
/// </summary>
|
/// <returns></returns>
|
[HttpPost]
|
public ActionResult EndBatchMonitor()
|
{
|
string dd = Request["list"];
|
ArrayList models = new JavaScriptSerializer().Deserialize<ArrayList>(dd);
|
string[] list = (string[])models.ToArray(typeof(string));
|
if (models != null)
|
{
|
DAL_CheckMonitor provider = new DAL_CheckMonitor();
|
bool value = provider.EndBatchTask(list);
|
|
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_CheckMonitor provider = new DAL_CheckMonitor();
|
bool value = provider.TaskMonitorBackhaul(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);
|
}
|
}
|
}
|