From 047e8be481b2b626a5dbcc613b5f2e77323239be Mon Sep 17 00:00:00 2001 From: wanshenmean <cathay_xy@163.com> Date: 星期四, 20 三月 2025 14:27:36 +0800 Subject: [PATCH] 更新配置和任务处理逻辑 --- /dev/null | 0 .gitignore | 36 +++++++++ CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs | 66 ++++----------- CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs | 51 ++---------- CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs | 11 ++ CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json | 2 CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs | 34 ++++++- 7 files changed, 101 insertions(+), 99 deletions(-) diff --git a/.gitignore b/.gitignore index 5f8bb13..7a48912 100644 --- a/.gitignore +++ b/.gitignore @@ -2449,3 +2449,39 @@ CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/obj/Debug/net6.0/staticwebassets/msbuild.WIDESEA_WMSServer.Microsoft.AspNetCore.StaticWebAssetEndpoints.props CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/obj/Debug/net6.0/staticwebassets/msbuild.WIDESEA_WMSServer.Microsoft.AspNetCore.StaticWebAssets.props CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/obj/WIDESEA_WMSServer.csproj.nuget.g.targets +/CodeManagement/WCS/WIDESEAWCS_Server/.vs/ProjectEvaluation/wideseawcs_server.metadata.v9.bin +/CodeManagement/WCS/WIDESEAWCS_Server/.vs/ProjectEvaluation/wideseawcs_server.projects.v9.bin +/CodeManagement/WCS/WIDESEAWCS_Server/.vs/ProjectEvaluation/wideseawcs_server.strings.v9.bin +/CodeManagement/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/DesignTimeBuild/.dtbcache.v2 +/CodeManagement/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/DesignTimeBuild/.dtbcache.v2 +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoRepository/obj/Debug/net6.0/WIDESEAWCS_BasicInfoRepository.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/obj/Debug/net6.0/WIDESEAWCS_BasicInfoService.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/obj/Debug/net6.0/WIDESEAWCS_DTO.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoRepository/obj/Debug/net6.0/WIDESEAWCS_IBasicInfoRepository.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoService/obj/Debug/net6.0/WIDESEAWCS_IBasicInfoService.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_ISystemRepository/obj/Debug/net6.0/WIDESEAWCS_ISystemRepository.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_ISystemServices/obj/Debug/net6.0/WIDESEAWCS_ISystemServices.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoRepository/obj/Debug/net6.0/WIDESEAWCS_ITaskInfoRepository.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/obj/Debug/net6.0/WIDESEAWCS_ITaskInfoService.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfo_HtyRepository/obj/Debug/net6.0/WIDESEAWCS_ITaskInfo_HtyRepository.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfo_HtyService/obj/Debug/net6.0/WIDESEAWCS_ITaskInfo_HtyService.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/obj/Debug/net6.0/WIDESEAWCS_Model.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessParameters/obj/Debug/net6.0/WIDESEAWCS_IProcessRepository.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessRepository/obj/Debug/net6.0/WIDESEAWCS_ProcessRepository.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/obj/Debug/net6.0/WIDESEAWCS_QuartzJob.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/bin/Debug/net6.0/Log_PLCReadWrite/鍒嗗11绾垮叆搴撹緭閫佺嚎/Logs_20250319142110.txt +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/bin/Debug/net6.0/Log_PLCReadWrite/楂樻俯鍏ュ簱杈撻�佺嚎/Logs_20250320094927.txt +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/ApiEndpoints.json +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/EndpointInfo/WIDESEAWCS_Server_V1.json +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/EndpointInfo/WIDESEAWCS_Server_V2.json +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/WIDESEAWCS_Server.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/WIDESEAWCS_Server.csproj.EntityFrameworkCore.targets +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_SignalR/obj/Debug/net6.0/WIDESEAWCS_SignalR.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemRepository/obj/Debug/net6.0/WIDESEAWCS_SystemRepository.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/obj/Debug/net6.0/WIDESEAWCS_SystemServices.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/obj/Debug/net6.0/WIDESEAWCS_TaskInfoRepository.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/obj/Debug/net6.0/WIDESEAWCS_TaskInfoService.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfo_HtyRepository/obj/Debug/net6.0/WIDESEAWCS_TaskInfo_HtyRepository.csproj.BuildWithSkipAnalyzers +/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfo_HtyService/obj/Debug/net6.0/WIDESEAWCS_TaskInfo_HtyService.csproj.BuildWithSkipAnalyzers +*.log +*.BuildWithSkipAnalyzers diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.13.439.2385/CodeChunks.db b/CodeManagement/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.13.439.2385/CodeChunks.db deleted file mode 100644 index a7bee96..0000000 --- a/CodeManagement/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.13.439.2385/CodeChunks.db +++ /dev/null Binary files differ diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/DesignTimeBuild/.dtbcache.v2 b/CodeManagement/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/DesignTimeBuild/.dtbcache.v2 deleted file mode 100644 index cdcf78f..0000000 --- a/CodeManagement/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/DesignTimeBuild/.dtbcache.v2 +++ /dev/null Binary files differ diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/v17/.suo b/CodeManagement/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/v17/.suo deleted file mode 100644 index 2f1b82e..0000000 --- a/CodeManagement/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/v17/.suo +++ /dev/null Binary files differ diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json index c6d89d8..def7b97 100644 --- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json +++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json @@ -11,7 +11,7 @@ "ConnectionStringsEncryption": false, "MainDB": "DB_WIDESEA", //褰撳墠椤圭洰鐨勪富搴擄紝鎵�瀵瑰簲鐨勮繛鎺ュ瓧绗︿覆鐨凟nabled蹇呴』涓簍rue //杩炴帴瀛楃涓� - "ConnectionString": "Data Source=.;Initial Catalog=WIDESEA_WCSDB_BB3F;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", + "ConnectionString": "Data Source=.;Initial Catalog=WIDESEA_WCS3F09;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", //璺ㄥ煙 "Cors": { "PolicyName": "CorsIpAccess", //绛栫暐鍚嶇О diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs index 0a71bac..4638dac 100644 --- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs +++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs @@ -2,6 +2,7 @@ using Mapster; using Newtonsoft.Json; using System.Diagnostics.CodeAnalysis; +using WIDESEAWCS_BasicInfoRepository; using WIDESEAWCS_Common; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core; @@ -227,22 +228,22 @@ return content.Error($"銆恵stationManager.stationChildCode}銆戝凡瀛樺湪鐩存帴鍑哄簱浠诲姟浠诲姟"); } - if (stationManager.stationType == 7) - { - var result = await HandleStationType7(palletCode, stationManager); - if (result != null) - { - return result; - } - } - else if (stationManager.stationType == 6) - { - var result = await HandleStationType6(palletCode, stationManager); - if (result != null) - { - return result; - } - } + //if (stationManager.stationType == 7) + //{ + // var result = await HandleStationType7(palletCode, stationManager); + // if (result != null) + // { + // return result; + // } + //} + //else if (stationManager.stationType == 6) + //{ + // var result = await HandleStationType6(palletCode, stationManager); + // if (result != null) + // { + // return result; + // } + //} // 鍙戣捣璇锋眰鑾峰彇鍏ュ簱浠诲姟 content = await RequestInTask(palletCode, stationManager); @@ -279,38 +280,9 @@ } // 澶勭悊 stationType 涓� 7 鐨勬儏鍐� - private async Task<WebResponseContent> HandleStationType7(string palletCode, Dt_StationManager stationManager) + private async Task<WebResponseContent> HandleStationType7(Dt_StationManager stationManager) { - var station = await _stationManagerRepository.QueryFirstAsync(x => x.stationType == 6 && x.productLine == stationManager.productLine && x.stationArea == stationManager.stationArea); - var runTask = await BaseDal.QueryFirstAsync(x => x.CurrentAddress == station.stationChildCode && x.TaskState == (int)TaskInStatusEnum.Line_InFinish && x.TaskType == (int)TaskInboundTypeEnum.InTray); - - if (runTask != null) - { - runTask.TargetAddress = stationManager.stationLocation; - runTask.NextAddress = stationManager.stationChildCode; - runTask.Grade = 3; - runTask.TaskType = (int)TaskOutboundTypeEnum.InToOut; - runTask.TaskState = (int)TaskOutStatusEnum.OutNew; - - var wmsIpAddrss = GetWmsIpAddress(SysConfigKeyConst.SetEmptyOutbyInToOutAsync); - var result = await HttpHelper.PostAsync(wmsIpAddrss, new { palletCode = runTask.PalletCode, EquiCodeMOM = stationManager.stationEquipMOM, Roadways = stationManager.Roadway, area = stationManager.stationArea, Position = station.stationChildCode }.ToJsonString()); - var content = JsonConvert.DeserializeObject<WebResponseContent>(result); - - if (content.Status) - { - await BaseDal.UpdateDataAsync(runTask); - ConsoleHelper.WriteSuccessLine($"銆恵runTask.PalletCode}鐩存帴鍑哄簱鑷充簩灏併��"); - return content.OK("鎴愬姛"); - } - else - { - ConsoleHelper.WriteErrorLine(content.Message); - } - } - else - { - ConsoleHelper.WriteErrorLine($"銆恵station.stationChildCode}銆戞湭鎵惧埌绌烘墭鐩樺叆搴撲换鍔�"); - } + var station = await _taskNeedBarcodeRepository.QueryFirstAsync(x => x.toArea == stationManager.stationChildCode && x.productLine == stationManager.productLine); return null; } 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 324f8e2..c291afa 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 @@ -97,10 +97,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 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇 @@ -181,8 +181,10 @@ 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.TargetAddress == stationInfo.stationChildCode && x.TaskType == (int)TaskOutboundTypeEnum.OutTray); + var cache = command.Reserved5; + if (taskNew.Count < cache) //涓嶅瓨鍦ㄧ┖妗嗗嚭搴撲换鍔� 鍒欒姹俉MS鍑虹┖搴� { ConsoleHelper.WriteWarningLine("璇锋眰绌烘墭鐩�"); if (_taskService.RequestTask(command.ConveyorLineBarcode, stationInfo).Result.Status) @@ -194,43 +196,6 @@ } } } - - /// <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) { diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs index bf61d3b..ad8822c 100644 --- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs +++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs @@ -40,11 +40,13 @@ using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_Model.Models; using WIDESEAWCS_QuartzJob; +using WIDESEAWCS_QuartzJob.DeviceBase; using WIDESEAWCS_QuartzJob.DTO; using WIDESEAWCS_QuartzJob.Repository; using WIDESEAWCS_QuartzJob.Service; using WIDESEAWCS_SignalR; using WIDESEAWCS_Tasks.ConveyorLineJob; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; using Platform = WIDESEAWCS_Model.Models.Platform; @@ -117,7 +119,14 @@ List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode); foreach (string childDeviceCode in childDeviceCodes) { - ConveyorLineTaskCommand_After command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand_After>(childDeviceCode); + ConveyorLineTaskCommand_After command = null; + if (childDeviceCode == "2236") + { + var stationPLC = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.stationChildCode == childDeviceCode).stationPLC; + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationPLC); + CommonConveyorLine_After conveyorLine1 = (CommonConveyorLine_After)device; + command = conveyorLine1.ReadCustomer<ConveyorLineTaskCommand_After>(childDeviceCode); + } if (command == null) continue; if (command.ConveyorLineBarcode.Trim().Contains("\0")) command.ConveyorLineBarcode = ""; diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs index f197e7e..6852e39 100644 --- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs +++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs @@ -192,17 +192,37 @@ if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { - // 妫�鏌ュ綋鍓嶅嚭搴撲换鍔$珯鍙版槸鍚﹀厑璁告斁璐� - var occupiedStation = OutTaskStationIsOccupied(task); - if (occupiedStation == null) + if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound) { - // 濡傛灉褰撳墠鍑哄簱浠诲姟绔欏彴涓嶅厑璁告斁璐э紝鎺掗櫎褰撳墠浠诲姟锛屾煡鎵惧叾浠栧嚭搴撲换鍔� - ConsoleHelper.WriteErrorLine($"浠诲姟鍙凤細銆恵task.TaskNum}銆戝嚭搴撳湴鍧�锛氥�恵task.NextAddress}銆戜笉鍏佽鏀捐揣"); - task = FindAnotherOutboundTask(commonStackerCrane.DeviceCode, task); + Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.Roadway == task.Roadway && x.stationLocation == task.TargetAddress); + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManager.stationPLC); + if (device != null) + { + CommonConveyorLine_After conveyorLine = (CommonConveyorLine_After)device; + string str = conveyorLine.DeviceProDTOs.Where(x => x.DeviceChildCode == stationManager.stationChildCode).Select(x => x.DeviceProAddress) + ".0"; + conveyorLine.Communicator.Write(str, true); + return task; + } + else + { + _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵task.NextAddress}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤"); + return null; + } } else { - return task; + // 妫�鏌ュ綋鍓嶅嚭搴撲换鍔$珯鍙版槸鍚﹀厑璁告斁璐� + var occupiedStation = OutTaskStationIsOccupied(task); + if (occupiedStation == null) + { + // 濡傛灉褰撳墠鍑哄簱浠诲姟绔欏彴涓嶅厑璁告斁璐э紝鎺掗櫎褰撳墠浠诲姟锛屾煡鎵惧叾浠栧嚭搴撲换鍔� + ConsoleHelper.WriteErrorLine($"浠诲姟鍙凤細銆恵task.TaskNum}銆戝嚭搴撳湴鍧�锛氥�恵task.NextAddress}銆戜笉鍏佽鏀捐揣"); + task = FindAnotherOutboundTask(commonStackerCrane.DeviceCode, task); + } + else + { + return task; + } } if (task == null) -- Gitblit v1.9.3