From 0a1470be0c3a381b9528d389d6921ec244bff042 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期一, 30 六月 2025 14:33:25 +0800
Subject: [PATCH] 更新超时信息相关功能及配置文件 在 `appsettings.json` 中更新连接字符串,移除旧配置并优化格式。  修改 `Dt_OutTime.vue` 中的表格 URL。 新增 `IStockInfoTimeoutRepository` 和 `IStockInfoTimeoutService` 接口定义。 实现超时信息存储和服务的类,增强数据处理能力。 添加 `StockInfoTimeoutController` 控制器以处理相关 API 请求。

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json                                   |   92 +++++++++++-----------
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicRepository/Stock/StockInfoTimeoutRepository.cs   |    9 ++
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json                                   |    4 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicRepository/Stock/IStockInfoTimeoutRepository.cs |    6 +
 Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_OutTime.vue                           |    2 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoTimeoutService.cs        |   88 ++++++++++++++++++++++
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicService/Stock/IStockInfoTimeoutService.cs       |    5 +
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/StockInfoTimeoutController.cs    |   13 +++
 8 files changed, 170 insertions(+), 49 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
index 94f23b4..0c8f095 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
@@ -11,8 +11,8 @@
   "ConnectionStringsEncryption": false,
   "MainDB": "DB_WIDESEA", //褰撳墠椤圭洰鐨勪富搴擄紝鎵�瀵瑰簲鐨勮繛鎺ュ瓧绗︿覆鐨凟nabled蹇呴』涓簍rue
   //杩炴帴瀛楃涓�
-  "ConnectionString": "Data Source=.\\LIULEI;Initial Catalog=WIDESEA_WCSDBB2F;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
-  //"ConnectionString": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WCSDB_BB3F;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+  //"ConnectionString": "Data Source=.\\LIULEI;Initial Catalog=WIDESEA_WCSDBB2F;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+  "ConnectionString": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WCSDB_BB3F;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
   //璺ㄥ煙
   "Cors": {
     "PolicyName": "CorsIpAccess", //绛栫暐鍚嶇О
diff --git a/Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_OutTime.vue b/Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_OutTime.vue
index 4473a3f..7cf35e1 100644
--- a/Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_OutTime.vue
+++ b/Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/stock/Dt_OutTime.vue
@@ -21,7 +21,7 @@
             footer: "Foots",
             cnName: '瓒呮椂淇℃伅',
             name: 'stock/Dt_BillGroupStock',
-            url: "/Task/GetTimeout",
+            url:"/StockInfoTimeout/",
             sortName: "createDate"
         });
         const editFormFields = ref({
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicRepository/Stock/IStockInfoTimeoutRepository.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicRepository/Stock/IStockInfoTimeoutRepository.cs
new file mode 100644
index 0000000..ffa1ef1
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicRepository/Stock/IStockInfoTimeoutRepository.cs
@@ -0,0 +1,6 @@
+锘縩amespace WIDESEA_IStorageBasicRepository
+{
+    public interface IStockInfoTimeoutRepository : IRepository<DtStockInfo>
+    {
+    }
+}
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicService/Stock/IStockInfoTimeoutService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicService/Stock/IStockInfoTimeoutService.cs
new file mode 100644
index 0000000..e3d5578
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicService/Stock/IStockInfoTimeoutService.cs
@@ -0,0 +1,5 @@
+锘縩amespace WIDESEA_IStorageBasicService;
+
+public interface IStockInfoTimeoutService : IService<DtStockInfo>
+{
+}
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicRepository/Stock/StockInfoTimeoutRepository.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicRepository/Stock/StockInfoTimeoutRepository.cs
new file mode 100644
index 0000000..667d5cd
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicRepository/Stock/StockInfoTimeoutRepository.cs
@@ -0,0 +1,9 @@
+锘縩amespace WIDESEA_StorageBasicRepository
+{
+    public class StockInfoTimeoutRepository : RepositoryBase<DtStockInfo>, IStockInfoTimeoutRepository
+    {
+        public StockInfoTimeoutRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage)
+        {
+        }
+    }
+}
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoTimeoutService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoTimeoutService.cs
new file mode 100644
index 0000000..5007d2d
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Stock/StockInfoTimeoutService.cs
@@ -0,0 +1,88 @@
+锘縰sing SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Cache;
+
+namespace WIDESEA_StorageBasicServices.Stock
+{
+    public class StockInfoTimeoutService : ServiceBase<DtStockInfo, IStockInfoRepository>, IStockInfoTimeoutService
+    {
+
+        private readonly ISimpleCacheService _simpleCacheService;
+        private readonly ILocationStatusChangeRecordRepository _locationStatusChangeRecordRepository;
+        public StockInfoTimeoutService(IStockInfoRepository BaseDal, ISimpleCacheService simpleCacheService, ILocationStatusChangeRecordRepository locationStatusChangeRecordRepository) : base(BaseDal)
+        {
+            _simpleCacheService = simpleCacheService;
+            _locationStatusChangeRecordRepository = locationStatusChangeRecordRepository;
+        }
+
+        public override PageGridData<DtStockInfo> GetPageData(PageDataOptions options)
+        {
+            string wheres = ValidatePageOptions(options);
+            //鑾峰彇鎺掑簭瀛楁
+            Dictionary<string, SqlSugar.OrderByType> orderbyDic = GetPageDataSort(options, TProperties);
+            List<OrderByModel> orderByModels = new List<OrderByModel>();
+            foreach (var item in orderbyDic)
+            {
+                OrderByModel orderByModel = new()
+                {
+                    FieldName = item.Key,
+                    OrderByType = item.Value
+                };
+                orderByModels.Add(orderByModel);
+            }
+
+
+            int totalCount = 0;
+            List<SearchParameters> searchParametersList = new List<SearchParameters>();
+            if (!string.IsNullOrEmpty(options.Wheres))
+            {
+                try
+                {
+                    searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
+                    options.Filter = searchParametersList;
+                }
+                catch { }
+            }
+
+            Expression<Func<DtStockInfo, bool>> locationStatus = null;
+            Expression<Func<DtStockInfo, bool>> roadwayNo = null;
+            Expression<Func<DtStockInfo, bool>> materielCode = null;
+            foreach (var item in searchParametersList)
+            {
+                if (item.Name.Contains("locationStatus"))
+                {
+                    locationStatus = x => x.LocationInfo.LocationStatus == Convert.ToInt32(item.Value);
+                }
+                else if (item.Name.Contains("roadwayNo"))
+                {
+                    roadwayNo = x => x.LocationInfo.RoadwayNo.Contains(item.Value);
+                }
+                else if (item.Name.Contains("materielCode"))
+                {
+                    materielCode = x => x.StockInfoDetails.Any(d => d.MaterielCode.Contains(item.Value));
+                }
+            }
+
+            var now = DateTime.Now;
+            // 浣跨敤Subtract鏂规硶
+            var threeHoursAgo = now.Subtract(TimeSpan.FromHours(3));
+
+            var data = BaseDal.Db.Queryable<DtStockInfo>()
+                .Includes(x => x.StockInfoDetails)
+                .Includes(x => x.LocationInfo)
+                .Where(x => x.OutboundTime < threeHoursAgo)
+                .WhereIF(!wheres.IsNullOrEmpty(), wheres)
+                .WhereIF(locationStatus != null, locationStatus)
+                .WhereIF(roadwayNo != null, roadwayNo)
+                .WhereIF(materielCode != null, materielCode)
+                .OrderBy(orderByModels)
+                .ToPageList(options.Page, options.Rows, ref totalCount);
+            return new PageGridData<DtStockInfo>(totalCount, data);
+        }
+    }
+}
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/StockInfoTimeoutController.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/StockInfoTimeoutController.cs
new file mode 100644
index 0000000..37193de
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/StockInfoTimeoutController.cs
@@ -0,0 +1,13 @@
+锘縰sing WIDESEA_IStorageBasicService;
+
+namespace WIDESEA_WMSServer.Controllers;
+
+[Route("api/StockInfoTimeout")]
+[ApiController]
+public class StockInfoTimeoutController : ApiBaseController<IStockInfoTimeoutService, DtStockInfo>
+{
+    public StockInfoTimeoutController(IStockInfoTimeoutService service) : base(service)
+    {
+    }
+
+}
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
index 353a3e3..78cc774 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
@@ -1,49 +1,49 @@
 {
-    "Logging": {
-        "LogLevel": {
-            "Default": "Information",
-            "Microsoft.AspNetCore": "Warning"
-        }
-    },
-    "AllowedHosts": "*",
-    "urls": "http://*:5000",
-    "MainDB": "DB_WIDESEA", //褰撳墠椤圭洰鐨勪富搴擄紝鎵�瀵瑰簲鐨勮繛鎺ュ瓧绗︿覆鐨凟nabled蹇呴』涓簍rue
-    //杩炴帴瀛楃涓�
-    //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=",
-    //"ConnectionString": "Data Source=192.168.15.253;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
-    "ConnectionString": "Data Source=.;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
-    //"ConnectionString": "Data Source=.\\LIULEI;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
-    //"ConnectionString": "Data Source=192.168.20.251;Initial Catalog=WIDESEA_WMSDB;User ID=sa;Password=123456@gy;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
-    //"ConnectionStringWCS": "Data Source=192.168.15.253;Initial Catalog=WIDESEA_WCSDB_BBMain;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
-    "ConnectionStringWCS": "Data Source=.;Initial Catalog=WIDESEA_WCSDB_BBMain;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
-    //璺ㄥ煙
-    "Cors": {
-        "PolicyName": "CorsIpAccess", //绛栫暐鍚嶇О
-        "EnableAllIPs": true, //褰撲负true鏃讹紝寮�鏀炬墍鏈塈P鍧囧彲璁块棶銆�
-        // 鏀寔澶氫釜鍩熷悕绔彛锛屾敞鎰忕鍙e彿鍚庝笉瑕佸甫/鏂滄潌锛氭瘮濡俵ocalhost:8000/锛屾槸閿欑殑
-        // 娉ㄦ剰锛宧ttp://127.0.0.1:1818 鍜� http://localhost:1818 鏄笉涓�鏍风殑
-        "IPs": "http://127.0.0.1:8080,http://localhost:8080,http://127.0.0.1:8081,http://localhost:8081"
-    },
-    "ApiName": "WIDESEA",
-    "ExpMinutes": 120,
+  "Logging": {
+    "LogLevel": {
+      "Default": "Information",
+      "Microsoft.AspNetCore": "Warning"
+    }
+  },
+  "AllowedHosts": "*",
+  "urls": "http://*:5000",
+  "MainDB": "DB_WIDESEA", //褰撳墠椤圭洰鐨勪富搴擄紝鎵�瀵瑰簲鐨勮繛鎺ュ瓧绗︿覆鐨凟nabled蹇呴』涓簍rue
+  //杩炴帴瀛楃涓�
+  //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=",
+  //"ConnectionString": "Data Source=192.168.15.253;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+  "ConnectionString": "Data Source=.;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+  //"ConnectionString": "Data Source=.\\LIULEI;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+  //"ConnectionString": "Data Source=192.168.20.251;Initial Catalog=WIDESEA_WMSDB;User ID=sa;Password=123456@gy;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+  //"ConnectionStringWCS": "Data Source=192.168.15.253;Initial Catalog=WIDESEA_WCSDB_BBMain;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+  "ConnectionStringWCS": "Data Source=.;Initial Catalog=WIDESEA_WCSDB_BBMain;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+  //璺ㄥ煙
+  "Cors": {
+    "PolicyName": "CorsIpAccess", //绛栫暐鍚嶇О
+    "EnableAllIPs": true, //褰撲负true鏃讹紝寮�鏀炬墍鏈塈P鍧囧彲璁块棶銆�
+    // 鏀寔澶氫釜鍩熷悕绔彛锛屾敞鎰忕鍙e彿鍚庝笉瑕佸甫/鏂滄潌锛氭瘮濡俵ocalhost:8000/锛屾槸閿欑殑
+    // 娉ㄦ剰锛宧ttp://127.0.0.1:1818 鍜� http://localhost:1818 鏄笉涓�鏍风殑
+    "IPs": "http://127.0.0.1:8080,http://localhost:8080,http://127.0.0.1:8081,http://localhost:8081"
+  },
+  "ApiName": "WIDESEA",
+  "ExpMinutes": 120,
 
-    // 闇�瑕佺Щ搴撶殑琛�
-    "TransfertRows": "1,4,5,8",
-    "CacheSettings": {
-        "UseRedis": false,
-        "RedisSettings": {
-            "Address": "127.0.0.1:6379",
-            "Password": "123456",
-            "Db": 9,
-            "ClearRedis": true
-        }
-    },
-    // 鍏佽鍑哄簱鐨勭紪鐮�
-    "OutBoundMateriel": [
-        //{
-        //    "MaterielCode": "CC01050001348",
-        //    "ProductionLine": "ZJ-8",
-        //    "ProcessCode": "CH001"
-        //}
-    ]
+  // 闇�瑕佺Щ搴撶殑琛�
+  "TransfertRows": "1,4,5,8",
+  "CacheSettings": {
+    "UseRedis": false,
+    "RedisSettings": {
+      "Address": "127.0.0.1:6379",
+      "Password": "123456",
+      "Db": 9,
+      "ClearRedis": true
+    }
+  },
+  // 鍏佽鍑哄簱鐨勭紪鐮�
+  "OutBoundMateriel": [
+    //{
+    //    "MaterielCode": "CC01050001348",
+    //    "ProductionLine": "ZJ-8",
+    //    "ProcessCode": "CH001"
+    //}
+  ]
 }

--
Gitblit v1.9.3