From 9ce6731460179c71f0f2c636b2a1598324d5194e Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期六, 20 九月 2025 15:16:48 +0800 Subject: [PATCH] 最新代码更新 --- 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/原料库/StackerCraneJob_YLSC2.cs | 54 +++++++++++++++++++++++++++++++++++------------------- 1 files changed, 35 insertions(+), 19 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\345\216\237\346\226\231\345\272\223/StackerCraneJob_YLSC2.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\345\216\237\346\226\231\345\272\223/StackerCraneJob_YLSC2.cs" index 4c1a6ca..d20a39b 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\345\216\237\346\226\231\345\272\223/StackerCraneJob_YLSC2.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\345\216\237\346\226\231\345\272\223/StackerCraneJob_YLSC2.cs" @@ -60,22 +60,26 @@ commonStackerCrane.CheckStackerCraneTaskCompleted();//闃叉浠诲姟瀹屾垚浜嬩欢鐩戞祴瓒呮椂锛屽啀鎵嬪姩瑙﹀彂涓�娆� if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal && commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) { - Dt_Task? task = GetTask(commonStackerCrane); - if (task != null) + short stackerError = commonStackerCrane.Communicator.Read<short>("DB1000.54.0"); + if (stackerError==0) { - StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); - if (stackerCraneTaskCommand != null) + Dt_Task? task = GetTask(commonStackerCrane); + if (task != null) { - bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); - if (sendFlag) + StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); + if (stackerCraneTaskCommand != null) { - commonStackerCrane.LastTaskType = task.TaskType; - task.Dispatchertime = DateTime.Now; - task.ExceptionMessage = ""; - _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing); - commonStackerCrane.Communicator.Write("DB1000.20.0", true); - //寤舵椂1s - Thread.Sleep(1000); + bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); + if (sendFlag) + { + commonStackerCrane.LastTaskType = task.TaskType; + task.Dispatchertime = DateTime.Now; + task.ExceptionMessage = ""; + _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing); + commonStackerCrane.Communicator.Write("DB1000.20.0", true); + //寤舵椂1s + Thread.Sleep(1000); + } } } } @@ -112,7 +116,7 @@ { try { - Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == taskNum); + Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == taskNum && x.TaskState == TaskStatusEnum.SC_Executing.ObjToInt()); if (task != null) { if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) @@ -132,7 +136,7 @@ return WebResponseContent.Instance.Error($"鏈壘鍒拌矾鐢变俊鎭�,{task.NextAddress}"); } int oldStatus = task.TaskState; - //todo 鍫嗗灈鏈哄畬鎴愬畬鎴� + // 鍫嗗灈鏈哄畬鎴� _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: stationManger.StationDeviceCode, currentAddress: stationManger.StationCode, nextAddress: router.NextPosi); _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"绯荤粺鑷姩娴佺▼,浠诲姟鐘舵�佷粠銆恵oldStatus}銆戣浆鍒般�恵task.TaskState}銆�"); WriteInfo(deviceCode, $"鍫嗗灈鏈哄嚭搴撲换鍔″畬鎴�,浠诲姟鍙�:{taskNum}"); @@ -172,7 +176,7 @@ /// <returns></returns> private Dt_Task? GetTask(CommonStackerCrane commonStackerCrane) { - Dt_Task task; + Dt_Task? task; if (commonStackerCrane.LastTaskType == null) { task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode); @@ -181,6 +185,7 @@ { if (commonStackerCrane.LastTaskType.GetValueOrDefault().GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { + //涓婁竴涓负鍑哄簱鍒欐煡鏄惁瀛樺湪鍏ュ簱浠诲姟 浜ゆ浛鎵ц task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); if (task == null) { @@ -189,6 +194,7 @@ } else { + //涓婁竴涓负鍏ュ簱鍒欐煡鏄惁瀛樺湪鍑哄簱浠诲姟 浜ゆ浛鎵ц task = _taskService.QueryStackerCraneOutTask(commonStackerCrane.DeviceCode); if (task == null) { @@ -199,6 +205,7 @@ if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { + //鍒ゆ柇鍑哄簱绔欏彴鍗犵敤 if (OutTaskStationIsOccupied(task) == null) { bool flag = false; @@ -218,7 +225,11 @@ } } } - task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode); + if (task == null) + { + task = _taskService.QuertStackerCraneTask(commonStackerCrane.DeviceCode, TaskTypeGroup.RelocationGroup); + } + return task; } @@ -241,6 +252,11 @@ task.NextAddress = stationManger.StackerCraneStationCode; _taskRepository.UpdateData(task); return task; + } + else + { + task.ExceptionMessage = "鍑哄簱绔欏彴鏃犳硶涓嬪彂"; + _taskRepository.UpdateData(task); } } else @@ -298,7 +314,7 @@ return null; } } - else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) + else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)//鍒ゆ柇鏄惁鏄嚭搴撲换鍔� { string[] targetCodes = task.NextAddress.Split("-"); if (targetCodes.Length == 3) @@ -327,7 +343,7 @@ return null; } } - else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) + else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)//鍒ゆ柇鏄惁鏄Щ搴撲换鍔� { string[] targetCodes = task.NextAddress.Split("-"); if (targetCodes.Length == 5) -- Gitblit v1.9.3