From c6e8b600398de38b6684f5fa1eaaaade8562859b Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期六, 20 九月 2025 15:16:56 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhiHuiQiCe/LongDeLiLiKu

---
 项目代码/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs |  238 ++++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 145 insertions(+), 93 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs"
index 3c93ccd..104266a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs"
@@ -20,6 +20,7 @@
 using WIDESEAWCS_Tasks;
 using WIDESEAWCS_Tasks.ConveyorLineJob;
 using WIDESEAWCS_Tasks.DBNames;
+using WIDESEAWCS_Tasks.StackPlateJob;
 using static Dm.net.buffer.ByteArrayBuffer;
 
 namespace WIDESEAWCS_Server.Controllers
@@ -54,6 +55,10 @@
             AgvResponse agvResponse = new AgvResponse();
             try
             {
+                if (secureApplyModel.ReceiveTaskID=="100")
+                {
+                    return agvResponse.OK("鎴愬姛", "0");
+                }
                 var task = _taskRepository.QueryFirst(x => secureApplyModel.ReceiveTaskID.ObjToInt() == x.TaskNum);
                 if (task == null) throw new Exception("鏈壘鍒颁换鍔�");
                 if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
@@ -325,60 +330,76 @@
                 {
                     return content.Error($"鏈壘鍒板搴旇澶�");
                 }
+                if (device.DeviceCode.Contains("Plate"))
+                {
+                    CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device;
+                    StackPlateTaskCommandCommand command = commonConveyorLine.ReadCustomer<StackPlateTaskCommandCommand>(device.DeviceCode);
 
-                OtherDevice otherDevice = (OtherDevice)device;
+                    if (command != null && command.State == 2 && command.InteractiveSignal == 1)
+                    {
+                        return content.OK("鍏佽鏀炬枡");
+                    }
+                    else
+                    {
+                        return content.Error("绂佹鏀炬枡");
+                    }
+                }
+                else
+                {
 
-                if (device.DeviceCode.Contains("CP"))//鎴愬搧杈撻�佺嚎
-                {
-                    short Command = otherDevice.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode);
-                    if (Command == 3)
+                    OtherDevice otherDevice = (OtherDevice)device;
+
+                    if (device.DeviceCode.Contains("CP"))//鎴愬搧杈撻�佺嚎
                     {
-                        content.OK("鍏佽鏀炬枡");
+                        short Command = otherDevice.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode);
+                        if (Command == 3)
+                        {
+                            content.OK("鍏佽鏀炬枡");
+                        }
+                        else
+                        {
+                            return content.Error("绂佹鏀炬枡");
+                        }
                     }
-                    else
+                    else if (device.DeviceCode.Contains("Coveryor"))//鎺ラ┏鍙�
                     {
-                        return content.Error("绂佹鏀炬枡");
+                        bool RequestPut = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_RequestPut, stationManger.StationDeviceCode);
+                        if (!RequestPut)
+                        {
+                            otherDevice.SetValue(CoveryorDB.C_InTaskNum, taskNum, stationManger.StationDeviceCode);
+                            otherDevice.SetValue(CoveryorDB.C_RequestPut, true, stationManger.StationDeviceCode);
+                            Thread.Sleep(1000);
+                        }
+                        bool AllowFinish = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_AllowFinish, stationManger.StationDeviceCode);
+                        if (AllowFinish)
+                        {
+                            content.OK("鍏佽鏀炬枡");
+                        }
+                        else
+                        {
+                            return content.Error("绂佹鏀炬枡");
+                        }
+                    }
+                    else if (device.DeviceCode.Contains("Retract"))//浼哥缉璐у弶
+                    {
+                        bool RequestPut = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_RequestPut, stationManger.StationDeviceCode);
+                        if (!RequestPut)
+                        {
+                            otherDevice.SetValue(RetractDB.Ret_TargetAddress, Convert.ToInt16(stationManger.StationCode), stationManger.StationDeviceCode);
+                            otherDevice.SetValue(RetractDB.Ret_RequestPut, true, stationManger.StationDeviceCode);
+                            Thread.Sleep(1000);
+                        }
+                        bool AllowFinish = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_AllowFinish, stationManger.StationDeviceCode);
+                        if (AllowFinish)
+                        {
+                            content.OK("鍏佽鏀炬枡");
+                        }
+                        else
+                        {
+                            return content.Error("绂佹鏀炬枡");
+                        }
                     }
                 }
