From 8b8fd6e60718e5015c9b200a59edcdfede284b87 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期四, 25 十二月 2025 16:00:05 +0800
Subject: [PATCH] 1

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Jobs/InventoryLockJob.cs  |   26 +++++++-------------------
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs                |   13 +++++++------
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs  |    2 +-
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs    |    1 -
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Jobs/QuartzJobMildd.cs    |   13 +++++++++++++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs |    3 +++
 6 files changed, 31 insertions(+), 27 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs"
index 8450c53..8b9f256 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs"
@@ -107,6 +107,9 @@
         [Description("宸叉竻鐞�")]
         宸叉竻鐞� = 33,
 
+        [Description("鎵嬪姩瑙i攣")]
+        鎵嬪姩瑙i攣 = 66,
+
         [Description("杩囨湡")]
         杩囨湡 =98,
 
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs"
index f621cae..051e334 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs"
@@ -134,7 +134,6 @@
                         OrderNo = inboundOrder.InboundOrderNo,
                         BusinessType = inboundOrder.BusinessType,
                         ValidDate = inboundOrder.BusinessType == BusinessTypeEnum.澶栭儴浠撳簱璋冩櫤浠�.ToString() ? item.ValidDate : datevaliDate == null ? null : Convert.ToDateTime(DateTime.Now).AddDays(Convert.ToDouble(datevaliDate.ValidityDays)),
-                        //ValidDate = datevaliDate == null ? null : DateTime.Now.AddDays(datevaliDate.ValidityDays),
                     });
 
                     item.ReceiptQuantity = item.BarcodeQty;
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs"
index c7cd1e8..4d53ab6 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs"
@@ -549,7 +549,7 @@
         private List<Dt_StockInfo> BuildStockQueryWithInfo(MaterielOutboundCalculationDTO materielCalc, string factoryArea)
         {
             // 鍩虹鏌ヨ鏉′欢锛氱墿鏂欑紪鍙枫�佹壒娆″彿锛堝鏋滄彁渚涳級銆佸簱瀛樻暟閲�>0
-            ISugarQueryable<Dt_StockInfoDetail> stockDetails = _stockDetailRepository.Db.Queryable<Dt_StockInfoDetail>().Where(x => x.MaterielCode == materielCalc.MaterielCode && x.StockQuantity > 0);
+            ISugarQueryable<Dt_StockInfoDetail> stockDetails = _stockDetailRepository.Db.Queryable<Dt_StockInfoDetail>().Where(x => x.MaterielCode == materielCalc.MaterielCode && x.StockQuantity > 0 && (x.Status == (int)StockStatusEmun.鍏ュ簱瀹屾垚 || x.Status == (int)StockStatusEmun.鎵嬪姩瑙i攣));
 
             // 鏍规嵁鏉′欢娣诲姞渚涘簲鍟嗙紪鍙峰尮閰嶏紙涓嶄负绌烘椂鎵嶉渶瑕佸尮閰嶏級
             if (!string.IsNullOrEmpty(materielCalc.SupplyCode))
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Jobs/InventoryLockJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Jobs/InventoryLockJob.cs"
index ec6e218..240cea6 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Jobs/InventoryLockJob.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Jobs/InventoryLockJob.cs"
@@ -4,37 +4,25 @@
 using WIDESEA_Common.StockEnum;
 using WIDESEA_Model.Models;
 using WIDESEA_Model.Models.Basic;
+using WIDESEA_WMSServer.Jobs;
 
-namespace WIDESEA_WMSServer.Jobs
+namespace WIDESEA_WMSServer
 {
     [DisallowConcurrentExecution]
     public class InventoryLockJob : IJob
     {
-        private readonly ILogger<ErpJob> _logger;
         private readonly ISqlSugarClient _db;
-        public InventoryLockJob(ILogger<ErpJob> logger, ISqlSugarClient db )
+        public InventoryLockJob(ISqlSugarClient db)
         {
-            _logger = logger;
             _db = db;
-      
         }
         public Task Execute(IJobExecutionContext context)
         {
-
-            // 绗竴姝ワ細鏇存柊ValidDate鐨勫師鐢烻QL锛圫QL Server锛�
-    //        string updateSql = @"
-    //UPDATE s
-    //SET s.ValidDate = DATEADD(DAY, m.ValidityDays, s.CreateDate)
-    //FROM Dt_StockInfoDetail s
-    //INNER JOIN Dt_MaterialExpirationDate m ON SUBSTRING(s.MaterielCode, 1, 6) = m.MaterialCode
-    //WHERE s.ValidDate IS NULL";
-    //        int updateValidDateResult = _db.Ado.ExecuteCommand(updateSql);
-
-            // 绗簩姝ワ細鏇存柊杩囨湡鐘舵�佺殑鍘熺敓SQL
             string updateStatusSql = @"
-    UPDATE Dt_StockInfoDetail
-    SET Status = 98
-    WHERE ValidDate IS NOT NULL AND ValidDate < GETDATE()";
+                                        UPDATE Dt_StockInfoDetail
+                                        SET Status = 98
+                                        WHERE  ValidDate IS NOT NULL AND ValidDate < GETDATE()
+                                        AND Status = 6";
             int updateStatusResult = _db.Ado.ExecuteCommand(updateStatusSql);
 
             return Task.CompletedTask;
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Jobs/QuartzJobMildd.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Jobs/QuartzJobMildd.cs"
index 09e3e2e..c3d2d45 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Jobs/QuartzJobMildd.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Jobs/QuartzJobMildd.cs"
@@ -34,6 +34,19 @@
                          Name = "AgvTaskJob",
                          TriggerType = 0
                     },
+                     new TasksQz()
+                    {
+                         Id = 2,
+                         AssemblyName = "WIDESEA_WMSServer",
+                         ClassName = "InventoryLockJob",
+                         CreateTime = DateTime.Now,
+                         IntervalSecond = 3,
+                         IsDeleted = false,
+                         IsStart = false,
+                         JobGroup = "WIDESEA_WMSServer",
+                         Name = "InventoryLockJob",
+                         TriggerType = 0
+                    },
 
                 };
                 foreach (var item in allQzServices)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs"
index 8152876..d9dfa17 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs"
@@ -188,6 +188,7 @@
 });
 builder.Services.AddSingleton<IJobFactory, JobFactory>();
 builder.Services.AddTransient<AgvTaskJob>();//Job使用瞬时依赖注入
