From 2cc749ec598c39f9172f9b989979f6218ec256b1 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <1247017146@qq.com>
Date: 星期四, 27 三月 2025 11:06:24 +0800
Subject: [PATCH] 1

---
 CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs |   94 ++++++++---------------------------------------
 1 files changed, 16 insertions(+), 78 deletions(-)

diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs
index c5ad01c..4ace90d 100644
--- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs
+++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs
@@ -38,6 +38,7 @@
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
 using WIDESEAWCS_QuartzJob;
+using WIDESEAWCS_QuartzJob.DeviceBase;
 using WIDESEAWCS_QuartzJob.DTO;
 using WIDESEAWCS_QuartzJob.Service;
 using WIDESEAWCS_SignalR;
@@ -97,10 +98,10 @@
                                 method.Invoke(this, new object[] { conveyorLine, command, station });
                             }
                         }
-                        if (station.stationType == 6 && station.stationArea == "3")
-                        {
-                            await GetEmptyTrayAsync(station, conveyorLine, command);
-                        }
+                        //if (station.stationType == 6 && station.stationArea == "3")
+                        //{
+                        //    await GetEmptyTrayAsync(station, conveyorLine, command);
+                        //}
 
                         #region 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
 
@@ -122,28 +123,6 @@
 
                         #endregion 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
                     }
-
-                    #region 璺敱鏂瑰紡
-
-                    //List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
-                    //foreach (string childDeviceCode in childDeviceCodes)
-                    //{
-                    //    ConveyorLineTaskCommand_After command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand_After>(childDeviceCode);
-
-                    //    if (command.ConveyorLineBarcode.Trim().Contains("\0")) command.ConveyorLineBarcode = "";
-
-                    //    DeviceProtocolDetailDTO? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.DeviceProParamName == nameof(ConveyorLineTaskCommand_After.InteractiveSignal) && x.ProtocalDetailValue == command.InteractiveSignal.ToString());
-                    //    if (deviceProtocolDetails != null)
-                    //    {
-                    //        MethodInfo? method = GetType().GetMethod(deviceProtocolDetails.ProtocolDetailType);
-                    //        if (method != null)
-                    //        {
-                    //            method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode });
-                    //        }
-                    //    }
-                    //}
-
-                    #endregion 璺敱鏂瑰紡
                 }
             }
             catch (Exception ex)
@@ -171,7 +150,6 @@
 
             _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
             WriteInfo(conveyorLine.DeviceName, log);
-            //if()
 
             var taskNew = _taskService.QueryTaskByPalletCode(command.ConveyorLineBarcode, stationInfo.Roadway);
             if (taskNew == null)
@@ -182,13 +160,6 @@
                     if (task != null)
                     {
                         conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, stationInfo.stationChildCode);
-
-                        var needBarcode = _needBarcodeRepository.QueryFirst(x => x.toArea == stationInfo.stationChildCode);
-                        if (needBarcode != null)
-                        {
-                            needBarcode.inLineNum -= 1;
-                            _needBarcodeRepository.UpdateData(needBarcode);
-                        }
                     }
                 }
                 else   //濡傛灉浠诲姟璇锋眰澶辫触
@@ -211,56 +182,23 @@
         public void RequestEmptyOutbound(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, Dt_StationManager stationInfo)
         {
             if (stationInfo.stationType != 7) return;
-            var taskNew = _taskRepository.QueryFirst(x => x.Roadway == stationInfo.Roadway && x.TaskType == (int)TaskOutboundTypeEnum.OutTray);
-            if (taskNew == null)   //涓嶅瓨鍦ㄧ┖妗嗗嚭搴撲换鍔� 鍒欒姹俉MS鍑虹┖搴�
+
+            var taskNew = _taskRepository.QueryData(x => x.TaskType == (int)TaskOutboundTypeEnum.OutTray);
+            //var need = _needBarcodeRepository.QueryFirst(x => x.toArea == stationInfo.stationChildCode && x.productLine == stationInfo.productLine);
+            //var cache = command.Reserved5;
+            //var proAddress = conveyorLine.DeviceProDTOs.Where(x => x.DeviceChildCode == stationInfo.stationChildCode).Where(x => x.DeviceProParamName == ConveyorLineDBName_After.Reserve5.ToString()).FirstOrDefault().DeviceProAddress;
+            var cache = Convert.ToInt16(conveyorLine.ReadValue(ConveyorLineDBName_After.Reserve5, stationInfo.stationChildCode));
+            ConsoleHelper.WriteColorLine($"宸茬粡鏈墈taskNew.Count}涓换鍔�,鍙互鏀緖cache}涓┖鎵樼洏", ConsoleColor.DarkCyan);
+            if (taskNew.Count + 1 < cache)   //涓嶅瓨鍦ㄧ┖妗嗗嚭搴撲换鍔� 鍒欒姹俉MS鍑虹┖搴�
             {
-                ConsoleHelper.WriteWarningLine("璇锋眰绌烘墭鐩�");
+                //ConsoleHelper.WriteWarningLine("璇锋眰绌烘墭鐩�");
                 if (_taskService.RequestTask(command.ConveyorLineBarcode, stationInfo).Result.Status)
                 {
-                    Dt_Task task = _taskService.QueryTaskByPalletCode(command.ConveyorLineBarcode, stationInfo.Roadway);
-                    if (task != null)
-                    {
-                    }
+                    //need.inLineNum += 1;
+                    //_needBarcodeRepository.UpdateData(need);
                 }
             }
         }
-
-        /// <summary>
-        /// 杈撻�佺嚎璇锋眰鍏ュ簱
-        /// </summary>
-        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
-        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
-        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
-        //public void RequestInbound(CommonConveyorLine_After conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
-        //{
-        //    var stationInfo = _stationManagerService.GetStationInfoByChildCode(childDeviceCode);
-        //    if (stationInfo != null)
-        //    {
-        //        //_taskService.r
-        //    }
-        //    var taskNew = _taskService.QueryCraneConveyorLineTask(command.ConveyorLineTaskNum.ObjToInt(), childDeviceCode);
-        //    if (taskNew == null)
-        //    {
-        //        string barcode = command.ConveyorLineBarcode.TrimEnd();
-        //        if (_taskService.RequestWMSTask(command.ConveyorLineBarcode, childDeviceCode).Result.Status)
-        //        {
-        //            Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
-        //            if (task != null)
-        //            {
-        //                ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
-        //                //taskCommand.InteractiveSignal = command.InteractiveSignal;
-        //                taskCommand.ResponState = 1;
-        //                taskCommand.ConveyorLineTaskNum = task.TaskNum;
-        //                taskCommand.ConveyorLineTargetAddress = Convert.ToInt16(task.NextAddress);
-        //                conveyorLine.SendCommand(taskCommand, childDeviceCode);
-
-        //                //ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-
-        //                _taskService.UpdateTaskStatusToNext(task);
-        //            }
-        //        }
-        //    }
-        //}
 
         private async Task GetEmptyTrayAsync(Dt_StationManager stationManager, CommonConveyorLine_After commonConveyor, ConveyorLineTaskCommand_After conveyorLine)
         {

--
Gitblit v1.9.3