EchartsDataController.cs 2.44 KB
using Infrastructure;
using Microsoft.AspNetCore.Mvc;
using System;
using WebApp;
using WebRepository;

namespace WebMvc
{
    [Area("base")]
    public class EchartsDataController : Controller
    {
        private readonly EchartsDataApp _app;
        private Response Result = new Response();

        public EchartsDataController(IUnitWork unitWork)
        {
            _app = new EchartsDataApp(unitWork);
        }

        /// <summary>
        /// 获取库位利用率
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public string GetWareCellOption()
        {
            try
            {
                return JsonHelper.Instance.Serialize(_app.GetWareCellCount());
            }
            catch (Exception ex)
            {
                Result.Status = false;
                Result.Message = ex.Message;
            }
            return JsonHelper.Instance.Serialize(Result);
        }

        /// <summary>
        /// 最近7天每日收发货量
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public string GetWeekTaskInfo()
        {

            try
            {
                return JsonHelper.Instance.Serialize(_app.GetWeekTask());
            }
            catch (Exception ex)
            {
                Result.Status = false;
                Result.Message = ex.Message;
            }
            return JsonHelper.Instance.Serialize(Result);
        }

        /// <summary>
        /// 待执行出入库任务
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public string GetExceTaskInfo()
        {

            try
            {
                return JsonHelper.Instance.Serialize(_app.GetWaitTask());
            }
            catch (Exception ex)
            {
                Result.Status = false;
                Result.Message = ex.Message;
            }
            return JsonHelper.Instance.Serialize(Result);
        }

        /// <summary>
        /// 库存概况
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public string GetMaterielInfo()
        {

            try
            {
                return JsonHelper.Instance.Serialize(_app.GetMaterielByGroup());

            }
            catch (Exception ex)
            {
                Result.Status = false;
                Result.Message = ex.Message;
            }
            return JsonHelper.Instance.Serialize(Result);
        }
    }
}