From 96a94a59c08f55712ba04eb413e7f61739f11f66 Mon Sep 17 00:00:00 2001
From: zhanghonglin <zhanghonglin@hnkhzn.com>
Date: 星期二, 19 八月 2025 17:09:31 +0800
Subject: [PATCH] 定时一周自动清楚重量厚度,不合格背景红色提示、筛选功能

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/GZJ/GZJJob.cs |   32 ++++++++++++++++++++++++++++----
 1 files changed, 28 insertions(+), 4 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/GZJ/GZJJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/GZJ/GZJJob.cs"
index 84b2514..4601aff 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/GZJ/GZJJob.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/GZJ/GZJJob.cs"
@@ -25,9 +25,11 @@
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_IWMSPart;
 using WIDESEAWCS_Model.Models;
+using WIDESEAWCS_Model.Models.System;
 using WIDESEAWCS_QuartzJob;
 using WIDESEAWCS_QuartzJob.DeviceBase;
 using WIDESEAWCS_QuartzJob.StackerCrane.Enum;
+using WIDESEAWCS_SystemServices;
 using WIDESEAWCS_TaskInfoService;
 using WIDESEAWCS_Tasks.OHT;
 using static System.Collections.Specialized.BitVector32;
@@ -46,6 +48,8 @@
         private readonly IRepository<dt_outstockinfo> _outStockRepository;
         private readonly IRepository<dt_batchInfo> _batchInfoRepository;
         private readonly IRepository<Dt_StockInfo> _StockInfoRepository;
+        private readonly IRepository<dt_Thickness_hty> _dt_Thickness_hty;
+        private readonly IRepository<dt_Weight_hty> _dt_Weight_hty;
         private readonly IRepository<Dt_LocationInfo> _LocationInfoRepository;
         private readonly IUnitOfWorkManage _unitOfWorkManage;
 
@@ -59,6 +63,8 @@
             IRepository<dt_storagemode> storagemodeRepository,
             IRepository<dt_batchInfo> batchInfoRepository,
             IRepository<Dt_StockInfo> StockInfoRepository,
+            IRepository<dt_Thickness_hty> ThicknessHtyService,
+            IRepository<dt_Weight_hty> WeightHtyService,
             IRepository<Dt_LocationInfo> LocationInfoRepository,
             IUnitOfWorkManage unitOfWorkManage)
         {
@@ -74,11 +80,30 @@
             _StockInfoRepository = StockInfoRepository;
             _LocationInfoRepository = LocationInfoRepository;
             _unitOfWorkManage = unitOfWorkManage;
+            _dt_Thickness_hty = ThicknessHtyService;
+            _dt_Weight_hty = WeightHtyService;
         }
+
+        //瀹氭椂娓呯┖涓�鍛ㄧ殑鏃堕棿
+        private static int shijian = 604800;
 
         public Task Execute(IJobExecutionContext context)
         {
-            //return Task.CompletedTask;
+            //瀹氭椂娓呯┖閲嶉噺鍜屽帤搴﹀巻鍙茶褰�
+            Thread.Sleep(1000);
+            if(shijian > 0)
+            {
+                shijian--;
+            }
+            else
+            {
+                List<dt_Weight_hty> weights = _dt_Weight_hty.QueryData();
+                _dt_Weight_hty.DeleteData(weights);
+                List<dt_Thickness_hty> Thickness = _dt_Thickness_hty.QueryData();
+                _dt_Thickness_hty.DeleteData(Thickness);
+                shijian = 604800;
+            }
+
             bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value);
             if (flag && value != null)
             {
@@ -227,7 +252,7 @@
                                 _dt_taskRepositiry.AddData(task);
                             }
                         }
-                        if (OHTJob.oHTReadData.R_RGVMode && OHTJob.oHTReadData.R_DK_isready)//RGV涓婃枡妯″紡锛屼笖涓滆法鏋跺瓙鏈変笂鏂欎俊鍙�
+                        else if (OHTJob.oHTReadData.R_RGVMode && OHTJob.oHTReadData.R_DK_isready)//RGV涓婃枡妯″紡锛屼笖涓滆法鏋跺瓙鏈変笂鏂欎俊鍙�
                         {
                             var station = _dt_stationInfoRepository.QueryFirst(v => v.msg == "涓滆法鏋跺瓙");
                             task.SourceAddress = station.Row + "-" + station.Column + "-1";
@@ -432,8 +457,7 @@
                         //鏌ヨ褰撳墠闇�瑕佸嚭搴撶殑鎵规鍙凤紝浠ュ強鍑哄簱鐗╂枡绫诲瀷
                         var batch = _batchInfoRepository.QueryFirst(v => v.Id == 1);
                         //鏌ヨ搴撳瓨鐗╂枡搴撳瓨淇℃伅
-                        var stocks = _StockInfoRepository.QueryData(v => v.Remark == batch.materType && v.BatchNo == batch.OutBatch && v.StockStatus == 0)
-                            .OrderBy(v => v.CreateDate).ToList();
+                        var stocks = _StockInfoRepository.QueryData(v => v.Remark == batch.materType && v.BatchNo == batch.OutBatch && v.StockStatus == 0).OrderBy(v => v.CreateDate).ToList();
                         if (stocks.Count <= 0)
                         {
                             throw new Exception($"褰撳墠搴撳瓨涓病鏈夈�恵batch.materType}銆戯紙0鑷骇 1澶栬喘锛変笖鎵规涓恒�恵batch.OutBatch}銆戠殑鐗╂枡");

--
Gitblit v1.9.3