| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.TaskEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_IWMsInfoServices; |
| | | using WIDESEA_Model.Models; |
| | | |
| | |
| | | public SupplyTaskHtyService(IRepository<Dt_SupplyTask_Hty> BaseDal) : base(BaseDal) |
| | | { |
| | | } |
| | | public WebResponseContent GetInOutTasks() |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | List<object> list = new List<object>(); |
| | | DateTime dateTime = DateTime.Now.AddDays(-6).Date; |
| | | List<Dt_SupplyTask_Hty> supplyTask_Hties = BaseDal.QueryData(x => x.InsertTime >= dateTime); |
| | | for (int i = 6; i >= 0; i--) |
| | | { |
| | | DateTime dateTime1 = DateTime.Now.AddDays(-i).Date; |
| | | DateTime dateTime2 = DateTime.Now.AddDays(-i + 1).Date; |
| | | var supplyTasks = supplyTask_Hties.Where(x => x.InsertTime >= dateTime1 && x.InsertTime < dateTime2).ToList(); |
| | | var inQty = Convert.ToInt32(supplyTasks.Where(x => x.TaskType == TaskTypeEnum.In.ObjToInt() || x.TaskType == TaskTypeEnum.OutReturn.ObjToInt()).Sum(x => x.StockQuantity)); |
| | | var outQty = Convert.ToInt32(supplyTasks.Where(x => x.TaskType == TaskTypeEnum.Out.ObjToInt() || x.TaskType == TaskTypeEnum.InReturn.ObjToInt()).Sum(x => x.StockQuantity)); |
| | | list.Add(new |
| | | { |
| | | date = dateTime1.ToString("yyyy-MM-dd"), |
| | | @in = inQty, |
| | | @out = outQty, |
| | | }); |
| | | } |
| | | content.OK(data: new |
| | | { |
| | | daily = list |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |