DashBoardController.cs 4.65 KB
using System;
using System.Collections.Generic;
using Infrastructure;
using Microsoft.AspNetCore.Mvc;
using WebApp;
using WebRepository;

namespace WebMvc
{
    /// <summary>
	/// DashBoard
	/// </summary>
    [Area("monitor")]
    public class DashBoardController : Controller
    {
        private IUnitWork _unitWork;

        protected Response Result = new Response();
        public DashBoardController(IUnitWork unitWork)
        {
            _unitWork = unitWork;
        }

        #region 视图功能
        /// <summary>
        /// 默认Action
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ActionResult Index()
        {
            return View();
        }
        #endregion

        #region 自定义方法
        /// <summary>
        /// 获取进度统计
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public string PartInfo()
        {
            dynamic data = new
            {
                ZD = 1,
                JH = 1,
                GY = 21,
                SC = 349,
            };
            return JsonHelper.Instance.Serialize(data);
        }

        /// <summary>
        /// 获取工人任务一览
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public string UserTaskInfo()
        {
            List<dynamic> data1 = new List<dynamic>();
            data1.Add(new {
                GroupName = "员工1",
                TaskNum = 396,
                UnWorkNum = 0,
                ComplateNum = 0,
                DelayNum = 100,
            });
            data1.Add(new
            {
                GroupName = "员工2",
                TaskNum = 326,
                UnWorkNum = 0,
                ComplateNum = 0,
                DelayNum = 30,
            });
            data1.Add(new
            {
                GroupName = "员工3",
                TaskNum = 316,
                UnWorkNum = 0,
                ComplateNum = 0,
                DelayNum = 62,
            });
            data1.Add(new
            {
                GroupName = "员工4",
                TaskNum = 196,
                UnWorkNum = 0,
                ComplateNum = 0,
                DelayNum = 63,
            });
            data1.Add(new
            {
                GroupName = "员工5",
                TaskNum = 332,
                UnWorkNum = 0,
                ComplateNum = 0,
                DelayNum = 81,
            });
            data1.Add(new
            {
                GroupName = "员工6",
                TaskNum = 311,
                UnWorkNum = 0,
                ComplateNum = 0,
                DelayNum = 78,
            });
            data1.Add(new
            {
                GroupName = "员工7",
                TaskNum = 301,
                UnWorkNum = 0,
                ComplateNum = 0,
                DelayNum = 61,
            });
            dynamic data = new { UMsg = data1};
            return JsonHelper.Instance.Serialize(data);
        }

        /// <summary>
        /// 获取班组任务一览
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public string GroupTaskInfo()
        {
            List<dynamic> data1 = new List<dynamic>();
            data1.Add(new
            {
                GroupName = "粗车一",
                TaskNum = 20,
                UnWorkNum = 0,
                ComplateNum = 0,
                DelayNum = 0,
            });
            data1.Add(new
            {
                GroupName = "插齿",
                TaskNum = 30,
                UnWorkNum = 0,
                ComplateNum = 0,
                DelayNum = 0,
            });
            data1.Add(new
            {
                GroupName = "磨半圆孔",
                TaskNum = 14,
                UnWorkNum = 0,
                ComplateNum = 0,
                DelayNum = 0,
            });
            data1.Add(new
            {
                GroupName = "倒角",
                TaskNum = 23,
                UnWorkNum = 0,
                ComplateNum = 0,
                DelayNum = 0,
            });
            data1.Add(new
            {
                GroupName = "铣孔",
                TaskNum = 31,
                UnWorkNum = 0,
                ComplateNum = 0,
                DelayNum = 0,
            });
            data1.Add(new
            {
                GroupName = "转大锥齿轮组装",
                TaskNum = 20,
                UnWorkNum = 0,
                ComplateNum = 0,
                DelayNum = 0,
            });
            dynamic data = new { RMsg = data1 };
            return JsonHelper.Instance.Serialize(data);
        }
        #endregion
    }
}