From f0428c0ce5831765142690676d1b337a84e90b8b Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <1247017146@qq.com> Date: 星期四, 05 六月 2025 10:23:02 +0800 Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/HuaYiZhongHeng/BaiBuSanLouNew --- CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs | 69 ++++++++++++++++++++++++++++++++++ 1 files changed, 69 insertions(+), 0 deletions(-) diff --git a/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs index f1e1cbe..05a4a49 100644 --- a/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs +++ b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs @@ -1789,7 +1789,76 @@ } #endregion + public WebResponseContent GetTimeout() + { + WebResponseContent content = new WebResponseContent(); + try + { + var now = DateTime.Now; + // 浣跨敤Subtract鏂规硶 + var threeHoursAgo = now.Subtract(TimeSpan.FromHours(3)); + List<DtStockInfo> dtStocks = _stockInfoRepository.Db.Queryable<DtStockInfo>() + .Where(x => x.OutboundTime < threeHoursAgo).ToList(); + return content.OK1(total1: dtStocks.Count, data: dtStocks); + } + catch (Exception ex) + { + return content.Error(ex.Message); + } + + } + + public WebResponseContent Getproductionstatistics() + { + WebResponseContent content = new WebResponseContent(); + try + { + var now = DateTime.Now; + var thirtyDaysAgo = now.AddDays(-30); + var roadwayMappings = new Dictionary<string, string> { + { "JZ", "闈欑疆搴�" }, + { "CH", "闄堝寲搴�" }, + { "FR", "鍒嗗搴�" }, + { "GW", "楂樻俯搴�" }, + { "CW", "甯告俯搴�" } + }; + + var roadwayKeys = roadwayMappings.Keys.ToArray(); + + var taskHty = _task_HtyRepository.Db.Queryable<Dt_Task_Hty>() + .Where(it => + it.CreateDate >= thirtyDaysAgo && + it.CreateDate <= now && + it.TaskType == 100 && + roadwayKeys.Any(rk => it.Roadway.Contains(rk))) + .ToList() + .Select(t => new { + OriginalRoadway = t.Roadway, + MatchedKey = roadwayKeys.FirstOrDefault(rk => t.Roadway.Contains(rk)), + CreateDate = t.CreateDate + }) + .Where(t => t.MatchedKey != null) + .GroupBy(t => new { + RoadwayKey = t.MatchedKey, + Date = t.CreateDate.Date, + Hour = t.CreateDate.Hour + }) + .OrderByDescending(group => group.Key.Date) + .ThenByDescending(group => group.Key.Hour) + .Select(group => new { + Hour = $"{group.Key.Date:yyyy/M/d} {group.Key.Hour}:00", + Count = group.Count(), + Roadway = roadwayMappings[group.Key.RoadwayKey] // 鏄犲皠涓轰腑鏂囧悕绉� + }) + .ToList(); + return content.OK1(total1: taskHty.Count, data: taskHty); + } + catch (Exception ex) + { + return content.Error(ex.Message); + } + } #endregion 澶栭儴鎺ュ彛鏂规硶 #region 鍐呴儴璋冪敤鏂规硶 -- Gitblit v1.9.3