From 4f8cbd783208925be8ccbfed198b86e20523ec0e Mon Sep 17 00:00:00 2001
From: chenyong <chenyong@hnkhzn.com>
Date: 星期一, 09 六月 2025 19:26:06 +0800
Subject: [PATCH] 更新最新代码
---
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs | 113 +++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 91 insertions(+), 22 deletions(-)
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
index 6919e58..a1744f2 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
@@ -4,6 +4,7 @@
using WIDESEA_Core.Const;
using WIDESEA_DTO.MOM;
using WIDESEA_DTO.WMS;
+using WIDESEA_Model.Models.Basic;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob.Models;
@@ -1138,37 +1139,36 @@
#region 鐏鍑哄簱
- public WebResponseContent EmergencyTask(object obj)
+ public WebResponseContent EmergencyTask(Object obj)
{
WebResponseContent content = new WebResponseContent();
var emergencyTask = new DTSEmergencyTask();
try
{
emergencyTask = JsonConvert.DeserializeObject<DTSEmergencyTask>(obj.ToString());
-
if (emergencyTask == null) throw new Exception("鐏鍙傛暟涓虹┖");
-
string[] strings = emergencyTask.LocationCode.Split("-");
-
- string[] Roadways = strings[0].Select(x => x.ToString()).ToArray();
- string Roadway = string.Empty;
- switch (Roadways[0])
- {
- case "J":
- Roadway = "JZSC" + Roadways[1];
- break;
- case "G":
- Roadway = "GWSC" + Roadways[1];
- break;
- case "C":
- Roadway = "CWSC" + Roadways[1];
- break;
- default: throw new Exception("鏈瘑鍒簱浣嶇紪鐮�");
- }
-
+ string Roadway = strings[0];
+ //switch (Roadways[0])
+ //{
+ // case "J":
+ // Roadway = "JZSC" + Roadways[1];
+ // break;
+ // case "G":
+ // Roadway = "GWSC" + Roadways[1];
+ // break;
+ // case "C":
+ // Roadway = "CWSC" + Roadways[1];
+ // break;
+ // default: throw new Exception("鏈瘑鍒簱浣嶇紪鐮�");
+ //}
+ int Row = Convert.ToInt16(strings[1]);
+ int Column= Convert.ToInt16(strings[2]);
+ int Layer= Convert.ToInt16(strings[3]);
+ if (!strings[0].Contains("SC")) throw new Exception("鏈煡搴撳尯");
for (int i = 0; i < 2; i++)
{
- DtLocationInfo locationInfo = _locationRepository.QueryFirst(x => x.Row == Convert.ToInt16(strings[1]) && x.Column == Convert.ToInt16(strings[2]) && x.Layer == (i == 0 ? Convert.ToInt16(strings[3]) * 2 - 1 : Convert.ToInt16(strings[3]) * 2) && x.RoadwayNo == Roadway);
+ DtLocationInfo locationInfo = _locationRepository.QueryFirst(x => x.Row == Row && x.Column == Column && x.Layer == (i == 0 ? Layer - 1 : Layer) && x.RoadwayNo == Roadway);
if (locationInfo == null)
{
throw new Exception("鏈煡搴撲綅");
@@ -1516,4 +1516,73 @@
}
#endregion
-}
\ No newline at end of file
+ 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);
+ }
+ }
+ }
\ No newline at end of file
--
Gitblit v1.9.3