| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Model.Models; |
| | |
| | | private readonly IRepository<Dt_LocationInfo> _locationInfoRepository; |
| | | private readonly IRepository<Dt_OutboundOrderDetail> _outBoundOrderDetailRepository; |
| | | private readonly IRepository<Dt_InboundOrderDetail> _inboundOrderDetailRepository; |
| | | private readonly IRepository<Dt_Task_Hty> _taskHtyRepository; |
| | | private readonly IRepository<Dt_Task> _taskRepository; |
| | | private readonly IRepository<Dt_StockInfo> _stockInfoRepository; |
| | | |
| | | public BigGreenService(IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_OutboundOrder> outBoundOrderRepository, IRepository<Dt_LocationInfo> locationInfoRepository,IRepository<Dt_OutboundOrderDetail> outBoundOrderDetailRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository,IRepository<Dt_Task> taskRepository) |
| | | public BigGreenService(IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_OutboundOrder> outBoundOrderRepository, IRepository<Dt_LocationInfo> locationInfoRepository,IRepository<Dt_OutboundOrderDetail> outBoundOrderDetailRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository,IRepository<Dt_Task> taskRepository,IRepository<Dt_Task_Hty> taskHtyRepository, IRepository<Dt_StockInfo> stockInfoRepository) |
| | | { |
| | | _stockInfoDetailRepository = stockInfoDetailRepository; |
| | | _outBoundOrderRepository = outBoundOrderRepository; |
| | |
| | | _outBoundOrderDetailRepository = outBoundOrderDetailRepository; |
| | | _inboundOrderDetailRepository = inboundOrderDetailRepository; |
| | | _taskRepository = taskRepository; |
| | | _taskHtyRepository = taskHtyRepository; |
| | | _stockInfoRepository = stockInfoRepository; |
| | | } |
| | | public WebResponseContent GetBigGreenData() |
| | | { |
| | |
| | | |
| | | //计ç®åºä½å©ç¨ç |
| | | var freeLocation =_locationInfoRepository.Db.Queryable<Dt_LocationInfo>().Where(x=>x.LocationStatus==(int)LocationStatusEnum.Free).Count(); |
| | | var inStockLocation =_locationInfoRepository.Db.Queryable<Dt_LocationInfo>().Where(x => x.LocationStatus == (int)LocationStatusEnum.InStock).Count(); |
| | | var inStockLocation =_locationInfoRepository.Db.Queryable<Dt_LocationInfo>().Where(x => x.LocationStatus == (int)LocationStatusEnum.InStock || x.LocationStatus == (int)LocationStatusEnum.Pallet).Count(); |
| | | int totalLocation = freeLocation + inStockLocation; |
| | | decimal locationUtilizationRate = totalLocation == 0 |
| | | ? 0 |
| | | : Math.Round((decimal)inStockLocation / totalLocation, 4); |
| | | : Math.Round((decimal)inStockLocation / totalLocation, 4)*100; |
| | | |
| | | //计ç®å
¥åºä»»å¡ååºåºä»»å¡å®ææ°é |
| | | var inboundCount =_taskHtyRepository.Db.Queryable<Dt_Task_Hty>().Where(x => x.TaskType >= 500 && x.TaskType < 900).Count(); |
| | | var outboundCount =_taskHtyRepository.Db.Queryable<Dt_Task_Hty>().Where(x => x.TaskType >= 100 && x.TaskType < 500).Count(); |
| | | |
| | | //è®¡ç®æè´§æç®±æ°é |
| | | var inStockPallet = _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletType ==(int) PalletTypeEnum.None).Count(); |
| | | //计ç®ç©ºç®±æ°é |
| | | var freeStockPallet = _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletType == (int)PalletTypeEnum.Empty).Count(); |
| | | // 4. è·åè¿7æ¥æ¯æ¥åºå
¥åºæç»ï¼æ ¸å¿ä¿®æ¹ï¼è°ç¨ä¸é¢çæ¹æ³ï¼ |
| | | var dailyInOutBoundList = Get7DaysDailyInOutBound(); |
| | | |
| | |
| | | UnOutBoundOrderCount = unOutBound, |
| | | LocationUtilizationRate = locationUtilizationRate, |
| | | DailyInOutBoundList = dailyInOutBoundList, |
| | | TaskList = tasks |
| | | TaskList = tasks, |
| | | InboundCount = inboundCount, |
| | | OutboundCount = outboundCount, |
| | | InStockPallet = inStockPallet, |
| | | FreeStockPallet = freeStockPallet |
| | | }; |
| | | return WebResponseContent.Instance.OK(data: bigGreenData); |
| | | } |
| | |
| | | return dailyInOutBoundList; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 大å±/æ±æ»æ°æ®è¿åDTOï¼å¤§ç»¿æ°æ®æ±æ»ï¼ |
| | | /// </summary> |
| | | public class BigGreenDataDto |
| | | { |
| | | /// <summary> |
| | | /// å
¥åºå®ææ°é |
| | | /// </summary> |
| | | public int InboundCount { get; set; } |
| | | /// <summary> |
| | | /// åºåºå®ææ°é |
| | | /// </summary> |
| | | public int OutboundCount { get; set; } |
| | | /// <summary> |
| | | /// æ»åºåæ°é |
| | | /// </summary> |
| | |
| | | public decimal NetStock7Days { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è¿7æ¥åå
¥åºéï¼å
¥åº-åºåºï¼ |
| | | /// </summary> |
| | | public decimal totalStockChangeRate { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å表 |
| | | /// </summary> |
| | | public List<Dt_Task> TaskList { get; set; } = new List<Dt_Task>(); |
| | | |
| | | public int InStockPallet { get; set; } |
| | | |
| | | public int FreeStockPallet { get; set; } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public decimal DailyInboundQuantity { get; set; } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |