From f7686c71ac53f0d1bbd439bc0c898c86f7d68e34 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期一, 10 十一月 2025 16:39:10 +0800
Subject: [PATCH] 优化代码
---
项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneExtend/SignalInteraction.cs | 99 +++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 87 insertions(+), 12 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneExtend/SignalInteraction.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneExtend/SignalInteraction.cs"
index 9d81eb2..32740ca 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneExtend/SignalInteraction.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneExtend/SignalInteraction.cs"
@@ -53,47 +53,122 @@
&& task.TargetIsPickPlace && ASRSRqtPutGoods)//璇锋眰鏀捐揣
{
commonStackerCrane.SetValue(StackerCraneDBName.AGVAlwASRSPuttGoods, ASRSRqtPutGoods);
+ WriteDebug($"{commonStackerCrane.DeviceName}璇锋眰鏀捐揣", $"WCS鍏佽鏀捐揣,浠诲姟鍙枫�恵task.TaskNum}銆�");
}
else if ((_taskService.TaskOutboundTypes.Contains(task.TaskType)
|| task.TaskType == TaskRelocationTypeEnum.Relocation.ObjToInt())
&& ASRSRqtGetGoods && task.SourceIsPickPlace)//璇锋眰鍙栬揣
{
commonStackerCrane.SetValue(StackerCraneDBName.AGVAlwASRSGetGoods, ASRSRqtGetGoods);
- }
- else if (_taskService.TaskOutboundTypes.Contains(task.TaskType) && ASRSPutAGoodsDone)
- {
-
+ WriteDebug($"{commonStackerCrane.DeviceName}璇锋眰鍙栬揣", $"WCS鍏佽鍙栬揣,浠诲姟鍙枫�恵task.TaskNum}銆�");
+ if (task.TaskState == TaskOutStatusEnum.SC_OutExecuting.ObjToInt())
+ {
+ task.TaskState = TaskOutStatusEnum.SC_OutGetFinish.ObjToInt();
+ _taskRepository.UpdateData(task);
+ }
}
else
{
- Dt_ShuttleCar? shuttleCar1 = _shuttleCarService.QueryCode(task.ShuttleCarCode);
- if (task.TaskType == TaskRelocationTypeEnum.Relocation.ObjToInt() && task.Remark == "")
+ if (task.TaskType == TaskRelocationTypeEnum.Relocation.ObjToInt())
{
- shuttleCar1 = _shuttleCarService.QueryNoCode(task.ShuttleCarCode);
- task.Remark = shuttleCar1.ShuttleCarCode;
- _taskService.UpdateData(task);
+ var shuttleCar2 = _shuttleCarService.QueryNoCode(task.ShuttleCarCode);
+ ShuttleCar shuttleCarA = Storage.Devices.FirstOrDefault(x => x.DeviceCode == shuttleCar2.ShuttleCarCode) as ShuttleCar;
+ ShuttleCar shuttleCarB = Storage.Devices.FirstOrDefault(x => x.DeviceCode == task.ShuttleCarCode) as ShuttleCar;
+
+ #region 鍙栬揣
+ if (ASRSRqtGetGoods)
+ {
+ shuttleCarA.SetValue(ShuttleCarDBName.ASRSRqtGetGoods, ASRSRqtGetGoods, shuttleCarA.DeviceCode);
+
+ var AGVAlwASRSGetGoods = shuttleCarA.GetValue<ShuttleCarDBName, bool>(ShuttleCarDBName.AGVAlwASRSGetGoods, shuttleCarA.DeviceCode);//鍏佽鍙栬揣
+ if (AGVAlwASRSGetGoods)
+ commonStackerCrane.SetValue(StackerCraneDBName.AGVAlwASRSGetGoods, AGVAlwASRSGetGoods);
+
+ WriteDebug($"{commonStackerCrane.DeviceName}璇锋眰鍙栬揣", $"銆恵shuttleCarA.DeviceName}銆憑(AGVAlwASRSGetGoods ? "鍏佽" : "涓嶅厑璁�")}鍙栬揣,浠诲姟鍙枫�恵task.TaskNum}銆�");
+ }
+ #endregion
+
+ #region 鍙栬揣瀹屾垚
+ if (ASRSGetGoodsDone)
+ {
+ shuttleCarA.SetValue(ShuttleCarDBName.ASRSGetGoodsDone, ASRSGetGoodsDone, shuttleCarA.DeviceCode);
+ WriteDebug($"{commonStackerCrane.DeviceName}鍙栬揣瀹屾垚", $"銆恵shuttleCarA.DeviceName}銆�,浠诲姟鍙枫�恵task.TaskNum}銆�");
+ }
+ #endregion
+
+ #region 鏀捐揣
+ if (ASRSRqtPutGoods)
+ {
+ shuttleCarB.SetValue(ShuttleCarDBName.ASRSRqtPutGoods, ASRSRqtPutGoods, shuttleCarB.DeviceCode);
+
+ var AGVAlwASRSPuttGoods = shuttleCarB.GetValue<ShuttleCarDBName, bool>(ShuttleCarDBName.AGVAlwASRSPuttGoods, shuttleCarB.DeviceCode);//鍏佽鏀捐揣
+ if (AGVAlwASRSPuttGoods)
+ commonStackerCrane.SetValue(StackerCraneDBName.AGVAlwASRSPuttGoods, AGVAlwASRSPuttGoods);
+
+ WriteDebug($"{commonStackerCrane.DeviceName}璇锋眰鏀捐揣", $"銆恵shuttleCarB.DeviceName}銆憑(AGVAlwASRSPuttGoods ? "鍏佽" : "涓嶅厑璁�")}鏀捐揣,浠诲姟鍙枫�恵task.TaskNum}銆�");
+ }
+ #endregion
+
+ #region 鏀捐揣瀹屾垚
+ if (ASRSPutAGoodsDone)
+ {
+ shuttleCarB.SetValue(ShuttleCarDBName.ASRSPutAGoodsDone, ASRSPutAGoodsDone, shuttleCarB.DeviceCode);
+ WriteDebug($"{commonStackerCrane.DeviceName}鏀捐揣瀹屾垚", $"銆恵shuttleCarA.DeviceName}銆�,浠诲姟鍙枫�恵task.TaskNum}銆�");
+ }
+ #endregion
+
}
- if (shuttleCar1 != null)
+ else
{
- ShuttleCar shuttleCar = Storage.Devices.FirstOrDefault(x => x.DeviceName == shuttleCar1.ShuttleCarName) as ShuttleCar;
+ ShuttleCar shuttleCar = Storage.Devices.FirstOrDefault(x => x.DeviceCode == task.ShuttleCarCode) as ShuttleCar;
if (shuttleCar != null)
{
shuttleCar.SetValue(ShuttleCarDBName.ASRSRqtGetAGV, ASRSRqtGetAGV, shuttleCar.DeviceCode);
+
shuttleCar.SetValue(ShuttleCarDBName.ASRSRqtGetGoods, ASRSRqtGetGoods, shuttleCar.DeviceCode);
+
shuttleCar.SetValue(ShuttleCarDBName.ASRSRqtPutGoods, ASRSRqtPutGoods, shuttleCar.DeviceCode);
var AGVAlwASRSGetAGV = shuttleCar.GetValue<ShuttleCarDBName, bool>(ShuttleCarDBName.AGVAlwASRSGetAGV, shuttleCar.DeviceCode);//鍏佽鍙栬溅
commonStackerCrane.SetValue(StackerCraneDBName.AGVAlwASRSGetAGV, AGVAlwASRSGetAGV);
+
+ if (ASRSRqtGetAGV)
+ WriteDebug($"{commonStackerCrane.DeviceName}璇锋眰鍙栬溅", $"銆恵shuttleCar.DeviceName}銆憑(AGVAlwASRSGetAGV ? "鍏佽" : "涓嶅厑璁�")}鍙栬溅,浠诲姟鍙枫�恵task.TaskNum}銆�");
+
var AGVAlwASRSGetGoods = shuttleCar.GetValue<ShuttleCarDBName, bool>(ShuttleCarDBName.AGVAlwASRSGetGoods, shuttleCar.DeviceCode);//鍏佽鍙栬揣
commonStackerCrane.SetValue(StackerCraneDBName.AGVAlwASRSGetGoods, AGVAlwASRSGetGoods);
+
+ if (ASRSRqtGetGoods)
+ WriteDebug($"{commonStackerCrane.DeviceName}璇锋眰鍙栬揣", $"銆恵shuttleCar.DeviceName}銆憑(AGVAlwASRSGetGoods ? "鍏佽" : "涓嶅厑璁�")}鍙栬揣,浠诲姟鍙枫�恵task.TaskNum}銆�");
+
var AGVAlwASRSPuttGoods = shuttleCar.GetValue<ShuttleCarDBName, bool>(ShuttleCarDBName.AGVAlwASRSPuttGoods, shuttleCar.DeviceCode);//鍏佽鏀捐揣
commonStackerCrane.SetValue(StackerCraneDBName.AGVAlwASRSPuttGoods, AGVAlwASRSPuttGoods);
+
+ if (ASRSRqtPutGoods)
+ WriteDebug($"{commonStackerCrane.DeviceName}璇锋眰鏀捐揣", $"銆恵shuttleCar.DeviceName}銆憑(AGVAlwASRSPuttGoods ? "鍏佽" : "涓嶅厑璁�")}鏀捐揣,浠诲姟鍙枫�恵task.TaskNum}銆�");
+
commonStackerCrane.SetValue(StackerCraneDBName.AGVAlwASRSPutAGV, ASRSRqtPutAGV);
+ if (ASRSRqtPutAGV)
+ WriteDebug($"{commonStackerCrane.DeviceName}璇锋眰鏀捐溅", $"WCS鍏佽鏀捐溅,浠诲姟鍙枫�恵task.TaskNum}銆�");
shuttleCar.SetValue(ShuttleCarDBName.ASRSGetAGVDone, ASRSGetAGVDone, shuttleCar.DeviceCode);
+ if (ASRSGetAGVDone)
+ WriteDebug($"{commonStackerCrane.DeviceName}鍙栬溅瀹屾垚", $"銆恵shuttleCar.DeviceName}銆�,浠诲姟鍙枫�恵task.TaskNum}銆�");
+
shuttleCar.SetValue(ShuttleCarDBName.ASRSGetGoodsDone, ASRSGetGoodsDone, shuttleCar.DeviceCode);
+ if (ASRSGetGoodsDone)
+ {
+ if (_taskService.TaskOutboundTypes.Contains(task.TaskType) && task.TaskState == TaskOutStatusEnum.SC_OutExecuting.ObjToInt())
+ {
+ task.TaskState = TaskOutStatusEnum.SC_OutGetFinish.ObjToInt();
+ _taskRepository.UpdateData(task);
+ }
+ WriteDebug($"{commonStackerCrane.DeviceName}鍙栬揣瀹屾垚", $"銆恵shuttleCar.DeviceName}銆�,浠诲姟鍙枫�恵task.TaskNum}銆�");
+ }
+
shuttleCar.SetValue(ShuttleCarDBName.ASRSPutAGoodsDone, ASRSPutAGoodsDone, shuttleCar.DeviceCode);
- //shuttleCar.SetValue(ShuttleCarDBName.ASRSPutAGVDone, ASRSPutAGVDone, shuttleCar.DeviceCode);
+ if (ASRSPutAGoodsDone)
+ WriteDebug($"{commonStackerCrane.DeviceName}鏀捐揣瀹屾垚", $"銆恵shuttleCar.DeviceName}銆�,浠诲姟鍙枫�恵task.TaskNum}銆�");
}
}
}
--
Gitblit v1.9.3