From 3b3f39b55ba6d04a95536bebd6233b2a6e464290 Mon Sep 17 00:00:00 2001 From: xxyy <cathay_xy@163.com> Date: 星期二, 18 二月 2025 10:20:02 +0800 Subject: [PATCH] 更新命名空间、异常处理和任务逻辑 --- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs | 10 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/SysConfigKeyConst.cs | 7 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs | 15 - Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs | 12 + Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs | 333 ++++++++++++++++++++++++++++++++++------- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs | 50 ++++++ 6 files changed, 350 insertions(+), 77 deletions(-) diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/SysConfigKeyConst.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/SysConfigKeyConst.cs index 2e03823..54b30c0 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/SysConfigKeyConst.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/SysConfigKeyConst.cs @@ -80,6 +80,11 @@ /// <summary> /// 鍒嗗绌烘鍏ュ簱鏀逛负鐩存帴鍑哄簱 /// </summary> - public const string SetEmptyOutbyInToOutAsync = "SetEmptyOutbyInToOutAsync"; + public const string SetEmptyOutbyInToOutAsync = "SetEmptyOutbyInToOutAsync"; + + /// <summary> + /// 鍒嗗绌烘鍑哄簱鏀逛负鐩存帴鍑哄簱 + /// </summary> + public const string SetEmptyOutbyInToOutOneAsync = "SetEmptyOutbyInToOutOneAsync"; } } \ No newline at end of file diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs index c8dbbc8..0d172c9 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs @@ -1,28 +1,18 @@ 锘縰sing HslCommunication; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using WIDESEAWCS_Common; -using WIDESEAWCS_Core.Helper; -using WIDESEAWCS_Core; -using WIDESEAWCS_DTO.TaskInfo; -using System.Diagnostics.CodeAnalysis; -using WIDESEAWCS_Common.TaskEnum; -using WIDESEAWCS_Model.Models; -using WIDESEAWCS_QuartzJob.Models; -using System.Drawing; -using WIDESEAWCS_ITaskInfoService; using Mapster; -using AngleSharp.Io; +using Newtonsoft.Json; +using System.Diagnostics.CodeAnalysis; +using WIDESEAWCS_Common; +using WIDESEAWCS_Common.TaskEnum; +using WIDESEAWCS_Core; +using WIDESEAWCS_Core.Helper; +using WIDESEAWCS_DTO.TaskInfo; +using WIDESEAWCS_Model.Models; namespace WIDESEAWCS_TaskInfoService { public partial class TaskService { - /// <summary> /// 鏍规嵁鎵樼洏鍙枫�佽捣濮嬪湴鍧�鍚慦MS璇锋眰浠诲姟 /// </summary> @@ -56,7 +46,6 @@ { // wms澶辫触杩斿洖鍘籒G鍙d换鍔� - return content; } @@ -69,65 +58,105 @@ } } + #region 鏍规嵁鎵樼洏鍙枫�佺珯鍙板悜WMS璇锋眰浠诲姟 + /// <summary> /// 鏍规嵁鎵樼洏鍙枫�佺珯鍙板悜WMS璇锋眰浠诲姟 /// </summary> /// <param name="palletCode">鎵樼洏鍙�</param> - /// <param name="sourceAddress">璧峰鍦板潃</param> + /// <param name="stationManager">绔欏彴</param> /// <returns></returns> - public async Task<WebResponseContent> RequestTask(string palletCode, Dt_StationManager stationManager) + public async Task<WebResponseContent> RequestTask1(string palletCode, Dt_StationManager stationManager) { WebResponseContent content = new WebResponseContent(); try { + StaticVariable.isLineRun = false; var hasTask = await BaseDal.QueryFirstAsync(x => x.PalletCode == palletCode); if (hasTask != null) { return content.Error("褰撳墠鎵樼洏瀛樺湪浠诲姟"); } + var Station = await _stationManagerRepository.QueryFirstAsync(x => x.stationType == 6 && x.productLine == stationManager.productLine && x.stationArea == stationManager.stationArea); - var tasks= await BaseDal.QueryFirstAsync(x => x.TaskType == (int)TaskOutboundTypeEnum.InToOut && x.TargetAddress == stationManager.stationLocation && x.CurrentAddress == Station.stationChildCode); - if(tasks!=null) + var tasks = await BaseDal.QueryFirstAsync(x => x.TaskType == (int)TaskOutboundTypeEnum.InToOut && x.TargetAddress == stationManager.stationLocation && x.CurrentAddress == Station.stationChildCode); + if (tasks != null) { ConsoleHelper.WriteErrorLine($"銆恵stationManager.stationChildCode}銆戝凡瀛樺湪鐩存帴鍑哄簱浠诲姟浠诲姟"); return content.Error($"銆恵stationManager.stationChildCode}銆戝凡瀛樺湪鐩存帴鍑哄簱浠诲姟浠诲姟"); } - if (stationManager.stationType == 7) + + if (StaticVariable.isStackerRun) { - - var runTask = await BaseDal.QueryFirstAsync(x => x.CurrentAddress == Station.stationChildCode && x.TaskState == (int)TaskInStatusEnum.Line_InFinish && x.TaskType == (int)TaskInboundTypeEnum.InTray); - if (runTask != null) + if (stationManager.stationType == 7) { - runTask.TargetAddress = stationManager.stationLocation; - runTask.NextAddress = stationManager.stationChildCode; - runTask.Grade = 3; - runTask.TaskType = (int)TaskOutboundTypeEnum.InToOut; - runTask.TaskState = (int)TaskOutStatusEnum.OutNew; - - var config1 = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); - var wmsBase1 = config1.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue; - var requestTask1 = config1.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.SetEmptyOutbyInToOutAsync)?.ConfigValue; - if (wmsBase1 == null || requestTask1 == null) + var runTask = await BaseDal.QueryFirstAsync(x => x.CurrentAddress == Station.stationChildCode && x.TaskState == (int)TaskInStatusEnum.Line_InFinish && x.TaskType == (int)TaskInboundTypeEnum.InTray); + if (runTask != null) { - throw new InvalidOperationException("WMS IP 鏈厤缃�"); - } - var wmsIpAddrss1 = wmsBase1 + requestTask1; + runTask.TargetAddress = stationManager.stationLocation; + runTask.NextAddress = stationManager.stationChildCode; + runTask.Grade = 3; + runTask.TaskType = (int)TaskOutboundTypeEnum.InToOut; + runTask.TaskState = (int)TaskOutStatusEnum.OutNew; - var result1 = await HttpHelper.PostAsync(wmsIpAddrss1, new { palletCode = runTask.PalletCode, EquiCodeMOM = stationManager.stationEquipMOM, Roadways = stationManager.Roadway, area = stationManager.stationArea, Position = Station.stationChildCode }.ToJsonString()); - content = JsonConvert.DeserializeObject<WebResponseContent>(result1); - if (content.Status) - { - await BaseDal.UpdateDataAsync(runTask); - ConsoleHelper.WriteSuccessLine($"銆恵runTask.PalletCode}鐩存帴鍑哄簱鑷充簩灏併��"); - return content.OK("鎴愬姛"); + var config1 = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); + var wmsBase1 = config1.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue; + var requestTask1 = config1.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.SetEmptyOutbyInToOutAsync)?.ConfigValue; + if (wmsBase1 == null || requestTask1 == null) + { + throw new InvalidOperationException("WMS IP 鏈厤缃�"); + } + var wmsIpAddrss1 = wmsBase1 + requestTask1; + + var result1 = await HttpHelper.PostAsync(wmsIpAddrss1, new { palletCode = runTask.PalletCode, EquiCodeMOM = stationManager.stationEquipMOM, Roadways = stationManager.Roadway, area = stationManager.stationArea, Position = Station.stationChildCode }.ToJsonString()); + content = JsonConvert.DeserializeObject<WebResponseContent>(result1); + if (content.Status) + { + await BaseDal.UpdateDataAsync(runTask); + ConsoleHelper.WriteSuccessLine($"銆恵runTask.PalletCode}鐩存帴鍑哄簱鑷充簩灏併��"); + return content.OK("鎴愬姛"); + } + else + ConsoleHelper.WriteErrorLine(content.Message); } else - ConsoleHelper.WriteErrorLine(content.Message); + ConsoleHelper.WriteErrorLine($"銆恵Station.stationChildCode}銆戞湭鎵惧埌绌烘墭鐩樺叆搴撲换鍔�"); } - else - ConsoleHelper.WriteErrorLine($"銆恵Station.stationChildCode}銆戞湭鎵惧埌绌烘墭鐩樺叆搴撲换鍔�"); - } + else if (stationManager.stationType == 6) + { + var emptyStation = await _stationManagerRepository.QueryFirstAsync(x => x.stationType == 7 && x.productLine == stationManager.productLine && x.stationArea == stationManager.stationArea); + var runTask = await BaseDal.QueryFirstAsync(x => x.NextAddress == emptyStation.stationChildCode && x.TaskState == (int)TaskInStatusEnum.Line_InFinish && x.TaskType == (int)TaskInboundTypeEnum.InTray); + if (runTask != null) + { + runTask.SourceAddress = stationManager.stationLocation; + runTask.CurrentAddress = stationManager.stationChildCode; + runTask.Grade = 3; + runTask.TaskType = (int)TaskOutboundTypeEnum.InToOut; + runTask.TaskState = (int)TaskOutStatusEnum.OutNew; + runTask.PalletCode = palletCode; + var config1 = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); + var wmsBase1 = config1.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue; + var requestTask1 = config1.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.SetEmptyOutbyInToOutOneAsync)?.ConfigValue; + if (wmsBase1 == null || requestTask1 == null) + { + throw new InvalidOperationException("WMS IP 鏈厤缃�"); + } + var wmsIpAddrss1 = wmsBase1 + requestTask1; + + var result1 = await HttpHelper.PostAsync(wmsIpAddrss1, new { palletCode = runTask.PalletCode, EquiCodeMOM = stationManager.stationEquipMOM, Roadways = stationManager.Roadway, area = stationManager.stationArea, Position = emptyStation.stationChildCode }.ToJsonString()); + content = JsonConvert.DeserializeObject<WebResponseContent>(result1); + if (content.Status) + { + await BaseDal.UpdateDataAsync(runTask); + ConsoleHelper.WriteSuccessLine($"銆恵runTask.PalletCode}鐩存帴鍑哄簱鑷充簩灏併��"); + return content.OK("鎴愬姛"); + } + else + ConsoleHelper.WriteErrorLine(content.Message); + } + } + } var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue; var requestTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.RequestInTask)?.ConfigValue; @@ -168,7 +197,190 @@ { return WebResponseContent.Instance.Error(ex.Message); } + finally + { + StaticVariable.isLineRun = true; + } } + + /// <summary> + /// 鏍规嵁鎵樼洏鍙枫�佺珯鍙板悜WMS璇锋眰浠诲姟 + /// </summary> + /// <param name="palletCode">鎵樼洏鍙�</param> + /// <param name="stationManager">绔欏彴</param> + /// <returns></returns> + public async Task<WebResponseContent> RequestTask(string palletCode, Dt_StationManager stationManager) + { + WebResponseContent content = new WebResponseContent(); + try + { + StaticVariable.isLineRun = false; + + // 妫�鏌ュ綋鍓嶆墭鐩樻槸鍚﹀瓨鍦ㄤ换鍔� + if (await HasTask(palletCode)) + { + return content.Error("褰撳墠鎵樼洏瀛樺湪浠诲姟"); + } + + // 妫�鏌ユ槸鍚﹀凡瀛樺湪鐩存帴鍑哄簱浠诲姟 + if (await HasDirectOutboundTask(stationManager)) + { + return content.Error($"銆恵stationManager.stationChildCode}銆戝凡瀛樺湪鐩存帴鍑哄簱浠诲姟浠诲姟"); + } + + if (StaticVariable.isStackerRun) + { + 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); + ConsoleHelper.WriteErrorLine($"{stationManager.stationChildCode}绔欏彴璇锋眰鍝嶅簲淇℃伅:{content.ToJsonString()}"); + + if (!content.Status) + { + return content; + } + + var task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString()); + ConsoleHelper.WriteSuccessLine(content.Data.ToString()); + return ReceiveByWMSTask(task); + } + catch (Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + finally + { + StaticVariable.isLineRun = true; + } + } + + // 妫�鏌ュ綋鍓嶆墭鐩樻槸鍚﹀瓨鍦ㄤ换鍔� + private async Task<bool> HasTask(string palletCode) + { + var hasTask = await BaseDal.QueryFirstAsync(x => x.PalletCode == palletCode); + return hasTask != null; + } + + // 妫�鏌ユ槸鍚﹀凡瀛樺湪鐩存帴鍑哄簱浠诲姟 + private async Task<bool> HasDirectOutboundTask(Dt_StationManager stationManager) + { + var station = await _stationManagerRepository.QueryFirstAsync(x => x.stationType == 6 && x.productLine == stationManager.productLine && x.stationArea == stationManager.stationArea); + var tasks = await BaseDal.QueryFirstAsync(x => x.TaskType == (int)TaskOutboundTypeEnum.InToOut && x.TargetAddress == stationManager.stationLocation && x.CurrentAddress == station.stationChildCode); + return tasks != null; + } + + // 澶勭悊 stationType 涓� 7 鐨勬儏鍐� + private async Task<WebResponseContent> HandleStationType7(string palletCode, 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}銆戞湭鎵惧埌绌烘墭鐩樺叆搴撲换鍔�"); + } + + return null; + } + + // 澶勭悊 stationType 涓� 6 鐨勬儏鍐� + private async Task<WebResponseContent> HandleStationType6(string palletCode, Dt_StationManager stationManager) + { + var emptyStation = await _stationManagerRepository.QueryFirstAsync(x => x.stationType == 7 && x.productLine == stationManager.productLine && x.stationArea == stationManager.stationArea); + var runTask = await BaseDal.QueryFirstAsync(x => x.NextAddress == emptyStation.stationChildCode && x.TaskState == (int)TaskInStatusEnum.Line_InFinish && x.TaskType == (int)TaskInboundTypeEnum.InTray); + + if (runTask != null) + { + runTask.SourceAddress = stationManager.stationLocation; + runTask.CurrentAddress = stationManager.stationChildCode; + runTask.Grade = 3; + runTask.TaskType = (int)TaskOutboundTypeEnum.InToOut; + runTask.TaskState = (int)TaskOutStatusEnum.OutNew; + runTask.PalletCode = palletCode; + + 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 = emptyStation.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); + } + } + + return null; + } + + // 鑾峰彇 WMS 璇锋眰鍦板潃 + private string GetWmsIpAddress(string configKey) + { + var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); + var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue; + var requestTask = config.FirstOrDefault(x => x.ConfigKey == configKey)?.ConfigValue; + + if (wmsBase == null || requestTask == null) + { + throw new InvalidOperationException("WMS IP 鏈厤缃�"); + } + + return wmsBase + requestTask; + } + + // 鍙戣捣璇锋眰鑾峰彇鍏ュ簱浠诲姟 + private async Task<WebResponseContent> RequestInTask(string palletCode, Dt_StationManager stationManager) + { + var wmsIpAddrss = GetWmsIpAddress(SysConfigKeyConst.RequestInTask); + var result = await HttpHelper.PostAsync(wmsIpAddrss, new { palletCode = palletCode, EquiCodeMOM = stationManager.stationEquipMOM, Roadways = stationManager.Roadway, area = stationManager.stationArea, Position = stationManager.stationChildCode }.ToJsonString()); + return JsonConvert.DeserializeObject<WebResponseContent>(result); + } + + #endregion 鏍规嵁鎵樼洏鍙枫�佺珯鍙板悜WMS璇锋眰浠诲姟 public async Task<WebResponseContent> RequestOutTaskToBZAsync(Dt_StationManager stationManager) { @@ -206,7 +418,6 @@ } catch (Exception ex) { - return content.Error(ex.Message); } } @@ -307,7 +518,6 @@ return content; } - /// <summary> /// 楂樻俯鍑哄簱 /// </summary> @@ -346,7 +556,6 @@ return content; } - /// <summary> /// 鎺ユ敹WMS浠诲姟淇℃伅 /// </summary> @@ -371,7 +580,6 @@ if (!content.Status) { - return content; } Dt_StationManager dt_Station = content.Data as Dt_StationManager; @@ -420,7 +628,7 @@ //if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup && task.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting) //{ - // //todo + // //todo //} //else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup && task.TaskState == (int)TaskInStatusEnum.SC_InExecuting) @@ -442,8 +650,8 @@ // throw new Exception($"浠诲姟绫诲瀷閿欒,鏈壘鍒拌浠诲姟绫诲瀷,浠诲姟鍙�:銆恵taskNum}銆�,浠诲姟绫诲瀷:銆恵task.TaskType}銆�"); //} - #region WMS鍚屾浠诲姟瀹屾垚 + var keys = new Dictionary<string, object>() { {"taskNum", taskNum} @@ -460,7 +668,8 @@ var result = HttpHelper.GetAsync(wmsIpAddress, keys).Result; content = JsonConvert.DeserializeObject<WebResponseContent>(result); - #endregion + + #endregion WMS鍚屾浠诲姟瀹屾垚 if (content.Status) { @@ -470,7 +679,7 @@ BaseDal.DeleteData(task); } - #region 鏇存柊浠诲姟鐘舵�� + #region 鏇存柊浠诲姟鐘舵�� //var updateTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.UpdateTask)?.ConfigValue; //if (wmsBase == null || updateTask == null) @@ -481,7 +690,9 @@ //result = HttpHelper.PostAsync(wmsIpAddress, new { TaskNum = task.TaskNum, TaskState = task.TaskState }.ToJsonString()).Result; //content = JsonConvert.DeserializeObject<WebResponseContent>(result); - #endregion + + #endregion 鏇存柊浠诲姟鐘舵�� + //content = WebResponseContent.Instance.OK(); } catch (Exception ex) @@ -491,4 +702,4 @@ return content; } } -} +} \ No newline at end of file diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs index d6c8e23..c5ad01c 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs @@ -1,4 +1,5 @@ 锘�#region MyRegion + #region << 鐗� 鏈� 娉� 閲� >> /*---------------------------------------------------------------- @@ -20,19 +21,15 @@ using AutoMapper; using HslCommunication; -using Microsoft.AspNetCore.Server.HttpSys; using Newtonsoft.Json; using Quartz; using SqlSugar; -using System.Diagnostics.CodeAnalysis; using System.Reflection; -using System.Threading.Tasks; using WIDESEAWCS_BasicInfoRepository; using WIDESEAWCS_BasicInfoService; using WIDESEAWCS_Common; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core; -using WIDESEAWCS_Core.Caches; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_Core.HttpContextUser; using WIDESEAWCS_DTO.TaskInfo; @@ -41,7 +38,6 @@ 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; @@ -128,6 +124,7 @@ } #region 璺敱鏂瑰紡 + //List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode); //foreach (string childDeviceCode in childDeviceCodes) //{ @@ -144,8 +141,9 @@ // method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode }); // } // } - //} - #endregion + //} + + #endregion 璺敱鏂瑰紡 } } catch (Exception ex) @@ -193,7 +191,7 @@ } } } - else //濡傛灉浠诲姟璇锋眰澶辫触 + else //濡傛灉浠诲姟璇锋眰澶辫触 { //濡傛灉璇锋眰浣嶇疆涓嶯G浣嶇疆涓�鑷� 鍒欏啓褰撳墠浣嶇疆璁╃嚎浣撻��鍥� if (stationInfo.stationChildCode == stationInfo.stationNGChildCode) @@ -309,4 +307,5 @@ } } } + #endregion \ No newline at end of file diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs index 1b17388..73152f9 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs @@ -22,6 +22,7 @@ using WIDESEAWCS_QuartzJob.StackerCrane.Enum; using WIDESEAWCS_SignalR; using WIDESEAWCS_Tasks.StackerCraneJob; +using WIDESEAWCS_Common; namespace WIDESEAWCS_Tasks { @@ -67,7 +68,12 @@ if (commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) { - Dt_Task? task = GetTask(commonStackerCrane); + Dt_Task? task = null; + if (StaticVariable.isLineRun) + { + StaticVariable.isStackerRun = false; + task = GetTask(commonStackerCrane); + } if (task != null) { StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); @@ -125,6 +131,10 @@ WriteError("CommonStackerStationCraneJob", "test", ex); //Console.WriteLine(nameof(CommonStackerCraneJob) + ":" + ex.ToString()); } + finally + { + StaticVariable.isStackerRun = true; + } //WriteDebug("CommonStackerStationCraneJob", "test"); return Task.CompletedTask; } diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs index a86d379..dbd804c 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs @@ -1,5 +1,4 @@ 锘縰sing Masuit.Tools; -using WIDESEA_Common; using WIDESEA_Common.CustomModels; //using WIDESEA_Common.CustomModels; @@ -1156,10 +1155,11 @@ #endregion #region 鍒嗗绌烘鍏ュ簱鏀逛负鐩存帴鍑哄簱 + public async Task<WebResponseContent> SetEmptyOutbyInToOutAsync(RequestTaskDto request) { WebResponseContent content = new WebResponseContent(); - var task = await BaseDal.QueryFirstAsync(x => x.PalletCode == request.PalletCode && x.CurrentAddress == request.Position); + var task = await BaseDal.QueryFirstAsync(x => x.PalletCode == request.PalletCode); if (!task.IsNullOrEmpty()) { var fromStation = await _stationManagerRepository.QueryFirstAsync(x => x.stationChildCode == request.Position); @@ -1194,4 +1194,50 @@ } #endregion + + #region 鍒嗗绌烘鍑哄簱鏀逛负鐩存帴鍑哄簱 + + /// <summary> + /// 鍒嗗绌烘鍑哄簱鏀逛负鐩存帴鍑哄簱 + /// </summary> + /// <param name="request"></param> + /// <returns></returns> + public async Task<WebResponseContent> SetEmptyOutbyInToOutOneAsync(RequestTaskDto request) + { + WebResponseContent content = new WebResponseContent(); + var task = await BaseDal.QueryFirstAsync(x => x.PalletCode == request.PalletCode); + if (!task.IsNullOrEmpty()) + { + var toStation = await _stationManagerRepository.QueryFirstAsync(x => x.stationChildCode == request.Position); + var fromStation = await _stationManagerRepository.QueryFirstAsync(x => x.stationType == 6 && x.productLine == toStation.productLine && x.stationArea == toStation.stationArea); + if (!fromStation.IsNullOrEmpty()) + { + //var location = await _locationRepository.QueryFirstAsync(x => x.LocationCode == task.TargetAddress && x.AreaId == int.Parse(fromStation.stationArea)); + task.SourceAddress = toStation.stationLocation; + task.CurrentAddress = toStation.stationChildCode; + task.Grade = 3; + task.TaskType = (int)TaskOutboundTypeEnum.InToOut; + task.TaskState = (int)TaskOutStatusEnum.OutNew; + + //location.LocationStatus = (int)LocationEnum.Free; + + //await _locationRepository.UpdateDataAsync(location); + await BaseDal.UpdateDataAsync(task); + return content.OK("鎴愬姛"); + } + else + { + ConsoleHelper.WriteErrorLine("鍒嗗绌烘鍑哄簱鏀逛负鐩存帴鍑哄簱:鏈壘鍒板搴旂珯鍙�"); + content.Error("鏈壘鍒板搴旂珯鍙�"); + } + } + else + { + ConsoleHelper.WriteErrorLine("鍒嗗绌烘鍑哄簱鏀逛负鐩存帴鍑哄簱:鏈壘鍒颁换鍔�"); + content.Error("鏈壘鍒颁换鍔�"); + } + return content; + } + + #endregion } \ No newline at end of file diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs index 6250387..fffdaf9 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/RequestInTaskAsync.cs @@ -78,12 +78,14 @@ var needBarcode = await SqlSugarHelper.DbWCS.Queryable<dt_needBarcode>().FirstAsync(x => x.productLine == STATION.productLine); var needCount = needBarcode.inLineNum; //var count = BaseDal.QueryData(x => x.TargetAddress == stationManagers[0].Roadway).Count; - if (needCount < 2) + if (needCount < needBarcode.cacheNum) { // 閫佽嚦鍖呰 - List<string> strings = stationManagers.Where(x => x.stationType == 0).Select(x => x.Roadway).ToList(); - var x = await SqlSugarHelper.DbWCS.Updateable<dt_needBarcode>().SetColumns(x => x.inLineNum == x.inLineNum + 1).ExecuteCommandHasChangeAsync(); - ConsoleHelper.WriteSuccessLine($"鍦ㄩ�旀暟閲忔坊鍔爗(x ? "鎴愬姛" : "澶辫触")}鏁伴噺+1"); + List<string> strings = stationManagers.Where(x => x.stationType == 0 && x.productLine == input.ProductionLine).Select(x => x.Roadway).ToList(); + var x = await SqlSugarHelper.DbWCS.Updateable<dt_needBarcode>() + .SetColumns(x => x.inLineNum == x.inLineNum + 1) + .Where(x => x.id == needBarcode.id).ExecuteCommandHasChangeAsync(); + ConsoleHelper.WriteSuccessLine($"鍦ㄩ�旀暟閲忔坊鍔爗(x ? "鎴愬姛" : "澶辫触")}鏁伴噺+1,褰撳墠宸ュ簭{boxing.ProcessCode},浜х嚎{input.ProductionLine}"); return await CreateNewTask(input, input.ProductionLine, boxing.ProcessCode, strings, 3); } else -- Gitblit v1.9.3