-                else if (device.DeviceCode.Contains("Coveryor"))//鎺ラ┏鍙�
-                {
-                    bool RequestPut = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_RequestPut, stationManger.StationDeviceCode);
-                    if (!RequestPut)
-                    {
-                        otherDevice.SetValue(CoveryorDB.C_InTaskNum, taskNum, stationManger.StationDeviceCode);
-                        otherDevice.SetValue(CoveryorDB.C_RequestPut, true, stationManger.StationDeviceCode);
-                        Thread.Sleep(1000);
-                    }
-                    bool AllowFinish = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_AllowFinish, stationManger.StationDeviceCode);
-                    if (AllowFinish)
-                    {
-                        content.OK("鍏佽鏀炬枡");
-                    }
-                    else
-                    {
-                        return content.Error("绂佹鏀炬枡");
-                    }
-                }
-                else if (device.DeviceCode.Contains("Retract"))//浼哥缉璐у弶
-                {
-                    bool RequestPut = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_RequestPut, stationManger.StationDeviceCode);
-                    if (!RequestPut)
-                    {
-                        otherDevice.SetValue(RetractDB.Ret_TargetAddress, Convert.ToInt16(stationManger.StationCode), stationManger.StationDeviceCode);
-                        otherDevice.SetValue(RetractDB.Ret_RequestPut, true, stationManger.StationDeviceCode);
-                        Thread.Sleep(1000);
-                    }
-                    bool AllowFinish = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_AllowFinish, stationManger.StationDeviceCode);
-                    if (AllowFinish)
-                    {
-                        content.OK("鍏佽鏀炬枡");
-                    }
-                    else
-                    {
-                        return content.Error("绂佹鏀炬枡");
-                    }
-                }
-                
                 return content;
             }
             catch (Exception ex)
@@ -408,15 +429,23 @@
                 {
                     return WebResponseContent.Instance.Error($"鏈壘鍒板搴旇澶�");
                 }
-
-                OtherDevice otherDevice = (OtherDevice)device;
-                if (device.DeviceCode.Contains("Coveryor"))//鎺ラ┏鍙�
+                if (device.DeviceCode.Contains("Plate"))
                 {
-                    otherDevice.SetValue(CoveryorDB.C_PutFinish, true, stationManger.StationDeviceCode);
+                    CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device;
+                    commonConveyorLine.SetValue(StackPlateDBName.WriteInteractiveSignal, Convert.ToInt16(1), device.DeviceCode);
+                    return WebResponseContent.Instance.OK();
                 }
-                else if (device.DeviceCode.Contains("Retract"))//浼哥缉璐у弶
+                else
                 {
-                    otherDevice.SetValue(RetractDB.Ret_PutFinish, true, stationManger.StationDeviceCode);
+                    OtherDevice otherDevice = (OtherDevice)device;
+                    if (device.DeviceCode.Contains("Coveryor"))//鎺ラ┏鍙�
+                    {
+                        otherDevice.SetValue(CoveryorDB.C_PutFinish, true, stationManger.StationDeviceCode);
+                    }
+                    else if (device.DeviceCode.Contains("Retract"))//浼哥缉璐у弶
+                    {
+                        otherDevice.SetValue(RetractDB.Ret_PutFinish, true, stationManger.StationDeviceCode);
+                    }
                 }
                 return WebResponseContent.Instance.OK();
             }
@@ -448,46 +477,61 @@
                 {
                     return WebResponseContent.Instance.Error($"鏈壘鍒板搴旇澶噞stationManger.StationDeviceCode}");
                 }
-
-                OtherDevice otherDevice = (OtherDevice)device;
-
-                if (otherDevice.DeviceCode.Contains("CP"))//鎴愬搧杈撻�佺嚎
+                if (device.DeviceCode.Contains("Plate"))
                 {
-                    short Command = otherDevice.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode);
-                    if (Command == 2)
+                    CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device;
+                    StackPlateTaskCommandCommand command = commonConveyorLine.ReadCustomer<StackPlateTaskCommandCommand>(device.DeviceCode);
+                    
+                    if (command != null&&command.State == 2 && command.InteractiveSignal == 2)
                     {
-                        content.OK("鍏佽鍙栨枡");
+                        return content.OK("鍏佽鍙栨枡");
                     }
                     else
                     {
                         return content.Error("绂佹鍙栨枡");
                     }
                 }
