From b4fe67964e65428d8be84e6aed1a48b864620972 Mon Sep 17 00:00:00 2001
From: zhanghonglin <zhanghonglin@hnkhzn.com>
Date: 星期二, 28 四月 2026 09:37:26 +0800
Subject: [PATCH] 111

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 15283b5..51a0c89 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -26,6 +26,9 @@
         private readonly IRepository<Dt_Task_Hty> _Task_HtyRepository;
         private readonly IUnitOfWorkManage _unitOfWorkManage;
 
+        private static int kkk = 1;
+        private static int ttt = 1;
+
         public TaskService(IRepository<Dt_Task> BaseDal, IRepository<Dt_StationManger> StationMangerRepository, IRepository<Dt_Task_Hty> Task_HtyRepository, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal)
         {
             _StationMangerRepository = StationMangerRepository;
@@ -50,11 +53,22 @@
             //鑾峰彇浠诲姟
             if (InorOuts.Equals("In"))
             {
-                task = BaseDal.QueryData(v => ( v.TaskType == (int)TaskTypeEnum.InEmpty || v.TaskType == (int)TaskTypeEnum.Infull) && v.TaskState == (int)TaskStatusEnum.InNew).OrderByDescending(v => v.Grade).First();
+                task = BaseDal.QueryFirst(v => (v.TaskType == (int)TaskTypeEnum.InEmpty || v.TaskType == (int)TaskTypeEnum.Infull) && v.TaskState == (int)TaskStatusEnum.InNew);
             }
             else if (InorOuts.Equals("Out"))
             {
-                task = BaseDal.QueryData(v => (v.TaskType == (int)TaskTypeEnum.OutDirect || v.TaskType == (int)TaskTypeEnum.OutEmpty || v.TaskType == (int)TaskTypeEnum.Outfull) && v.TaskState == (int)TaskStatusEnum.OutNew).OrderByDescending(v => v.Grade).First();
+                //涓�婊℃《鍑虹┖妗跺嚭
+                if (kkk == 1)
+                {
+                    task = BaseDal.QueryFirst(v => (v.TaskType == (int)TaskTypeEnum.OutEmpty) && v.TaskState == (int)TaskStatusEnum.OutNew);
+                    kkk = 2;
+                }
+                else if (kkk == 2)
+                {
+                    task = BaseDal.QueryFirst(v => (v.TaskType == (int)TaskTypeEnum.OutDirect || v.TaskType == (int)TaskTypeEnum.Outfull) && v.TaskState == (int)TaskStatusEnum.OutNew);
+                    kkk = 1;
+                }
+
             }
             return task;
         }
@@ -80,8 +94,12 @@
         {
             Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == TaskNum);
 
+            if (task == null)
+            {
+                return null;
+            }
             //鍏ュ簱
-            if (R_TaskPhases == 4 && (task.TaskType == (int)TaskTypeEnum.InEmpty|| task.TaskType == (int)TaskTypeEnum.Infull))
+            if (R_TaskPhases == 4 && (task.TaskType == (int)TaskTypeEnum.InEmpty || task.TaskType == (int)TaskTypeEnum.Infull))
             {
                 task.TaskState = (int)TaskStatusEnum.Task_Put;
             }
@@ -131,7 +149,7 @@
                         taskhty.Remark = task.Remark;
                         taskhty.TaskType = task.TaskType;
                         taskhty.TaskState = (int)TaskStatusEnum.Task_Finish;
-                        
+
                         //寮�濮嬫暟鎹簱浜嬪姟
                         _unitOfWorkManage.BeginTran();
                         //淇敼璐т綅鐘舵�佸拰鍒涘缓搴撳瓨
@@ -292,7 +310,7 @@
             catch (Exception ex)
             {
                 //content = WebResponseContent.Instance.Error($"浠诲姟瀹屾垚寮傚父锛屼换鍔″彿锛歿TaskNum},{ex}");
-                LogLock.OutLogAOP("鎺ュ彛鏃ュ織", new string[] { "浠诲姟瀹屾垚寮傚父锛屼换鍔″彿:", TaskNum+"|"+ex.ToString() });
+                LogLock.OutLogAOP("鎺ュ彛鏃ュ織", new string[] { "浠诲姟瀹屾垚寮傚父锛屼换鍔″彿:", TaskNum + "|" + ex.ToString() });
             }
             return content;
         }

--
Gitblit v1.9.3