From fb79dc54d6484146b74d29bf5644df880fc1fa01 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期四, 19 六月 2025 12:16:54 +0800
Subject: [PATCH] WMS添加AGV任务完成取消
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 56 ++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 38 insertions(+), 18 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
index 3fd7762..b727fc4 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
@@ -42,21 +42,29 @@
{
getStackerObject.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//璁㈤槄浠诲姟瀹屾垚浜嬩欢
}
- if (getStackerObject.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && getStackerObject.StackerCraneStatusValue == StackerCraneStatus.Ready)
- {
- getStackerObject.CheckStackerCraneTaskCompleted();//妫�娴嬪爢鍨涙満浠诲姟瀹屾垚浜嬩欢
- if(getStackerObject.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby)
+ getStackerObject.CheckStackerCraneTaskCompleted();//妫�娴嬪爢鍨涙満浠诲姟瀹屾垚浜嬩欢
+
+ if (getStackerObject.StackerCraneStatusValue == StackerCraneStatus.Ready)
+ {
+ Dt_Task? task = GetTask(speStackerCrane);
+ if (task != null)
{
- Dt_Task? task = GetTask(speStackerCrane);
- if (task != null)
+ bool sendFlag = true;
+ //if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt() || task.TaskType == TaskTypeEnum.PalletOutbound.ObjToInt())
+ //{
+ // //鍚慦MS鐢宠鍑哄叆搴撳彛鏄惁鏈夌┖鎵樼洏
+ // sendFlag = false;
+ //}
+ if (sendFlag)
{
StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task);
if (stackerCraneTaskCommand != null)
{
- bool sendFlag = getStackerObject.SendCommand(stackerCraneTaskCommand);
+ sendFlag = getStackerObject.SendCommand(stackerCraneTaskCommand);
if (sendFlag)
{
+ speStackerCrane.SetValue(StackerCraneDBName.CommandSend, 1);//鍚姩鍛戒护
speStackerCrane.LastTaskType = task.TaskType;
_taskService.UpdateTaskStatusToNext(task.TaskNum);
}
@@ -83,10 +91,10 @@
SpeStackerCrane? speStackerCrane = sender as SpeStackerCrane;
if (speStackerCrane != null)
{
- if (speStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
+ if (speStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.CommandSend) != 2)
{
- _taskService.StackCraneTaskCompleted(e.TaskNum);
- speStackerCrane.SetValue(StackerCraneDBName.WorkType, 5);
+ speStackerCrane.SetValue(StackerCraneDBName.CommandSend, 2);
+ _taskService.StackCraneTaskCompleted(e.TaskNum, "鍫嗗灈鏈�");
}
}
}
@@ -99,12 +107,18 @@
private Dt_Task? GetTask(SpeStackerCrane speStackerCrane)
{
Dt_Task? task;
+ string DeviceCode = speStackerCrane.DeviceCode.Contains("CP") ? "CP" : "FL";
if (speStackerCrane.LastTaskType == null)
{
- task = _taskService.QueryStackerCraneTask(speStackerCrane.DeviceCode);
+ task = _taskService.QueryStackerCraneTask(DeviceCode);
}
else
{
+ if (speStackerCrane.LastTaskType == TaskTypeEnum.Relocation.ObjToInt())
+ {
+ task = _taskService.QueryStackerCraneTask(DeviceCode);
+ if (task != null) return task;
+ }
bool flag = speStackerCrane.LastTaskType == TaskTypeEnum.Inbound.ObjToInt() || speStackerCrane.LastTaskType == TaskTypeEnum.PalletInbound.ObjToInt();
if (flag == false)
{
@@ -117,6 +131,10 @@
else
{
task = _taskService.QueryStackerCraneOutTask(speStackerCrane.DeviceCode);
+ if (task == null)
+ {
+ task = _taskService.QueryStackerCraneInTask(speStackerCrane.DeviceCode);
+ }
}
}
return task;
@@ -164,14 +182,14 @@
stackerCraneTaskCommand.Barcode = task.PalletCode;
stackerCraneTaskCommand.TaskNum = task.TaskNum;
- stackerCraneTaskCommand.WorkType = 1;
stackerCraneTaskCommand.TrayType = 0;
if (task.TaskType == TaskTypeEnum.Inbound.ObjToInt() || task.TaskType == TaskTypeEnum.PalletInbound.ObjToInt())//鍒ゆ柇鏄惁鏄叆搴撲换鍔�
{
+ stackerCraneTaskCommand.WorkType = 1;
if (task.SourceAddress != null && task.TargetAddress != null)
{
string[] sourceCodes = task.SourceAddress.Split("-");
- if (sourceCodes.Length == 3)
+ if (sourceCodes.Length == 5)
{
stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[1]);
stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[2]);
@@ -184,7 +202,7 @@
return null;
}
string[] targetCodes = task.TargetAddress.Split("-");
- if (targetCodes.Length == 3)
+ if (targetCodes.Length == 5)
{
stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[1]);
stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[2]);
@@ -205,10 +223,11 @@
}
else if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt() || task.TaskType == TaskTypeEnum.PalletOutbound.ObjToInt())
{
+ stackerCraneTaskCommand.WorkType = 2;
if (task.SourceAddress != null && task.TargetAddress != null)
{
string[] targetCodes = task.TargetAddress.Split("-");
- if (targetCodes.Length == 3)
+ if (targetCodes.Length == 5)
{
stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[1]);
stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[2]);
@@ -221,7 +240,7 @@
return null;
}
string[] sourceCodes = task.SourceAddress.Split("-");
- if (sourceCodes.Length == 3)
+ if (sourceCodes.Length == 5)
{
stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[1]);
stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[2]);
@@ -242,10 +261,11 @@
}
else if (task.TaskType == TaskTypeEnum.Relocation.ObjToInt())
{
+ stackerCraneTaskCommand.WorkType = 3;
if (task.SourceAddress != null && task.TargetAddress != null)
{
string[] targetCodes = task.TargetAddress.Split("-");
- if (targetCodes.Length == 3)
+ if (targetCodes.Length == 5)
{
stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[1]);
stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[2]);
@@ -258,7 +278,7 @@
return null;
}
string[] sourceCodes = task.SourceAddress.Split("-");
- if (sourceCodes.Length == 3)
+ if (sourceCodes.Length == 5)
{
stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[1]);
stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[2]);
--
Gitblit v1.9.3