From 42a51b0fc2041b872691637db0ec01391a67e026 Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com> Date: 星期一, 18 八月 2025 15:56:35 +0800 Subject: [PATCH] 1 --- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RGVJob_FirstFloor/CommonRGV_FirstFloorJob.cs | 151 +++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 131 insertions(+), 20 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RGVJob_FirstFloor/CommonRGV_FirstFloorJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RGVJob_FirstFloor/CommonRGV_FirstFloorJob.cs" index 1fb6714..2584b75 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RGVJob_FirstFloor/CommonRGV_FirstFloorJob.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RGVJob_FirstFloor/CommonRGV_FirstFloorJob.cs" @@ -433,7 +433,6 @@ { if (commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Automatic) && !commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Fault)) { - var taskSecond = _taskRepository.QueryFirst(x => x.RGVName == "RGV02" && x.TaskNum == commonRGVSecond.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum) && ((x.TaskType == (int)TaskInboundTypeEnum.Inbound && (x.TaskState < 230||x.TaskState == (int)TaskInStatusEnum.RGV_TransFer|| x.TaskState == (int)TaskInStatusEnum.RGV_TransFerFInish)) || (x.TaskType == (int)TaskOutboundTypeEnum.Outbound))); if (taskSecond != null) { @@ -449,7 +448,26 @@ if (task.Remark != null) { - return GetDispatchExecutingTask(task); + return GetDispatchExecutingTask(task, taskSecond); + } + + return task; + } + } + } + else if ((taskSecond.CurrentAddress == "1025" || taskSecond.CurrentAddress == "1026") && (taskSecond.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting || taskSecond.TaskState == (int)TaskInStatusEnum.RGV_InExecuting)) + { + if (task.TaskState == (int)TaskOutStatusEnum.RGV_OutdispatchFinish || task.TaskState == (int)TaskInStatusEnum.RGV_IndispatchFinish) + { + if (task.TargetStation - taskSecond.SourceStation > 1 && task.TargetStation - taskSecond.TargetStation > 1) + { + LogAndWarn("鎵ц璋冨害浠诲姟鎺у埗", $"銆恵commonRGV.DeviceCode}宸ヤ綔妯″紡锛氥�恵commonRGV.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}銆戣澶囩姸鎬侊細銆恵commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Fault)}銆戙�恵commonRGVSecond.DeviceCode}銆戜换鍔°�恵JsonConvert.SerializeObject(taskSecond)}銆憑commonRGVSecond.DeviceCode}杩斿洖浠诲姟锛氥�恵JsonConvert.SerializeObject(task.TaskNum)}銆戙��"); + + Thread.Sleep(1000); + + if (task.Remark != null) + { + return GetDispatchExecutingTask(task, taskSecond); } return task; @@ -466,7 +484,7 @@ Thread.Sleep(1000); if (task.Remark != null) { - return GetDispatchExecutingTask(task); + return GetDispatchExecutingTask(task, taskSecond); } return task; } @@ -482,6 +500,10 @@ } if (commonRGVSecond.GetValue<RGVDBName, int>(RGVDBName.LevelPoint) > 35000) { + if (commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Running)) + { + return null; + } RGVTaskCommand command = new RGVTaskCommand() { PickupLocation = (byte)Convert.ToSByte(15), @@ -523,7 +545,24 @@ if (task.Remark != null) { - return GetDispatchExecutingTask(task); + return GetDispatchExecutingTask(task, taskSecond); + } + return task; + } + } + } + else if ((taskSecond.CurrentAddress == "1025" || taskSecond.CurrentAddress == "1026") && (taskSecond.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting || taskSecond.TaskState == (int)TaskInStatusEnum.RGV_InExecuting)) + { + if (task.TaskState == (int)TaskOutStatusEnum.RGV_OutdispatchFinish || task.TaskState == (int)TaskInStatusEnum.RGV_IndispatchFinish) + { + if (taskSecond.SourceStation - task.TargetStation > 1 && taskSecond.TargetStation - task.TargetStation > 1) + { + LogAndWarn("鎵ц璋冨害浠诲姟鎺у埗", $"銆恵commonRGV.DeviceCode}宸ヤ綔妯″紡锛氥�恵commonRGV.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}銆戣澶囩姸鎬侊細銆恵commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Fault)}銆戙�恵commonRGVFirst.DeviceCode}銆戜换鍔°�恵JsonConvert.SerializeObject(taskSecond)}銆憑commonRGVFirst.DeviceCode}杩斿洖浠诲姟锛氥�恵JsonConvert.SerializeObject(task.TaskNum)}銆戙��"); + Thread.Sleep(1000); + + if (task.Remark != null) + { + return GetDispatchExecutingTask(task, taskSecond); } return task; } @@ -540,7 +579,7 @@ if (task.Remark != null) { - return GetDispatchExecutingTask(task); + return GetDispatchExecutingTask(task, taskSecond); } return task; } @@ -556,6 +595,10 @@ } if (commonRGVFirst.GetValue<RGVDBName, int>(RGVDBName.LevelPoint) < 420000) { + if (commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Running)) + { + return null; + } RGVTaskCommand command = new RGVTaskCommand() { PickupLocation = (byte)Convert.ToSByte(26), @@ -623,6 +666,10 @@ } if (commonRGVSecond.GetValue<RGVDBName, int>(RGVDBName.LevelPoint) > 35000) { + if (commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Running)) + { + return null; + } RGVTaskCommand command = new RGVTaskCommand() { PickupLocation = (byte)Convert.ToSByte(15), @@ -679,7 +726,7 @@ { task = GetDispatchTask(tasks, taskFirst); - LogAndWarn("鎵ц璋冨害浠诲姟鎺у埗", $"銆恵commonRGVFirst.DeviceCode}宸ヤ綔妯″紡锛氥�恵commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}銆戣澶囩姸鎬侊細銆恵commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Fault)}銆戙�恵commonRGVFirst.DeviceCode}銆戜换鍔°�恵JsonConvert.SerializeObject(taskFirst)}銆憑commonRGVFirst.DeviceCode}杩斿洖浠诲姟锛氥�恵JsonConvert.SerializeObject(task.TaskNum)}銆戙��"); + LogAndWarn("璋冨害浠诲姟鎺у埗", $"銆恵commonRGVFirst.DeviceCode}宸ヤ綔妯″紡锛氥�恵commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}銆戣澶囩姸鎬侊細銆恵commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Fault)}銆戙�恵commonRGVFirst.DeviceCode}銆戜换鍔°�恵JsonConvert.SerializeObject(taskFirst)}銆憑commonRGVFirst.DeviceCode}杩斿洖浠诲姟锛氥�恵JsonConvert.SerializeObject(task.TaskNum)}銆戙��"); Thread.Sleep(1000); return task; @@ -696,6 +743,10 @@ } if (commonRGVFirst.GetValue<RGVDBName, int>(RGVDBName.LevelPoint) < 420000) { + if (commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Running)) + { + return null; + } RGVTaskCommand command = new RGVTaskCommand() { PickupLocation = (byte)Convert.ToSByte(26), @@ -799,6 +850,10 @@ } if (commonRGVSecond.GetValue<RGVDBName, int>(RGVDBName.LevelPoint) > 35000) { + if (commonRGVSecond.GetValue<RGVDBName, bool>(RGVDBName.Running)) + { + return null; + } RGVTaskCommand command = new RGVTaskCommand() { PickupLocation = (byte)Convert.ToSByte(15), @@ -856,7 +911,7 @@ if (taskFirst.TaskState == (int)TaskOutStatusEnum.RGV_Outdispatch || taskFirst.TaskState == (int)TaskOutStatusEnum.RGV_OutdispatchFinish || taskFirst.TaskState == (int)TaskInStatusEnum.RGV_IndispatchFinish) { - task = tasks.FirstOrDefault(x => ((x.SourceStation - taskFirst.TargetStation > 1 && x.SourceStation - taskFirst.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - taskFirst.TargetStation > 1 && x.TargetStation - taskFirst.SourceStation > 1 && x.SourceStation - taskFirst.SourceStation > 1 && x.TargetStation - taskFirst.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)) && x.RGVName == "RGV02"); + task = tasks.FirstOrDefault(x => ((taskFirst.TargetStation-x.SourceStation > 1 &&taskFirst.SourceStation - x.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || ( taskFirst.TargetStation- x.SourceStation > 1 && taskFirst.SourceStation- x.TargetStation > 1 && taskFirst.SourceStation- x.SourceStation > 1 && taskFirst.TargetStation - x.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)) && x.RGVName == "RGV02"); LogAndWarn("涓浆璋冨害浠诲姟鎺у埗", $"銆恵commonRGVFirst.DeviceCode}宸ヤ綔妯″紡锛氥�恵commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Automatic)}銆戣澶囩姸鎬侊細銆恵commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Fault)}銆戙�恵commonRGVFirst.DeviceCode}銆戜换鍔°�恵JsonConvert.SerializeObject(taskFirst)}銆憑commonRGVFirst.DeviceCode}杩斿洖浠诲姟锛氥�恵JsonConvert.SerializeObject(task.TaskNum)}銆戙��"); @@ -882,6 +937,10 @@ } if (commonRGVFirst.GetValue<RGVDBName, int>(RGVDBName.LevelPoint) < 420000) { + if (commonRGVFirst.GetValue<RGVDBName, bool>(RGVDBName.Running)) + { + return null; + } RGVTaskCommand command = new RGVTaskCommand() { PickupLocation = (byte)Convert.ToSByte(26), @@ -1034,19 +1093,44 @@ Dt_Task y = tasks.Where(x => x.Remark != null&& ((x.SourceStation - oldtask.TargetStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.SourceStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TargetStation - oldtask.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound))).FirstOrDefault(); if (y == null) { - LogAndWarn("鏌ヨ浠诲姟", $" 杩斿洖浠诲姟锛氥�恵JsonConvert.SerializeObject(oldtask)}銆戙��"); + WriteInfo("鏌ヨ浠诲姟", $" 杩斿洖浠诲姟锛氥�恵JsonConvert.SerializeObject(oldtask)}銆戙��"); if (oldtask.TaskState == (int)TaskOutStatusEnum.RGV_Outdispatch || oldtask.TaskState == (int)TaskOutStatusEnum.RGV_OutdispatchFinish || oldtask.TaskState == (int)TaskInStatusEnum.RGV_IndispatchFinish) { - - return tasks.FirstOrDefault(x => (x.SourceStation - oldtask.TargetStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.SourceStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TargetStation - oldtask.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)); + if (oldtask.RGVName == "RGV01") + { + return tasks.FirstOrDefault(x => (oldtask.TargetStation - x.SourceStation > 1 && oldtask.SourceStation - x.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (oldtask.TargetStation - x.SourceStation > 1 && oldtask.SourceStation - x.TargetStation > 1 && oldtask.SourceStation - x.SourceStation > 1 && oldtask.TargetStation - x.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)); + } + else + { + return tasks.FirstOrDefault(x => (x.SourceStation - oldtask.TargetStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.SourceStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TargetStation - oldtask.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)); + + } } else if ((oldtask.CurrentAddress == "1025" || oldtask.CurrentAddress == "1026") && (oldtask.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting || oldtask.TaskState == (int)TaskInStatusEnum.RGV_InExecuting)) { - return tasks.FirstOrDefault(x => (x.SourceStation - oldtask.TargetStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.SourceStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TargetStation - oldtask.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)); + if (oldtask.RGVName == "RGV01") + { + return tasks.FirstOrDefault(x => (oldtask.TargetStation - x.SourceStation > 1 && oldtask.SourceStation - x.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (oldtask.TargetStation - x.SourceStation > 1 && oldtask.SourceStation - x.TargetStation > 1 && oldtask.SourceStation - x.SourceStation > 1 && oldtask.TargetStation - x.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)); + } + else + { + return tasks.FirstOrDefault(x => (x.SourceStation - oldtask.TargetStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.SourceStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TargetStation - oldtask.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)); + + } + } else if (oldtask.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting || oldtask.TaskState == (int)TaskInStatusEnum.RGV_InExecuting) { - return tasks.FirstOrDefault(x => x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.TargetStation > 1); + if (oldtask.RGVName == "RGV01") + { + return tasks.FirstOrDefault(x => oldtask.TargetStation - x.SourceStation > 1 && oldtask.TargetStation - x.TargetStation > 1); + + } + else + { + return tasks.FirstOrDefault(x => x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.TargetStation > 1); + } + } return null; @@ -1079,6 +1163,10 @@ return tasks.FirstOrDefault(x => (x.SourceStation - oldtask.TargetStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.SourceStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TargetStation - oldtask.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)); } + else if ((oldtask.CurrentAddress == "1025" || oldtask.CurrentAddress == "1026") && (oldtask.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting || oldtask.TaskState == (int)TaskInStatusEnum.RGV_InExecuting)) + { + return tasks.FirstOrDefault(x => (x.SourceStation - oldtask.TargetStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TaskType == (int)TaskInboundTypeEnum.Inbound) || (x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.SourceStation > 1 && x.SourceStation - oldtask.SourceStation > 1 && x.TargetStation - oldtask.TargetStation > 1 && x.TaskType == (int)TaskOutboundTypeEnum.Outbound)); + } else if (oldtask.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting || oldtask.TaskState == (int)TaskInStatusEnum.RGV_InExecuting) { return tasks.FirstOrDefault(x => x.SourceStation - oldtask.TargetStation > 1 && x.TargetStation - oldtask.TargetStation > 1); @@ -1087,13 +1175,13 @@ } } - public Dt_Task? GetDispatchExecutingTask(Dt_Task oldtask) + public Dt_Task? GetDispatchExecutingTask(Dt_Task oldtask,Dt_Task task) { - var stationManager = _stationManagerRepository.QueryData(x => x.stationType == 15); - if (stationManager.Count() > 0) + var stationManagers = _stationManagerRepository.QueryData(x => x.stationType == 15); + if (stationManagers.Count() > 0) { string next = null; - foreach (var item in stationManager) + foreach (var item in stationManagers) { var x = _taskRepository.QueryFirst(x => x.NextAddress == item.stationChildCode || x.CurrentAddress == item.stationChildCode); if (x == null) @@ -1104,13 +1192,36 @@ } if (next != null) { + var stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == next); oldtask.Remark = next; - _taskRepository.UpdateData(oldtask); - LogAndWarn("涓浆浠诲姟GetDispatchExecutingTask", $" 杩斿洖浠诲姟锛氥�恵JsonConvert.SerializeObject(oldtask)}銆戙��"); - return oldtask; + if (task.RGVName == "RGV01") + { + if (task.TargetStation - stationManager.stationRemark > 1 && task.SourceStation - stationManager.stationRemark > 1 && task.SourceStation - oldtask.SourceStation > 1 && task.TargetStation - oldtask.SourceStation > 1) + { + _taskRepository.UpdateData(oldtask); + LogAndWarn("涓浆浠诲姟GetDispatchExecutingTask", $" 杩斿洖浠诲姟锛氥�恵JsonConvert.SerializeObject(oldtask)}銆戙��"); + return oldtask; + } + else + { + return null; + } + } + else + { + if (stationManager.stationRemark - task.TargetStation > 1 && stationManager.stationRemark - task.SourceStation > 1 && oldtask.SourceStation - task.SourceStation > 1 && oldtask.SourceStation - task.TargetStation > 1) + { + _taskRepository.UpdateData(oldtask); + LogAndWarn("涓浆浠诲姟GetDispatchExecutingTask", $" 杩斿洖浠诲姟锛氥�恵JsonConvert.SerializeObject(oldtask)}銆戙��"); + return oldtask; + } + else + { + return null; + } + } } } - return null; } -- Gitblit v1.9.3