dengjunjie
5 天以前 7ca9651f81d7b84f054194d3d46fdbd1d9c8b922
ÏîÄ¿´úÂë/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Interface/LargeScreenController.cs
@@ -3,6 +3,7 @@
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using SqlSugar.Extensions;
using System.Threading.Tasks;
using WIDESEA_Common.TaskEnum;
using WIDESEA_Core;
using WIDESEA_Core.Enums;
@@ -10,6 +11,7 @@
using WIDESEA_IBasicService;
using WIDESEA_IInboundRepository;
using WIDESEA_IOutboundRepository;
using WIDESEA_IStockRepository;
using WIDESEA_ITaskInfoRepository;
using WIDESEA_Model.Models;
using WIDESEAWCS_DTO.WCSInfo;
@@ -23,11 +25,12 @@
        private readonly ILocationInfoService _locationInfoService;
        private readonly ITaskRepository _taskRepository;
        private readonly ITask_HtyRepository _taskHtyRepository;
        private readonly IStockInfoDetailRepository _stockInfoDetailRepository;
        private readonly IInboundOrderDetailRepository _inboundOrderDetailRepository;
        private readonly IInboundOrderRepository _inboundOrderRepository;
        private readonly IOutboundOrderDetailRepository _outboundOrderDetailRepository;
        private readonly IOutboundOrderRepository _outboundOrderRepository;
        public LargeScreenController(ILocationInfoService locationInfoService, ITaskRepository taskRepository, ITask_HtyRepository taskHtyRepository, IInboundOrderDetailRepository inboundOrderDetailRepository, IInboundOrderRepository inboundOrderRepository, IOutboundOrderDetailRepository outboundOrderDetailRepository, IOutboundOrderRepository outboundOrderRepository)
        public LargeScreenController(ILocationInfoService locationInfoService, ITaskRepository taskRepository, ITask_HtyRepository taskHtyRepository, IInboundOrderDetailRepository inboundOrderDetailRepository, IInboundOrderRepository inboundOrderRepository, IOutboundOrderDetailRepository outboundOrderDetailRepository, IOutboundOrderRepository outboundOrderRepository, IStockInfoDetailRepository stockInfoDetailRepository)
        {
            _locationInfoService = locationInfoService;
            _taskRepository = taskRepository;
@@ -36,8 +39,30 @@
            _inboundOrderRepository = inboundOrderRepository;
            _outboundOrderDetailRepository = outboundOrderDetailRepository;
            _outboundOrderRepository = outboundOrderRepository;
            _stockInfoDetailRepository = stockInfoDetailRepository;
        }
        [HttpPost, Route("GetStockInfos")]
        public WebResponseContent GetStockInfos()
        {
            WebResponseContent webResponseContent = new WebResponseContent();
            List<Dt_StockInfoDetail> _StockInfoDetails = _stockInfoDetailRepository.QueryData(x => x.Status == StockStatusEmun.已入库.ObjToInt());
            List<StockInfo> stocks = new List<StockInfo>();
            foreach (var item in _StockInfoDetails.GroupBy(x => x.MaterielCode))
            {
                StockInfo stockInfo = new StockInfo()
                {
                    Name = item.First().MaterielName,
                    Qty = item.ToList().Count()
                };
                stocks.Add(stockInfo);
            }
            return webResponseContent.OK(data: stocks.OrderByDescending(x => x.Qty));
        }
        public class StockInfo
        {
            public string Name { get; set; }
            public int Qty { get; set; }
        }
        [HttpPost, Route("GetLocationInfo")]
        public WebResponseContent GetLocationInfo([FromBody] SaveModel model)
        {
@@ -106,19 +131,57 @@
            }
            return webResponseContent;
        }
        [HttpPost, Route("GetTaskInfos")]
        public WebResponseContent GetTaskInfos()
        {
            WebResponseContent webResponseContent = new WebResponseContent();
            var date = DateTime.Now;
            var date1 = DateTime.Today.AddDays(-1);
            List<Dt_Task_Hty> Task_YearHties = _taskHtyRepository.QueryData(x => x.InsertTime.Year == date.Year).ToList();
            List<Dt_Task_Hty> Task_Hties = Task_YearHties.Where(x => x.InsertTime.Date == date.Date).ToList();
            List<Dt_Task_Hty> ZTask_Hties = Task_YearHties.Where(x => x.InsertTime.Date == date1.Date).ToList();
            List<Dt_Task_Hty> _Task_InYearHties = Task_YearHties.Where(x => x.TaskType == TaskInboundTypeEnum.Inbound.ObjToInt() || x.TaskType == TaskInboundTypeEnum.PalletInbound.ObjToInt()).ToList();
            List<Dt_Task_Hty> _Task_OutYearHties = Task_YearHties.Where(x => x.TaskType == TaskOutboundTypeEnum.Outbound.ObjToInt() || x.TaskType == TaskOutboundTypeEnum.PalletOutbound.ObjToInt()).ToList();
            List<Dt_Task_Hty> _Task_InMonthHties = _Task_InYearHties.Where(x => x.InsertTime.Month == date.Month).ToList();
            List<Dt_Task_Hty> _Task_OutMonthHties = _Task_OutYearHties.Where(x => x.InsertTime.Month == date.Month).ToList();
            List<Dt_Task_Hty> _Task_InHties = _Task_InMonthHties.Where(x => x.InsertTime.Day == date.Day).ToList();
            List<Dt_Task_Hty> _Task_OutHties = _Task_OutMonthHties.Where(x => x.InsertTime.Day == date.Day).ToList();
            List<Dt_Task_Hty> _Task_ZInHties = _Task_InMonthHties.Where(x => x.InsertTime.Day == date1.Day).ToList();
            List<Dt_Task_Hty> _Task_ZOutHties = _Task_OutMonthHties.Where(x => x.InsertTime.Day == date1.Day).ToList();
            webResponseContent.OK(data: new
            {
                InYearHties = _Task_InYearHties.Count,
                OutYearHties = _Task_OutYearHties.Count,
                InMonthHties = _Task_InMonthHties.Count,
                OutMonthHties = _Task_OutMonthHties.Count,
                InHties = _Task_InHties.Count,
                OutHties = _Task_OutHties.Count,
                Hties = Task_Hties.Count,
                ZHties = ZTask_Hties.Count,
                ZInHties = _Task_ZInHties.Count,
                ZOutHties = _Task_ZOutHties.Count,
            });
            return webResponseContent;
        }
        [HttpPost, Route("GetTask")]
        public WebResponseContent GetTask([FromBody] SaveModel model)
        {
            WebResponseContent webResponseContent = new WebResponseContent();
            var name = model.MainData["Name"].ToString();
            List<Dt_Task_Hty> task_Hties = _taskHtyRepository.QueryData(x => x.TaskType == (name == "入库" ? TaskInboundTypeEnum.Inbound.ObjToInt() : TaskOutboundTypeEnum.Outbound.ObjToInt())).ToList();
            var task_htys = task_Hties.Where(x => x.InsertTime.Date == DateTime.Now.Date).ToList();
            var tasks = _taskRepository.QueryData(x => x.TaskType == (name == "入库" ? TaskInboundTypeEnum.Inbound.ObjToInt() : TaskOutboundTypeEnum.Outbound.ObjToInt())).ToList();
            List<Dt_InboundOrderDetail> inboundOrderDetails = _inboundOrderDetailRepository.QueryData(x => x.OrderDetailStatus <= OrderDetailStatusEnum.GroupAndInbound.ObjToInt()).ToList();
            List<Dt_Task_Hty> task_Hties = new List<Dt_Task_Hty>();
            if (name != "入库")
            {
                task_Hties = _taskHtyRepository.QueryData(x => x.TaskType == TaskOutboundTypeEnum.Outbound.ObjToInt() || x.TaskType == TaskOutboundTypeEnum.PalletOutbound.ObjToInt()).ToList();
                var task_htys = task_Hties.Where(x => x.InsertTime.Date == DateTime.Now.Date).ToList();
                var tasks = _taskRepository.QueryData(x => x.TaskType == TaskOutboundTypeEnum.Outbound.ObjToInt() || x.TaskType == TaskOutboundTypeEnum.PalletOutbound.ObjToInt()).ToList();
                List<Dt_OutboundOrderDetail> outboundOrderDetails = _outboundOrderDetailRepository.QueryData(x => x.OrderDetailStatus < OrderDetailStatusEnum.Outbound.ObjToInt()).ToList();
                return WebResponseContent.Instance.OK(data: new
                webResponseContent.OK(data: new
                {
                    task_Htiesqty = task_Hties.Count,
                    task_htysqty = task_htys.Count,
@@ -126,13 +189,22 @@
                    inboundOrderDetailsqty = outboundOrderDetails.Sum(x => x.OrderQuantity - x.OverOutQuantity)
                });
            }
            return WebResponseContent.Instance.OK(data: new
            else
            {
                task_Htiesqty = task_Hties.Count,
                task_htysqty = task_htys.Count,
                tasksqty = tasks.Count,
                inboundOrderDetailsqty = inboundOrderDetails.Sum(x => x.OrderQuantity - x.OverInQuantity)
            });
                task_Hties = _taskHtyRepository.QueryData(x => x.TaskType == TaskInboundTypeEnum.Inbound.ObjToInt() || x.TaskType == TaskInboundTypeEnum.PalletInbound.ObjToInt()).ToList();
                var task_htys = task_Hties.Where(x => x.InsertTime.Date == DateTime.Now.Date).ToList();
                var tasks = _taskRepository.QueryData(x => x.TaskType == TaskInboundTypeEnum.Inbound.ObjToInt() || x.TaskType == TaskInboundTypeEnum.PalletInbound.ObjToInt()).ToList();
                List<Dt_InboundOrderDetail> inboundOrderDetails = _inboundOrderDetailRepository.QueryData(x => x.OrderDetailStatus <= OrderDetailStatusEnum.GroupAndInbound.ObjToInt()).ToList();
                webResponseContent.OK(data: new
                {
                    task_Htiesqty = task_Hties.Count,
                    task_htysqty = task_htys.Count,
                    tasksqty = tasks.Count,
                    inboundOrderDetailsqty = inboundOrderDetails.Sum(x => x.OrderQuantity - x.OverInQuantity)
                });
            }
            return webResponseContent;
        }
    }
}