+builder.Services.AddTransient<InventoryLockJob>();//Job使用瞬时依赖注入
 builder.Services.AddSingleton<ISchedulerCenter, SchedulerCenterServer>();
 
 builder.Services.AddQuartz(q =>
@@ -202,13 +203,13 @@
         .WithIdentity("ErpJob-trigger")
         .WithCronSchedule("0 0 10,14,20 * * ?"));
 
-    var inventoryLockJobKey = new JobKey("InventoryLockJob");
-    q.AddJob<InventoryLockJob>(opts => opts.WithIdentity(inventoryLockJobKey));
+    //var inventoryLockJobKey = new JobKey("InventoryLockJob");
+    //q.AddJob<InventoryLockJob>(opts => opts.WithIdentity(inventoryLockJobKey));
 
-    q.AddTrigger(opts => opts
-        .ForJob(inventoryLockJobKey)
-        .WithIdentity("InventoryLockJob-trigger")
-        .WithCronSchedule("0 0/10 * * * ?")); // 每10分钟执行一次
+    //q.AddTrigger(opts => opts
+    //    .ForJob(inventoryLockJobKey)
+    //    .WithIdentity("InventoryLockJob-trigger")
+    //    .WithCronSchedule("0 0/10 * * * ?")); // 每10分钟执行一次
 });
 
 builder.Services.AddQuartzHostedService(q => q.WaitForJobsToComplete = true);

--
Gitblit v1.9.3