From 9de6c7c6d835ba5161d64114d154bfc7676244a1 Mon Sep 17 00:00:00 2001
From: 陈勇 <竞男@ASUNA>
Date: 星期一, 06 四月 2026 12:44:43 +0800
Subject: [PATCH] 同步

---
 项目代码/WMS/WMSServer/WIDESEA_StorageTaskServices/AutoTask/BackgroundJob.cs |   65 ++++++--------------------------
 1 files changed, 13 insertions(+), 52 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageTaskServices/AutoTask/BackgroundJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageTaskServices/AutoTask/BackgroundJob.cs"
index 710ef80..95c7017 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageTaskServices/AutoTask/BackgroundJob.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageTaskServices/AutoTask/BackgroundJob.cs"
@@ -1,12 +1,6 @@
 锘縰sing Masuit.Tools;
-using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Logging;
 using Quartz;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using WIDESEA_Core.Const;
 using WIDESEA_DTO.WMS;
 using WIDESEA_IServices;
@@ -47,23 +41,15 @@
         {
             try
             {
-                //var area = _areaInfoRepository.QueryFirst(x => x.AreaCode == "GWSC1");
+                //鎬昏涓嶇敓浜�  鍒欏仠姝㈡媺鍔ㄥ嚭搴�
+                var area = _areaInfoRepository.QueryFirst(x => x.AreaCode == "5");
+                if (area.AreaStatus != 1l) { return Task.CompletedTask; }
 
-                //if (area == null) { return; }
-
-                //IDictionary<string, DtStockInfo>? stockInfos = _simpleCacheService.HashGetAll<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo);
-                //List<DtStockInfo> stockInfoList = stockInfos.Values.ToList();
-
-                //var stockInfo = stockInfoList.Where(x => x.AreaCode == area.AreaCode && x.OutboundTime < DateTime.Now && x.IsFull == true) // 杩囨护鏉′欢
-                //     .Where(x => x.LocationInfo != null && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID) // 杩囨护鏉′欢
-                //     .OrderBy(x => x.OutboundTime) // 鎺掑簭
-                //     .ToList(); // 鑾峰彇绗竴涓厓绱�
-                var lockInfo = _palletStockInfoRepository.Db.Queryable<Dt_MESLockInfo>()
+                var lockInfo = _MESLockInfoRepository.Db.Queryable<Dt_MESLockInfo>()
                     //.Where(x => x.LockStatue == 0)
                     .Includes(x => x.CarBodyInfo)
                     .OrderBy(x => x.sequenceNo) // 鎺掑簭
                     .ToList(); // 鑾峰彇绗竴涓厓绱�
-
 
                 if (lockInfo.Where(x => x.LockStatue == 1).Count() > 10) return Task.CompletedTask;
                 if (lockInfo.Count == 0) return Task.CompletedTask;
@@ -86,10 +72,6 @@
                 {
                     stationLists = _stationManagerRepository.QueryData(x => x.RoadwayNo == lockCar.TCLine && x.stationType == 2 && x.stationStatus == "1" && x.stationArea == "4");
                 }
-                //else if (item.CarBodyInfo.CarType == 3)
-                //{
-                //    stationLists = _stationManagerRepository.QueryData(x => x.RoadwayNo == item.TCLine && x.stationType == 7 && x.stationStatus == "1" && x.stationArea == "3");
-                //}
 
                 var stock = _VVStockInfoRepository.QueryFirst(x => x.carBodyID == lockCar.carBodyID);
                 var lockStock = _palletStockInfoRepository.QueryFirst(x => x.carBodyID == lockCar.carBodyID);
@@ -116,7 +98,7 @@
                 // 鍒涘缓骞舵坊鍔犱换鍔″埌鏁版嵁搴�
                 hasTask = new Dt_Task
                 {
-                    Grade = 1,
+                    Grade = 3,
                     Roadway = Outstation.Roadway,
                     TargetAddress = "RB043",
                     Dispatchertime = DateTime.Now,
@@ -132,6 +114,8 @@
                     Creater = "System",
                     CreateDate = DateTime.Now,
                     TaskId = 0,
+                    CarType = stock.CarType,
+                    RoadwayNo = stock.RoadwayNo,
                 };
 
                 // 鍒涘缓浠诲姟浼犺緭鐢ㄧ殑DTO瀵硅薄
@@ -160,6 +144,7 @@
                     _unitOfWorkManage.CommitTran();
                 }
 
+                #region 闆嗗悎
                 //foreach (var item in lockInfo)
                 //{
                 //    var hasTask = _taskRepository.QueryFirst(x => x.PalletCode == item.CarBodyInfo.PalletCode);
@@ -251,7 +236,8 @@
                 //        _palletStockInfoRepository.UpdateData(lockStock);
                 //        _unitOfWorkManage.CommitTran();
                 //    }
-                //}
+                //} 
+                #endregion
             }
             catch (Exception ex)
             {
@@ -261,33 +247,8 @@
             {
                 ConsoleHelper.WriteSuccessLine($"鎷夊姩閿佽溅锛�" + DateTime.Now.ToString());
             }
-           
-            return Task.CompletedTask;
-        }
 
-        /// <summary>
-        /// 鍒涘缓浠诲姟瀹炰緥
-        /// </summary>
-        private Dt_Task CreateTask(DtStockInfo stockInfo, string position, int tag)
-        {
-            return new Dt_Task
-            {
-                Grade = 1,
-                Roadway = stockInfo.LocationInfo.RoadwayNo,
-                TargetAddress = position,
-                Dispatchertime = DateTime.Now,
-                NextAddress = position,
-                OrderNo = null,
-                PalletCode = stockInfo.PalletCode,
-                SourceAddress = stockInfo.LocationCode,
-                CurrentAddress = stockInfo.LocationCode,
-                TaskState = (int)TaskOutStatusEnum.OutNew,
-                TaskType = tag,
-                TaskNum = _taskRepository.GetTaskNo().Result,
-                Creater = "System", // 淇鎷煎啓閿欒
-                CreateDate = DateTime.Now,
-                TaskId = 0,
-            };
+            return Task.CompletedTask;
         }
 
         /// <summary>
@@ -307,8 +268,8 @@
                 Id = 0,
                 TaskType = task.TaskType,
                 pvi = task.PVI,
-                NextAddress = task.NextAddress
-
+                NextAddress = task.NextAddress,
+                CarType = task.CarType
             };
         }
 

--
Gitblit v1.9.3