From 0bfcc4a5c9a07ce1747f6ec8e60bc3c78d75c3e3 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期二, 17 三月 2026 11:01:01 +0800
Subject: [PATCH] 1

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |   79 +++++++++++++++++++++++++++++++++------
 1 files changed, 67 insertions(+), 12 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 285947c..bd413ad 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -18,7 +18,9 @@
 using AutoMapper;
 using SixLabors.ImageSharp.ColorSpaces;
 using SqlSugar;
+using System.Collections.Generic;
 using System.Diagnostics.CodeAnalysis;
+using System.Threading.Tasks;
 using WIDESEAWCS_BasicInfoService;
 using WIDESEAWCS_Common;
 using WIDESEAWCS_Common.LocationEnum;
@@ -36,6 +38,7 @@
 using WIDESEAWCS_IBasicInfoService;
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
+using WIDESEAWCS_QuartzJob;
 using WIDESEAWCS_QuartzJob.Models;
 using WIDESEAWCS_QuartzJob.Service;
 
@@ -91,12 +94,12 @@
             {
                 List<object> objects = new List<object>();
                 foreach (var item in taskDTOs)
-                {
+                { 
                     foreach (var task in item.tasks)
                     {
                         #region 鍒ゆ柇
-                        content = TaskHelpMethods.isOkTaskInfo(task, true, true);
-                        if (!content.Status)
+                       var  contentStatus = TaskHelpMethods.isOkTaskInfo(task, true, true);
+                        if (!contentStatus.Status)
                         {
                             objects.Add(new
                             {
@@ -106,7 +109,7 @@
                             continue;
                             //throw new Exception(content.Message);
                         }
-                        if (BaseDal.QueryFirst(x => x.WMSTaskNum == task.taskCode) != null)
+                        if (BaseDal.QueryFirst(x => x.WMSTaskNum == task.taskCode && x.TaskType == item.taskType) != null)
                         {
                             objects.Add(new
                             {
@@ -116,7 +119,7 @@
                             continue;
                             //throw new Exception($"浠诲姟鍙枫�恵task.taskCode}銆戝凡瀛樺湪浠诲姟");
                         }
-                        if (BaseDal.QueryFirst(x => x.PalletCode == task.containerCode) != null)
+                        if (BaseDal.QueryFirst(x => x.PalletCode == task.containerCode && x.TaskType == item.taskType) != null)
                         {
                             objects.Add(new
                             {
@@ -126,12 +129,12 @@
                             continue;
                             //throw new Exception($"鎵樼洏鍙枫�恵task.containerCode}銆戝凡瀛樺湪浠诲姟");
                         }
-                        if (BaseDal.QueryFirst(x => x.SourceAddress == task.fromLocationCode) != null)
+                        if (BaseDal.QueryFirst(x => x.SourceAddress == task.fromLocationCode && x.TaskType == item.taskType) != null)
                         {
                             objects.Add(new
                             {
                                 taskCode = task.taskCode,
-                                Message = $"璧风偣浣嶇疆銆恵task.containerCode}銆戝凡瀛樺湪浠诲姟"
+                                Message = $"璧风偣浣嶇疆銆恵task.fromLocationCode}銆戝凡瀛樺湪浠诲姟"
                             });
                             continue;
                             //throw new Exception($"璧风偣浣嶇疆銆恵task.containerCode}銆戝凡瀛樺湪浠诲姟");
@@ -232,6 +235,7 @@
                     if (apiInfo == null) throw new Exception("鏈壘鍒板嚡涔愬+AGV浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
                     string response = HttpHelper.Post(apiInfo.ApiAddress, KLS.Serialize());
                     GALAXISReturn agvContent = response.DeserializeObject<GALAXISReturn>();
+                    content.OK(data: agvContent);
                     if (agvContent.success == true && agvContent.code == 0)
                     {
                         //鐩存帴绉诲叆鍘嗗彶
@@ -258,6 +262,7 @@
                     if (apiInfo == null) throw new Exception("鏈壘鍒板洓鍚戣溅AGV浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
                     string response = HttpHelper.Post(apiInfo.ApiAddress, cancelSXCTake.Serialize());
                     FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
+                    content.OK(data: fOURBOTReturn);
                     if (fOURBOTReturn.returnCode == 0 && fOURBOTReturn.returnUserMsg == "鎴愬姛")
                     {
                         //鐩存帴绉诲叆鍘嗗彶
@@ -270,6 +275,7 @@
                     }
                 }
                 #endregion
+
                 #region 娴峰悍
                 if (isHK)
                 {
@@ -282,6 +288,7 @@
                     if (apiInfo == null) throw new Exception("鏈壘鍒板洓鍚戣溅AGV浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
                     string response = HttpHelper.Post(apiInfo.ApiAddress, cancelHIKROBOTTask.Serialize());
                     HIKROBOTReturn hIKROBOTReturn = response.DeserializeObject<HIKROBOTReturn>();
+                    content.OK(data: hIKROBOTReturn);
                     if (hIKROBOTReturn.code == "SUCCESS" && hIKROBOTReturn.message == "鎴愬姛")
                     {
                         //鐩存帴绉诲叆鍘嗗彶
@@ -372,6 +379,7 @@
                     if (apiInfo == null) throw new Exception("鏈壘鍒板嚡涔愬+AGV浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
                     string response = HttpHelper.Post(apiInfo.ApiAddress, updateGALAXISTaskGrade.Serialize());
                     GALAXISReturn agvContent = response.DeserializeObject<GALAXISReturn>();
+                    content.OK(data: agvContent);
                     if (agvContent.success == true && agvContent.code == 0)
                     {
 
@@ -397,6 +405,7 @@
                     if (apiInfo == null) throw new Exception("鏈壘鍒版洿鏂板洓鍚戣溅浠诲姟浼樺厛绾ф帴鍙i厤缃俊鎭紒璇锋鏌ユ帴鍙i厤缃�");
                     string response = HttpHelper.Post(apiInfo.ApiAddress, request.Serialize());
                     FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
+                    content.OK(data: fOURBOTReturn);
                     if (fOURBOTReturn.returnCode == 0 && fOURBOTReturn.returnUserMsg == "鎴愬姛")
                     {
                         BaseDal.UpdateData(dt_Task);
@@ -421,6 +430,7 @@
                     if (apiInfo == null) throw new Exception("鏈壘鍒板洓鍚戣溅AGV浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
                     string response = HttpHelper.Post(apiInfo.ApiAddress, Hkrequest.Serialize());
                     HIKROBOTReturn hIKROBOTReturn = response.DeserializeObject<HIKROBOTReturn>();
+                    content.OK(data: hIKROBOTReturn);
                     if (hIKROBOTReturn.code == "SUCCESS0" && hIKROBOTReturn.message == "鎴愬姛")
                     {
                         BaseDal.UpdateData(dt_Task);
@@ -1078,11 +1088,15 @@
             try
             {
                 if (getLocationInfo == null) throw new Exception("璇锋眰鍙傛暟涓嶈兘涓虹┖锛�");
-                if (getLocationInfo.AreaCode == null) throw new Exception("搴撳尯缂栧彿涓嶈兘涓虹┖锛�");
+                //if (getLocationInfo.AreaCode == null) throw new Exception("搴撳尯缂栧彿涓嶈兘涓虹┖锛�");
                 if (getLocationInfo.WarehouseId == 0) throw new Exception("浠撳簱ID涓嶈兘涓虹┖锛�");
                 if (getLocationInfo.WarehouseId == 1)
                 {
-                    List<Dt_RGVLocationInfo> rGVLocationInfos = _rGVLocationInfoService.Repository.QueryData(x => x.WarehouseId == getLocationInfo.AreaCode.ObjToInt());
+                    List<Dt_RGVLocationInfo> rGVLocationInfos = new List<Dt_RGVLocationInfo>();
+                    if (!string.IsNullOrEmpty(getLocationInfo.AreaCode))
+                        rGVLocationInfos = _rGVLocationInfoService.Repository.QueryData(x => x.WarehouseId == getLocationInfo.AreaCode.ObjToInt());
+                    else
+                        rGVLocationInfos = _rGVLocationInfoService.Repository.QueryData();
                     foreach (var item in rGVLocationInfos)
                     {
                         list.Add(new
@@ -1092,11 +1106,25 @@
                             EnableStatus = item.EnableStatus
                         });
                     }
-                    content.Data = list;
+                    content.OK(data: list);
                 }
                 else if (getLocationInfo.WarehouseId == 2)
                 {
-
+                    List<Dt_KLSLocationInfo> rGVLocationInfos = new List<Dt_KLSLocationInfo>();
+                    if (!string.IsNullOrEmpty(getLocationInfo.AreaCode))
+                        rGVLocationInfos = _kLSLocationInfoService.Repository.QueryData(x => x.WarehouseId == getLocationInfo.AreaCode.ObjToInt());
+                    else
+                        rGVLocationInfos = _kLSLocationInfoService.Repository.QueryData();
+                    foreach (var item in rGVLocationInfos)
+                    {
+                        list.Add(new
+                        {
+                            LoctionCode = item.LocationCode,
+                            LocationStatus = item.LocationStatus,
+                            EnableStatus = item.EnableStatus
+                        });
+                    }
+                    content.OK(data: list);
                 }
                 else if (getLocationInfo.WarehouseId == 3)
                 {
@@ -1108,7 +1136,22 @@
                 }
                 else if (getLocationInfo.WarehouseId == 5)
                 {
-
+                    //璇诲彇鍏夌數淇″彿
+                    var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "F1") as OtherDevice;
+                    if (device == null) throw new Exception("鏈壘鍒�1妤艰川妫�闂ㄨ澶囦俊鎭�") ;
+                    if (!device.IsConnected) throw new Exception("PLC1妤艰川妫�闂ㄨ澶囪繛鎺ュけ璐�");
+                    var sta = _stationMangerService.Repository.QueryData(x => x.Remark == "鎴愬搧搴�");
+                    foreach (var item in sta)
+                    {
+                        bool value = device.GetValue<QualityInspectionCommandEnum,bool>(QualityInspectionCommandEnum.R_StockAvailableSymbol, item.StationCode);
+                             list.Add(new
+                             {
+                                 LoctionCode = item.StationCode,
+                                 LocationStatus = value?100:0,
+                                 EnableStatus = 0,
+                             });
+                    }
+                    content.OK(data: list);
                 }
             }
             catch (Exception ex)
@@ -1211,6 +1254,7 @@
                 };
                 string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOToccupyStation.Serialize());
                 FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
+                content.OK(data: fOURBOTReturn);
                 if (fOURBOTReturn.returnCode != 0 /*&& fOURBOTReturn.returnUserMsg != $"绔欑偣宸茶鍗犵敤,(podID={iQC.ContainerCode})"*/)
                     throw new Exception(fOURBOTReturn.returnUserMsg);
                 #endregion
@@ -1271,5 +1315,16 @@
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
+
+
+        public override WebResponseContent DeleteData(object[] keys)
+        {
+              //鏌ユ壘鎵�鏈変换鍔′腑鍖呭惈杩欎釜id鐨�
+               var  take= BaseDal.QueryData(x => keys.Contains(x.TaskId));
+                //鎴戝氨灏嗚繖涓换鍔$Щ鍏ュ巻鍙蹭腑
+              BaseDal.DeleteAndMoveIntoHty(take, OperateTypeEnum.鑷姩瀹屾垚);
+            return base.DeleteData(keys); 
+        }
+
     }
 }

--
Gitblit v1.9.3