-                else if (device.DeviceCode.Contains("Coveryor"))//鎺ラ┏鍙�
+                else
                 {
-                    bool AllowTake = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_AllowTake, stationManger.StationDeviceCode);
-                    if (AllowTake)
-                    {
-                        content.OK("鍏佽鍙栨枡");
-                    }
-                    else
-                    {
-                        return content.Error("绂佹鍙栨枡");
-                    }
-                }
-                else if (device.DeviceCode.Contains("Retract"))//浼哥缉璐у弶
-                {
-                    bool AllowTake = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_AllowTake, stationManger.StationDeviceCode);
-                    if (AllowTake)
-                    {
-                        content.OK("鍏佽鍙栨枡");
-                    }
-                    else
-                    {
-                        return content.Error("绂佹鍙栨枡");
-                    }
-                }
+                    OtherDevice otherDevice = (OtherDevice)device;
 
+                    if (otherDevice.DeviceCode.Contains("CP"))//鎴愬搧杈撻�佺嚎
+                    {
+                        short Command = otherDevice.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode);
+                        if (Command == 2)
+                        {
+                            content.OK("鍏佽鍙栨枡");
+                        }
+                        else
+                        {
+                            return content.Error("绂佹鍙栨枡");
+                        }
+                    }
+                    else if (device.DeviceCode.Contains("Coveryor"))//鎺ラ┏鍙�
+                    {
+                        bool AllowTake = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_AllowTake, stationManger.StationDeviceCode);
+                        if (AllowTake)
+                        {
+                            content.OK("鍏佽鍙栨枡");
+                        }
+                        else
+                        {
+                            return content.Error("绂佹鍙栨枡");
+                        }
+                    }
+                    else if (device.DeviceCode.Contains("Retract"))//浼哥缉璐у弶
+                    {
+                        bool AllowTake = otherDevice.GetValue<RetractDB, bool>(RetractDB.Ret_AllowTake, stationManger.StationDeviceCode);
+                        if (AllowTake)
+                        {
+                            content.OK("鍏佽鍙栨枡");
+                        }
+                        else
+                        {
+                            return content.Error("绂佹鍙栨枡");
+                        }
+                    }
+                }
                 return content;
             }
             catch (Exception ex)
@@ -517,19 +561,27 @@
                 {
                     return WebResponseContent.Instance.Error($"鏈壘鍒板搴旇澶�");
                 }
-
-                OtherDevice otherDevice = (OtherDevice)device;
-                if (device.DeviceCode.Contains("CP"))
+                if (device.DeviceCode.Contains("Plate"))
                 {
-                    otherDevice.SetValue(W_ConveyorLineCPDB.W_Command, 2, stationManger.StationCode);
+                    CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device;
+                    commonConveyorLine.SetValue(StackPlateDBName.WriteInteractiveSignal, Convert.ToInt16(2), device.DeviceCode);
+                    return WebResponseContent.Instance.OK();
                 }
-                else if (device.DeviceCode.Contains("Coveryor"))
+                else
                 {
-                    otherDevice.SetValue(CoveryorDB.C_TakeFinish, true, stationManger.StationDeviceCode);
-                }
-                else if (device.DeviceCode.Contains("Retract"))//浼哥缉璐у弶
-                {
-                    otherDevice.SetValue(RetractDB.Ret_TakeFinish, true, stationManger.StationDeviceCode);
+                    OtherDevice otherDevice = (OtherDevice)device;
+                    if (device.DeviceCode.Contains("CP"))
+                    {
+                        otherDevice.SetValue(W_ConveyorLineCPDB.W_Command, 2, stationManger.StationCode);
+                    }
+                    else if (device.DeviceCode.Contains("Coveryor"))
+                    {
+                        otherDevice.SetValue(CoveryorDB.C_TakeFinish, true, stationManger.StationDeviceCode);
+                    }
+                    else if (device.DeviceCode.Contains("Retract"))//浼哥缉璐у弶
+                    {
+                        otherDevice.SetValue(RetractDB.Ret_TakeFinish, true, stationManger.StationDeviceCode);
+                    }
                 }
 
                 return WebResponseContent.Instance.OK();

--
Gitblit v1.9.3